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-1.0.7 lib/perus/server/views/scripts/edit.erb
perus-1.0.6 lib/perus/server/views/scripts/edit.erb
perus-1.0.5 lib/perus/server/views/scripts/edit.erb
perus-1.0.4 lib/perus/server/views/scripts/edit.erb
perus-1.0.3 lib/perus/server/views/scripts/edit.erb
perus-1.0.2 lib/perus/server/views/scripts/edit.erb
perus-1.0.1 lib/perus/server/views/scripts/edit.erb
perus-1.0.0 lib/perus/server/views/scripts/edit.erb
perus-0.1.35 lib/perus/server/views/scripts/edit.erb
perus-0.1.34 lib/perus/server/views/scripts/edit.erb
perus-0.1.33 lib/perus/server/views/scripts/edit.erb
perus-0.1.32 lib/perus/server/views/scripts/edit.erb
perus-0.1.31 lib/perus/server/views/scripts/edit.erb
perus-0.1.30 lib/perus/server/views/scripts/edit.erb
perus-0.1.29 lib/perus/server/views/scripts/edit.erb
perus-0.1.28 lib/perus/server/views/scripts/edit.erb
perus-0.1.27 lib/perus/server/views/scripts/edit.erb
perus-0.1.26 lib/perus/server/views/scripts/edit.erb
perus-0.1.25 lib/perus/server/views/scripts/edit.erb
perus-0.1.24 lib/perus/server/views/scripts/edit.erb