Skip to content

Commit

Permalink
Moved @page_title stuff out of the user views
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Chinery committed Dec 6, 2012
1 parent 9b23b0a commit 89cb3b8
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
5 changes: 5 additions & 0 deletions app/controllers/users_controller.rb
Expand Up @@ -23,11 +23,14 @@ class UsersController < ApplicationController
before_filter :capture_participations, :only => [:create, :update]

def index
@page_title = "Users"
@users = User.find(:all)
end

def new
@page_title = "New User"
@user = User.new
@user.password = @user.password_confirmation = nil
@projects = Project.all
end

Expand All @@ -47,6 +50,8 @@ def create

def edit
@user = User.find(params[:id])
@page_title = "Edit #{@user.login}"
@user.password = @user.password_confirmation = nil
@projects = Project.all
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/projects/index.html.erb
@@ -1,9 +1,9 @@
<% @page_title = "Manage Projects" %>
<% @page_title = "Projects" %>
<h2><%=h @page_title %></h2>

<div id="actions">
<ul>
<li><%= link_to 'New Project', new_project_path, :class => 'add' %></li>
<li><%= slink_to 'New Project', new_project_path, "admin" %></li>
</ul>
</div>

Expand Down
5 changes: 3 additions & 2 deletions app/views/releases/index.html.erb
@@ -1,6 +1,6 @@
<div class="index-head">
<h2>Releases</h2>
<%= link_to 'New release', new_release_path, :class => "add" %>
<%= link_to 'New release', new_release_path %>
</div>

<table class="index">
Expand All @@ -23,6 +23,7 @@
</tr>
<% end %>
</table>

<br />
<%= link_to 'New release', new_release_path, :class => "add" if @releases.size > 10 %>

<%= link_to 'New release', new_release_path if @releases.size > 10 %>
6 changes: 3 additions & 3 deletions app/views/stories/index.html.erb
Expand Up @@ -9,7 +9,7 @@
</div>

<p>
<%= @total_assigned_points %>/<%= @iteration.velocity %> points assigned (<%=((@total_assigned_points.to_f/@iteration.velocity.to_f)*100).to_i%>%) -
<%= @total_assigned_points %>/<%= @iteration.velocity %> points assigned (<%=((@total_assigned_points.to_f/@iteration.velocity.to_f)*100).to_i%>%) -
<% case (@assignment_difference <=> 0)
when -1 -%>
Undersubscribed by <%= 0 - @assignment_difference%> points
Expand All @@ -20,7 +20,7 @@
<% end -%>
</p>

<p><%= link_to 'New story', new_iteration_story_path(@iteration), :class => "add" %></p>
<p><%= link_to 'New story', new_iteration_story_path(@iteration) %></p>

<div id="columns">
<div id="completed-stories-bg" class="column-bg">
Expand Down Expand Up @@ -57,7 +57,7 @@
<% end %>
<!-- Column three end -->
</div>

<div id="completed-stories" class="column">
<!-- Column four start -->
<h3>Completed stories <%=points_label(@completed_stories)%></h3>
Expand Down
18 changes: 13 additions & 5 deletions app/views/users/_user_bar.html.erb
@@ -1,8 +1,16 @@
<% if logged_in? -%>
<div id="user-bar-greeting">Logged in as <%= link_to_current_user :content_method => :login %></div>
<div id="user-bar-action" >(<%= link_to "Log out", logout_path, { :title => "Log out" } %>)</div>
<div id="user-bar-greeting">
Logged in as <%= link_to_current_user :content_method => :login %>
</div>
<div id="user-bar-action" >
(<%= link_to "Log out", logout_path, { :title => "Log out" } %>)
</div>
<% else -%>
<div id="user-bar-greeting"><%= link_to_login_with_IP 'Not logged in', :style => 'border: none;' %></div>
<div id="user-bar-action" ><%= link_to "Log in", login_path, { :title => "Log in" } %> /
<%= link_to "Sign up", signup_path, { :title => "Create an account" } %></div>
<div id="user-bar-greeting">
<%= link_to_login_with_IP 'Not logged in', :style => 'border: none;' %>
</div>
<div id="user-bar-action">
<%= link_to "Log in", login_path, { :title => "Log in" } %> /
<%= link_to "Sign up", signup_path, { :title => "Create an account" } %>
</div>
<% end -%>
4 changes: 0 additions & 4 deletions app/views/users/edit.html.erb
@@ -1,7 +1,3 @@
<%
@page_title = "Edit #{@user.login}"
@user.password = @user.password_confirmation = nil
%>
<h2><%=h @page_title %></h2>

<div id="actions">
Expand Down
6 changes: 2 additions & 4 deletions app/views/users/index.html.erb
@@ -1,9 +1,8 @@
<% @page_title = "Manage Users" %>
<h2><%=h @page_title %></h2>

<div id="actions">
<ul>
<li><%= link_to 'New user', new_user_path, :class => "add" %></li>
<li><%= link_to 'New user', new_user_path %></li>
</ul>
</div>

Expand Down Expand Up @@ -33,5 +32,4 @@
</td>
</tr>
<% end %>
</table>

</table>
4 changes: 0 additions & 4 deletions app/views/users/new.html.erb
@@ -1,7 +1,3 @@
<%
@page_title = "New User"
@user.password = @user.password_confirmation = nil
%>
<h2><%=h @page_title %></h2>

<div id="actions">
Expand Down

0 comments on commit 89cb3b8

Please sign in to comment.