@@ -34,7 +34,7 @@ class @Utils |
||
| 34 | 34 |
body?(modal.querySelector('.modal-body'))
|
| 35 | 35 |
$(modal).modal('show')
|
| 36 | 36 |
|
| 37 |
- @handleDryRunButton: (button, data = $(button.form).serialize()) -> |
|
| 37 |
+ @handleDryRunButton: (button, data = if button.form then $(':input[name!="_method"]', button.form).serialize() else '') ->
|
|
| 38 | 38 |
$(button).prop('disabled', true)
|
| 39 | 39 |
$('body').css(cursor: 'progress')
|
| 40 | 40 |
$.ajax type: 'POST', url: $(button).data('action-url'), dataType: 'json', data: data
|
@@ -37,7 +37,7 @@ class AgentsController < ApplicationController |
||
| 37 | 37 |
def dry_run |
| 38 | 38 |
attrs = params[:agent] || {}
|
| 39 | 39 |
if agent = current_user.agents.find_by(id: params[:id]) |
| 40 |
- # PUT /agents/:id/dry_run |
|
| 40 |
+ # POST /agents/:id/dry_run |
|
| 41 | 41 |
if attrs.present? |
| 42 | 42 |
type = agent.type |
| 43 | 43 |
agent = Agent.build_for_type(type, current_user, attrs) |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 |
|
| 8 | 8 |
<% if agent.can_dry_run? %> |
| 9 | 9 |
<li> |
| 10 |
- <%= link_to icon_tag('glyphicon-refresh') + ' Dry Run', '#', 'data-action-url' => dry_run_agent_path(agent), tabindex: "-1", onclick: "Utils.handleDryRunButton(this, '_method=PUT')" %>
|
|
| 10 |
+ <%= link_to icon_tag('glyphicon-refresh') + ' Dry Run', '#', 'data-action-url' => dry_run_agent_path(agent), tabindex: "-1", onclick: "Utils.handleDryRunButton(this)" %>
|
|
| 11 | 11 |
</li> |
| 12 | 12 |
<% end %> |
| 13 | 13 |
|
@@ -2,7 +2,7 @@ Huginn::Application.routes.draw do |
||
| 2 | 2 |
resources :agents do |
| 3 | 3 |
member do |
| 4 | 4 |
post :run |
| 5 |
- put :dry_run |
|
| 5 |
+ post :dry_run |
|
| 6 | 6 |
post :handle_details_post |
| 7 | 7 |
put :leave_scenario |
| 8 | 8 |
delete :remove_events |