From 10c6417874129f03f3d2125c5df460865bad2797 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 1 May 2014 17:02:37 -0400 Subject: clean up grep-able issues in forms (mostly using

instead of

) --- app/views/common/_show_tournament.html.erb | 10 ++-- app/views/pms/show.html.erb | 76 +++++++++++++++--------------- app/views/sessions/new.html.erb | 12 ++--- app/views/tournaments/_form.html.erb | 12 ++--- app/views/tournaments/show.html.erb | 2 +- app/views/users/new.html.erb | 54 ++++++++++----------- app/views/users/show.html.erb | 61 ++++++++++++------------ 7 files changed, 111 insertions(+), 116 deletions(-) diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb index c0237b1..87a4f5b 100644 --- a/app/views/common/_show_tournament.html.erb +++ b/app/views/common/_show_tournament.html.erb @@ -24,22 +24,20 @@
<% if signed_in? %> <% if !target.players.include?(current_user) && target.status == 0 %> - <%= form_tag(tournament_path(target), method: "put") do %> -

+ <%= form_tag(tournament_path(target), method: "put", role: :button) do %> <%= submit_tag("Join")%> - <% end %> -

+ <% end %> <% elsif target.players.include?(current_user)%>

You've signed up for this tournament!

<% end %> <% @user_bracket = target.brackets.find_by(user: current_user) %> <% if target.status == 1 && target.stages.order(:id).first.scheduling_method == "elimination" && target.stages.order(:id).first.matches.order(:id).first.status < 2 && !@user_bracket %> - <%= form_tag(tournament_brackets_path(target), method: "post") do %> + <%= form_tag(tournament_brackets_path(target), method: "post", role: :button) do %> <%= submit_tag("Make Bracket") %> <% end %> <% elsif @user_bracket && target.status == 4 %> - <%= form_tag(tournament_bracket_path(@tournament, @bracket), method: 'put') do %> + <%= form_tag(tournament_bracket_path(@tournament, @bracket), method: 'put', role: :button) do %> <%= submit_tag("Bracket Results") %> <% end %> diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb index 2c93102..35deaa9 100644 --- a/app/views/pms/show.html.erb +++ b/app/views/pms/show.html.erb @@ -1,48 +1,46 @@ -

- Participants: - <% receps = @pm.conversation.participants %> - <% receps.each do |recep| %> - <% #unless recep == @pm.conversation.last_sender %> - <%= recep.user_name %> - <%= "," %> - <% #end %> - <% end %> - <%= "and the NSA" %> -

- -

- Subject: - <%= @pm.conversation.subject %> -

+<%= link_to '« Back to all private messages', pms_path, class: :breadcrumb %> + +
+

+ Participants: + <% receps = @pm.conversation.participants %> + <% receps.each do |recep| %> + <% #unless recep == @pm.conversation.last_sender %> + <%= recep.user_name %>, + <% #end %> + <% end %> + <%= "and the NSA" %> +

+ +

+ Subject: + <%= @pm.conversation.subject %> +

+
<% receipts = @pm.conversation.receipts_for current_user %> <% receipts.each do |receipt| %> - <% message = receipt.message %> - -

________________________________________________

- -

- <%= message.sender.user_name %> - <%= ":" %> - <%= message.body %> -

- + <% message = receipt.message %> +
+

+ <%= message.sender.user_name %>: + <%= message.body %> +

<% end %> -

________________________________________________

-

- <% @pm.message = "" %> - <%= form_for(@pm) do |f| %> -

- <%= f.text_area :message %> -
+
-
- <%= submit_tag("Reply", :class => "signup") %> -
+
+ <% @pm.message = "" %> + <%= form_for(@pm) do |f| %> +
+ <%= f.text_area :message %> +
- <% end %> -

+
+ <%= submit_tag("Reply", :class => "signup") %> +
+ <% end %> +
<% @pm.conversation.mark_as_read(current_user) %> -<%= link_to 'Back', pms_path %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 97f09b6..10adced 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -9,17 +9,17 @@ try again.

<% end %> -

+

<%= label_tag(:username_or_email, "Username/Email") %>
<%= text_field_tag(:username_or_email) %> -

-

+

+
<%= label_tag(:password) %>
<%= password_field_tag(:password) %> -

-

+

+
<%= submit_tag("Log in", class: :signin) %> -

+
<% end %>

New user? <%= link_to("Sign up now!", new_user_path) %>

diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index 93badeb..72e0886 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -7,8 +7,8 @@ <%= f.select(:game_id, Game.all.map{|game| [game.name, game.id]}) %>
- - + +
<% if @tournament.game %> <%= f.submit("Update (Will reset the rest of the form)", class: "btn-danger") %> @@ -98,12 +98,12 @@
Stage <%= i %>
- <%= stage_fields.label :scheduling_method, :scheduling_method.to_s.titleize %> - <%= stage_fields.select(:scheduling_method, @tournament.scheduling_methods.map{|method| [method.humanize.titleize, method]}) %> + <%= stage_fields.label :scheduling_method, :scheduling_method.to_s.titleize %> + <%= stage_fields.select(:scheduling_method, @tournament.scheduling_methods.map{|method| [method.humanize.titleize, method]}) %>
- <%= stage_fields.label :seeding_method, :seeding_method.to_s.titleize %> - <%= stage_fields.select(:seeding_method, @tournament.seeding_methods.map{|method| [method.humanize.titleize, method]}) %> + <%= stage_fields.label :seeding_method, :seeding_method.to_s.titleize %> + <%= stage_fields.select(:seeding_method, @tournament.seeding_methods.map{|method| [method.humanize.titleize, method]}) %>
<% end %> diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index 6cb9783..07c1c6b 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -74,7 +74,7 @@ <% end %> -
+
<%# If user can join, and user hasn't joined already, show a join tournment button %> <% if @tournament.joinable_by?(current_user) && !@tournament.players.include?(current_user) %> <%= form_tag(tournament_path(@tournament), method: "put", role: :button) do %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 5c88945..95b56a9 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,34 +1,34 @@

Sign Up

<%= form_for @user do |f| %> - <%= render "common/error_messages", :target => @user %> -

- <%= f.label :name %>
- <%= f.text_field :name %> -

-

- <%= f.label :email %>
- <%= f.text_field(:email, type: "email") %> -

-

- <%= f.label :user_name %>
- <%= f.text_field :user_name %> -

-

- <%= f.label :password %>
- <%= f.password_field :password %> -

-

- <%= f.label(:password_confirmation, "Confirm Password") %>
- <%= f.password_field :password_confirmation %> -

-

- <%= show_simple_captcha %> - - <%= f.submit("Be a Leaguer", :class => "signup") %> -

+ <%= render "common/error_messages", :target => @user %> +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :email %>
+ <%= f.text_field(:email, type: "email") %> +
+
+ <%= f.label :user_name %>
+ <%= f.text_field :user_name %> +
+
+ <%= f.label :password %>
+ <%= f.password_field :password %> +
+
+ <%= f.label(:password_confirmation, "Confirm Password") %>
+ <%= f.password_field :password_confirmation %> +
+
+ <%= show_simple_captcha %> +
+
+ <%= f.submit("Be a Leaguer", :class => "signup") %> +
<% end %> - <%= link_to 'Already Have an Account? Log in', new_session_path, :class => "signin" %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index b247b7d..cd232a3 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,56 +2,55 @@

<%= @user.user_name %>'s Profile

- <%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(@user.email) + '?s=100&d=identicon' %> + <%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(@user.email) + '?s=100&d=identicon' %>

- Email: - <%= @user.email %> -

- + Name: + <%= @user.name %>

- Preferred name: - <%= @user.user_name %> -

- Relationship Status: - too single + Alias: + <%= @user.user_name %> +

+ Email: + <%= @user.email %>

- -

-<% if @user.remote_usernames[0].nil? %> +<% if @user.remote_usernames.empty? and @user.check_permission(current_user, :edit) %> <%= form_for @user do |f| %> - - <%= f.submit "Add Username", :class => 'signup' %> +

+ +
+ + <%= f.submit "Add Username", :class => 'signup' %> +
+
<% end %> <% end %> -

-
-

Recent Tournaments Played

+

Recent Tournaments Played

    <% @user.tournaments_played.each do |t| %>
  • <%= t.name %>
  • <% end %>
-
-
-

Recent Tournaments Hosted

- <% if @user.tournaments_hosted.count == 0 %>

<%= @user.user_name %> has never hosted a tournament

<%end %> -
    - <% @user.tournaments_hosted.each do |t| %> -
  • <%= t.name %>
  • - <% end %> -
+
+
+

Recent Tournaments Hosted

+ <% if @user.tournaments_hosted.empty? %> +

<%= @user.user_name %> has never hosted a tournament.

+ <% else %> +
    + <% @user.tournaments_hosted.each do |t| %> +
  • <%= t.name %>
  • + <% end %> +
+ <% end %>
-<%= link_to 'Edit', edit_user_path(@user) %> | -<%= link_to 'All Users', users_path %> +<%= link_to 'Edit', edit_user_path(@user), role: :button %> -- cgit v1.2.3