Revision 85eac622
Added by Amos Benari over 11 years ago
- ID 85eac622eefa79bbf8b8280f5e30b0f47ee16592
app/helpers/layout_helper.rb | ||
---|---|---|
|
||
def field(f, attr, options = {})
|
||
fluid = options[:fluid]
|
||
error = f.object.errors[attr] if f.object.respond_to?(:errors)
|
||
error = f.object.errors[attr] if f && f.object.respond_to?(:errors)
|
||
inline = options.delete(:help_inline)
|
||
inline = error.to_sentence.html_safe unless error.empty?
|
||
help_inline = inline.blank? ? '' : content_tag(:span, inline, :class => "help-inline")
|
app/helpers/taxonomy_helper.rb | ||
---|---|---|
controller_name.humanize.titleize
|
||
end
|
||
|
||
def wizard_header(current, *args)
|
||
content_tag(:ul,:class=>"wizard") do
|
||
step=1
|
||
content = nil
|
||
args.each do |arg|
|
||
step_content = content_tag(:li,(content_tag(:span,step,:class=>"badge" +" #{'badge-inverse' if step==current}")+arg).html_safe, :class=>"#{'active' if step==current}")
|
||
step == 1 ? content = step_content : content += step_content
|
||
step += 1
|
||
end
|
||
content
|
||
end
|
||
end
|
||
|
||
def option_button text, href, options
|
||
field(nil, "", options) do
|
||
link_to(text, href, options)
|
||
end
|
||
end
|
||
|
||
end
|
app/views/hosts/_assign_hosts.html.erb | ||
---|---|---|
<% assign_selected_hosts_taxonomy_path = (@taxonomy_type == "Location") ? assign_selected_hosts_location_path : assign_selected_hosts_organization_path %>
|
||
|
||
<%= form_for taxonomy, :url => assign_selected_hosts_taxonomy_path do |f| %>
|
||
<%= base_errors_for taxonomy %>
|
||
<%= base_errors_for taxonomy %>
|
||
<%= wizard_header 3, "Create "+taxonomy.class.name,"Select Hosts", "Assign Selected Hosts" %>
|
||
<div class="row">
|
||
<div class="span11">
|
||
<table class="table table-bordered table-striped table-condensed" >
|
||
<tr>
|
||
<th class="ca"><%= check_box_tag "check_all", "", false, { :onclick => "toggleCheck()", :title => "Select All" } %></th>
|
||
... | ... | |
|
||
<%= page_entries_info hosts, :more => " - <strong><span class='select_count'>0</span></strong> Selected" %>
|
||
<%= will_paginate hosts %>
|
||
|
||
</div>
|
||
</div>
|
||
<%= content_tag(:div, :class => "form-actions") do %>
|
||
<%= link_to("Cancel", "#{controller_name}_path", :class => "btn") %>
|
||
<%= f.submit("Assign to #{@taxonomy_type}", :class => "btn btn-success") %>
|
app/views/layouts/application.html.erb | ||
---|---|---|
<html>
|
||
<head>
|
||
<title> <%= h(yield(:title) || "Foreman") %></title>
|
||
<%= stylesheet_link_tag 'jquery-ui', 'jquery.jnotify', 'bootstrap.min', 'style', 'bootstrap-responsive.min', 'multi-select' %>
|
||
<%= stylesheet_link_tag 'jquery-ui', 'jquery.jnotify', 'bootstrap.min', 'style', 'bootstrap-responsive.min', 'multi-select', 'wizard' %>
|
||
<%= javascript_include_tag :defaults, 'jquery_ujs', 'jquery-ui', 'highcharts', 'charts', 'jquery.jnotify', 'jquery.jeditable',
|
||
'bootstrap.min', 'jquery.multi-select', 'jquery.dataTables.min', 'jquery.dataTables.bootstrap-paging' %>
|
||
<%= csrf_meta_tag %>
|
app/views/taxonomies/_step1.html.erb | ||
---|---|---|
<% javascript 'taxonomy' %>
|
||
<%= form_for taxonomy do |f| %>
|
||
<%= base_errors_for taxonomy %>
|
||
<ul class="nav nav-tabs" data-tabs="tabs">
|
||
<li class="active"><a href="#primary" data-toggle="tab"><%= taxonomy.class.name %></a></li>
|
||
</ul>
|
||
<%= wizard_header 1, "Create "+taxonomy.class.name,"Select Hosts", "Edit Properties" %>
|
||
<%= text_f f, :name, :class => "input-xlarge" %>
|
||
|
||
<%= submit_or_cancel f %>
|
||
|
||
<div class="tab-content">
|
||
<div class="tab-pane active" id="primary">
|
||
<%= text_f f, :name, :class => "input-xlarge" %>
|
||
</div>
|
||
<%= submit_or_cancel f %>
|
||
</div>
|
||
<% end %>
|
app/views/taxonomies/_step2.html.erb | ||
---|---|---|
<% edit_taxonomy_path = (taxonomy_type == "Location") ? edit_location_path(taxonomy) : edit_organization_path(taxonomy) %>
|
||
|
||
<%= form_for taxonomy do |f| %>
|
||
<%= base_errors_for taxonomy %>
|
||
<ul class="nav nav-tabs" data-tabs="tabs">
|
||
<li class="active"><a href="#hosts" data-toggle="tab">Hosts</a></li>
|
||
</ul>
|
||
<%= base_errors_for taxonomy %>
|
||
<%= wizard_header 2, "Create "+taxonomy.class.name,"Select Hosts", "Edit Properties" %>
|
||
|
||
<% if @count_nil_hosts > 0 %>
|
||
<%= alert :header => "Notice",:class => 'alert-info',
|
||
:text => "Assigning hosts to #{taxonomy.name} will also update #{taxonomy.name} to include all the resources that the selected Hosts are currently using."%>
|
||
<%= option_button "Assign All", assign_all_hosts_taxonomy_path, :class => 'btn btn-success',:method => :post,
|
||
:help_inline => "Assign All #{@count_nil_hosts} Hosts with No #{taxonomy_type} to #{taxonomy.name}" %>
|
||
<%= option_button "Manually Assign", assign_hosts_taxonomy_path, :class => 'btn',
|
||
:help_inline => "Manually select and assign Hosts with No #{taxonomy_type}" %>
|
||
<%= option_button("Proceed to Edit", edit_taxonomy_path, :class => 'btn',
|
||
:help_inline => "Skip Assign Hosts and Proceed to Edit #{taxonomy_type} Settings")%>
|
||
<% end %>
|
||
|
||
<div class="tab-content">
|
||
<div class="tab-pane active" id="hosts">
|
||
<% if @count_nil_hosts > 0 %>
|
||
<%= link_to("Assign All #{@count_nil_hosts} Hosts with No #{taxonomy_type} to #{taxonomy.name}", assign_all_hosts_taxonomy_path, :class => 'btn btn-success',:method => :post)%>
|
||
<br />
|
||
<br />
|
||
<%= link_to("Manually Assign Hosts with No #{taxonomy_type}", assign_hosts_taxonomy_path, :class => 'btn')%>
|
||
<br />
|
||
<br />
|
||
<%= link_to("Skip Assign Hosts and Proceed to Edit #{taxonomy_type} Settings", edit_taxonomy_path, :class => 'btn')%>
|
||
<% end %>
|
||
</div>
|
||
</div>
|
||
<% end %>
|
public/stylesheets/wizard.css | ||
---|---|---|
.wizard li {
|
||
padding: 10px 12px 10px;
|
||
margin-right: 5px;
|
||
margin-bottom: 30px;
|
||
background: #efefef;
|
||
position: relative;
|
||
display: inline-block;
|
||
}
|
||
.wizard li:before {
|
||
width: 0;
|
||
height: 0;
|
||
border-top: 20px inset transparent;
|
||
border-bottom: 20px inset transparent;
|
||
border-left: 20px solid #fff;
|
||
position: absolute;
|
||
content: "";
|
||
top: 0;
|
||
left: 0;
|
||
}
|
||
.wizard li:after {
|
||
width: 0;
|
||
height: 0;
|
||
border-top: 20px inset transparent;
|
||
border-bottom: 20px inset transparent;
|
||
border-left: 20px solid #efefef;
|
||
position: absolute;
|
||
content: "";
|
||
top: 0;
|
||
right: -20px;
|
||
z-index: 2;
|
||
}
|
||
.wizard li:first-child:before,.wizard li:last-child:after {
|
||
border: none;
|
||
}
|
||
.wizard li:first-child {
|
||
-webkit-border-radius: 4px 0 0 4px;
|
||
-moz-border-radius: 4px 0 0 4px;
|
||
border-radius: 4px 0 0 4px;
|
||
}
|
||
.wizard li:last-child {
|
||
-webkit-border-radius: 0 4px 4px 0;
|
||
-moz-border-radius: 0 4px 4px 0;
|
||
border-radius: 0 4px 4px 0;
|
||
}
|
||
.wizard .badge {
|
||
margin: 0 5px 0 18px;
|
||
position: relative;
|
||
top: -1px;
|
||
}
|
||
.wizard a:first-child .badge {
|
||
margin-left: 0;
|
||
}
|
||
.wizard .active {
|
||
background: #007ACC;
|
||
color: #fff;
|
||
}
|
||
.wizard .active:after {
|
||
border-left-color: #007ACC;
|
||
}
|
Also available in: Unified diff
new org wizard.