Skip to content

Commit

Permalink
Fixed host page templates and designs.
Browse files Browse the repository at this point in the history
  • Loading branch information
kentaro committed Jun 19, 2012
1 parent c89322b commit e4c7d97
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 126 deletions.
7 changes: 7 additions & 0 deletions app/views/hosts/_form.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="control-group">
<%= form.label :name, class: "control-label" %>
<div class="controls">
<%= form.text_field :name, :style => 'width: 330px' %>
DNS name or IP address
</div>
</div>
43 changes: 23 additions & 20 deletions app/views/hosts/_stages.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,24 +1,27 @@
<% if @stages.empty? %> <% if @stages.empty? %>
No deployments for this host. <p>No deployments for this host.</p>
<% else %> <% else %>
<table class="sortable"> <table class="table table-striped">
<tr> <thead>
<th>Project</th> <tr>
<th>Stage</th> <th>Project</th>
<th>Role</th> <th>Stage</th>
</tr> <th>Role</th>
<% for stage in @stages %>
<tr class="<%= cycle :even, :odd, :name => 'stages' %>">
<td valign="top"><%= link_to stage.project.name, stage.project %></td>
<td valign="top"><%= link_to stage.name, [stage.project, stage] %></td>
<td valign="top">
<% for role in stage.roles.find(:all, :conditions => ['host_id = ?', @host.id]) %>
<%= role.name %>
<%= role.role_attribute_hash.inspect unless role.role_attribute_hash.blank? %>
<br />
<% end %>
</td>
</tr> </tr>
<% end %> </thead>
<tbody>
<% @stages.each do |stage| %>
<tr>
<td><%= link_to stage.project.name, stage.project %></td>
<td><%= link_to stage.name, [stage.project, stage] %></td>
<td>
<% stage.roles.find(:all, :conditions => ['host_id = ?', @host.id]).each do |role| %>
<%= role.name %>
<%= role.role_attribute_hash.inspect unless role.role_attribute_hash.blank? %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table> </table>
<% end %> <% end %>
40 changes: 19 additions & 21 deletions app/views/hosts/edit.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,28 +1,26 @@
<% flashed_errors(:host) %> <% content_for :page_title do %>
<% @page_title = "Edit host #{@host.name}" %>
<%= form_for(:host, :url => host_path(@host), :html => { :method => :put }) do |f| %> <h1>Edit host <%= @host.name %></h1>
<p>
<b>Name (DNS name or IP address)</b><br />
<%= f.text_field :name, :style => 'width: 330px' %>
</p>

<%= link_to 'Back to host', @host, :class => 'arrow_link ontheright', :style => 'margin-right: 330px' %>

<p>
<%= submit_tag "Update" %>
</p>
<% end %> <% end %>
<% content_for(:breadcrumb) do %> <% content_for :breadcrumb do %>
<%= breadcrumb_box do %> <%= breadcrumb_box do %>
<%= link_to "Back to host", @host, :style => "float:right", :class => "arrow_link" %> <%= link_to "Hosts", hosts_path %>
<%= link_to "Hosts", hosts_path %> &gt; <span class="divider">&raquo;</span>
Host <%= link_to @host.name, @host %> &gt; <%= link_to @host.name, @host %>
<span class="divider">&raquo;</span>
Edit Edit
<% end %> <% end %>
<% end %> <% end %>
<% content_for(:page_title) do %> <% flashed_errors(:host) %>
<% @page_title = "Edit host #{@host.name}" %>
<h2>Edit host <%= @host.name %></h2> <section>
<% end %> <%= form_for @host, html: { class: "form-horizontal" } do |f| %>
<%= render partial: 'form', locals: { form: f } %>
<div class="form-actions">
<%= f.submit class: "btn btn-primary" %>
<%= link_to 'Back to host', host_path(@host), :class => 'btn' %>
</div>
<% end %>
</section>
62 changes: 33 additions & 29 deletions app/views/hosts/index.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,36 +1,40 @@
<h2>Hosts</h2> <% content_for :page_title do %>

<% @page_title = "Hosts" %>
<fieldset class="fieldset"> <h1>Hosts</h1>
<legend> <%= pluralize(Host.count, 'Host')%> listed</legend> <% end %>

<table class="sortable">
<tr>
<th width="34%">Name</th>
<th width="33%">#Stages</th>
<th width="33%">#Roles</th>
</tr>
<% for host in @hosts %>
<tr class="<%= cycle :even, :odd %>">
<td><%= link_to host.name, host %></td>
<td><%= host.stages.count %></td>
<td><%= host.roles.count %></td>
<% if current_user.admin? %>
<td><%= link_to 'Edit', [:edit, host] %></td>
<td><%= link_to 'Delete', host, :data => { :confirm => 'Are you sure?' }, :method => :delete %></td>
<% end %>
</tr>
<% end %>
</table>
<% content_for(:breadcrumb) do %> <% content_for :breadcrumb do %>
<%= breadcrumb_box do %> <%= breadcrumb_box do %>
<%= link_to "Hosts", hosts_path %> <%= link_to "Hosts", hosts_path %>
<% end %> <% end %>
<% end %> <% end %>


<% if current_user.admin? %> <section>
<br /> <h2><%= pluralize(Host.count, 'Host')%> listed</h2>
<%= link_to 'New host', new_host_path, :class => 'arrow_link' %> <table class="table table-striped">
<% end %> <thead>
<tr>
<th>Name</th>
<th>Stages</th>
<th>Roles</th>
</tr>
</thead>
<tbody>
<% @hosts.each do |host| %>
<tr>
<td><%= link_to host.name, host %></td>
<td><%= host.stages.count %></td>
<td><%= host.roles.count %></td>
<% if current_user.admin? %>
<td><%= link_to 'Edit', [:edit, host] %></td>
<td><%= link_to 'Delete', host, data: { confirm: 'Are you sure?' }, method: :delete %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>


</fieldset> <% if current_user.admin? %>
<p><%= link_to 'New host', new_host_path %></p>
<% end %>
</section>
37 changes: 17 additions & 20 deletions app/views/hosts/new.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,27 +1,24 @@
<% flashed_errors(:host) %> <% content_for :breadcrumb do %>
<%= form_for(:host, :url => hosts_path) do |f| %>
<p>
<b>Name (DNS name or IP address)</b><br />
<%= f.text_field :name, :style => 'width: 330px' %>
</p>

<%= link_to 'Back to hosts', hosts_path, :class => 'arrow_link ontheright', :style => 'margin-right: 330px' %>

<p>
<%= submit_tag "Create host" %>
</p>
<% end %>
<% content_for(:breadcrumb) do %>
<%= breadcrumb_box do %> <%= breadcrumb_box do %>
<%= link_to "Manage hosts", hosts_path, :style => "float:right", :class => "arrow_link" %> <%= link_to "Hosts", hosts_path %>
<%= link_to "Hosts", hosts_path %> &gt; <span class="divider">&raquo;</span>
New New
<% end %> <% end %>
<% end %> <% end %>
<% content_for(:page_title) do %> <% content_for :page_title do %>
<% @page_title = "New host" %> <% @page_title = "New host" %>
<h2>New host</h2> <h1>New host</h1>
<% end %> <% end %>
<% flashed_errors(:host) %>

<section>
<%= form_for @host, html: { class: "form-horizontal" } do |f| %>
<%= render partial: 'form', locals: { form: f } %>
<div class="form-actions">
<%= f.submit class: "btn btn-primary" %>
<%= link_to 'Back to host', hosts_path, :class => 'btn' %>
</div>
<% end %>
</section>
59 changes: 25 additions & 34 deletions app/views/hosts/show.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,46 +1,37 @@
<div class="special_box"> <% content_for :page_title do %>
<div class="special_box_top"></div> <% @page_title = "Host #{@host.name}" %>
<div class="special_box_middle host_box"></div> <h1>Host <%= @host.name %></h1>
<div class="special_box_bottom"></div> <% end %>
</div>
<div class="box"> <% content_for :breadcrumb do %>
<dl> <%= breadcrumb_box do %>
<%= link_to "Hosts", hosts_path %>
<span class="divider">&raquo;</span>
<%= link_to @host.name, host_path(@host) %>
<% end %>
<% end %>

<section>
<dl class="dl-horizontal">
<dt>Name:</dt> <dt>Name:</dt>
<dd><%= @host.name %></dd> <dd><%= @host.name %></dd>


<dt>#Stages:</dt> <dt>Stages:</dt>
<dd><%= @host.stages.uniq.size %></dd> <dd><%= @host.stages.uniq.size %></dd>


<dt>#Roles:</dt> <dt>Roles:</dt>
<dd><%= @host.roles.count %></dd> <dd><%= @host.roles.count %></dd>
</dl> </dl>


<% if current_user.admin? %> <% if current_user.admin? %>
<p> <div>
<%= link_to 'Edit Host', edit_host_path(@host), :class => 'arrow_link' %> | <%= link_to 'Edit Host', edit_host_path(@host), :class => 'arrow_link' %> |
<%= link_to 'Delete', host_path(@host), :data => { :confirm => 'Are you sure?' }, :method => :delete, :class => 'arrow_link' %> <%= link_to 'Delete', host_path(@host), :data => { :confirm => 'Are you sure?' }, :method => :delete, :class => 'arrow_link' %>
</p> </div>
<% end %>
</div>

<div class="clear"></div>
<br>

<fieldset class="fieldset">
<legend>Stages</legend>
<%= render(:partial => 'stages')%>
</fieldset>

<% content_for(:breadcrumb) do %>
<%= breadcrumb_box do %>
<%= link_to "Manage hosts", hosts_path, :style => "float:right", :class => "arrow_link" %>
<%= link_to "Hosts", hosts_path %> &gt;
Host <%= link_to @host.name, host_path(@host) %>
<% end %> <% end %>
<% end %> </section>


<% content_for(:page_title) do %> <section>
<% @page_title = "Host #{@host.name}" %> <h2>Stages</h2>
<h2>Host <%= @host.name %></h2> <%= render partial: 'stages' %>
<% end %> </section>
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Peritor Webistrano - Capristrano Deployment the easy way" /> <meta name="description" content="Peritor Webistrano - Capristrano Deployment the easy way" />
<meta name="keywords" content="rubyonrails ruby rails capistrano deployment" /> <meta name="keywords" content="rubyonrails ruby rails capistrano deployment" />
<link href="images/favicon.ico" rel="shortcut icon"> <link href="/favicon.ico" rel="shortcut icon">
<title><%= content_for?(:title) ? yield(:title) : "Webistrano" %></title> <title><%= content_for?(:title) ? yield(:title) : "Webistrano" %></title>


<%= csrf_meta_tags %> <%= csrf_meta_tags %>
Expand Down
1 change: 0 additions & 1 deletion spec/factories

This file was deleted.

0 comments on commit e4c7d97

Please sign in to comment.