Class: Fe::Admin::QuestionSheetsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Fe::Admin::QuestionSheetsController
- Defined in:
- app/controllers/fe/admin/question_sheets_controller.rb
Overview
QuestionSheets is used exclusively on the administration side to design a Questionniare
which can than be instantiated as an AnswerSheet for data capture on the front-end
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
21 22 23 24 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 21 def archive @question_sheet.update_attribute(:archived, true) redirect_to :back end |
#create ⇒ Object
create sheet with inital page, redirect to show POST /question_sheets
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 50 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
94 95 96 97 98 99 100 101 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 94 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
31 32 33 34 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 31 def duplicate @question_sheet.duplicate redirect_to :back end |
#edit ⇒ Object
display sheet properties panel GET /question_sheets/1/edit
67 68 69 70 71 72 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 67 def edit respond_to do |format| format.js end end |
#index ⇒ Object
list of all questionnaires/forms to edit GET /question_sheets
11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 11 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
38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 38 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
26 27 28 29 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 26 def unarchive @question_sheet.update_attribute(:archived, false) redirect_to :back end |
#update ⇒ Object
save changes to properties panel (label, language) PUT /question_sheets/1
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'app/controllers/fe/admin/question_sheets_controller.rb', line 76 def update params.require(:fe_question_sheet).permit! respond_to do |format| if @question_sheet.update_attributes(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 |