Class: Storytime::Dashboard::NavigationsController
Instance Method Summary
collapse
#authenticate_user!, #current_user, #setup, #user_signed_in?
#current_storytime_site
#content_for, #content_for?, #view_context
Instance Method Details
#create ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/storytime/dashboard/navigations_controller.rb', line 18
def create
authorize current_storytime_site, :manage?
@navigation = Navigation.new(navigation_params)
respond_to do |format|
if @navigation.save
format.html { redirect_to [storytime, :edit, :dashboard, @navigation], notice: t('dashboard.navigations.create.success') }
else
format.html { render :new }
end
end
end
|
#destroy ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'app/controllers/storytime/dashboard/navigations_controller.rb', line 49
def destroy
authorize current_storytime_site, :manage?
@navigation = Navigation.find(params[:id])
@navigation.destroy
flash[:notice] = I18n.t('flash.navigations.destroy.success') unless request.xhr?
respond_with [:dashboard, @navigation] do |format|
format.html{ redirect_to url_for([:dashboard, Storytime::Navigation]) }
end
end
|
#edit ⇒ Object
31
32
33
34
|
# File 'app/controllers/storytime/dashboard/navigations_controller.rb', line 31
def edit
authorize current_storytime_site, :manage?
@navigation = Navigation.find(params[:id])
end
|
#index ⇒ Object
8
9
10
11
|
# File 'app/controllers/storytime/dashboard/navigations_controller.rb', line 8
def index
authorize current_storytime_site, :manage?
@navigations = Navigation.includes(:links)
end
|
#new ⇒ Object
13
14
15
16
|
# File 'app/controllers/storytime/dashboard/navigations_controller.rb', line 13
def new
authorize current_storytime_site, :manage?
@navigation = Navigation.new
end
|
#update ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/storytime/dashboard/navigations_controller.rb', line 36
def update
authorize current_storytime_site, :manage?
@navigation = Navigation.find(params[:id])
respond_to do |format|
if @navigation.update(navigation_params)
format.html { redirect_to [storytime, :edit, :dashboard, @navigation], notice: t('dashboard.navigations.update.success') }
else
format.html { render :edit }
end
end
end
|