Project

General

Profile

« Previous | Next » 

Revision dec6f148

Added by Amos Benari about 12 years ago

  • ID dec6f148597f2b72fa2ecb0786ee70d059a77e52

[UI] templates button in host form.

View differences:

app/helpers/layout_helper.rb
end
end
def icon_text(i, text="")
(content_tag(:i,"", :class=>"icon-#{i}") + " " + text).html_safe
end
end
app/views/hosts/_provisioning.html.erb
<div class="alert alert-success">
<a class="close" href="#" data-dismiss="alert">&times;</a>
<% templates.sort{|t,x| t.template_kind <=> x.template_kind}.each do |tmplt| -%>
<div class="row">
<li class="span3"> <b><%= tmplt.template_kind %> Template</b> </li>
<li class="span5"> <%= link_to_if_authorized h(tmplt), hash_for_edit_config_template_path(:id => tmplt.to_param), :class => "label label-info" %></li>
<div class="control-group">
<div class="control-label"> <%= tmplt.template_kind %> Template </div>
<div class="controls"> <%= link_to_if_authorized h(tmplt), hash_for_edit_config_template_path(:id => tmplt.to_param), :rel=>"external" %></div>
</div>
<% end -%>
</div>
app/views/hosts/_unattended.html.erb
<% end -%>
<%= password_f f, :root_pass, :label => "Root Password" %>
<div class="row">
<%= link_to_function "Provisioning Templates", "template_info('#templates_info','#{template_used_hosts_url}')", :title => "Click to refresh", :class => "btn btn-small span2 ra" %>
<div id="templates_info" class="span7"> </div>
<div class="control-group">
<div class="control-label"> Provisioning Templates</div>
<div class=controls>
<%= link_to_function icon_text("refresh", "Resolve"), "template_info('#templates_info','#{template_used_hosts_url}')", :class => "btn" %>
<%= popover("?", "Display the templates that will be used to provision this host", :title=>"Provisioning Templates") %>
</div>
<br>
<div id="templates_info" class="span6 controls"> </div>
</div>
</div>
app/views/operatingsystems/_template_defaults.html.erb
<% else -%>
<% if ConfigTemplate.joins(:operatingsystems).where(:id => @operatingsystem.id).empty? -%>
<div class="alert alert-message alert-warning">
<a class="close" href="#" data-dismiss="alert">×</a>
<a class="close" href="#" data-dismiss="alert">&times;</a>
<p><strong>No templates found!</strong> you probably need to configure your <%= link_to "templates", config_templates_path %> first.</p>
</div>
<% end -%>
public/javascripts/application.js
$(div).load(url + "?operatingsystem_id=" + os_id + "&hostgroup_id=" + hostgroup_id + "&environment_id=" + env_id,
function(response, status, xhr) {
if (status == "error") {
$(div).html("<p>Sorry but no templates were configured.</p>");
$(div).html("<div class='alert alert-warning'><a class='close' data-di smiss='alert'>&times;</a><p>Sorry but no templates were configured.</p></div>");
}
});
}

Also available in: Unified diff