@@ -16,10 +16,25 @@ class @AgentEditPage |
||
16 | 16 |
if $("#agent_type").length |
17 | 17 |
$("#agent_type").on "change", => @handleTypeChange(false) |
18 | 18 |
@handleTypeChange(true) |
19 |
+ $('#agent_type').select2 |
|
20 |
+ width: 'resolve' |
|
21 |
+ formatResult: formatAgentForSelect |
|
22 |
+ escapeMarkup: (m) -> |
|
23 |
+ m |
|
24 |
+ matcher: (term, text, opt) -> |
|
25 |
+ description = opt.attr('title') |
|
26 |
+ text.toUpperCase().indexOf(term.toUpperCase()) >= 0 or description.toUpperCase().indexOf(term.toUpperCase()) >= 0 |
|
27 |
+ |
|
19 | 28 |
else |
20 | 29 |
@enableDryRunButton() |
21 | 30 |
@buildAce() |
22 | 31 |
|
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 |
+ |
|
23 | 38 |
handleTypeChange: (firstTime) -> |
24 | 39 |
$(".event-descriptions").html("").hide() |
25 | 40 |
type = $('#agent_type').val() |
@@ -2,12 +2,12 @@ module Agents |
||
2 | 2 |
class DataOutputAgent < Agent |
3 | 3 |
cannot_be_scheduled! |
4 | 4 |
|
5 |
- description <<-MD |
|
5 |
+ description do <<-MD |
|
6 | 6 |
The Agent outputs received events as either RSS or JSON. Use it to output a public or private stream of Huginn data. |
7 | 7 |
|
8 | 8 |
This Agent will output data at: |
9 | 9 |
|
10 |
- `https://\#{ENV['DOMAIN']}/users/\#{user.id}/web_requests/\#{id || '<id>'}/:secret.xml` |
|
10 |
+ `https://#{ENV['DOMAIN']}/users/#{user.id}/web_requests/#{id || '<id>'}/:secret.xml` |
|
11 | 11 |
|
12 | 12 |
where `:secret` is one of the allowed secrets specified in your options and the extension can be `xml` or `json`. |
13 | 13 |
|
@@ -22,6 +22,7 @@ module Agents |
||
22 | 22 |
* `events_to_show` - The number of events to output in RSS or JSON. (default: `40`) |
23 | 23 |
* `ttl` - A value for the <ttl> element in RSS output. (default: `60`) |
24 | 24 |
MD |
25 |
+ end |
|
25 | 26 |
|
26 | 27 |
def default_options |
27 | 28 |
{ |
@@ -8,7 +8,7 @@ module Agents |
||
8 | 8 |
cannot_receive_events! |
9 | 9 |
default_schedule "every_1d" |
10 | 10 |
|
11 |
- description <<-MD |
|
11 |
+ description do <<-MD |
|
12 | 12 |
This Agent consumes RSS feeds and emits events when they change. |
13 | 13 |
|
14 | 14 |
This Agent is fairly simple, using [feed-normalizer](https://github.com/aasmith/feed-normalizer) as a base. For complex feeds |
@@ -24,8 +24,9 @@ module Agents |
||
24 | 24 |
* `headers` - When present, it should be a hash of headers to send with the request. |
25 | 25 |
* `basic_auth` - Specify HTTP basic auth parameters: `"username:password"`, or `["username", "password"]`. |
26 | 26 |
* `disable_ssl_verification` - Set to `true` to disable ssl verification. |
27 |
- * `user_agent` - A custom User-Agent name (default: "Faraday v\#{Faraday::VERSION}"). |
|
27 |
+ * `user_agent` - A custom User-Agent name (default: "Faraday v#{Faraday::VERSION}"). |
|
28 | 28 |
MD |
29 |
+ end |
|
29 | 30 |
|
30 | 31 |
def default_options |
31 | 32 |
{ |
@@ -6,17 +6,18 @@ module Agents |
||
6 | 6 |
|
7 | 7 |
gem_dependency_check { defined?(Haversine) } |
8 | 8 |
|
9 |
- description <<-MD |
|
9 |
+ description do <<-MD |
|
10 | 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. |
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. |
|
14 |
+ Your POST path will be `https://#{ENV['DOMAIN']}/users/#{user.id}/update_location/:secret` where `:secret` is specified in your options. |
|
15 | 15 |
|
16 | 16 |
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 | 17 |
|
18 | 18 |
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. |
19 | 19 |
MD |
20 |
+ end |
|
20 | 21 |
|
21 | 22 |
event_description <<-MD |
22 | 23 |
Assuming you're using the iOS application, events look like this: |
@@ -3,12 +3,12 @@ module Agents |
||
3 | 3 |
cannot_be_scheduled! |
4 | 4 |
cannot_receive_events! |
5 | 5 |
|
6 |
- description <<-MD |
|
6 |
+ description do <<-MD |
|
7 | 7 |
Use this Agent to create events by receiving webhooks from any source. |
8 |
- |
|
9 | 8 |
In order to create events with this agent, make a POST request to: |
9 |
+ |
|
10 | 10 |
``` |
11 |
- https://\#{ENV['DOMAIN']}/users/\#{user.id}/web_requests/\#{id || '<id>'}/:secret |
|
11 |
+ https://#{ENV['DOMAIN']}/users/#{user.id}/web_requests/#{id || '<id>'}/:secret |
|
12 | 12 |
``` where `:secret` is specified in your options. |
13 | 13 |
|
14 | 14 |
Options: |
@@ -20,7 +20,7 @@ module Agents |
||
20 | 20 |
used as the Event payload. If `payload_path` points to an array, |
21 | 21 |
Events will be created for each element. |
22 | 22 |
MD |
23 |
- |
|
23 |
+ end |
|
24 | 24 |
|
25 | 25 |
event_description do |
26 | 26 |
<<-MD |
@@ -25,26 +25,6 @@ |
||
25 | 25 |
<%= f.label :type %> |
26 | 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' %> |
27 | 27 |
</div> |
28 |
- <script> |
|
29 |
- function formatAgentForSelect(agent) { |
|
30 |
- var originalOption = agent.element; |
|
31 |
- var description = $(originalOption).attr('title'); |
|
32 |
- description = (/^[a-zA-Z]/.test(description)) ? description : ''; |
|
33 |
- return '<strong>' + agent.text + '</strong><br/>' + description; |
|
34 |
- } |
|
35 |
- $(function() { |
|
36 |
- $('#agent_type').select2({ |
|
37 |
- width: 'resolve', |
|
38 |
- formatResult: formatAgentForSelect, |
|
39 |
- escapeMarkup: function(m) { return m; }, |
|
40 |
- matcher: function(term, text, opt) { |
|
41 |
- var description = opt.attr('title'); |
|
42 |
- return text.toUpperCase().indexOf(term.toUpperCase())>=0 |
|
43 |
- || description.toUpperCase().indexOf(term.toUpperCase())>=0; |
|
44 |
- } |
|
45 |
- }); |
|
46 |
- }); |
|
47 |
- </script> |
|
48 | 28 |
<% end %> |
49 | 29 |
</div> |
50 | 30 |
|