Skip to content

Commit

Permalink
added css grid
Browse files Browse the repository at this point in the history
converted most pages to use that grid
  • Loading branch information
ohadlevy committed Feb 23, 2011
1 parent 4d1d914 commit 10c5720
Show file tree
Hide file tree
Showing 34 changed files with 272 additions and 293 deletions.
3 changes: 1 addition & 2 deletions app/controllers/hosts_controller.rb
Expand Up @@ -10,8 +10,7 @@ class HostsController < ApplicationController
before_filter :set_admin_user, :only => ANONYMOUS_ACTIONS

before_filter :find_hosts, :only => :query
before_filter :ajax_methods, :only => [:hostgroup_or_environment_selected, :architecture_selected, :os_selected,
:domain_selected, :hypervisor_selected, :process_hostgroup]
before_filter :ajax_methods, :only => [:hostgroup_or_environment_selected]
before_filter :find_multiple, :only => [:multiple_actions, :update_multiple_parameters, :multiple_build,
:select_multiple_hostgroup, :select_multiple_environment, :multiple_parameters, :multiple_destroy,
:multiple_enable, :multiple_disable, :submit_multiple_disable, :submit_multiple_enable]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/operatingsystems_controller.rb
Expand Up @@ -68,7 +68,7 @@ def bootfiles

def templates_for_type
return head(:method_not_allowed) unless request.xhr?
if params[:template_kind_id].to_i > 0 and kind = TemplateKind.find(params[:template_kind_id]) and @operatingsystem
if @operatingsystem and params[:template_kind_id].to_i > 0 and kind = TemplateKind.find(params[:template_kind_id])
render :partial => 'template', :locals => {:templates => ConfigTemplate.template_kind_id_eq(kind.id).operatingsystems_id_eq(@operatingsystem.id), :fid => params[:fid]}
else
return head(:not_found)
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Expand Up @@ -106,9 +106,9 @@ def logout
def auth_source_selected
render :update do |page|
if params[:auth_source_id] and AuthSource.find(params[:auth_source_id]).can_set_password?
page.show 'password', 'verification'
page.show 'password'
else
page.hide 'password', 'verification'
page.hide 'password'
end
end
end
Expand Down
7 changes: 7 additions & 0 deletions app/helpers/hosts_helper.rb
Expand Up @@ -55,4 +55,11 @@ def accessible_hostgroups
(User.current.hostgroups.any? and !User.current.admin?) ? User.current.hostgroups : Hostgroup.all
end

def update_details_from_hostgroup
return nil unless @host.new_record?
remote_function(:url => { :action => "process_hostgroup" },
:method => :post, :loading => "$('indicator1').show()",
:complete => "$('indicator1').hide()",
:with => "'hostgroup_id=' + value")
end
end
1 change: 1 addition & 0 deletions app/models/hostgroup.rb
Expand Up @@ -5,6 +5,7 @@ class Hostgroup < ActiveRecord::Base
has_and_belongs_to_many :users, :join_table => "user_hostgroups"
validates_uniqueness_of :name
validates_format_of :name, :with => /\A(\S+\s?)+\Z/, :message => "can't be blank or contain trailing white spaces."
validates_presence_of :puppetmaster
has_many :group_parameters, :dependent => :destroy, :foreign_key => :reference_id
accepts_nested_attributes_for :group_parameters, :reject_if => lambda { |a| a[:value].blank? }, :allow_destroy => true
has_many :hosts
Expand Down
3 changes: 2 additions & 1 deletion app/views/architectures/_form.html.erb
@@ -1,7 +1,8 @@
<% form_for @architecture do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %>: <%= f.text_field :name %>
<%= f.label :name, nil, :class => "span-3" %>
<%= f.text_field :name, :class => "last" %>
</p>
<% field_set_tag("Valid Operating systems") do -%>
<%= authorized_edit_habtm @architecture, Operatingsystem %>
Expand Down
90 changes: 44 additions & 46 deletions app/views/auth_source_ldaps/_form.html.erb
@@ -1,60 +1,58 @@
<% form_for @auth_source_ldap do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
<p class="span-24">
<%= f.label :name, nil, :class => "span-2" %>
<%= f.text_field :name, :class => "span-3" %>
</p>
<p>
<%= f.label :host %><br />
<%= f.text_field :host %>
<p class="span-24">
<%= f.label :host, nil, :class => "span-2" %>
<%= f.text_field :host, :class => "span-5" %>
</p>
<p>
<%= f.label :port %><br />
<%= f.text_field :port, :size => 6 %>
<%= f.check_box :tls %>
<%= f.label :tls, "LDAPS" %>
<p class="span-24">
<%= f.label :port, nil, :class => "span-2" %>
<%= f.text_field :port, :class => "span-2" %>
<%= f.check_box :tls, :class => "span-1" %>
<%= f.label :tls, "LDAPS", :class => "span-3" %>
</p>
<p>
<%= f.label :account %><br />
<%= f.text_field :account %>
<small> Use this account to authenticate, optional </small>
<p class="span-24">
<%= f.label :account, nil, :class => "span-2" %>
<%= f.text_field :account, :class => "span-3" %>
<small> Use this account to authenticate,<i>optional</i> </small>
</p>
<p>
<%= f.label :account_password %><br />
<%= f.password_field :account_password,
:value => ((@auth_source_ldap.new_record? || @auth_source_ldap.account_password.blank?) ? '' : ('x'*15)),
:onfocus => "this.value='';"
%>
<small> Use this account to authenticate, optional </small>
<p class="span-24">
<%= f.label :account_password, nil, :class => "span-2" %>
<%= f.password_field :account_password, :class => "span-3",
:value => ((@auth_source_ldap.new_record? || @auth_source_ldap.account_password.blank?) ? '' : ('x'*15)),
:onfocus => "this.value='';"
%>
<small> Use this account to authenticate, <i>optional</i> </small>
</p>
<p>
<%= f.label :base_dn %><br />
<%= f.text_field :base_dn, :size => 60 %>
<p class="span-24">
<%= f.label :base_dn ,nil, :class => "span-2" %>
<%= f.text_field :base_dn, :class => "span-10" %>
<%= f.check_box :onthefly_register, :class => "span-2" %>
<%= f.label :onthefly_register, "On-the-fly user creation", :class => "span-5" %>
</p>
<p>
<%= f.label :onthefly_register, "On-the-fly user creation" %>
<%= f.check_box :onthefly_register %>
</p>
<% field_set_tag("Attributes") do %>
<p>
<%= f.label :attr_login %>
<%= f.text_field :attr_login %>
<small>e.g. uid</small>
<% field_set_tag("Attributes for on the fly user creation") do %>
<p class="span-24">
<%= f.label :attr_login, nil, :class => "span-3" %>
<%= f.text_field :attr_login, :class => "span-4" %>
<small class="last" >e.g. uid</small>
</p>
<p>
<%= f.label :attr_firstname %>
<%= f.text_field :attr_firstname %>
<small>e.g. givenName</small>
<p class="span-24">
<%= f.label :attr_firstname, nil, :class => "span-3" %>
<%= f.text_field :attr_firstname, :class => "span-4" %>
<small class="last">e.g. givenName</small>
</p>
<p>
<%= f.label :attr_lastname %>
<%= f.text_field :attr_lastname %>
<small>e.g. sn</small>
<p class="span-24">
<%= f.label :attr_lastname, nil, :class => "span-3" %>
<%= f.text_field :attr_lastname, :class => "span-4" %>
<small class="last">e.g. sn</small>
</p>
<p>
<%= f.label :attr_mail %>
<%= f.text_field :attr_mail %>
<small>e.g. mail</small>
<p class="span-24">
<%= f.label :attr_mail, nil, :class => "span-3" %>
<%= f.text_field :attr_mail, :class => "span-4" %>
<small class="last">e.g. mail</small>
</p>
<% end -%>
<p><%= f.submit "Submit" %></p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/common/_edit_habtm.erb
@@ -1,4 +1,4 @@
<div class="box tabular">
<div class="tabular">
<% for association in associations -%>
<% content_tag_for :label, association, :class=>"floating" do %>
<%= check_box_tag(
Expand Down
7 changes: 4 additions & 3 deletions app/views/common/os_selection/_architecture.html.erb
@@ -1,6 +1,7 @@
Operating system
<%= collection_select :item, :operatingsystem_id, @architecture.operatingsystems, :id, :to_label,
{:include_blank => true, :selected => item.operatingsystem_id}, {:id => type + "_operatingsystem_id", :name => type + "[operatingsystem_id]"} %>
<%= label_tag "#{item}_operatingsystem_id", "Operating System", :class => "span-4" %>
<%= collection_select(:item, :operatingsystem_id, @architecture.operatingsystems, :id, :to_label,
{:include_blank => true, :selected => item.operatingsystem_id},
{:id => type + "_operatingsystem_id", :name => type + "[operatingsystem_id]", :class => "span-3"}) %>
<%= observe_field type + "_operatingsystem_id",
:url => { :action => :os_selected },
Expand Down
37 changes: 15 additions & 22 deletions app/views/common/os_selection/_initial.html.erb
@@ -1,29 +1,22 @@
<tr>
<td colspan="6">
<span id="architecture">
Architecture
<%= f.collection_select :architecture_id, Architecture.all, :id, :to_label, :include_blank => true %>
<span id="host_os">
<p>
<span id="architecture">
<%= f.label :architecture_id, nil, :class => "span-3" %>
<%= f.collection_select :architecture_id, Architecture.all, :id, :to_label, { :include_blank => true }, { :class => "span-3" } %>
<span id="host_os">

<span id="architecture_select">
<% if @architecture -%>
<%= render :partial => 'common/os_selection/architecture', :locals => { :f => f, :item=> item } %>
<% end -%>
</span>

<span id="operatingsystem_select">
<% if @operatingsystem -%>
<%= render :partial => 'common/os_selection/operatingsystem', :locals => { :f => f, :item=> item } %>
<% end -%>
</span>
<span id="architecture_select">
<%= render 'common/os_selection/architecture', { :item => item } if @architecture %>
</span>

</span>
<span id="operatingsystem_select">
<%= render 'common/os_selection/operatingsystem', { :item=> item } if @operatingsystem %>
</span>
</td>
</tr>

</span>
</span>
</p>

<%= observe_field(type + "_architecture_id",
:url => { :action => :architecture_selected},
:update => :architecture_select, :id => item.id,
:with => :architecture_id)
%>
:with => :architecture_id) %>
8 changes: 4 additions & 4 deletions app/views/common/os_selection/_operatingsystem.html.erb
@@ -1,6 +1,6 @@
Media
<%= label_tag "#{item}_medium_id", "Media" , :class => "span-2" %>
<%= collection_select(:item, :medium_id, @operatingsystem.media, :id, :to_label, {:include_blank => @operatingsystem.media.size > 1,
:selected => item.medium_id}, {:id => type + "_medium_id", :name => type + "[medium_id]"}) %>
Partition Table
:selected => item.medium_id}, {:id => type + "_medium_id", :name => type + "[medium_id]", :class => "span-3"}) %>
<%= label_tag "#{item}_ptable_id", "Partition Table" , :class => "span-3" %>
<%= collection_select(:item, :ptable_id, @operatingsystem.ptables, :id, :to_label, {:include_blank => @operatingsystem.ptables.size > 1,
:selected => item.ptable_id}, {:id => type + "_ptable_id", :name => type + "[ptable_id]"}) %>
:selected => item.ptable_id}, {:id => type + "_ptable_id", :name => type + "[ptable_id]", :class => "span-3"}) %>
10 changes: 6 additions & 4 deletions app/views/common_parameters/_form.html.erb
@@ -1,12 +1,14 @@
<% form_for @common_parameter do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
<%= f.label :name, nil, :class => "span-3" %>
<%= f.text_field :name, :class => "last" %>
</p>
<p>
<%= f.label :value %><br />
<%= f.text_field :value, :size => 100 %>
<%= f.label :value, nil, :class => "span-3" %>
<%= f.text_field :value, :class => "span-20 last" %>
</p>
<br/>
<br/>
<p><%= f.submit "Submit" %></p>
<% end %>
20 changes: 8 additions & 12 deletions app/views/common_parameters/_parameter.erb
@@ -1,12 +1,8 @@
<table class="fields">
<tr>
<td>Name</td>
<td> <%= f.text_field :name, :size => 10 %> </td>
<td>Value</td>
<td>
<%= f.text_field :value, :size => 75 %>
<%= f.hidden_field :nested %>
<%= authorized_via_my_scope(params[:controller], params[:action]) ? link_to_remove_fields("remove", f) : "" %>
</td>
</tr>
</table>
<p class="fields">
<%= f.label :name, nil, :class => "span-2" %>
<%= f.text_field :name, :class => "span-3" %>
<%= f.label :value, nil, :class => "span-2" %>
<%= f.text_field :value, :class => "span-14" %>
<%= f.hidden_field :nested %>
<%= authorized_via_my_scope(params[:controller], params[:action]) ? link_to_remove_fields("remove", f) : "" %>
</p>
6 changes: 4 additions & 2 deletions app/views/config_templates/_combination.html.erb
@@ -1,5 +1,7 @@
<div class="fields">
Host group <%= f.collection_select :hostgroup_id, Hostgroup.all, :id, :name, :include_blank => true %>
Environment <%= f.collection_select :environment_id, Environment.all, :id, :name, :include_blank => true %>
<%= f.label :hostgroup_id, nil, :class => "span-3" %>
<%= f.collection_select :hostgroup_id, Hostgroup.all, :id, :name, { :include_blank => true }, { :class => "span-4"} %>
<%= f.label :environment_id, nil, :class => "span-3" %>
<%= f.collection_select :environment_id, Environment.all, :id, :name, { :include_blank => true }, { :class => "span-4"} %>
<%= link_to_remove_fields("remove", f) %>
</div>
32 changes: 17 additions & 15 deletions app/views/config_templates/_form.html.erb
@@ -1,27 +1,29 @@
<% form_for @config_template do |f| %>
<%= f.error_messages %>
<p>
Name <%= f.text_field :name %>
Snippet <%= f.check_box :snippet %>
<span id="kind_selector" <%= display? @config_template.snippet %>>
Kind <%= f.collection_select :template_kind_id, TemplateKind.all, :id, :name, :include_blank => true %>
</span>
<p class="span-24">
<%= f.label :name, nil, :class => "span-3" %>
<%= f.text_field :name, :class => "span-3" %>
<%= f.label :snippet, nil, :class => "span-2" %>
<%= f.check_box :snippet, :class => "span-1" %>
<span id="kind_selector" <%= display? @config_template.snippet %>>
<%= f.label :template_kind_id, "Type", :class => "span-1" %>
<%= f.collection_select :template_kind_id, TemplateKind.all, :id, :name, {:include_blank => true}, { :class => "span-3 last"} %>
</span>
</p>
<p>
<%= f.label :template %><br />
<%= f.text_area :template, :size => "100x20" %>
<p class="span-24">
<%= f.label :template, nil, :class => "span-3" %>
<%= f.text_area :template, :class => "span-15" %>
</p>
<div id="template_associations" <%= display? @config_template.snippet %>>
<% field_set_tag("Valid Operating Systems") do %>
<% field_set_tag("Valid Operating Systems", :class => "span-24") do %>
<%= authorized_edit_habtm @config_template, Operatingsystem %>
<% end -%>
<br>

<%= render "combinations", :f => f %>
<br>
<div class="span-24">
<%= render "combinations", :f => f %>
</div>
</div>
<p><%= f.submit %></p>
<p class="span-24 last"><%= f.submit %></p>
<% end %>
<%= observe_field "config_template_snippet", :function => toggle_div("template_associations") %>
<%= observe_field "config_template_snippet", :function => toggle_div("kind_selector") %>
2 changes: 1 addition & 1 deletion app/views/config_templates/new.html.erb
Expand Up @@ -2,4 +2,4 @@
<%= render :partial => 'form' %>

<p><%= link_to "Back to List", config_templates_path %></p>
<p class="span-24"><%= link_to "Back to List", config_templates_path %></p>
14 changes: 8 additions & 6 deletions app/views/domains/_form.html.erb
@@ -1,17 +1,19 @@
<% form_for @domain do |f| %>
<%= f.error_messages %>

<p>
<%= f.label :name %><br/>
<%= f.text_field :name %>
<%= f.label :name, nil, :class => "span-3" %>
<%= f.text_field :name, :class => "last" %>
</p>

<p title='Full name describing the domain'>
<%= f.label :fullname %><br>
<%= f.text_field :fullname %>
<%= f.label :fullname, nil, :class => "span-3" %>
<%= f.text_field :fullname, :class => "last" %>
</p>

<p title="DNS Proxy to use within this domain">
<%= f.label :dns_id, "DNS Proxy" %><br />
<%= f.collection_select :dns_id, Feature.find_by_name("DNS").smart_proxies, :id, :name, :include_blank => "None" %>
<%= f.label :dns_id, "DNS Proxy",:class => "span-3" %>
<%= f.collection_select :dns_id, Feature.find_by_name("DNS").smart_proxies, :id, :name, :include_blank => "None", :class => "last" %>
</p>

<%= render :partial => "common_parameters/parameters", :locals => { :f => f, :type => :domain_parameters } %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/environments/_form.html.erb
@@ -1,8 +1,8 @@
<% form_for @environment do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br/>
<%= f.text_field :name %>
<%= f.label :name, nil, :class => "span-3" %>
<%= f.text_field :name, :class => "last" %>
</p>
<%= f.submit "Submit" %></p>
<% end %>
4 changes: 2 additions & 2 deletions app/views/environments/edit.html.erb
Expand Up @@ -2,6 +2,6 @@
<%= render :partial => 'form' %>

<p>
<div class="title_action">
<%= link_to "View All", environments_path %>
</p>
</div>

0 comments on commit 10c5720

Please sign in to comment.