Skip to content

Commit

Permalink
improve help text and fix a few minor bugs (#1588)
Browse files Browse the repository at this point in the history
  • Loading branch information
srabraham authored Feb 9, 2025
1 parent 4eacea6 commit d4eb6e1
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 45 deletions.
18 changes: 14 additions & 4 deletions src/ims/element/admin/events/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@

<body>
<div t:render="container">
For each event, you can configure access for individuals and for positions.
You can also choose when each permission applies, whether it be only
when a Ranger is marked on-site in Clubhouse, or all year long (always).
<p>For each event, you can configure permissions for individuals, positions, or teams. For example:</p>
<ul>
<li>person:Tool</li>
<li>position:007</li>
<li>team:Council</li>
</ul>
<p>You can also choose when each permission is valid:</p>
<ul>
<li>Always: valid all year long</li>
<li>On-Site: valid only when a matching Ranger is marked "on-site" in Clubhouse</li>
</ul>
<p><strong>The REQUIRE_ACTIVE flag is unused</strong>, replaced by "on-site" validity.</p>

<div class="row" id="event_access_container">
<div class="col-sm-12 py-1 event_access">
<div class="card">
Expand Down Expand Up @@ -38,7 +48,7 @@
</div>
<div class="row" id="event_new_container">
<div class="col-sm-12 event_access">
<label>Create New Event:</label>
<label for="event_add">Create New Event:</label>
<input
id="event_add"
class="form-control input-sm auto-width"
Expand Down
3 changes: 3 additions & 0 deletions src/ims/element/root/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<p class="mt-3" t:render="if_logged_in">
Select an event from the pop-up above.
</p>
<p class="mt-3" t:render="if_logged_in">
<a href="https://github.com/burningmantech/ranger-ims-server/wiki/What's-New-in-IMS">See what's new in IMS for 2025.</a>
</p>
<p t:render="if_logged_in">
On a shared machine? <strong>Please log out</strong> when you're done.
</p>
Expand Down
5 changes: 3 additions & 2 deletions src/ims/element/static/admin_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ function addAccess(sender) {
if (!validExpression) {
const confirmed = confirm(
"WARNING: '" + newExpression + "' does not look like a valid ACL " +
"expression. Example expressions include 'person:Hubcap' for an individual " +
"or 'position:007' for a role. Wildcards are valid too, e.g. '*'\n\n" +
"expression. Example expressions include 'person:Hubcap' for an individual, " +
"'position:007' for a role, and 'team:Council' for a team. Wildcards are " +
"supported as well, e.g. '*'\n\n" +
"Proceed with firing footgun?"
);
if (!confirmed) {
Expand Down
1 change: 1 addition & 0 deletions src/ims/element/static/field_reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ function initSearchField() {
urlReplace(url_viewFieldReports) + val,
"Field_Report:" + val,
);
searchInput.value = "";
}
}
}
Expand Down
35 changes: 15 additions & 20 deletions src/ims/element/static/ims.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,31 +454,25 @@ function stateForIncident(incident) {

// Return a summary for a given incident.
function summarizeIncident(incident) {
const summary = incident.summary;
const reportEntries = incident.report_entries;
if (incident.summary) {
return incident.summary;
}

if (!summary) {
if (!reportEntries) {
return "";
// Get the first line of the first report entry.
for (const reportEntry of incident.report_entries??[]) {
if (reportEntry.system_entry) {
// Don't use a system-generated entry in the summary
continue;
}
// Get the first line of the first report entry.
for (const reportEntry of reportEntries) {
if (reportEntry.system_entry) {
// Don't use a system-generated entry in the summary
continue;
}

const lines = reportEntry.text.split("\n");
for (const line of lines) {
if (line) {
return line;
}
const lines = reportEntry.text.split("\n");
for (const line of lines) {
if (line) {
return line;
}
}
return "";
}

return summary;
return "";
}


Expand Down Expand Up @@ -912,7 +906,8 @@ function submitReportEntry() {
controlHasError($("#report_entry_add"), 1000);
}

sendEdits({"report_entries": [{"text": text}]}, ok, fail);
// send a dummy ID to appease the JSON parser in the server
sendEdits({"report_entries": [{"text": text, "id": -1}]}, ok, fail);
}

//
Expand Down
19 changes: 0 additions & 19 deletions src/ims/element/static/incident.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,6 @@ function loadPersonnel(success) {
}


function localCachePersonnel(personnel) {
if (personnel == null) {
alert("Attempt to cache undefined personnel")
return;
}
cacheSet("personnel", personnel, 20 /* minutes */);
}


//
// Load incident types
//
Expand Down Expand Up @@ -288,16 +279,6 @@ function loadIncidentTypes(success) {
jsonRequest(url_incidentTypes, null, ok, fail);
}


function localCacheIncidentTypes(incidentTypes) {
if (incidentTypes == null) {
alert("Attempt to cache undefined incident types")
return;
}
cacheSet("incident_types", incidentTypes, 20 /* minutes */);
}


//
// Load all field reports
//
Expand Down
1 change: 1 addition & 0 deletions src/ims/element/static/incidents.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ function initSearchField() {
viewIncidentsURL + val,
"Incident:" + eventID + "#" + val,
);
searchInput.value = "";
}
}
}
Expand Down

0 comments on commit d4eb6e1

Please sign in to comment.