_form.html.erb 2.7KB

    <%= form_for(@scenario, :method => @scenario.new_record? ? "POST" : "PUT") do |f| %> <% if @scenario.errors.any? %> <div class="row well"> <h2><%= pluralize(@scenario.errors.count, "error") %> prohibited this Scenario from being saved:</h2> <% @scenario.errors.full_messages.each do |msg| %> <p class='text-warning'><%= msg %></p> <% end %> </div> <% end %> <div class="row"> <div class="col-md-4"> <div class="form-group"> <%= f.label :name %> <%= f.text_field :name, :class => 'form-control', :placeholder => "Name your Scenario" %> </div> </div> <div class="col-md-2"> <div class="form-group"> <%= f.label :tag_bg_color, "Tag Background Color" %> <%= f.color_field :tag_bg_color, :class => 'form-control', :value => @scenario.tag_bg_color || default_scenario_bg_color %> </div> </div> <div class="col-md-2"> <div class="form-group"> <%= f.label :tag_fg_color, "Tag Foreground Color" %> <%= f.color_field :tag_fg_color, :class => 'form-control', :value => @scenario.tag_fg_color || default_scenario_fg_color %> </div> </div> </div> <div class="row"> <div class="col-md-8"> <div class="form-group"> <%= f.label :description, "Optional Description" %> <%= f.text_area :description, :rows => 10, :class => 'form-control', :placeholder => "Optionally describe what this Scenario will do. If this will be public, you should also include some contact information." %> </div> <div class="checkbox"> <%= f.label :public do %> <%= f.check_box :public %> Share this Scenario publicly <% end %> <span class="glyphicon glyphicon-question-sign hover-help" data-content="When selected, this Scenario and all Agents in it will be made public. An export URL will be available to share with other Huginn users. Be very careful that you do not have secret credentials stored in these Agents' options. Instead, use Credentials by reference."></span> </div> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <div> <%= f.label :agents %> <%= f.select(:agent_ids, options_for_select(current_user.agents.pluck(:name, :id), @scenario.agent_ids), {}, { :multiple => true, :size => 5, :class => 'select2-linked-tags form-control', data: {url_prefix: '/agents'} }) %> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class='form-actions' style='clear: both'> <%= f.submit "Save Scenario", :class => "btn btn-primary" %> </div> </div> </div> <% end %>