From bb53f8ac2ab52301b32fe65ddc10a32f6bc730e8 Mon Sep 17 00:00:00 2001 From: tkimia Date: Tue, 22 Apr 2014 17:42:57 -0400 Subject: prelim search --- app/views/common/_show_tournament.html.erb | 32 ++++++++++++++++++++++++++++ app/views/layouts/application.html.erb | 12 ++++++++--- app/views/search/go.html.erb | 6 ++++++ app/views/tournaments/index.html.erb | 34 +----------------------------- 4 files changed, 48 insertions(+), 36 deletions(-) create mode 100644 app/views/common/_show_tournament.html.erb create mode 100644 app/views/search/go.html.erb (limited to 'app/views') diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb new file mode 100644 index 0000000..89d8f53 --- /dev/null +++ b/app/views/common/_show_tournament.html.erb @@ -0,0 +1,32 @@ +
+
<%= image_tag ('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(target.hosts.first.email) + '?s=100&d=mm') %>
+
+ <%# "header" %> + <%= link_to(target) do %>

<%= target.name %>

<% end %> +
+
+ Hosted by: <%= target.hosts.first.name %> +
+
+

Players per team: <%= target.min_players_per_team %>

+

Players signed up: <%= target.players.count %>

+
+
+

<%= (target.randomized_teams)? "Teams are Random" : "Teams are Chosen" %>

+

Players signed up: <%= target.players.count %>

+
+
+
+
+ <% if signed_in? %> + <% if !target.players.include?(current_user) %> + <%= form_tag(tournament_path(target), method: "put") do %> + + <%= submit_tag("Join")%> + <% end %> + <% else %> +

You've signed up for this tournament!

+ <% end %> + <% end %> +
+
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e6b5b25..fb5c1c5 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,15 +13,20 @@ BetterDragSort.makeListSortable(document.getElementById("boxes")); }; -
+
<% if notice %>

<%= notice %>

<% end %> diff --git a/app/views/search/go.html.erb b/app/views/search/go.html.erb new file mode 100644 index 0000000..12a76c8 --- /dev/null +++ b/app/views/search/go.html.erb @@ -0,0 +1,6 @@ +

Showing results for: <%= @query %>

+ + +<% if @tounaments.empty? and @players.empty %> +

No results found for "<%= @query %>"

+<% else %> \ No newline at end of file diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb index eef9577..129f3de 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -4,39 +4,7 @@ <% if @tournaments.length > 0 %> <%# Each tournament has a div for its listing %> <% @tournaments.each do |t| %> -
-
<%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(t.hosts.first.email) + '?s=100&d=mm' %>
-
- <%# "header" %> - <%= link_to(t) do %>

<%= t.name %>

<% end %> -
-
- Hosted by: <%= t.hosts.first.name %> -
-
-

Players per team: <%= t.min_players_per_team %>

-

Players signed up: <%= t.players.count %>

-
-
-

<%= (t.randomized_teams)? "Teams are Random" : "Teams are Chosen" %>

-

Players signed up: <%= t.players.count %>

-
-
-
-
- <% if signed_in? %> - <% if !t.players.include?(current_user) %> - <%= form_tag(tournament_path(t), method: "put") do %> - - <%= submit_tag("Join") - %> - <% end %> - <% else %> -

You've signed up for this tournament!

- <% end %> - <% end %> -
-
+ <%= render "common/show_tournament", :target => t %> <% end %> <% else %>

No tournaments going on right now... -- cgit v1.2.3-2-g168b From 266602ea1e97d886f031b80add7a760034221f76 Mon Sep 17 00:00:00 2001 From: tkimia Date: Tue, 22 Apr 2014 18:04:41 -0400 Subject: basic search complete --- app/views/search/go.html.erb | 25 +++++++++++++++++++++---- app/views/tournaments/index.html.erb | 4 ++++ 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'app/views') diff --git a/app/views/search/go.html.erb b/app/views/search/go.html.erb index 12a76c8..6d5826f 100644 --- a/app/views/search/go.html.erb +++ b/app/views/search/go.html.erb @@ -1,6 +1,23 @@ -

Showing results for: <%= @query %>

+<%# Show search results if a query was not nill %> +<% if !@query.empty? %> +

Showing results for: <%= @query %>

+ <% if @tournaments.empty? and @players.empty? %> +

No results found for "<%= @query %>"

+ <% else %> + <% if @tournaments.length > 0 %> +

Tournaments

+ <% end %> + <% @tournaments.each do |t| %> + <%= render "common/show_tournament", :target => t %> + <% end %> -<% if @tounaments.empty? and @players.empty %> -

No results found for "<%= @query %>"

-<% else %> \ No newline at end of file + <% if @players.length > 0 %> +

Players

+ <% end %> + <% @players.each do |p| %> + <%= render "common/show_player", :target => p %> + <% end %> + + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb index 129f3de..06e1b25 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -2,16 +2,20 @@
<% if @tournaments.length > 0 %> + <%# Each tournament has a div for its listing %> <% @tournaments.each do |t| %> <%= render "common/show_tournament", :target => t %> <% end %> + <% else %> +

No tournaments going on right now... <% if current_user.can?(:create_tournament) %> Why not start your own? <% end %>

+ <% end %>
-- cgit v1.2.3-2-g168b From cd54af413c57581f35026f60dc24e4bc21bb0bd1 Mon Sep 17 00:00:00 2001 From: tkimia Date: Tue, 22 Apr 2014 18:25:02 -0400 Subject: footer is ok? --- app/views/search/go.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/views') diff --git a/app/views/search/go.html.erb b/app/views/search/go.html.erb index 6d5826f..324fa48 100644 --- a/app/views/search/go.html.erb +++ b/app/views/search/go.html.erb @@ -1,10 +1,11 @@ <%# Show search results if a query was not nill %> <% if !@query.empty? %> -

Showing results for: <%= @query %>

+ <% if @tournaments.empty? and @players.empty? %> -

No results found for "<%= @query %>"

+

No results found for "<%= @query %>"

<% else %> +

Showing results for: <%= @query %>

<% if @tournaments.length > 0 %>

Tournaments

<% end %> -- cgit v1.2.3-2-g168b From b4bc055585dee532653a8c64e45385e085ec22a8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 22 Apr 2014 18:29:17 -0400 Subject: I hate code --- app/views/matches/index.html.erb | 2 +- app/views/matches/show.html.erb | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'app/views') diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 058477a..fda8582 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -37,5 +37,5 @@
<% @tournament.stages_ordered.keys.sort.each do |stage_key| %> -
<%= raw @tournament.stages_ordered[stage_key].to_svg %>
+
<%= raw @tournament.stages_ordered[stage_key].to_svg(current_user) %>
<% end %> diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index e7fe791..a1d82a3 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -7,10 +7,6 @@ <%= @match.tournament_stage %>

-

- Name: - <%= @match.name %> -