lib/perus/server/views/systems.erb in perus-0.1.11 vs lib/perus/server/views/systems.erb in perus-0.1.12

- old
+ new

@@ -15,27 +15,34 @@ <% end %> </div> <% end %> <p id="no-systems" <% unless @systems.empty? %>style="display: none"<% end %>>No Systems</p> -<p id="add-command"> - Add action to <%= @title %>: - <select id="command-select"> - <option></option> - <optgroup label="Commands"> - <% command_actions.each do |command| %> - <option value="<%= command.name %>"><%= command.human_name %></option> - <% end %> - </optgroup> - <optgroup label="Scripts"> - <% @scripts.each do |script| %> - <option value="<%= script.code_name %>"><%= script.name %></option> - <% end %> - </optgroup> - </select> -</p> +<menu id="actions-menu"> + <p id="add-command"> + Add Action to <%= @title %>: + <select id="command-select"> + <option></option> + <optgroup label="Commands"> + <% command_actions.each do |command| %> + <option value="<%= command.name %>"><%= command.human_name %></option> + <% end %> + </optgroup> + <optgroup label="Scripts"> + <% @scripts.each do |script| %> + <option value="<%= script.code_name %>"><%= script.name %></option> + <% end %> + </optgroup> + </select> + </p> + <form id="delete-completed" method="POST" action="<%= url_prefix %><%= @action_url %>"> + <input type="hidden" name="_method" value="DELETE"> + <input type="submit" value="Delete Completed Actions"> + </form> +</menu> + <!-- new commands --> <% command_actions.each do |command| %> <%= erb :command_config, locals: {command: command, action: "#{url_prefix}#{@action_url}"} %> <% end %> <% @scripts.each do |script| %> @@ -46,9 +53,14 @@ <p class="actions"><input type="submit" value="Add"></p> </form> <% end %> <script> + $('#delete-completed').submit(function(event) { + if (!confirm('Are you sure you want to delete all completed actions? Their results will no longer be available.')) + event.preventDefault(); + }); + $('#command-select').change(function() { $('form.command').hide(); $('form[data-command="' + $(this).val() + '"]').show(); }); \ No newline at end of file