Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
#55 popup edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Vera Peeters committed Aug 11, 2013
1 parent 92ff241 commit 7a95e30
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/controllers/program_entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @program_entry }
format.js
end
end

Expand All @@ -45,9 +46,11 @@ def create
if @program_entry.save
format.html { redirect_to :controller => 'programs', :action => 'edit', :id => @program_entry.program.id }
format.json { render json: @program_entry, status: :created, location: @program_entry }
format.js
else
format.html { render action: "new" }
format.json { render json: @program_entry.errors, status: :unprocessable_entity }
format.js
end
end
end
Expand Down
10 changes: 7 additions & 3 deletions app/views/program_entries/_show_in_program_matrix.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<% if program_entry.nil? %>
<td class="ProgramMatrix" >
<td class="ProgramMatrix" id="ProgramMatrix_entry_<%=slot%>_<%=track%>">
<% if editable %>
<%= link_to 'add', new_program_program_entry_path(program, :slot => slot, :track => track ), :class => "ProgramMatrix_edit_link" %>
<%= link_to 'add', new_program_program_entry_path(program, :slot => slot, :track => track ),
id: "program_entry_#{slot}_#{track}",
:remote => true, :class => "ProgramMatrix_edit_link" %>
<% end %>
</td>
<% else %>
Expand All @@ -13,7 +15,9 @@
<% end %>
<%= wikinize(program_entry.comment) %>
<% if editable %>
<%= link_to "edit", {controller: 'program_entries', action: 'edit', id: program_entry.to_param}, id: "program_entry_#{program_entry.id}" , :remote => true, :class => "ProgramMatrix_edit_link" %>
<%= link_to "edit", {controller: 'program_entries', action: 'edit', id: program_entry.to_param},
id: "program_entry_#{program_entry.id}",
:remote => true, :class => "ProgramMatrix_edit_link" %>
<% end %>
</td>
<% end %>
3 changes: 3 additions & 0 deletions app/views/program_entries/create.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$('<%="#new_program_entry"%>').remove();
$('<%="#ProgramMatrix_entry_#{@program_entry.slot}_#{@program_entry.track}"%>').after("<%= j render 'show_in_program_matrix', :program_entry => @program_entry, :program=> @program_entry.program, :slot=> @program_entry.slot, :track=> @program_entry.track, :editable=> true %>");
$('<%="#ProgramMatrix_entry_#{@program_entry.slot}_#{@program_entry.track}"%>').remove();
2 changes: 2 additions & 0 deletions app/views/program_entries/new.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$('<%="#program_entry_#{@program_entry.slot}_#{@program_entry.track}"%>').hide().after('<%= j render("form_popup") %>');

0 comments on commit 7a95e30

Please sign in to comment.