mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-20 17:20:12 +01:00
migrate deleting of contexts
This commit is contained in:
parent
15fdb1e572
commit
e52a8609c7
10 changed files with 124 additions and 31 deletions
|
|
@ -127,7 +127,10 @@ class ContextsController < ApplicationController
|
|||
|
||||
@context.destroy
|
||||
respond_to do |format|
|
||||
format.js { @down_count = current_user.contexts.size }
|
||||
format.js do
|
||||
@down_count = current_user.contexts.size
|
||||
update_state_counts
|
||||
end
|
||||
format.xml { render :text => "Deleted context #{@context.name}" }
|
||||
end
|
||||
end
|
||||
|
|
@ -145,6 +148,13 @@ class ContextsController < ApplicationController
|
|||
|
||||
protected
|
||||
|
||||
def update_state_counts
|
||||
@active_contexts_count = current_user.contexts.active.count
|
||||
@hidden_contexts_count = current_user.contexts.hidden.count
|
||||
@show_active_contexts = @active_contexts_count > 0
|
||||
@show_hidden_contexts = @hidden_contexts_count > 0
|
||||
end
|
||||
|
||||
def render_contexts_html
|
||||
lambda do
|
||||
@page_title = "TRACKS::List Contexts"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue