Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable game_slots start/finish modifications
- Loading branch information
1 parent
93e7675
commit 65d153c
Showing
33 changed files
with
1,463 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,28 @@ | ||
class GameSlotsController < ApplicationController | ||
|
||
def inline_edit | ||
game_slot = GameSlot.find params[:id] | ||
respond_to do |format| | ||
format.js do | ||
render :update do |page| | ||
page.replace_html "game-slot-#{game_slot.id}", | ||
render_game_slot(game_slot, true, false) | ||
end | ||
end | ||
end | ||
end | ||
|
||
def update | ||
game_slot = GameSlot.find params[:id] | ||
game_slot.update_attributes params[:game_slot] | ||
respond_to do |format| | ||
format.js do | ||
render :update do |page| | ||
page.replace_html "game-slot-#{game_slot.id}", | ||
render_game_slot(game_slot, false, true) | ||
end | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,40 @@ | ||
module GameSlotsHelper | ||
|
||
def render_game_slot(game_slot, edit = false, enable_edit = false) | ||
result = '' | ||
if enable_edit | ||
result += '[' | ||
result += link_to_remote('edytuj', :url => inline_edit_game_slot_path(game_slot)) | ||
result += '] ' | ||
end | ||
if edit | ||
form_elements = '' | ||
form = remote_form_for(game_slot) do |f| | ||
form_elements += f.submit 'Zapisz' | ||
form_elements += f.calendar_date_select(:start) | ||
form_elements += f.calendar_date_select(:end) | ||
end | ||
result += form[0] | ||
result += form_elements | ||
result += form[1] | ||
#result += calendar_date_select_tag("p_date_and_time", game_slot.start, | ||
# :time => true) | ||
#result += ' ' | ||
#result += calendar_date_select_tag("p_date_and_time", game_slot.end, | ||
# :time => true) | ||
else | ||
result += game_slot.start.strftime("%Y-%m-%d") | ||
result += ' ' | ||
result += game_slot.start.strftime("%H:%M") | ||
result += game_slot.end.strftime("%H:%M") | ||
end | ||
result += ' ' | ||
if game_slot.game | ||
result += "#{game_slot.game.home_team.name} - #{game_slot.game.away_team.name}" | ||
else | ||
result += " _ _ _ _ _ - _ _ _ _ _" | ||
end | ||
result | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<% enable_drag_n_drop = false unless defined? enable_drag_n_drop %> | ||
<% enable_edit = false unless defined? enable_edit %> | ||
<ul> | ||
<%= render :partial => 'game_slot', :collection => game_slots, | ||
:locals => { :enable_drag_n_drop => enable_drag_n_drop } %> | ||
:locals => { :enable_drag_n_drop => enable_drag_n_drop, | ||
:enable_edit => enable_edit } %> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!-- Nothing here; part of the calendar_date_select plugin --> | ||
<html><head></head><body></body></html> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.