Permalink
Browse files

cleanup setup cont.

  • Loading branch information...
1 parent df908ff commit be6e4d9e8c9d748ca793ac548927020c798e6d63 @geraldb geraldb committed Nov 18, 2012
@@ -1,43 +0,0 @@
-class Setup::CalcGamesController < Setup::BaseController
-
- # GET /calc_games/new
- def new
- @game = CalcGame.new
- end
-
- # POST /calc_games
- def create
- @game = CalcGame.new(params[:calc_game])
-
- if @game.save
- redirect_to games_path(), :notice => 'Spiel erfolgreich gespeichert.'
- else
- render :action => 'new'
- end
- end
-
- # GET /calc_games/1/edit
- def edit
- @game = CalcGame.find(params[:id])
- end
-
- # PUT /calc_games/1
- def update
- @game = CalcGame.find(params[:id])
-
- if @game.update_attributes(params[:calc_game])
- redirect_to games_path(), :notice => 'Spiel erfolgreich gespeichert.'
- else
- render :action => 'edit'
- end
- end
-
- # DELETE /calc_games/1
- def destroy
- @game = CalcGame.find(params[:id])
- @game.destroy
-
- redirect_to games_path()
- end
-
-end # class CalcGamesController
@@ -7,46 +7,4 @@ def index
@events = Event.all
end
- # GET /events/new
- def new
- @event = Event.new
- end
-
- # POST /events
- def create
- @event = Event.new( params[:event] )
-
- if @event.save
- redirect_to events_path(), notice: 'Veranstaltung erfolgreich gespeichert.'
- else
- render action: 'new'
- end
- end
-
- # GET /events/1/edit
- def edit
- @event = Event.find( params[:id] )
- end
-
- # PUT /events/1
- def update
- @event = Event.find( params[:id] )
-
- if @event.update_attributes(params[:event])
- redirect_to events_path(), notice: 'Veranstaltung erfolgreich gespeichert.'
- else
- render action: 'edit'
- end
- end
-
- # POST /events/1/add_team_to
- def add_team_to # rename to add_team or similar?
- event = Event.find( params[:id] )
- team = Team.find( params[:team_id] )
-
- event.teams << team
-
- redirect_to events_path(), :notice => 'Team erfolgreich hinzugefügt.'
- end
-
end # class EventsController
@@ -5,44 +5,4 @@ def index
@events = Event.all
end
- # GET /games/new
- def new
- @game = Game.new
- end
-
- # POST /games
- def create
- @game = Game.new(params[:game])
-
- if @game.save
- redirect_to games_path(), notice: 'Spiel erfolgreich gespeichert.'
- else
- render action: 'new'
- end
- end
-
- # GET /games/1/edit
- def edit
- @game = Game.find(params[:id])
- end
-
- # PUT /games/1
- def update
- @game = Game.find(params[:id])
-
- if @game.update_attributes(params[:game])
- redirect_to games_path(), notice: 'Spiel erfolgreich gespeichert.'
- else
- render action: 'edit'
- end
- end
-
- # DELETE /games/1
- def destroy
- @game = Game.find(params[:id])
- @game.destroy
-
- redirect_to games_path()
- end
-
end # class GamesController
@@ -5,44 +5,4 @@ def index
@events = Event.all
end
- # GET /rounds/new
- def new
- @round = Round.new
- end
-
- # POST /rounds
- def create
- @round = Round.new(params[:round])
-
- if @round.save
- redirect_to rounds_path(), notice: 'Runde erfolgreich gespeichert.'
- else
- render action: 'new'
- end
- end
-
- # GET /rounds/1/edit
- def edit
- @round = Round.find(params[:id])
- end
-
- # PUT /rounds/1
- def update
- @round = Round.find(params[:id])
-
- if @round.update_attributes(params[:round])
- redirect_to rounds_path(), notice: 'Runde erfolgreich gespeichert.'
- else
- render action: 'edit'
- end
- end
-
- # DELETE /rounds/1
- def destroy
- @round = Round.find(params[:id])
- @round.destroy
-
- redirect_to rounds_path()
- end
-
end # class RoundsController
@@ -5,44 +5,4 @@ def index
@teams = Team.all
end
- # GET /teams/new
- def new
- @team = Team.new
- end
-
- # POST /teams
- def create
- @team = Team.new(params[:team])
-
- if @team.save
- redirect_to teams_path(), notice: 'Team erfolgreich gespeichert.'
- else
- render action: 'new'
- end
- end
-
- # GET /teams/1/edit
- def edit
- @team = Team.find(params[:id])
- end
-
- # PUT /teams/1
- def update
- @team = Team.find(params[:id])
-
- if @team.update_attributes(params[:team])
- redirect_to teams_path(), notice: 'Team erfolgreich gespeichert.'
- else
- render action: 'edit'
- end
- end
-
- # DELETE /teams/1
- def destroy
- @team = Team.find(params[:id])
- @team.destroy
-
- redirect_to teams_path()
- end
-
end # class TeamsController
@@ -43,11 +43,11 @@
<div>
- <%= link_to 'Events', events_path() %> &bull;
- <%= link_to 'Teams', teams_path() %> &bull;
- <%= link_to 'Rounds', rounds_path() %> &bull;
- <%= link_to 'Bonus Rounds', bonus_rounds_path() %> &bull;
- <%= link_to 'Games', games_path() %>
+ <%= link_to 'Events', setup_events_path() %> &bull;
+ <%= link_to 'Teams', setup_teams_path() %> &bull;
+ <%= link_to 'Rounds', setup_rounds_path() %> &bull;
+ <%= link_to 'Bonus Rounds', setup_bonus_rounds_path() %> &bull;
+ <%= link_to 'Games', setup_games_path() %>
<!-- todo: add some more links -->
</div>
@@ -1,4 +1,4 @@
-<%= form_for(@round) do |f| %>
+<%= form_for(@round, :url => setup_bonus_rounds_path()) do |f| %>
<% if @round.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@round.errors.count, "error") %> prohibited this round from being saved:</h2>
@@ -15,7 +15,8 @@
<tr>
<td></td>
<td><!-- todo: add pool/event field w/ select box -->
- <%= @round.pool.full_title %>
+ <!-- todo/fix: why does it now work?? -->
+ <%#= @round.pool.full_title %>
</td>
</tr>
<tr>
@@ -30,6 +31,6 @@
<div class="actions">
<%= f.submit 'Save', :class => 'btn-primary' %>
- <%= link_to 'Back', bonus_rounds_path(), :class => 'btn' %>
+ <%= link_to 'Back', setup_bonus_rounds_path(), :class => 'btn' %>
</div>
<% end %>
@@ -1,6 +1,6 @@
<h1><%= BonusRound.count %> Bonus Rounds</h1>
-<%= link_to 'New Bonus Round', new_bonus_round_path(), :class => 'btn-primary' %>
+<%= link_to 'New Bonus Round', new_setup_bonus_round_path(), :class => 'btn-primary' %>
<!-- todo: stack by pool -->
@@ -11,11 +11,11 @@
<td>(<%= round.id %>)</td>
<td>#<%= round.pos %></td>
<td><%= round.title %></td>
- <td><%= link_to 'Edit', edit_bonus_round_path( round ), :class => 'btn' %></td>
+ <td><%= link_to 'Edit', edit_setup_bonus_round_path( round ), :class => 'btn' %></td>
</tr>
<% end %><!-- rounds.each -->
</table>
<p>
-<%= link_to 'New Bonus Round', new_bonus_round_path(), :class => 'btn-primary' %>
+<%= link_to 'New Bonus Round', new_setup_bonus_round_path(), :class => 'btn-primary' %>
</p>
View
@@ -64,25 +64,22 @@
resources :users
end
+
##############################
- ## routes for setup via module (setup not in url -- todo/fix??)
+ ## routes for setup
match 'setup', :to => 'setup/teams#index'
- scope :module => 'setup' do
- resources :bonus_rounds
+ namespace :setup do
+ resources :events
+ resources :teams
resources :rounds
+ resources :bonus_rounds
resources :games
- resources :calc_games
- resources :teams
-
- resources :events do
- post 'add_team_to', :on => :member
- end
end
-
+
#######################
## home route

0 comments on commit be6e4d9

Please sign in to comment.