Project

General

Profile

« Previous | Next » 

Revision 82e47ae0

Added by Amos Benari about 12 years ago

  • ID 82e47ae0f86994702c3a084cc6150250a81034ee

updates UI to bootstrap v2

View differences:

app/helpers/application_helper.rb
end
def link_to_remove_fields(name, f)
f.hidden_field(:_destroy) + link_to_function("x", "remove_fields(this)", :class => "label important", :title => "Remove")
f.hidden_field(:_destroy) + link_to_function("x", "remove_fields(this)", :class => "label label-important", :title => "Remove")
end
def trunc text, length
......
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
render((partial.nil? ? association.to_s.singularize + "_fields" : partial), :f => builder)
end
link_to_function(name, ("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")").html_safe, options.merge({:class => "btn small info"}) )
link_to_function(name, ("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")").html_safe, options.merge({:class => "btn btn-small btn-success"}) )
end
def toggle_div divs
......
:class => "ui-icon ui-icon-plus")
end
def check_all_links(form_name)
link_to_function("Check all", "checkAll('##{form_name}', true)") +
link_to_function("Uncheck all", "checkAll('##{form_name}', false)")
def check_all_links(form_name=':checkbox')
link_to_function("Check all", "checkAll('#{form_name}', true)") +
link_to_function("Uncheck all", "checkAll('#{form_name}', false)")
end
# Return true if user is authorized for controller/action, otherwise false
......
end
end
def display_delete_if_authorized(options ={}, html_options ={})
options = {:auth_action => :destroy}.merge(options)
html_options = {:confirm => 'Are you sure?', :method => :delete, :class => 'delete'}.merge(html_options)
display_link_if_authorized("Delete", options, html_options)
end
# Display a link if user is authorized, otherwise nothing
# +name+ : String to be displayed
# +options+ : Hash containing
......
}.merge(options))
end
def action_buttons(*args)
# the no-buttons code is needed for users with less permissions
return unless args
args = args.map{|arg| arg unless arg.blank?}.compact
return if args.length == 0
#single button
return content_tag(:span, args[0].html_safe, :class=>'btn') if args.length == 1
#multiple buttons
primary = args.delete_at(0)
content_tag(:div,:class => "btn-group") do
primary + link_to(content_tag(:span, '', :class=>'caret'),'#', :class=>'btn dropdown-toggle', :'data-toggle'=>'dropdown') +
content_tag(:ul,:class=>"dropdown-menu") do
args.map{|option| content_tag(:li,option)}.join(" ").html_safe
end
end
end
private
def edit_inline(object, property, options={})
name = "#{type}[#{property}]"
app/helpers/compute_resources_helper.rb
include LookupKeysHelper
def vm_state s
s ? "Off" : " On"
s ? " Off" : " On"
end
def vm_power_class s
"class='label #{s ? "success" : ""}'"
"class='label #{s ? "label-success" : ""}'"
end
def vm_power_action vm
opts = hash_for_power_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.identity)
html = vm.ready? ? { :confirm => 'Are you sure?', :class => "label important" } : { :class => "label notice" }
html = vm.ready? ? { :confirm => 'Are you sure?', :class => "btn btn-small btn-danger" } : { :class => "btn btn-small btn-info" }
display_link_if_authorized "Power#{state(vm.ready?)}", opts, html.merge(:method => :put)
display_link_if_authorized "Power#{vm_state(vm.ready?)}", opts, html.merge(:method => :put)
end
def memory_options max_memory
app/helpers/home_helper.rb
def setting_options
choices = [
['Bookmarks', :bookmarks],
['Environments', :environments],
['Settings', :settings],
['Global Parameters', :common_parameters],
['Host Groups', :hostgroups],
['Puppet Classes', :puppetclasses],
......
]
choices += [
['Architectures', :architectures],
[:divider],
['Compute Resources', :compute_resources],
['Hypervisors', :hypervisors]
] if SETTINGS[:libvirt]
choices += [
[:divider],
['Architectures', :architectures],
['Domains', :domains],
['Hardware Models', :models],
['Installation Media', :media],
......
] if SETTINGS[:unattended]
choices += [
[:divider],
['LDAP Authentication', :auth_source_ldaps],
['Users', :users],
['User Groups', :usergroups],
['LDAP Authentication', :auth_source_ldaps]
] if SETTINGS[:login]
choices += [
['Roles', :roles]
] if SETTINGS[:login] and User.current.admin?
choices += [['Hypervisors', :hypervisors]] if SETTINGS[:libvirt]
choices.sort
choices += [
[:divider],
['Bookmarks', :bookmarks],
['Settings', :settings]
]
choices
end
......
link_to_if_authorized(tab.capitalize, path, :class => b.empty? ? "" : "narrow-right")
end
out += content_tag :li, :class => "dropdown " + class_for_current_page(tab) do
link_to("", "#", :class => "dropdown-toggle narrow-left") + menu_dropdown(b)
link_to(content_tag(:span,'', :'data-toggle'=> 'dropdown', :class=>'caret'), "#", :class => "dropdown-toggle narrow-left") + menu_dropdown(b)
end unless b.empty?
out
end
app/helpers/hosts_helper.rb
# method that reformat the hostname column by adding the status icons
def name_column(record)
if record.build
style ="notice"
style ="label-info"
label = "Pending Installation"
short = "B"
elsif record.respond_to?(:enabled) && !record.enabled
......
short = "N"
elsif record.no_report
label = "Out of sync"
style = "warning"
style = "label-warning"
short = "S"
elsif record.error?
label = "Error"
style = "important"
style = "lable-important"
short = "E"
elsif record.changes?
label = "Active"
style = "notice"
style = "label-info"
short = "A"
elsif record.pending?
label = "Pending"
style = "warning"
style = "label-warning"
short = "P"
else
label = "No changes"
style = "success"
style = "label-success"
short = "O"
end
content_tag(:span, short, {:rel => "twipsy", :class => "label " + style, :"data-original-title" => label} ) +
link_to(trunc(" #{record}",36), host_path(record))
link_to(trunc(" #{record}",32), host_path(record))
end
def days_ago time
......
def report_status_chart name, title, subtitle, data, options = {}
content_tag(:div, nil,
{ :id => name,
:class => 'span11 host_chart',
:class => 'span7 host_chart',
:'chart-name' => name,
:'chart-title' => title,
:'chart-subtitle' => subtitle,
......
def runtime_chart name, title, subtitle, data, options = {}
content_tag(:div, nil,
{ :id => name,
:class => 'span11 host_chart',
:class => 'span7 host_chart',
:'chart-name' => name,
:'chart-title' => title,
:'chart-subtitle' => subtitle,
......
form_tag @host, :id => 'days_filter', :method => :get do
content_tag(:span, "Reports from the last ") +
select(nil, 'range', 1..days_ago(@host.reports.first.reported_at),
{:selected => @range}, {:class=>"mini", :onchange =>"$('#days_filter').submit();$(this).disabled();"}).html_safe +
{:selected => @range}, {:class=>"span1", :onchange =>"$('#days_filter').submit();$(this).disabled();"}).html_safe +
" days - #{@host.reports.recent(@range.days.ago).count} reports found"
end
end
app/helpers/hypervisors/guests_helper.rb
module Hypervisors::GuestsHelper
def state s
s ? "Off" : " On"
s ? " Off" : " On"
end
def power_class s
"class='label #{s ? "success" : ""}'"
"class='label #{s ? "label-success" : ""}'"
end
def power_action guest
opts = hash_for_power_hypervisor_guest_path(:hypervisor_id => @hypervisor, :id => guest)
html = guest.running? ? { :confirm => 'Are you sure?', :class => "label important" } : { :class => "label notice" }
html = guest.running? ? { :confirm => 'Are you sure?', :class => "btn btn-small btn-danger" } : { :class => "btn btn-small btn-info" }
display_link_if_authorized "Power#{state(guest.running?)}" , opts, html.merge(:method => :put)
end
app/helpers/layout_helper.rb
module LayoutHelper
def title(page_title, page_header = nil)
content_for(:title, page_title.to_s)
@page_header = page_header || @content_for_title
@page_header = page_header || @content_for_title || page_title.to_s
end
def title_actions *elements
......
error = obj.errors[attr] if obj.respond_to?(:errors)
help_inline = content_tag(:span, (error.empty? ? options.delete(:help_inline) : error.to_sentence.html_safe), :class => "help-inline")
help_block = content_tag(:span, options.delete(:help_block), :class => "help-block")
content_tag :div, :class => "clearfix #{error.empty? ? "" : 'error'}" do
f.label(attr, options.delete(:label)).html_safe +
content_tag(:div, :class => "input") do
content_tag :div, :class => "control-group #{error.empty? ? "" : 'error'}" do
f.label(attr, options.delete(:label),:class=>"control-label").html_safe +
content_tag(:div, :class => "controls") do
yield.html_safe + help_inline.html_safe + help_block.html_safe
end.html_safe
end
......
def submit_or_cancel f, overwrite = false
"<br>".html_safe + content_tag(:p, :class => "ra") do
text = overwrite ? "Overwrite" : "Submit"
options = overwrite ? {:class => "btn danger"} : {:class => "btn primary"}
options = overwrite ? {:class => "btn btn-danger"} : {:class => "btn btn-primary"}
link_to("Cancel", eval("#{controller_name}_path"), :class => "btn") + " " +
f.submit(text, options)
end
......
def base_errors_for obj
unless obj.errors[:base].blank?
content_tag(:div, :class => "alert-message block-message error base in fade", "data-alert" => true) do
"<a class='close' href='#'>×</a><h4>Unable to save</h4> ".html_safe + obj.errors[:base].map {|e| "<li>#{e}</li>"}.to_s.html_safe
content_tag(:div, :class => "alert alert-message alert-block alert-error base in fade") do
"<a class='close' href='#' data-dismiss='alert'>×</a><h4>Unable to save</h4> ".html_safe + obj.errors[:base].map {|e| "<li>#{e}</li>"}.to_s.html_safe
end
end
end
def popover title, msg, options = {}
link_to_function title, {:rel => "popover", "data-content" => msg, "data-original-title" => title}.merge(options)
link_to_function title, {:class => "label label-info", :rel => "popover", "data-content" => msg, "data-original-title" => title}.merge(options)
end
def will_paginate(collection = nil, options = {})
options.merge!(:class=>"span10 pagination fr")
options.merge!(:class=>"span7 pagination")
options[:renderer] ||= "WillPaginate::ActionView::BootstrapLinkRenderer"
options[:inner_window] ||= 2
options[:outer_window] ||= 0
......
:ul, content_tag(
:li, link_to(html, "#")
), :style=>"float: left;"
), :class => "span6 pagination")
), :class => "span4 pagination")
end
def form_for(record_or_name_or_array, *args, &proc)
if args.last.is_a?(Hash)
args.last[:html] = {:class=>"form-horizontal"}.merge(args.last[:html]||{})
else
args << {:html=>{:class=>"form-horizontal"}}
end
super record_or_name_or_array, *args, &proc
end
def icons i
content_tag :i, :class=>"icon-#{i}" do
yield
end
end
end
app/helpers/lookup_keys_helper.rb
end
def add_child_link(name, association, opts = {})
opts[:class] = [opts[:class], "add_nested_fields btn small success"].compact.join(" ")
opts[:class] = [opts[:class], "add_nested_fields btn btn-small btn-success"].compact.join(" ")
opts[:"data-association"] = association
link_to_function(name.to_s, "add_child_node(this);" , opts)
end
app/helpers/reports_helper.rb
def report_tag level
tag = case level
when :notice
"notice"
"info"
when :warning
"warning"
when :err
......
else
"default"
end
"class='label #{tag}'"
"class='label label-#{tag}'"
end
def logs_show
......
form_tag @report, :id => 'level_filter', :method => :get do
content_tag(:span, "Show log messages: ") +
select(nil, 'level', [['All messages', 'notice'],['Warnings and errors', 'warning'],['Errors only', 'error']],
{}, {:class=>"span4", :onchange =>"filter_by_level($(this).val());"})
{}, {:class=>"span3", :onchange =>"filter_by_level(this);"})
end
end
end
app/views/architectures/index.html.erb
<% title "Architectures" %>
<% title_actions display_link_if_authorized("New Architecture", hash_for_new_architecture_path), help_path %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th><%= sort :name %></th>
<th>Operatingsystems</th>
<th></th>
</tr>
<% for architecture in @architectures %>
<tr class="<%= cycle("even", "odd") -%>">
<tr>
<td><%= link_to_if_authorized(h(architecture.name), hash_for_edit_architecture_path(:id => architecture.name)) %></td>
<td><%=h architecture.operatingsystems.to_sentence %></td>
<td align="right">
<%= display_link_if_authorized "Delete", hash_for_architecture_path(:id => architecture.name, :auth_action => :destroy), :confirm => "Delete #{architecture.name}?", :method => :delete %>
<%= display_delete_if_authorized hash_for_architecture_path(:id => architecture.name), :confirm => "Delete #{architecture.name}?" %>
</td>
</tr>
<% end %>
app/views/audits/index.html.erb
<% title "Audits" %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th><%= sort :changed %></th>
<th>Object</th>
app/views/audits/show.html.erb
<% title "#{@audit.action.camelize} #{association_type @audit} #{audit_title @audit}" %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th>What</th>
<th>Parent</th>
app/views/auth_source_ldaps/_form.html.erb
<%= checkbox_f f, :tls, :label => "LDAPS" %>
<%= text_f f, :account, :help_inline =>"Use this account to authenticate,<i>optional</i>" %>
<%= password_f f, :account_password, :onfocus => "this.value='';", :help_inline => "Use this account to authenticate, <i>optional</i>" %>
<%= text_f f, :base_dn, :label => "basedn", :class => "xxlarge" %>
<%= text_f f, :base_dn, :label => "basedn", :class => "input-xxlarge" %>
<%= checkbox_f f, :onthefly_register, :label => "On-the-fly user creation", :onchange => "$('#on_the_fly_attrs').toggle($('#auth_source_ldap_onthefly_register').attr('checked'))",
:help_inline => "LDAP user will have his Foreman account automatically created the first time he logs into Foreman" %>
<div id="on_the_fly_attrs" <%= display?(!on_the_fly?(@auth_source_ldap)) %>>
app/views/auth_source_ldaps/index.html.erb
<% title_actions display_link_if_authorized("New Ldap Source", hash_for_new_auth_source_ldap_path), help_path %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th>Name</th>
<th>Host</th>
......
<td><%=h auth_source_ldap.host %></td>
<td><%=checked_icon auth_source_ldap.onthefly_register %></td>
<td><%=checked_icon auth_source_ldap.tls %></td>
<td><%= display_link_if_authorized "Delete", hash_for_auth_source_ldap_path(:id => auth_source_ldap, :auth_action => :destroy), :confirm => "Delete #{auth_source_ldap.name}?", :method => :delete %></td>
<td><%= display_delete_if_authorized hash_for_auth_source_ldap_path(:id => auth_source_ldap), :confirm => "Delete #{auth_source_ldap.name}?" %></td>
</tr>
<% end %>
</table>
app/views/bookmarks/_form.html.erb
<%= form_for @bookmark do |f| %>
<%= base_errors_for @bookmark %>
<%= text_f f, :name, :value => params[:query].to_s.strip.split(/\s|=|!|~|>|</)[0] %>
<%= textarea_f f, :query, :value => params[:query], :class => "xlarge" , :rows=> '3' %>
<%= textarea_f f, :query, :value => params[:query], :class => "input-xlarge" , :rows=> '3' %>
<%= checkbox_f(f, :public, :checked => true) %>
<%= f.hidden_field :controller, :value => params[:kontroller] %>
<%= submit_or_cancel f %>
app/views/bookmarks/index.html.erb
<% title "Manage Bookmarks" %>
<div class="title_action"></div>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th>Name</th>
<th>Query</th>
......
<td><%=h bookmark.controller %></td>
<td><%=h bookmark.public %></td>
<td align="right">
<%= display_link_if_authorized "Delete", hash_for_bookmark_path(:id => bookmark.name, :auth_action => :destroy), :confirm => "Delete #{bookmark.name}?", :method => :delete %>
<%= display_delete_if_authorized hash_for_bookmark_path(:id => bookmark.name), :confirm => "Delete #{bookmark.name}?" %>
</td>
</tr>
<% end %>
app/views/common/403.rhtml
<div class="alert-message block-message error">
<div class="alert alert-message alert-block alert-error base in fade">
<h2>Permission denied</h2>
<p><strong>You are not authorised to perform this action</strong></p>
<p>Please request the required privileges from a foreman administrator</p>
<div class="alert-actions">
<%= link_to "Back", root_path, :class => "btn small" %>
<%= link_to "Back", root_path, :class => "btn btn-small" %>
</div>
</div>
app/views/common/404.rhtml
<div class="alert-message block-message warning">
<div class="alert alert-message alert-block alert-warning base in fade">
<h1><%= controller_name.camelize.singularize rescue nil %> Not Found</h1>
<p>Please try to update your request</p>
<div class="alert-actions">
<%= link_to "Back", root_path, :class => "btn small" %>
<%= link_to "Back", root_path, :class => "btn btn-small" %>
</div>
</div>
app/views/common/500.rhtml
<% title "Oops, we're sorry but something went wrong" %>
<div class="alert-message block-message error" data-alert="close">
<a class="close" href="#">x</a>
<div class="alert alert-message alert-block alert-error base in fade">
<a class="close" href="#" data-dismiss="alert">x</a>
<%= h exception.message %>
</div>
......
<%= link_to_function "Full trace", toggle_div("backtrace") %> and relevant log entries.
</p>
<div id="backtrace" <%= display? %> class="alert-message block-message error">
<div id="backtrace" <%= display? %> class="alert alert-message alert-block alert-error base in fade">
<em><%= exception.class %></em><br>
<strong><%= exception.message %></strong><br>
<%= Rails.backtrace_cleaner.clean(exception.backtrace).join("<br>").html_safe %>
app/views/common/_puppetclasses_or_envs_changed.html.erb
</fieldset>
<div>
<%= link_to "Cancel","/" + controller_path, :class => "btn" %>
<%= submit_tag "Update", :class => "btn primary" %>
<%= submit_tag "Update", :class => "btn btn-primary" %>
</div>
<% end -%>
app/views/common/_searchbar.erb
<%= form_tag eval("#{controller_name}_path"), :method => "get" do %>
<%= auto_complete_search(:search, params[:search].try(:squeeze," "), {:placeholder => "Filter ..."},{ :delay => 100, :min_length => -1 }).html_safe %>
<%= display_link_if_authorized image_tag('bookmark.png', :class => "bookmark", :alt => "Bookmark this search"), {:controller => :bookmarks, :action => :new, :kontroller => controller_name}, {:'data-controls-modal'=>"bookmarks-modal", :"data-backdrop"=>"static", :id => "bookmark", :class => "btn small", :title => "Bookmark this search"} %>
<%= link_to_function 'Search', "$(this).parent().submit()" , {:id => 'submit_search', :class => 'btn small' } %>
<%= form_tag eval("#{controller_name}_path"), :method => "get", :class=>"form-inline form-search" do %>
<div class="span4">
<%= auto_complete_search(:search, params[:search].try(:squeeze," "), {:placeholder => "Filter ...", :class=>'search-query'},{ :delay => 100, :min_length => -1 }).html_safe %>
</div>
<%= link_to_function icons("bookmark"){""}, "$('#bookmarks-modal').modal();", {:id => "bookmark", :class => "btn btn-small",
:"data-url"=> new_bookmark_path(:kontroller => controller_name), :title => "Bookmark this search"}%>
<%= link_to_function "Search", "$(this).parent().submit()" , {:id => 'submit_search', :class => 'btn btn-small' } %>
<% end -%>
<div id="bookmarks-modal" class="modal hide fade">
<div class="modal-header">
<a href="#" class="close">×</a>
<a href="#" class="close" data-dismiss="modal">×</a>
<h3>Add Bookmark</h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<a href="#" class="btn primary">Submit</a>
<a href="#" class="btn secondary">Cancel</a>
<a href="#" class="btn btn-primary">Submit</a>
<a href="#" class="btn" data-dismiss="modal">Cancel</a>
</div>
</div>
app/views/common/os_selection/_image_details.html.erb
<%= fields_for item do |f| %>
<span id="image_details">
<%= checkbox_f f, :use_image, :label => "Build from img?", :onchange => 'use_image_selected(this)', "data-type" => controller_name %>
<%= text_f f, :image_file, :disabled => !item.use_image, :class => "xxlarge" %>
<%= text_f f, :image_file, :disabled => !item.use_image, :class => "input-xxlarge" %>
</span>
<% end -%>
app/views/common_parameters/_form.html.erb
<%= form_for @common_parameter do |f| %>
<%= base_errors_for @common_parameter %>
<%= text_f f, :name %>
<%= text_f f, :value, :class => "xxlarge" %>
<%= text_f f, :value, :class => "input-xxlarge" %>
<%= submit_or_cancel f %>
<% end %>
app/views/common_parameters/_parameter.erb
<div class="fields">
<div class="clearfix">
<%= f.label :name %>
<div class="input">
<%= f.text_field :name, :disabled => (not authorized_via_my_scope("host_editing", "edit_params")) %>
</div>
</div>
<div class="clearfix">
<%= f.label :value %>
<div class="input">
<%= f.text_field :value, :class => "span10", :disabled => (not authorized_via_my_scope("host_editing", "edit_params")) %>
<%= link_to_remove_fields("remove", f) if authorized_via_my_scope("host_editing", "destroy_params") -%>
</div>
</div>
<%= text_f f, :name, :disabled => (not authorized_via_my_scope("host_editing", "edit_params")) %>
<%= text_f f, :value, :class => "span7", :disabled => (not authorized_via_my_scope("host_editing", "edit_params")),
:help_inline => link_to_remove_fields("remove", f) if authorized_via_my_scope("host_editing", "destroy_params") %>
<%= f.hidden_field :nested %>
</div>
app/views/common_parameters/index.html.erb
<% title_actions display_link_if_authorized("New Parameter", hash_for_new_common_parameter_path) %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th><%= sort :name %></th>
<th><%= sort :value %></th>
......
<td><%= link_to_if_authorized h(common_parameter), hash_for_edit_common_parameter_path(:id => common_parameter.id)%></td>
<td><%=h common_parameter.value %></td>
<td class="ra">
<%= display_link_if_authorized "Delete", hash_for_common_parameter_path(:id => common_parameter, :auth_action => :destroy), :confirm => "Delete #{common_parameter.name}?", :method => :delete %>
<%= display_delete_if_authorized hash_for_common_parameter_path(:id => common_parameter), :confirm => "Delete #{common_parameter.name}?" %>
</td>
</tr>
<% end %>
app/views/compute_resources/form/_libvirt.html.erb
<%= text_f f, :url, :label => "URL", :class => "xlarge", :help_block => "e.g. qemu://host.example.com/system" %>
<%= text_f f, :url, :label => "URL", :class => "input-xlarge", :help_block => "e.g. qemu://host.example.com/system" %>
<% hypervisor = f.object.hypervisor.uuid rescue nil%>
<% if hypervisor -%>
app/views/compute_resources/form/_ovirt.html.erb
<%= text_f f, :url, :label => "URL", :class => "xlarge", :help_block => "e.g. https://ovirt.example.com:8443/api" %>
<%= text_f f, :user %>
<%= text_f f, :url, :label => "URL", :class => "input-xlarge", :help_block => "e.g. https://ovirt.example.com:8443/api" %>
<%= text_f f, :user, :help_block => "e.g. admin@internal" %>
<%= password_f f, :password %>
<% datacenters = (f.object.uuid.nil? && controller.action_name != 'test_connection') ? [] : f.object.datacenters rescue []%>
<%= selectable_f(f, :uuid, datacenters, {}, {:label => 'Datacenter',
app/views/compute_resources/form/_vmware.html.erb
<%= text_f f, :server, :label => "VCenter/Server", :class => "xlarge" %>
<%= text_f f, :server, :label => "VCenter/Server", :class => "input-xlarge" %>
<%= text_f f, :user %>
<%= password_f f, :password %>
<% datacenters = (f.object.uuid.nil? && controller.action_name != 'test_connection') ? [] : f.object.datacenters rescue []%>
app/views/compute_resources/index.html.erb
<% title "Listing compute resources" %>
<% title_actions display_link_if_authorized("New Compute Resource", hash_for_new_compute_resource_path), help_path %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th><%= sort :name %></th>
<th><%= sort :type %></th>
......
<td><%= link_to compute.name, compute %></td>
<td><%= compute.provider %></td>
<td>
<%= link_to 'Edit', edit_compute_resource_path(compute) %>
<%= link_to 'Destroy', compute, :confirm => 'Are you sure?', :method => :delete %>
<%= action_buttons(link_to('Edit', edit_compute_resource_path(compute),:class=>"btn btn-small"),
link_to('Delete', compute, :confirm => 'Are you sure?', :method => :delete)) %>
</td>
</tr>
<% end %>
app/views/compute_resources/show.html.erb
<%= javascript "compute_resource" %>
<ul class="tabs" data-tabs="tabs">
<li class="active"><a href="#primary">Primary</a></li>
<li><a href="#vms">Virtual Machines</a></li>
<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active"><a href="#primary" data-toggle="tab">Primary</a></li>
<li><a href="#vms" data-toggle="tab">Virtual Machines</a></li>
</ul>
<div class="tab-content">
<div class="active" id="primary">
<p>
<b>Name:</b>
<%= @compute_resource.name %>
</p>
<p>
<b>Provider:</b>
<%= @compute_resource.provider %>
</p>
<p>
<b>Description:</b>
<%= @compute_resource.description %>
</p>
<p>
<b>URL:</b>
<%= @compute_resource.url %>
</p>
<div class="tab-pane active" id="primary">
<table class="table table-bordered table-striped">
<th>Details</th>
<th></th>
<tr>
<td>Name</td>
<td><%= @compute_resource.name %></td>
</tr>
<tr>
<td>Provider</td>
<td><%= @compute_resource.provider %></td>
</tr>
<tr>
<td>Description</td>
<td><%= @compute_resource.description %></td>
</tr>
<tr>
<td>URL</td>
<td><%= @compute_resource.url %></td>
</tr>
</table>
</div>
<div id="vms" data-url=<%= compute_resource_vms_path(@compute_resource) %>>
<div id="vms" class="tab-pane" data-url=<%= compute_resource_vms_path(@compute_resource) %>>
<p id="vms_spinner">
<%= image_tag 'spinner.gif' %>
Loading Virtual Machines information ...
app/views/compute_resources/vms/form/_libvirt.html.erb
<% new = f.object && f.object.new? -%>
<%= text_f f, :name, :disabled => !new if controller_name != "hosts" %>
<%= selectable_f f, :cpus, 1..compute_resource.max_cpu_count, { }, :class => "mini",:disabled => !new %>
<%= selectable_f f, :cpus, 1..compute_resource.max_cpu_count, { }, :class => "input-mini",:disabled => !new %>
<%= selectable_f f, :memory, memory_options(compute_resource.max_memory), { }, :class => "span2", :disabled => !new %>
<!--NICS-->
app/views/compute_resources/vms/form/_ovirt.html.erb
<%= f.hidden_field :template if !new %>
<div class='hardware_profile'>
<%= selectable_f f, :cores, 1..compute_resource.max_cpu_count, { }, :class => "mini" %>
<%= selectable_f f, :cores, 1..compute_resource.max_cpu_count, { }, :class => "input-mini" %>
<%= selectable_f f, :memory, memory_options(compute_resource.max_memory), { }, :class => "span2" %>
<div class="children_fields">
<%= new_child_fields_template(f, :interfaces, {
app/views/compute_resources/vms/form/libvirt/_volume.html.erb
<div class="fields">
<%= selectable_f f, :pool_name, compute_resource.storage_pools.map(&:name), { }, :class => "span2", :label => "Storage Pool" %>
<%= text_f f, :capacity, :class => "mini", :label => "Size (GB)" %>
<%= text_f f, :capacity, :class => "input-mini", :label => "Size (GB)" %>
<%= select_f f, :format_type, %w[RAW QCOW2],:downcase, :to_s, { }, :class => "span2", :label => "Type",
:help_inline => remove_child_link("X", f, { :method => :'_delete', :title => 'remove network interface', :class => 'label important' }) %>
</div>
app/views/compute_resources/vms/form/ovirt/_network.html.erb
<% selected_cluster ||= clusters.size == 1 ? clusters.first.id : nil %>
<%= select_f f, :network, compute_resource.networks(selected_cluster ? { :cluster_id => selected_cluster } : { }), :id, :name,
{ }, :disabled => disabled, :class => "span2",
:help_inline => remove_child_link("X", f, { :method => :'_delete', :title => 'remove network interface', :class => 'label important' }) %>
:help_inline => remove_child_link("X", f, { :method => :'_delete', :title => 'remove network interface', :class => 'label label-important' }) %>
<%= f.hidden_field :network if disabled %>
<% end -%>
</div>
app/views/compute_resources/vms/form/ovirt/_volume.html.erb
<%= f.hidden_field :size_gb if disabled %>
<%= select_f f, :storage_domain, compute_resource.storage_domains, :id, :name,
{ },:label => "Storage Domain", :disabled => disabled, :class => "span2",
:help_inline => remove_child_link("X", f, { :method => :'_delete', :title => 'remove volume', :class => 'label important' }) %>
:help_inline => remove_child_link("X", f, { :method => :'_delete', :title => 'remove volume', :class => 'label label-important' }) %>
<%= f.hidden_field :storage_domain if disabled %>
<%= checkbox_f f, :bootable, {:label => "Is Bootable", :disabled => disabled, :checked => (f.object.bootable == 'true'), :help_inline => "Note that only one volume is allowed to be bootable" } %>
<% end -%>
app/views/compute_resources/vms/index/_ec2.html.erb
<table class="list">
<table class="table table-bordered">
<tr>
<thead>
<th>Name</th>
......
<td><%= vm.flavor_id %></td>
<td <%= vm_power_class(vm.ready?)%>> <%= vm_state(!vm.ready?) %> </td>
<td>
<%= vm_power_action vm %>
<%= display_link_if_authorized "Delete", hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id).merge(:auth_action => :destroy), :confirm => 'Are you sure?', :method => :delete, :class => "label important" %>
<%= action_buttons(vm_power_action(vm),
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id))) %>
</td>
</tr>
<% end -%>
app/views/compute_resources/vms/index/_libvirt.html.erb
<table class="list">
<table class="table table-bordered">
<tr>
<thead>
<th> Name </th>
......
<td> <%= number_to_human_size vm.memory_size*1024 %> </td>
<td <%= vm_power_class(vm.ready?)%>> <%= vm_state(!vm.ready?) %> </td>
<td>
<%= vm_power_action vm %>
<%= display_link_if_authorized "Delete", hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.uuid).merge(:auth_action => :destroy), :confirm => 'Are you sure?', :method => :delete, :class => "label important" %>
<%= action_buttons(vm_power_action(vm),
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.uuid))) %>
</td>
</tr>
<% end -%>
app/views/compute_resources/vms/index/_ovirt.html.erb
<table class="list">
<table class="table table-bordered">
<tr>
<thead>
<th>Name</th>
......
<td> <%= number_to_human_size vm.memory %> </td>
<td <%= vm_power_class(vm.ready?) %>> <%= vm_state(!vm.ready?) %> </td>
<td>
<%= vm_power_action vm %>
<%= display_link_if_authorized "Delete", hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id).merge(:auth_action => :destroy), :confirm => 'Are you sure?', :method => :delete, :class => "label important" %>
<%= action_buttons(vm_power_action(vm),
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id))) %>
</td>
</tr>
app/views/compute_resources/vms/index/_vmware.html.erb
<table class="list">
<table class="table table-bordered">
<tr>
<thead>
<th>Name</th>
......
<td> <%= number_to_human_size vm.memory %></td>
<td <%= vm_power_class(vm.ready?) %>> <%= vm_state(!vm.ready?) %> </td>
<td>
<%= vm_power_action vm %>
<%= display_link_if_authorized "Console", hash_for_console_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id), :class => "label notice" %>
<%= display_link_if_authorized "Delete", hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id).merge(:auth_action => :destroy), :confirm => 'Are you sure?', :method => :delete, :class => "label important" %>
<%= action_buttons(vm_power_action(vm),
display_link_if_authorized("Console", hash_for_console_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id)),
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id))) %>
</td>
</tr>
app/views/compute_resources/vms/show/_libvirt.html.erb
<% title @vm.name %>
<div class='row'>
<div class='span16'>
<table class="list zebra-striped">
<div class='span12'>
<table class="table table-bordered table-striped">
<tr><th colspan="2">Properties</th></tr>
<tr>
<td>Name</td>
......
</table>
</div>
</div>
<% title_actions display_link_if_authorized("Power#{state(@vm.ready?)}", hash_for_power_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => @vm.uuid), :confirm => 'Are you sure?', :method => :put, :class=>'btn ' + (@vm.ready? ? "danger" : "success")),
display_link_if_authorized("Delete", hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => @vm.uuid).merge(:auth_action => :destroy), :confirm => 'Are you sure?', :method => :delete, :class=>'btn danger'),
<% title_actions display_link_if_authorized("Power#{state(@vm.ready?)}", hash_for_power_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => @vm.uuid), :confirm => 'Are you sure?', :method => :put, :class=>'btn ' + (@vm.ready? ? "btn-danger" : "btn-success")),
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => @vm.uuid), :class=>'btn btn-danger'),
display_link_if_authorized("Other VMs on #{@compute_resource}", hash_for_compute_resource_vms_path(:compute_resource_id => @compute_resource), :class=>'btn') %>
app/views/compute_resources/vms/show/_ovirt.html.erb
</div>
</div>
<% title_actions display_link_if_authorized("Power#{state(@vm.ready?)}", hash_for_power_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => @vm.identity), :confirm => 'Are you sure?', :method => :put, :class=>'btn ' + (@vm.ready? ? "danger" : "success")),
display_link_if_authorized("Delete", hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => @vm.identity).merge(:auth_action => :destroy), :confirm => 'Are you sure?', :method => :delete, :class=>'btn danger'),
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => @vm.identity), :class=>'btn danger'),
display_link_if_authorized("Other VMs on #{@compute_resource}", hash_for_compute_resource_vms_path(:compute_resource_id => @compute_resource), :class=>'btn') %>
app/views/config_templates/_form.html.erb
<%= select_f f, :template_kind_id, TemplateKind.all, :id, :name, :include_blank => true, :label => "Type" %>
</div>
<%= textarea_f f, :template, :class => "span13",
:help_block =>"<span class='label notice'>Notice</span> #{link_to 'Useful template functions and macros', 'http://theforeman.org/projects/foreman/wiki/TemplateWriting#Functions-and-macros',
<%= textarea_f f, :template, :class => "input-xxlarge",
:help_block =>"<span class='label label-info'>Notice</span> #{link_to 'Useful template functions and macros', 'http://theforeman.org/projects/foreman/wiki/TemplateWriting#Functions-and-macros',
:rel => "external"}".html_safe
%>
<%= file_field_f f, :template, :help_inline => "<span class='label notice'>upload</span> a template instead".html_safe %>
<%= file_field_f f, :template, :help_inline => "<span class='label label-info'>upload</span> a template instead".html_safe %>
<div id="template_associations" <%= display? @config_template.snippet %>>
<%= multiple_checkboxes f, :operatingsystems, @config_template, Operatingsystem, :label => "Operating Systems" %>
app/views/config_templates/index.html.erb
<% title_actions display_link_if_authorized("New Template", hash_for_new_config_template_path),
display_link_if_authorized("Build PXE Default", {:action => :build_pxe_default},{
:confirm => "You Are about to change the default PXE menu on all configured TFTP servers - continue ?",
:class => "btn info"})
:class => "btn btn-info"})
%>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<tr class="<%= cycle("even", "odd") -%>">
<th><%= sort :name %></th>
......
<td><%= combination config_template %></td>
<td><%= config_template.try(:template_kind) %></td>
<td><%= checked_icon config_template.snippet %></td>
<td><%= display_link_if_authorized "Delete", hash_for_config_template_path(:id => config_template.to_param, :auth_action => :destroy),
:confirm => "Delete #{config_template}?", :method => :delete -%> </td>
<td><%= display_delete_if_authorized hash_for_config_template_path(:id => config_template.to_param),
:confirm => "Delete #{config_template}?" -%> </td>
</tr>
<% end %>
</table>
app/views/dashboard/index.html.erb
<% title 'Overview' %>
<div id='dashboard'>
<p>Generated at <%= Time.now.to_s(:short) %></p>
<table id='links-tbl' class="list zebra-striped">
<table id='links-tbl' class="table table-striped table-bordered">
<tr>
<th>Description</th>
<th>Data</th>
......
</tr>
</table>
<div id='dashboard-charts' class='row'>
<%= render_overview(@report, :class => 'statistics_pie span8') %>
<%= render_run_distribution(count_reports(@hosts), :class => 'statistics_bar span8') %>
<%= render_overview(@report, :class => 'statistics_pie span6') %>
<%= render_run_distribution(count_reports(@hosts), :class => 'statistics_bar span6') %>
</div>
</div>
app/views/dashboard/welcome.html.erb
<li> For Roles and permissions, see the <%= link_to "Roles", roles_path %> page</li>
</ul>
<% else -%>
<p><span class="label notice">Notice</span>
<p><span class="label label-info">Notice</span>
You would need to enable login in your settings.yml file first and restart foreman
<p>
<p><span class="label important">Important</span>
<p><span class="label label-important">Important</span>
the default username and password are <b>admin</b> and <b>changeme</b>
</p>
<% end -%>
......
<p>You may also find the <a href=http://theforeman.org/projects/foreman/wiki/Howtos rel="external">Howtos</a> useful.</p>
<p><span class="label notice">Notice</span> This page will self destruct once data comes in.</p>
<p><span class="label label-info">Notice</span> This page will self destruct once data comes in.</p>
</div>
app/views/domains/_form.html.erb
<%= form_for @domain do |f| %>
<%= base_errors_for @domain %>
<ul class="tabs" data-tabs="tabs">
<li class="active"><a href="#primary">Primary</a></li>
<li><a href="#params">Parameters</a></li>
<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active"><a href="#primary" data-toggle="tab">Primary</a></li>
<li><a href="#params" data-toggle="tab">Parameters</a></li>
</ul>
<div class="tab-content">
<div class="active" id="primary">
<div class="tab-pane active" id="primary">
<%= text_f f, :name, :help_inline => "The full DNS Domain name" %>
<%= text_f f, :fullname, :help_inline => "Full name describing the domain" %>
<%= select_f f, :dns_id, Feature.find_by_name("DNS").smart_proxies, :id, :name,
......
%>
</div>
<div id="params">
<div class="tab-pane" id="params">
<%= render "common_parameters/parameters", { :f => f, :type => :domain_parameters } %>
</div>
app/views/domains/index.html.erb
<% title_actions display_link_if_authorized("New Domain", hash_for_new_domain_path), help_path %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th><%= sort :name %></th>
<th>Hosts</th>
<th class="ra"></th>
<th></th>
</tr>
<% for domain in @domains %>
<tr class="<%= cycle("even", "odd") -%>">
<td><%= link_to_if_authorized h(domain.fullname.empty? ? domain.name : domain.fullname), hash_for_edit_domain_path(:id => domain.name)%></td>
<td><%= link_to_if domain.hosts.any?, domain.hosts.size, hosts_path(:search => "domain = #{domain}") %>
<td class="ra"> <%= display_link_if_authorized "Delete", hash_for_domain_path(:id => domain, :auth_action => :destroy), :confirm => "Delete #{domain.name}?", :method => :delete %></td>
<td><%= display_delete_if_authorized hash_for_domain_path(:id => domain), :confirm => "Delete #{domain.name}?" %></td>
</tr>
<% end %>
</table>
app/views/environments/index.html.erb
display_link_if_authorized("Import all classes and environments", hash_for_import_environments_environments_path, :action => "import_environments"), help_path
%>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th><%= sort :name %></th>
<th>Hosts</th>
......
</tr>
<% for environment in @environments %>
<tr class="<%= cycle("even", "odd") -%>">
<tr>
<td>
<%= link_to_if_authorized h(environment.name), hash_for_edit_environment_path(:id=> environment.name) %>
</td>
<td><%= link_to_if environment.hosts.any?, environment.hosts.size, hosts_path(:search => "environment = #{environment}") %>
<td class="ra">
<%= link_to "Classes", puppetclasses_path(:search => "environment = #{environment}")%>
<%= display_link_if_authorized "Delete", hash_for_environment_path(:id => environment.name, :auth_action => :destroy), :confirm => "Delete #{environment.name}?", :method => :delete %>
<td>
<%= action_buttons(link_to("Classes", puppetclasses_path(:search => "environment = #{environment}"), :class=>'btn btn-small'),
display_delete_if_authorized(hash_for_environment_path(:id => environment.name), :confirm => "Delete #{environment.name}?")) %>
</td>
</tr>
<% end %>
app/views/fact_values/index.html.erb
<% title "Fact Values" %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<% unless params[:host_id] -%>
<th><%= sort :host %></th>
app/views/home/_settings.html.erb
<li class="dropdown <%= class_for_setting_page %>">
<%= link_to "More", "#", :class => "dropdown-toggle" %>
<%= link_to ("More" + content_tag(:span,'', :class=>"caret")).html_safe, "#", :class => "dropdown-toggle", :'data-toggle'=>"dropdown" %>
<ul class="dropdown-menu">
<% setting_options.each do |c|-%>
<li> <%= display_link_if_authorized c[0], {:controller => c[1], :action => :index} %></li>
<% if c[0] == :divider -%>
<li class="divider"></li>
<% else %>
<li> <%= display_link_if_authorized c[0], {:controller => c[1], :action => :index} %></li>
<% end -%>
<% end -%>
</ul>
</li>
app/views/home/_topbar.rhtml
<ul class="nav">
<li><%=image_tag("foreman.png", :class=>"logo") %><h3 class="logo-text">Foreman</h3></li>
</ul>
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav1">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="btn btn-navbar btn-mini" data-toggle="collapse" data-target=".nav2">
<span class="icon-cog icon-white"></span>
</a>
<!-- logo -->
<%=image_tag("foreman.png", :class=>"logo") %><a class="brand logo-text" href="#">Foreman</a>
<!-- menu -->
<ul class="nav" id="menu">
<% if User.current -%>
<% my_bookmarks = Bookmark.my_bookmarks %>
<div class="nav-collapse nav1">
<ul class="nav" id="menu">
<% my_bookmarks = Bookmark.my_bookmarks %>
<%= menu 'dashboard', my_bookmarks %>
<%= menu 'hosts', my_bookmarks %>
<%= menu 'reports', my_bookmarks, hash_for_reports_path.merge(:search => 'eventful = true') %>
<%= menu 'facts' , my_bookmarks, hash_for_fact_values_path %>
<%= menu 'audits', my_bookmarks, hash_for_audits_path %>
<%= menu 'statistics', my_bookmarks %>
</ul>
<ul class="nav secondary-nav" id="menu2">
<% if User.current %>
<%= render "home/settings" -%>
<% if SETTINGS[:login]%>
<%= render 'home/user_dropdown' %>
<% end -%>
<%= menu 'dashboard', my_bookmarks %>
<%= menu 'hosts', my_bookmarks %>
<%= menu 'reports', my_bookmarks, hash_for_reports_path.merge(:search => 'eventful = true') %>
<%= menu 'facts' , my_bookmarks, hash_for_fact_values_path %>
<%= menu 'audits', my_bookmarks, hash_for_audits_path %>
<%= menu 'statistics', my_bookmarks %>
</ul>
</div>
<div class="nav-collapse nav2">
<ul class="nav pull-right" id="menu2">
<%= render "home/settings" -%>
<% if SETTINGS[:login]%>
<%= render 'home/user_dropdown' %>
<% end -%>
</ul>
</div>
<% end -%>
<% end -%>
</ul>
app/views/home/_user_dropdown.rhtml
<li class="dropdown">
<%= link_to User.current.login.capitalize, "#", :class => "dropdown-toggle" %>
<%= link_to (User.current.login.capitalize + content_tag(:span,'', :class=>"caret")).html_safe, "#", :class => "dropdown-toggle", :'data-toggle'=>"dropdown" %>
<ul class="dropdown-menu">
<li><%= link_to("Sign Out", logout_users_path) %></li>
<li><%= link_to("My account", edit_user_path(User.current) )%></li>
app/views/hostgroups/_form.html.erb
<%= form_for @hostgroup do |f| %>
<%= base_errors_for @hostgroup %>
<ul class="tabs" data-tabs="tabs">
<li class="active"><a href="#primary">Primary</a></li>
<li><a href="#puppet_klasses">Puppet Classes</a></li>
<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active"><a href="#primary" data-toggle="tab">Primary</a></li>
<li><a href="#puppet_klasses" data-toggle="tab">Puppet Classes</a></li>
<% if SETTINGS[:unattended] -%>
<li><a href="#network">Network</a></li>
<li><a href="#os">Operating System</a></li>
<li><a href="#network" data-toggle="tab">Network</a></li>
<li><a href="#os" data-toggle="tab">Operating System</a></li>
<% if !Hypervisor.first.nil? and authorized_for("Hypervisors::Guests", :create) -%>
<li><a href="#virtual_machine">Virtual Machine</a></li>
<li><a href="#virtual_machine" data-toggle="tab">Virtual Machine</a></li>
<% end -%>
<% end -%>
<li><a href="#params">Parameters</a></li>
<li><a href="#params" data-toggle="tab">Parameters</a></li>
</ul>
<div class="tab-content">
<div class="active" id="primary">
<div class="tab-pane active" id="primary">
<%= select_f f, :parent_id, accessible_hostgroups, :id, :to_label, {:include_blank => true}, {
:onchange => 'hostgroup_changed(this);', "data-type" => controller_name,
:help_inline => image_tag('spinner.gif', :id => 'hostgroup_indicator', :class => 'hide').html_safe } %>
......
<%= puppet_master_fields f %>
</div>
<div id="puppet_klasses">
<div class="tab-pane" id="puppet_klasses">
<% if @environment or @hostgroup.environment -%>
<%= render 'puppetclasses/class_selection', :obj => @hostgroup %>
<% else -%>
<p class="alert-message">Please select an Environment first</p>
<p class="alert alert-message">Please select an Environment first</p>
<% end -%>
</div>
<div id="network">
<div class="tab-pane" id="network">
<%= render 'common/domain_subnet', :item => @hostgroup %>
</div>
<div id="os">
<div class="tab-pane" id="os">
<%= render "common/os_selection/initial", :item=> @hostgroup %>
<%= password_f f, :root_pass, :label => "Root Password" %>
</div>
<div id="virtual_machine">
<div class="tab-pane" id="virtual_machine">
<%= render('common/hypervisor', :item => @hostgroup) %>
</div>
<div id="params">
<div class="tab-pane" id="params">
<%= render "common_parameters/parameters", { :f => f, :type => :group_parameters } %>
</div>
</div>
app/views/hostgroups/index.html.erb
<% title_actions display_link_if_authorized("New Hostgroup", hash_for_new_hostgroup_path), help_path %>
<table class="list">
<table class="table table-bordered table-striped">
<tr>
<th>Name</th>
<th></th>
......
<% Hostgroup.sort_by_ancestry(@hostgroups).each do |hostgroup| %>
<tr class="<%= cycle("even", "odd") -%>">
<td> <%= hostgroup_name hostgroup %> </td>
<td class="ra">
<%= display_link_if_authorized 'Nest', hash_for_nest_hostgroup_path(:id => hostgroup) %>
<%= display_link_if_authorized 'Clone', hash_for_clone_hostgroup_path(:id => hostgroup) %>
<%= display_link_if_authorized "Delete", hash_for_hostgroup_path(:id => hostgroup, :auth_action => :destroy), :confirm => warning_message(hostgroup), :method => :delete %>
<td>
<%= action_buttons(
display_link_if_authorized('Nest', hash_for_nest_hostgroup_path(:id => hostgroup), :class=>"btn btn-small"),
display_link_if_authorized('Clone', hash_for_clone_hostgroup_path(:id => hostgroup)),
display_delete_if_authorized(hash_for_hostgroup_path(:id => hostgroup), :confirm => warning_message(hostgroup))) %>
</td>
</tr>
<% end %>
app/views/hosts/_conflicts.html.erb
<div id="host-conflicts-modal" class="modal in fade" <%= display(false) %>>
<div class="modal-header">
<a href="#" class="close">&times</a>
<a href="#" class="close" data-dismiss="modal">&times</a>
<h3>Conflicts have been detected</h3>
</div>
<div class="modal-body">
......
<p> Please review them carefully, if you are certain that they should be removed, please click on overwrite.</p>
<div class="alert-message block-message">
<div class="alert alert-message alert-block base">
<% @host.errors[:conflict].each do |e| -%>
<li><%= e %></li>
<% end -%>
</div>
<h4>Additionally, we are about to perform the following <%@host.queue.count %> actions</h4>
<div class="alert-message block-message info">
<div class="alert alert-message alert-block alert-info base">
<% @host.queue.all.each do |task| -%>
<li><%= task.name %></li>
<% end -%>
app/views/hosts/_form.html.erb
<%= form_for @host do |f| %>
<%= base_errors_for @host %>
<ul class="tabs" data-tabs="tabs">
<li class="active"><a href="#primary">Primary</a></li>
<li><a href="#puppet_klasses">Puppet Classes</a></li>
<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active"><a href="#primary" data-toggle="tab">Primary</a></li>
<li><a href="#puppet_klasses" data-toggle="tab">Puppet Classes</a></li>
<% if SETTINGS[:unattended] and @host.managed -%>
<li><a href="#network">Network</a></li>
<li><a href="#os">Operating System</a></li>
<li><a href="#network" data-toggle="tab">Network</a></li>
<li><a href="#os" data-toggle="tab">Operating System</a></li>
<% if authorized_for("Hypervisors::Guests", :create) -%>
<% if @host.new_record? and !Hypervisor.first.nil? -%>
<li id="libvirt_tab" <%= display? !(params[:host] && params[:host][:hypervisor_id].present?) %>><a href="#virtual_machine">Virtual Machine</a></li>
<li id="libvirt_tab" <%= display? !(params[:host] && params[:host][:hypervisor_id].present?) %>><a href="#virtual_machine" data-toggle="tab">Virtual Machine</a></li>
<% end -%>
<li id="compute_resource_tab" <%= display? !(@host.compute_resource_id || params[:host] && params[:host][:compute_resource_id].present?)%>><a href="#compute_resource">Virtual Machine</a></li>
<li id="compute_resource_tab" <%= display? !(@host.compute_resource_id || params[:host] && params[:host][:compute_resource_id].present?)%>><a href="#compute_resource" data-toggle="tab">Virtual Machine</a></li>
<% end -%>
<% end -%>
<li><a href="#params">Parameters</a></li>
<li><a href="#info">Additional Information</a></li>
<li><a href="#params" data-toggle="tab">Parameters</a></li>
<li><a href="#info" data-toggle="tab">Additional Information</a></li>
</ul>
<div class="tab-content">
<div class="active" id="primary">
<%= text_f f, :name, :class => "xlarge", :value => name_field(@host) %>
<div class="tab-pane active" id="primary">
<%= text_f f, :name, :class => "input-xlarge", :value => name_field(@host) %>
<% libvirt = Hypervisor.first.nil? ? [] : [OpenStruct.new(:to_label => 'Libvirt')] -%>
<%= select_f f, :compute_resource_id, libvirt + ComputeResource.all, :id, :to_label,
{ :include_blank => 'Bare Metal' },
......
<%= puppet_master_fields f %>
</div>
<div id="puppet_klasses">
<div class="tab-pane" id="puppet_klasses">
<% if @environment or @hostgroup -%>
<%= render 'puppetclasses/class_selection', :obj => @host %>
<% else -%>
<p class="alert-message">Please select an Environment first</p>
<p class="alert alert-message">Please select an Environment first</p>
<% end -%>
</div>
......
<%= render('unattended', :f => f) if SETTINGS[:unattended] and @host.managed -%>
<div id="params">
<div class="tab-pane" id="params">
<%= render "common_parameters/parameters", { :f => f, :type => :host_parameters } %>
</div>
<div id="info">
<div class="tab-pane" id="info">
<% if SETTINGS[:login] -%>
<%= selectable_f f, :is_owned_by, option_groups_from_collection_for_select(
[User, Usergroup], :all, :table_name, :id_and_type, :select_title,
......
:help_inline => "Include this host within Foreman reporting"
%>
<%= select_f f, :model_id, Model.all, :id, :to_label, { :include_blank => true }, {:label => "Hardware Model"} %>
<%= textarea_f f, :comment, :help_block => "Additional information about this host", :class => "xxlarge", :rows => "3" %>
<%= textarea_f f, :comment, :help_block => "Additional information about this host", :class => "input-xxlarge", :rows => "3" %>
</div>
</div>
<%= f.hidden_field :overwrite? %>
app/views/hosts/_list.html.erb
<%= javascript "jquery.cookie", "host_checkbox" %>
<% title header ||= "" %>
<table class="list zebra-striped fixed-width" >
<table class="table table-bordered table-striped table-condensed" >
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff