Retire semantic_form_for

Also a buttload of form cleanups...
This commit is contained in:
Henne Vogelsang 2022-02-23 17:52:16 +01:00
parent 350b1ebbbe
commit 81853d1ef9
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
136 changed files with 1825 additions and 1441 deletions

View file

@ -7,12 +7,22 @@
%h1 Edit Survey: #{ @survey.title }
.col-md-6
= semantic_form_for @survey, url: @url do |f|
= form_for @survey, url: @url do |f|
= f.hidden_field :surveyable_type
= f.hidden_field :surveyable_id
= f.input :title
= f.input :description, input_html: { rows: 3 }
= f.input :target, as: :select, collection: Survey.targets.keys, label: "When to ask"
= f.input :start_date, as: :string, input_html: { class: 'datetimepicker' }
= f.input :end_date, as: :string, input_html: { class: 'datetimepicker' }
= f.submit 'Save', class: 'btn btn-primary'
.form-group
= f.label :title
%abbr{title: 'This field is required'} *
= f.text_field :title, class: 'form-control'
.form-group
= f.label :description
= f.text_area :description, rows: 3, class: 'form-control'
.form-group
= f.label :target, "When to ask"
= f.select :target, Survey.targets.keys, class: 'form-control'
.form-group
= f.label :start_date
= f.text_field :start_date, class: 'datetimepicker', class: 'form-control'
= f.label :end_date
= f.text_field :end_date, class: 'datetimepicker', class: 'form-control'
= f.submit nil, class: 'btn btn-primary'

View file

@ -11,7 +11,6 @@
%label
%input{ type: 'radio', name: "survey_submission[#{survey_question.id}][]", value: 'No', checked: survey_reply.text == 'No' }
No
- elsif survey_question.choice?
%input{ type: 'hidden', name: "survey_submission[#{survey_question.id}][]" }
- possible_answers = survey_question.possible_answers.split(',').map(&:strip)

View file

@ -21,12 +21,9 @@
= link_to 'Stats' , '#stats-content', 'data-toggle' => 'tab'
.tab-content
.tab-pane.active#questions-content
= semantic_form_for 'survey_submission', url: '#' do |f|
- @survey.survey_questions.each.with_index(1) do |survey_question, question_index|
.row
.col-md-12
- survey_reply = survey_question.survey_replies.new(survey_question_id: survey_question.id, user_id: current_user.id)
= render partial: 'survey_question', locals: { survey_question: survey_question, question_index: question_index, survey_reply: survey_reply }
- @survey.survey_questions.each.with_index(1) do |survey_question, question_index|
- survey_reply = survey_question.survey_replies.new(survey_question_id: survey_question.id, user_id: current_user.id)
= render partial: 'survey_question', locals: { survey_question: survey_question, question_index: question_index, survey_reply: survey_reply }
= link_to 'Add Question', new_admin_conference_survey_survey_question_path(@conference.short_title, @survey), class: 'btn btn-success pull-right'
.tab-pane#replies-content
= render partial: 'survey_replies'