mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 11:10:12 +01:00
Fix context state change
This commit is contained in:
parent
acad0596be
commit
550a0e4955
2 changed files with 3 additions and 4 deletions
|
|
@ -92,8 +92,7 @@ class ContextsController < ApplicationController
|
|||
|
||||
if @context.save
|
||||
if boolean_param('wants_render')
|
||||
@context_state_changed = ((@orgininal_context_hidden || false) != @context.hidden?)
|
||||
puts "CHANGED: #{@original_context_hidden}, #{@context.hidden?}, #{(@orgininal_context_hidden == @context.hidden?)}"
|
||||
@context_state_changed = (@original_context_hidden != @context.hidden?)
|
||||
@new_state = (@context.hidden? ? "hidden" : "active") if @context_state_changed
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
status_message = 'Context saved'
|
||||
page.notify :notice, status_message, 5.0
|
||||
if @context_state_changed
|
||||
page << "jQuery('##{dom_id(@context, 'edit')}').hide();"
|
||||
page.remove dom_id(@context, 'container')
|
||||
page.insert_html :bottom, "list-contexts-#{@new_state}", :partial => 'context_listing', :object => @context
|
||||
else
|
||||
page.replace_html dom_id(@context, 'container'), :partial => 'context_listing', :object => @context
|
||||
end
|
||||
page[dom_id(@context)].show
|
||||
page.visual_effect :highlight, dom_id(@context), :duration => 3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue