Sha256: e970238c59942c21bb158835c015391983060b3b1a3b9bbaf7fcc5e2e6b5e1e8

Contents?: true

Size: 1.3 KB

Versions: 44

Compression:

Stored size: 1.3 KB

Contents

<h2 class="edit">Commands</h2>

<% @record.script_commands.each do |script_command| %>
    <%= erb :command_config, locals: {command: script_command.command_config.command_class, action: "#{url_prefix}admin/scripts/#{@record.id}/commands/#{script_command.id}", command_options: script_command.command_config.options} %>
<% end %>

<p id="add-command">
    Add command:
    <select id="command-select">
        <option></option>
        <% command_actions.each do |command| %>
            <option value="<%= command.name %>"><%= command.human_name %></option>
        <% end %>
    </select>
</p>

<% command_actions.each do |command| %>
    <%= erb :command_config, locals: {command: command, action: "#{url_prefix}admin/scripts/#{@record.id}/commands"} %>
<% end %>

<script>
    $('#command-select').change(function() {
        $('form.command.new').hide();
        $('form.command.new[data-command="' + $(this).val() + '"]').show();
    });

    $('form.command').submit(function(event) {
        // there are three possible submit buttons in a form: Delete, Update and Add
        var submitAction = $(this).find("input[type=submit]:focus").val();

        if (submitAction == 'Delete') {
            if (!confirm('Are you sure you want to delete this action?'))
                event.preventDefault();
        }
    });
</script>

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
perus-0.1.23 lib/perus/server/views/scripts/edit.erb
perus-0.1.22 lib/perus/server/views/scripts/edit.erb
perus-0.1.21 lib/perus/server/views/scripts/edit.erb
perus-0.1.20 lib/perus/server/views/scripts/edit.erb
perus-0.1.19 lib/perus/server/views/scripts/edit.erb
perus-0.1.18 lib/perus/server/views/scripts/edit.erb
perus-0.1.17 lib/perus/server/views/scripts/edit.erb
perus-0.1.16 lib/perus/server/views/scripts/edit.erb
perus-0.1.15 lib/perus/server/views/scripts/edit.erb
perus-0.1.14 lib/perus/server/views/scripts/edit.erb
perus-0.1.13 lib/perus/server/views/scripts/edit.erb
perus-0.1.12 lib/perus/server/views/scripts/edit.erb
perus-0.1.11 lib/perus/server/views/scripts/edit.erb
perus-0.1.10 lib/perus/server/views/scripts/edit.erb
perus-0.1.9 lib/perus/server/views/scripts/edit.erb
perus-0.1.8 lib/perus/server/views/scripts/edit.erb
perus-0.1.7 lib/perus/server/views/scripts/edit.erb
perus-0.1.6 lib/perus/server/views/scripts/edit.erb
perus-0.1.5 lib/perus/server/views/scripts/edit.erb
perus-0.1.4 lib/perus/server/views/scripts/edit.erb