Skip to content

Commit

Permalink
Create header title content helper so we dont have to go through chan…
Browse files Browse the repository at this point in the history
…ging markup everywhere again for this section
  • Loading branch information
mrjabba committed Oct 11, 2013
1 parent e4d2250 commit 254cfdb
Show file tree
Hide file tree
Showing 30 changed files with 33 additions and 29 deletions.
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Expand Up @@ -23,6 +23,10 @@ def title
end
end

def header_title(content)
content_tag(:header, content_tag(:h1, content))
end

def zone_cell_at_position(zones, position)
zone = Leaguezone.find_zone_by_position(zones, position)
zone.nil? ? content_tag(:td, position) : content_tag(:td, position, {:class => zone.style, :title => zone.name})
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/registrations/edit.html.erb
@@ -1,4 +1,4 @@
<header><h1>Edit Profile</h1></header>
<%=header_title("Edit Profile")%>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:method => :put, :class => "well form-horizontal"}) do |f| %>
<%= devise_error_messages! %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/registrations/new.html.erb
@@ -1,4 +1,4 @@
<header><h1>Sign up</h1></header>
<%=header_title("Sign up")%>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => "well form-horizontal"}) do |f| %>
<%= devise_error_messages! %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/sessions/new.html.erb
@@ -1,4 +1,4 @@
<header><h1>Sign in</h1></header>
<%=header_title("Sign in")%>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => "well form-horizontal"}) do |f| %>
<div class="control-group">
Expand Down
2 changes: 1 addition & 1 deletion app/views/leagues/edit.html.erb
@@ -1,4 +1,4 @@
<header><h1>Edit League</h1></header>
<%=header_title("Edit League")%>
<%= render :partial => "form", :locals => {:model => [@league], :league => @league, :save_label => "Update"} %>

<div class="modal hide" id="gameWarning">
Expand Down
2 changes: 1 addition & 1 deletion app/views/leagues/index.html.erb
@@ -1,4 +1,4 @@
<header><h1>League Management</h1></header>
<%=header_title("League Management")%>
<div class="alert">Leagues contain teams and matches and may be long (season) or short (tournaments/cups). Teams have rosters within a league season. Manage the season lifecycle here.</div>

<%= form_tag leagues_path, :method => 'get', :remote => true, :id => "leagues_search", :class => "form-search" do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/leagues/new.html.erb
@@ -1,2 +1,2 @@
<h2>New League</h2>
<%=header_title("New League")%>
<%= render :partial => "form", :locals => {:model => [@league.organization, @league], :league => @league, :save_label => "Create"} %>
2 changes: 1 addition & 1 deletion app/views/leaguezones/edit.html.erb
@@ -1,2 +1,2 @@
<header><h1><%=t :zone_edit %></h1></header>
<%=header_title(t :zone_edit)%>
<%= render :partial => "form", :locals => {:model => [@leaguezone], :leaguezone => @leaguezone, :save_label => "Update"} %>
2 changes: 1 addition & 1 deletion app/views/leaguezones/index.html.erb
@@ -1,4 +1,4 @@
<header><h1>League Zone Management</h1></header>
<%=header_title("League Zone Management")%>
<div class="alert">Leagues may participate in promotion/relegation or may have qualifiers for tournaments based on table rank. Use League Zones to define those ranks.</div>

<ul class="breadcrumb">
Expand Down
2 changes: 1 addition & 1 deletion app/views/leaguezones/new.html.erb
@@ -1,2 +1,2 @@
<header><h1><%=t :zone_new %></h1></header>
<%=header_title(t :zone_new)%>
<%= render :partial => "form", :locals => {:model => [@leaguezone.league, @leaguezone], :leaguezone => @leaguezone, :save_label => "Create"} %>
2 changes: 1 addition & 1 deletion app/views/organizations/edit.html.erb
@@ -1,2 +1,2 @@
<header><h1>Edit organization</h1></header>
<%=header_title("Edit Organization")%>
<%= render :partial => "form", :locals => {:model => @organization, :organization => @organization, :save_label => "Update"} %>
2 changes: 1 addition & 1 deletion app/views/organizations/index.html.erb
@@ -1,4 +1,4 @@
<header><h1>Organization Management</h1></header>
<%=header_title("Organization Management")%>
<div class="alert">Organizations (also Associations) manage leagues. These can be as large as national/continental confederations or local city associations.</div>

<div class="btn-toolbar">
Expand Down
2 changes: 1 addition & 1 deletion app/views/organizations/new.html.erb
@@ -1,2 +1,2 @@
<h2>New Organization</h2>
<%=header_title("New Organization")%>
<%= render :partial => "form", :locals => {:model => @organization, :organization => @organization, :save_label => "Create"} %>
2 changes: 1 addition & 1 deletion app/views/people/edit.html.erb
@@ -1,2 +1,2 @@
<header><h1><%= @title %></h1></header>
<%=header_title(@title)%>
<%= render :partial => "form", :locals => {:model => @person, :person => @person, :save_label => "Update"} %>
2 changes: 1 addition & 1 deletion app/views/people/index.html.erb
@@ -1,4 +1,4 @@
<header><h1>Person Repository</h1></header>
<%=header_title("Person Repository")%>
<div class="alert">People careers span often span multiple teams and leagues. Manage basic person profile information here.</div>

<div class="btn-toolbar">
Expand Down
2 changes: 1 addition & 1 deletion app/views/people/new.html.erb
@@ -1,2 +1,2 @@
<h2><%= @title %></h2>
<%=header_title(@title)%>
<%= render :partial => "form", :locals => {:model => @person, :person => @person, :save_label => "Create"} %>
2 changes: 1 addition & 1 deletion app/views/playinglocations/new.html.erb
@@ -1,4 +1,4 @@
<header><h1>New Playing Location</h1></header>
<%=header_title("New Playing Location")%>
<%= form_for [@playinglocation.teamstat, @playinglocation], :html => {:class => "well form-horizontal"} do |f| %>
<%= render :partial => "shared/error_messages", :locals => {:model => f.object} %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/teams/edit.html.erb
@@ -1,2 +1,2 @@
<header><h1>Edit Team</h1></header>
<%=header_title("Edit Team")%>
<%= render :partial => "form", :locals => {:save_label => "Update"} %>
2 changes: 1 addition & 1 deletion app/views/teams/index.html.erb
@@ -1,4 +1,4 @@
<header><h1>Team Repository</h1></header>
<%=header_title("Team Repository")%>
<div class="alert">Teams play in different leagues over various seasons. And, they also play in tournaments and cups.
Manage basic team profile information here.</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/teams/new.html.erb
@@ -1,2 +1,2 @@
<header><h1><%=t :team_new %></h1></header>
<%=header_title(t :team_new)%>
<%= render :partial => "form", :locals => {:save_label => "Create"} %>
2 changes: 1 addition & 1 deletion app/views/teamstats/edit.html.erb
Expand Up @@ -3,7 +3,7 @@
<li><%= link_to "#{@teamstat.team_name} Roster", teamstat_path(@teamstat.id) %></li>
</ul>

<header><h1>Edit Roster</h1></header>
<%=header_title("Edit Roster")%>
<p>
<%= form_for(@teamstat, :html => {:class => "well form-horizontal"}) do |f| %>
<% unless @teamstat.rosters.empty? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/technicalstaffs/new.html.erb
@@ -1,4 +1,4 @@
<header><h1>New Technical Staff</h1></header>
<%=header_title("New Technical Staff")%>
<%= form_for [@technicalstaff.teamstat, @technicalstaff], :html => {:class => "well form-horizontal"} do |f| %>
<%= render :partial => "shared/error_messages", :locals => {:model => f.object} %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/edit.html.erb
@@ -1,4 +1,4 @@
<header><h1>Edit user</h1></header>
<%=header_title("Edit User")%>
<%= form_for(@user, :html => {:class => "well form-horizontal"}) do |f| %>
<%= render :partial => "shared/error_messages", :locals => {:model => f.object} %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/index.html.erb
@@ -1,4 +1,4 @@
<header><h1>All users</h1></header>
<%=header_title("All Users")%>
<% if can? :new, @user %>
<div class="alert">Filter Users By Role</div>
<div class="btn-toolbar">
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Expand Up @@ -3,7 +3,7 @@
<%= link_to "Edit Profile", "#{@user.id}/edit", :class => "btn" %>
</div>
<% end %>
<header><h1>User Information</h1></header>
<%=header_title("User Information")%>

<div class="hero-unit">
<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion app/views/venues/edit.html.erb
@@ -1,3 +1,3 @@
<header><h1>Edit Venue</h1></header>
<%=header_title("Edit Venue")%>
<%= render :partial => "form", :locals => {:save_label => "Update"} %>

2 changes: 1 addition & 1 deletion app/views/venues/index.html.erb
@@ -1,4 +1,4 @@
<header><h1>Venue Repository</h1></header>
<%=header_title("Venue Repository")%>
<div class="alert">Teams play in different venues over various seasons, sometimes sharing venues with other teams.
Manage basic venue information for fields and stadia here.</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/venues/new.html.erb
@@ -1,2 +1,2 @@
<header><h1>New Venue</h1></header>
<%=header_title("New Venue")%>
<%= render :partial => "form", :locals => {:save_label => "Create"} %>
2 changes: 1 addition & 1 deletion app/views/venues/show.html.erb
@@ -1,4 +1,4 @@
<header><h1>Venue: <%= @venue.name %></h1></header>
<%=header_title("Venue: #{@venue.name}")%>

<div class="btn-toolbar">
<% if can? :new, @venue %>
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/people_spec.rb
Expand Up @@ -18,7 +18,7 @@
lambda do
visit new_person_path
response.should have_selector('title', :content => "New Person")
response.should have_selector('h2', :content => "New Person")
response.should have_selector('h1', :content => "New Person")
response.should contain("Cancel")
fill_in "Firstname", :with => ""
fill_in "LastName", :with => ""
Expand Down

0 comments on commit 254cfdb

Please sign in to comment.