Browse files

move edit controllers to setup module cont.

  • Loading branch information...
1 parent e4e6c31 commit 735d623091b15c984ed33be60d0213d9a902da88 @geraldb geraldb committed Jul 7, 2012
View
73 app/views/setup/calc_games/_form.html.erb
@@ -0,0 +1,73 @@
+
+<%= form_for(@game) do |f| %>
+ <% if @game.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@game.errors.count, "error") %> prohibited this game from being saved:</h2>
+
+ <ul>
+ <% @game.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <table>
+ <tr>
+ <td><%= f.label :round_id, 'Runde:' %></td>
+ <td>(<%= f.object.round_id %>)</td>
+ <td><%= f.select :round_id, ([[ '- Runde wählen -', nil ]] + Round.all.map { |rec| [ "#{rec.event.title} / #{rec.title}", rec.id ] }) %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :pos, 'Lfd#:' %></td>
+ <td></td>
+ <td><%= f.text_field :pos, size: '3' %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :team1_id, 'Team 1:' %></td>
+ <td>(<%= f.object.team1_id %>)</td>
+ <td><%= f.select :team1_id, options_from_collection_for_select( Team.all, :id, :title, f.object.team1_id) %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :score1, 'Tore 1:' %></td>
+ <td></td>
+ <td><%= f.text_field :score1, size: '3' %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :score2, 'Tore 2:' %></td>
+ <td></td>
+ <td><%= f.text_field :score2, size: '3' %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :team2_id, 'Team 2:' %></td>
+ <td>(<%= f.object.team2_id %>)</td>
+ <td><%= f.select :team2_id, options_from_collection_for_select( Team.all, :id, :title, f.object.team2_id) %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :locked, 'Locked Flag:' %></td>
+ <td></td>
+ <td>
+ <%= f.radio_button :locked, 'true' %><%= f.label :locked_true, 'Ja' %>
+ <%= f.radio_button :locked, 'false' %><%= f.label :locked_false, 'Nein' %>
+ </td>
+ </tr>
+ <tr>
+ <td><%= f.label :knockout, 'Knockout Flag:' %></td>
+ <td></td>
+ <td>
+ <%= f.radio_button :knockout, 'true' %><%= f.label :knockout_true, 'Ja' %>
+ <%= f.radio_button :knockout, 'false' %><%= f.label :knockout_false, 'Nein' %>
+ </td>
+ </tr>
+ <tr>
+ <td><%= f.label :play_at, 'Datum:' %></td>
+ <td></td>
+ <td><%= f.text_field :play_at %></td>
+ </tr>
+ </table>
+
+ <div class="actions">
+ <%= f.submit 'Speichern', :class => 'btn-primary' %>
+ <%= link_to 'Zurück', games_path(), :class => 'btn' %>
+ </div>
+<% end %>
View
3 app/views/setup/calc_games/edit.html.erb
@@ -0,0 +1,3 @@
+<h1>Spiel (Calc) Bearbeiten</h1>
+
+<%= render 'form' %>
View
3 app/views/setup/calc_games/new.html.erb
@@ -0,0 +1,3 @@
+<h1>Neues Spiel (Calc)</h1>
+
+<%= render 'form' %>
View
37 app/views/setup/events/_form.html.erb
@@ -0,0 +1,37 @@
+<%= form_for(@event) do |f| %>
+
+<table>
+ <tr>
+ <td><%= f.label :title, 'Titel' %></td>
+ <td><%= f.text_field :title %></td>
+ </tr>
+
+ <tr>
+ <td><%= f.label :key, 'Key' %></td>
+ <td><%= f.text_field :key %></td>
+ </tr>
+
+ <tr>
+ <td><%= f.label :start_at, 'Start (Datum)' %></td>
+ <td><%= f.text_field :start_at %></td>
+ </tr>
+
+ <tr>
+ <td><%= f.label :team3, '3. Platz Flag' %></td>
+ <td>
+ <%= f.radio_button :team3, 'true' %><%= f.label :team3_true, 'Ja' %>
+ <%= f.radio_button :team3, 'false' %><%= f.label :team3_false, 'Nein' %>
+ </td>
+ </tr>
+
+
+
+
+</table>
+
+<div class="actions">
+ <%= f.submit 'Speichern', :class => 'btn-primary' %>
+ <%= link_to 'Zurück', events_path(), :class => 'btn' %>
+ </div>
+
+<% end %><!-- form_for event -->
View
29 app/views/setup/events/edit.html.erb
@@ -0,0 +1,29 @@
+<h1>Veranstaltung Bearbeiten</h1>
+
+<%= render 'form' %>
+
+<h3>Teams</h3>
+
+<%= form_for :event, :url => add_team_to_event_path(@event) do |f| %>
+
+ <!-- todo/fix: remove teams already added to event -->
+ <%= select_tag 'team_id', options_from_collection_for_select( Team.where( :calc => false ).all, :id, :title) %>
+ <%= f.submit 'Hinzufügen', :class => 'btn-primary' %>
+
+<% end %><!-- form_for event_team -->
+
+<table>
+ <% @event.teams.each do |team| %>
+ <tr>
+ <td>(<%= team.id %>)</td>
+ <td>
+ <% if team.img.present? %>
+ <%= image_tag( team.img ) %>
+ <% end %>
+ </td>
+ <td><%= team.title %></td>
+ </tr>
+ <% end %><!-- teams.each -->
+</table>
+
+<!-- todo/fix: add loeschen button -->
View
24 app/views/setup/events/index.html.erb
@@ -0,0 +1,24 @@
+<h1><%= Event.count %> Veranstaltungen</h1>
+
+<%= link_to 'Neue Veranstaltung', new_event_path(), :class => 'btn-primary' %>
+
+<table>
+<% @events.each do |event| %>
+ <tr style='background-color: black; color: white; font-weight: bold; font-size: 120%;'>
+ <td>(<%= event.id %>)</td>
+ <td colspan='2'><%= event.title %> (<%= event.key %>)</td>
+ <td><%= link_to 'Bearbeiten', edit_event_path(event), :class => 'btn' %></td>
+ </tr>
+ <% event.teams.each do |team| %>
+ <tr>
+ <td>(<%= team.id %>)</td>
+ <td>
+ <%= image_tag( team.img ) if team.img.present? %>
+ </td>
+ <td><%= team.title %> (<%= team.key %>)</td>
+ </tr>
+ <% end %><!-- teams.each -->
+<% end %><!-- events.each -->
+</table>
+
+<%= link_to 'Neue Veranstaltung', new_event_path(), :class => 'btn-primary' %>
View
3 app/views/setup/events/new.html.erb
@@ -0,0 +1,3 @@
+<h1>Neue Veranstaltung</h1>
+
+<%= render 'form' %>
View
73 app/views/setup/games/_form.html.erb
@@ -0,0 +1,73 @@
+
+<%= form_for(@game) do |f| %>
+ <% if @game.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@game.errors.count, "error") %> prohibited this game from being saved:</h2>
+
+ <ul>
+ <% @game.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <table>
+ <tr>
+ <td><%= f.label :round_id, 'Runde:' %></td>
+ <td>(<%= f.object.round_id %>)</td>
+ <td><%= f.select :round_id, ([[ '- Runde wählen -', nil ]] + Round.all.map { |rec| [ "#{rec.event.title} / #{rec.title}", rec.id ] }) %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :pos, 'Lfd#:' %></td>
+ <td></td>
+ <td><%= f.text_field :pos, size: '3' %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :team1_id, 'Team 1:' %></td>
+ <td>(<%= f.object.team1_id %>)</td>
+ <td><%= f.select :team1_id, options_from_collection_for_select( Team.all, :id, :title, f.object.team1_id) %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :score1, 'Tore 1:' %></td>
+ <td></td>
+ <td><%= f.text_field :score1, size: '3' %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :score2, 'Tore 2:' %></td>
+ <td></td>
+ <td><%= f.text_field :score2, size: '3' %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :team2_id, 'Team 2:' %></td>
+ <td>(<%= f.object.team2_id %>)</td>
+ <td><%= f.select :team2_id, options_from_collection_for_select( Team.all, :id, :title, f.object.team2_id) %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :locked, 'Locked Flag:' %></td>
+ <td></td>
+ <td>
+ <%= f.radio_button :locked, 'true' %><%= f.label :locked_true, 'Ja' %>
+ <%= f.radio_button :locked, 'false' %><%= f.label :locked_false, 'Nein' %>
+ </td>
+ </tr>
+ <tr>
+ <td><%= f.label :knockout, 'Knockout Flag:' %></td>
+ <td></td>
+ <td>
+ <%= f.radio_button :knockout, 'true' %><%= f.label :knockout_true, 'Ja' %>
+ <%= f.radio_button :knockout, 'false' %><%= f.label :knockout_false, 'Nein' %>
+ </td>
+ </tr>
+ <tr>
+ <td><%= f.label :play_at, 'Datum:' %></td>
+ <td></td>
+ <td><%= f.text_field :play_at %></td>
+ </tr>
+ </table>
+
+ <div class="actions">
+ <%= f.submit 'Speichern', :class => 'btn-primary' %>
+ <%= link_to 'Zurück', games_path, :class => 'btn' %>
+ </div>
+<% end %>
View
3 app/views/setup/games/edit.html.erb
@@ -0,0 +1,3 @@
+<h1>Spiel Bearbeiten</h1>
+
+<%= render 'form' %>
View
49 app/views/setup/games/index.html.erb
@@ -0,0 +1,49 @@
+<h1><%= Game.count %> Spiele</h1>
+
+<%= link_to 'Neues Spiel', new_game_path(), :class => 'btn-primary' %>
+
+<table>
+<% @events.each do |event| %>
+ <tr style='background-color: black; color: white; font-weight: bold; font-size: 140%;'>
+ <td>(<%= event.id %>)</td>
+ <td colspan='7'><%= event.title %></td>
+ </tr>
+ <% event.rounds.each do |round| %>
+ <tr style='font-size: 120%; font-weight: bold;'>
+ <td>(<%= round.id %>)</td>
+ <td><%= round.pos %></td>
+ <td colspan='6'><%= round.title %></td>
+ </tr>
+ <% round.games.each do |game| %>
+
+ <tr>
+ <td>(<%= game.id %>) <%= game.key %></td>
+ <td><%= game.pos %></td>
+ <td><%= game.team1.title %></td>
+ <td><%= game.team2.title %></td>
+ <td>
+ (
+ <%= if game.score1.present? then game.score1 else '-' end %>
+ :
+ <%= if game.score2.present? then game.score2 else '-' end %>
+ )
+ </td>
+ <td><%= game.knockout? ? '(Knockout Flag)' : '' %>
+ <%= game.locked? ? '(Locked Flag)' : '' %>
+ </td>
+ <td><%= game.play_at %></td>
+ <td><%= game.play_at.utc %></td>
+ <td><%= link_to 'Bearbeiten', game.calc? ? edit_calc_game_path(game) : edit_game_path( game ), :class => 'btn' %></td>
+ </tr>
+ <% end %><!-- games.each -->
+ <% end %><!-- rounds.each -->
+<% end %><!-- events.each -->
+
+
+
+</table>
+
+<p></p>
+
+<%= link_to 'Neues Spiel', new_game_path(), :class => 'btn-primary' %>
+
View
3 app/views/setup/games/new.html.erb
@@ -0,0 +1,3 @@
+<h1>Neues Spiel</h1>
+
+<%= render 'form' %>
View
44 app/views/setup/rounds/_form.html.erb
@@ -0,0 +1,44 @@
+<%= form_for(@round) do |f| %>
+ <% if @round.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@round.errors.count, "error") %> prohibited this round from being saved:</h2>
+
+ <ul>
+ <% @round.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <table>
+ <tr>
+ <td><%= f.label :event_id, 'Veranstaltung:' %></td>
+ <td>(<%= f.object.event_id %>)</td>
+ <td><%= f.select :event_id, options_from_collection_for_select( Event.all, :id, :title, f.object.event_id ) %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :pos, 'Lfd#:' %></td>
+ <td></td>
+ <td><%= f.text_field :pos, size: '3' %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :title, 'Titel:' %></td>
+ <td></td>
+ <td><%= f.text_field :title %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :calc, 'Calc Flag:' %></td>
+ <td></td>
+ <td>
+ <%= f.radio_button :calc, 'true' %><%= f.label :calc_true, 'Ja' %>
+ <%= f.radio_button :calc, 'false' %><%= f.label :calc_false, 'Nein' %>
+ </td>
+ </tr>
+ </table>
+
+ <div class="actions">
+ <%= f.submit 'Speichern', :class => 'btn-primary' %>
+ <%= link_to 'Zurück', rounds_path(), :class => 'btn' %>
+ </div>
+<% end %>
View
3 app/views/setup/rounds/edit.html.erb
@@ -0,0 +1,3 @@
+<h1>Runde Bearbeiten</h1>
+
+<%= render 'form' %>
View
25 app/views/setup/rounds/index.html.erb
@@ -0,0 +1,25 @@
+<h1><%= Round.count %> Runden</h1>
+
+<%= link_to 'Neue Runde', new_round_path(), :class => 'btn-primary' %>
+
+<table>
+<% @events.each do |event| %>
+ <tr style='background-color: black; color: white; font-weight: bold; font-size: 120%;'>
+ <td>(<%= event.id %>)</td>
+ <td colspan='4'><%= event.title %></td>
+ </tr>
+ <% event.rounds.each do |round| %>
+ <tr>
+ <td>(<%= round.id %>)</td>
+ <td><%= round.pos %></td>
+ <td><%= round.title %></td>
+ <td><%= '(Calc Flag)' if round.calc == true %></td>
+ <td><%= link_to 'Bearbeiten', edit_round_path( round ), :class => 'btn' %></td>
+ </tr>
+ <% end %><!-- rounds.each -->
+<% end %><!-- events.each -->
+</table>
+
+<p></p>
+
+<%= link_to 'Neue Runde', new_round_path(), :class => 'btn-primary' %>
View
3 app/views/setup/rounds/new.html.erb
@@ -0,0 +1,3 @@
+<h1>Neue Runde</h1>
+
+<%= render 'form' %>
View
42 app/views/setup/teams/_form.html.erb
@@ -0,0 +1,42 @@
+
+<%= form_for(@team) do |f| %>
+ <% if @team.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@team.errors.count, "error") %> prohibited this team from being saved:</h2>
+
+ <ul>
+ <% @team.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <table>
+ <tr>
+ <td><%= f.label :title, 'Titel' %></td>
+ <td><%= f.text_field :title %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :img, 'Bild' %></td>
+ <td><%= f.text_field :img %></td>
+ </tr>
+ <tr>
+ <td><%= f.label :key, 'Key' %></td>
+ <td><%= f.text_field :key %></td>
+ </tr>
+
+ <tr>
+ <td><%= f.label :calc, 'Calc Flag' %></td>
+ <td>
+ <%= f.radio_button :calc, 'true' %><%= f.label :calc_true, 'Ja' %>
+ <%= f.radio_button :calc, 'false' %><%= f.label :calc_false, 'Nein' %>
+ </td>
+ </tr>
+ </table>
+
+ <div class="actions">
+ <%= f.submit 'Speichern', :class => 'btn-primary' %>
+ <%= link_to 'Zurück', teams_path(), :class => 'btn' %>
+ </div>
+<% end %>
View
3 app/views/setup/teams/edit.html.erb
@@ -0,0 +1,3 @@
+<h1>Team Bearbeiten</h1>
+
+<%= render 'form' %>
View
19 app/views/setup/teams/index.html.erb
@@ -0,0 +1,19 @@
+<h1><%= Team.count %> Teams</h1>
+
+<%= link_to 'Neues Team', new_team_path(), :class => 'btn-primary' %>
+
+<table>
+ <% @teams.each do |team| %>
+ <tr>
+ <td>(<%= team.id %>)</td>
+ <td>
+ <%= image_tag( team.img ) if team.img.present? %>
+ </td>
+ <td><%= team.title %> (<%= team.key %>)</td>
+ <td><%= link_to 'Bearbeiten', edit_team_path( team.id ), :class => 'btn' %></td>
+ </tr>
+ <% end %><!-- teams.each -->
+</table>
+
+
+<%= link_to 'Neues Team', new_team_path(), :class => 'btn-primary' %>
View
3 app/views/setup/teams/new.html.erb
@@ -0,0 +1,3 @@
+<h1>Neues Team</h1>
+
+<%= render 'form' %>
View
13 config/routes.rb
@@ -59,17 +59,18 @@
end
##############################
- ## routes for db via module (db not in url -- todo/fix)
+ ## routes for db
- scope :module => 'db' do
+ namespace :db do
resources :rounds
resources :games
resources :calc_games
resources :teams
-
- resources :events do
- post 'add_team_to', :on => :member
- end
+ resources :events
+
+ # events do
+ # post 'add_team_to', :on => :member
+ #end
end
##############################

0 comments on commit 735d623

Please sign in to comment.