@@ -16,6 +16,8 @@ class @AgentEditPage |
||
| 16 | 16 |
if $("#agent_type").length
|
| 17 | 17 |
$("#agent_type").on "change", => @handleTypeChange(false)
|
| 18 | 18 |
@handleTypeChange(true) |
| 19 |
+ |
|
| 20 |
+ # Update the dropdown to match agent description as well as agent name |
|
| 19 | 21 |
$('#agent_type').select2
|
| 20 | 22 |
width: 'resolve' |
| 21 | 23 |
formatResult: formatAgentForSelect |
@@ -29,12 +31,6 @@ class @AgentEditPage |
||
| 29 | 31 |
@enableDryRunButton() |
| 30 | 32 |
@buildAce() |
| 31 | 33 |
|
| 32 |
- formatAgentForSelect = (agent) -> |
|
| 33 |
- originalOption = agent.element |
|
| 34 |
- description = $(originalOption).attr('title')
|
|
| 35 |
- description = if /^[a-zA-Z]/.test(description) then description else '' |
|
| 36 |
- '<strong>' + agent.text + '</strong><br/>' + description |
|
| 37 |
- |
|
| 38 | 34 |
handleTypeChange: (firstTime) -> |
| 39 | 35 |
$(".event-descriptions").html("").hide()
|
| 40 | 36 |
type = $('#agent_type').val()
|
@@ -192,5 +188,10 @@ class @AgentEditPage |
||
| 192 | 188 |
@updateFromEditors() |
| 193 | 189 |
Utils.handleDryRunButton(e.target) |
| 194 | 190 |
|
| 191 |
+ formatAgentForSelect = (agent) -> |
|
| 192 |
+ originalOption = agent.element |
|
| 193 |
+ description = agent.element[0].title |
|
| 194 |
+ '<strong>' + agent.text + '</strong><br/>' + description |
|
| 195 |
+ |
|
| 195 | 196 |
$ -> |
| 196 | 197 |
Utils.registerPage(AgentEditPage, forPathsMatching: /^agents/) |
@@ -304,3 +304,8 @@ $service-colors: #55acee #8fc857 #444444 #2c4762 #007EE5 |
||
| 304 | 304 |
.label-service {
|
| 305 | 305 |
@include services; |
| 306 | 306 |
} |
| 307 |
+ |
|
| 308 |
+.select2-highlighted a {
|
|
| 309 |
+ color: yellow; |
|
| 310 |
+ text-decoration: underline; |
|
| 311 |
+} |
@@ -7,12 +7,10 @@ module Agents |
||
| 7 | 7 |
gem_dependency_check { defined?(Haversine) }
|
| 8 | 8 |
|
| 9 | 9 |
description do <<-MD |
| 10 |
- The UserLocationAgent creates events based on WebHook POSTS that contain a `latitude` and `longitude`. You can use the [POSTLocation](https://github.com/cantino/post_location) or [PostGPS](https://github.com/chriseidhof/PostGPS) iOS app to post your location. |
|
| 10 |
+ The UserLocationAgent creates events based on WebHook POSTS that contain a `latitude` and `longitude`. You can use the [POSTLocation](https://github.com/cantino/post_location) or [PostGPS](https://github.com/chriseidhof/PostGPS) iOS app to post your location to `https://#{ENV['DOMAIN']}/users/#{user.id}/update_location/:secret` where `:secret` is specified in your options.
|
|
| 11 | 11 |
|
| 12 | 12 |
#{'## Include `haversine` in your Gemfile to use this Agent!' if dependencies_missing?}
|
| 13 | 13 |
|
| 14 |
- Your POST path will be `https://#{ENV['DOMAIN']}/users/#{user.id}/update_location/:secret` where `:secret` is specified in your options.
|
|
| 15 |
- |
|
| 16 | 14 |
If you want to only keep more precise locations, set `max_accuracy` to the upper bound, in meters. The default name for this field is `accuracy`, but you can change this by setting a value for `accuracy_field`. |
| 17 | 15 |
|
| 18 | 16 |
If you want to require a certain distance traveled, set `min_distance` to the minimum distance, in meters. Note that GPS readings and the measurement itself aren't exact, so don't rely on this for precision filtering. |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 |
<% if @agent.new_record? %> |
| 24 | 24 |
<div class="form-group type-select"> |
| 25 | 25 |
<%= f.label :type %> |
| 26 |
- <%= f.select :type, options_for_select([['Select an Agent Type', 'Agent', {title: ''}]] + Agent.types.map {|type| [type.name.gsub(/^.*::/, '').underscore.humanize.titleize, type, {title: type.description.to_s.strip.split(/\r?\n/)[0]}] }, @agent.type), {}, :class => 'form-control' %>
|
|
| 26 |
+ <%= f.select :type, options_for_select([['Select an Agent Type', 'Agent', {title: ''}]] + Agent.types.map {|type| [type.name.gsub(/^.*::/, '').underscore.humanize.titleize, type, {title: h(Agent.build_for_type(type.name,current_user,{}).html_description.lines.first.strip)}] }, @agent.type), {}, :class => 'form-control' %>
|
|
| 27 | 27 |
</div> |
| 28 | 28 |
<% end %> |
| 29 | 29 |
</div> |