Class: HelenaAdministration::SessionsController
- Inherits:
-
ApplicationController
show all
- Includes:
- ActionController::Live
- Defined in:
- app/controllers/helena_administration/sessions_controller.rb
Instance Method Summary
collapse
#add_breadcrumb, #set_locale
Instance Method Details
#destroy ⇒ Object
41
42
43
44
|
# File 'app/controllers/helena_administration/sessions_controller.rb', line 41
def destroy
flash[:success] = t 'shared.actions.deleted' if @session.destroy
redirect_to survey_path(@survey)
end
|
#edit ⇒ Object
27
28
29
|
# File 'app/controllers/helena_administration/sessions_controller.rb', line 27
def edit
add_breadcrumb "#{@session.model_name.human}: #{@session.token_was}", @survey
end
|
#index ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/helena_administration/sessions_controller.rb', line 11
def index
respond_to do |format|
@sessions = @survey.sessions.desc(:created_at)
format.json { render json: @sessions }
format.csv do
render_csv
end
end
end
|
#new ⇒ Object
21
22
23
24
25
|
# File 'app/controllers/helena_administration/sessions_controller.rb', line 21
def new
@survey.sessions.create version: @survey.newest_version
flash[:success] = t 'shared.actions.created'
redirect_to survey_path(@survey)
end
|
#update ⇒ Object
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/helena_administration/sessions_controller.rb', line 31
def update
if @session.update_attributes session_params
flash[:success] = t 'shared.actions.updated'
else
flash.now[:danger] = t 'shared.actions.error'
add_breadcrumb "#{@session.model_name.human}: #{@session.token_was}", @survey
end
respond_with @survey
end
|