Skip to content

Commit

Permalink
Template paths are set correctly with using a respond_with block. Thi…
Browse files Browse the repository at this point in the history
…s fixes a problem locating overriding templates in other plugins.
  • Loading branch information
steveyken committed Dec 5, 2012
1 parent 9168f26 commit ec98aa5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
10 changes: 8 additions & 2 deletions app/controllers/entities/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,21 @@ def redraw
current_user.pref[:accounts_sort_by] = Account::sort_by_map[params[:sort_by]] if params[:sort_by]
@accounts = get_accounts(:page => 1, :per_page => params[:per_page])
set_options # Refresh options
render :index

respond_with(@accounts) do |format|
format.js { render :index }
end
end

# POST /accounts/filter AJAX
#----------------------------------------------------------------------------
def filter
session[:accounts_filter] = params[:category]
@accounts = get_accounts(:page => 1, :per_page => params[:per_page])
render :index

respond_with(@accounts) do |format|
format.js { render :index }
end
end

private
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/entities/campaigns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,21 @@ def redraw
current_user.pref[:campaigns_sort_by] = Campaign::sort_by_map[params[:sort_by]] if params[:sort_by]
@campaigns = get_campaigns(:page => 1, :per_page => params[:per_page])
set_options # Refresh options
render :index

respond_with(@campaigns) do |format|
format.js { render :index }
end
end

# POST /campaigns/filter AJAX
#----------------------------------------------------------------------------
def filter
session[:campaigns_filter] = params[:status]
@campaigns = get_campaigns(:page => 1, :per_page => params[:per_page])
render :index

respond_with(@campaigns) do |format|
format.js { render :index }
end
end

private
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/entities/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ def redraw

@contacts = get_contacts(:page => 1, :per_page => params[:per_page]) # Start on the first page.
set_options # Refresh options
render :index

respond_with(@contacts) do |format|
format.js { render :index }
end
end

private
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/entities/leads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,21 @@ def redraw

@leads = get_leads(:page => 1, :per_page => params[:per_page]) # Start one the first page.
set_options # Refresh options
render :index

respond_with(@leads) do |format|
format.js { render :index }
end
end

# POST /leads/filter AJAX
#----------------------------------------------------------------------------
def filter
session[:leads_filter] = params[:status]
@leads = get_leads(:page => 1, :per_page => params[:per_page]) # Start one the first page.
render :index

respond_with(@leads) do |format|
format.js { render :index }
end
end

private
Expand Down
9 changes: 7 additions & 2 deletions app/controllers/entities/opportunities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,19 @@ def destroy
def redraw
@opportunities = get_opportunities(:page => 1, :per_page => params[:per_page])
set_options # Refresh options
render :index

respond_with(@opportunities) do |format|
format.js { render :index }
end
end

# POST /opportunities/filter AJAX
#----------------------------------------------------------------------------
def filter
@opportunities = get_opportunities(:page => 1, :per_page => params[:per_page])
render :index
respond_with(@opportunities) do |format|
format.js { render :index }
end
end

private
Expand Down

0 comments on commit ec98aa5

Please sign in to comment.