Module: Fe::Admin::QuestionSheetsControllerConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- QuestionSheetsController
- Defined in:
- app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb
Instance Method Summary collapse
- #archive ⇒ Object
-
#create ⇒ Object
create sheet with inital page, redirect to show POST /question_sheets.
-
#destroy ⇒ Object
mark sheet as destroyed DELETE /question_sheets/1.
- #duplicate ⇒ Object
-
#edit ⇒ Object
display sheet properties panel GET /question_sheets/1/edit.
-
#index ⇒ Object
list of all questionnaires/forms to edit GET /question_sheets.
-
#show ⇒ Object
entry point: display form designer with page 1 and panels loaded GET /question_sheets/1.
- #unarchive ⇒ Object
-
#update ⇒ Object
save changes to properties panel (label, language) PUT /question_sheets/1.
Instance Method Details
#archive ⇒ Object
25 26 27 28 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 25 def archive @question_sheet.update_attribute(:archived, true) redirect_back fallback_location: fe_admin_question_sheets_path end |
#create ⇒ Object
create sheet with inital page, redirect to show POST /question_sheets
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 54 def create @question_sheet = Fe::QuestionSheet.new_with_page respond_to do |format| if @question_sheet.save format.html { redirect_to fe_admin_question_sheet_path(@question_sheet) } format.xml { head :created, location: admin_question_sheet_path(@question_sheet) } else format.html { render action: "new" } format.xml { render xml: @question_sheet.errors.to_xml } end end end |
#destroy ⇒ Object
mark sheet as destroyed DELETE /question_sheets/1
98 99 100 101 102 103 104 105 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 98 def destroy @question_sheet.destroy respond_to do |format| format.html { redirect_to fe_admin_question_sheets_path } format.xml { head :ok } end end |
#duplicate ⇒ Object
35 36 37 38 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 35 def duplicate @question_sheet.duplicate redirect_back fallback_location: fe_admin_question_sheets_path end |
#edit ⇒ Object
display sheet properties panel GET /question_sheets/1/edit
71 72 73 74 75 76 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 71 def edit respond_to do |format| format.js end end |
#index ⇒ Object
list of all questionnaires/forms to edit GET /question_sheets
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 15 def index @active_question_sheets = Fe::QuestionSheet.active.order('label') @archived_question_sheets = Fe::QuestionSheet.archived.order('label') respond_to do |format| format.html # index.rhtml format.xml { render xml: @question_sheets.to_xml } end end |
#show ⇒ Object
entry point: display form designer with page 1 and panels loaded GET /question_sheets/1
42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 42 def show @all_pages = @question_sheet.pages @page = @all_pages[0] respond_to do |format| format.html # show.rhtml format.xml { render xml: @question_sheet.to_xml } end end |
#unarchive ⇒ Object
30 31 32 33 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 30 def unarchive @question_sheet.update_attribute(:archived, false) redirect_back fallback_location: fe_admin_question_sheets_path end |
#update ⇒ Object
save changes to properties panel (label, language) PUT /question_sheets/1
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb', line 80 def update params.require(:fe_question_sheet).permit! respond_to do |format| if @question_sheet.update(params[:fe_question_sheet]) format.html { redirect_to fe_admin_question_sheet_path(@question_sheet) } format.js format.xml { head :ok } else format.html { render action: "edit" } format.js { render action: "error.rjs"} format.xml { render xml: @question_sheet.errors.to_xml } end end end |