From 4a8c2173d4aef9b7efa72e3d1c7e838d1df91953 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Mon, 14 Jul 2014 18:04:58 +0300 Subject: [PATCH 1/2] remove put method --- app/views/admin/questions/index.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/questions/index.html.haml b/app/views/admin/questions/index.html.haml index decc6b41..3e357b36 100644 --- a/app/views/admin/questions/index.html.haml +++ b/app/views/admin/questions/index.html.haml @@ -5,10 +5,10 @@ %br %br - if @questions.count > 0 - = semantic_form_for(@conference, :url => admin_conference_questions_update_conference_path(@conference.short_title), :method => 'put') do |f| + = semantic_form_for(@conference, :url => admin_conference_questions_update_conference_path(@conference.short_title)) do |f| .questions{:id => "myquestions"} = render :partial => "questions" - = f.submit "Update Questions for #{@conference.short_title}", :class => "btn btn-primary", :confirm => "Are you sure you want to make these changes?" + = f.submit "Update Questions for #{@conference.short_title}", :class => "btn btn-primary", :confirm => "Are you sure you want to make these changes?" .modal.fade{:id => "new-question", "role" => "dialog", "aria-hidden" => "true"} From 2966b923199da911cbf45d23d8fd584da95eb05d Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Mon, 14 Jul 2014 21:13:32 +0300 Subject: [PATCH 2/2] style fixes --- app/views/admin/questions/_form.html.haml | 8 +++--- .../admin/questions/_questions.html.haml | 20 ++++++++++----- app/views/admin/questions/edit.html.haml | 6 ++--- app/views/admin/questions/index.html.haml | 25 ++++++++++--------- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/app/views/admin/questions/_form.html.haml b/app/views/admin/questions/_form.html.haml index 62e098f1..1c24e5b4 100644 --- a/app/views/admin/questions/_form.html.haml +++ b/app/views/admin/questions/_form.html.haml @@ -1,8 +1,10 @@ .row .col-md-6 %legend Question - = f.input :title, :label => "Your Question" + = f.input :title, label: 'Your Question' = f.input :question_type - = f.input :global, :label => "Make Global", :hint => "(Global questions are available for selection to all conferences)" + = f.input :global, label: 'Make Global', + hint: '(Global questions are available for selection to all conferences)' .col-md-6 - = dynamic_association :answers, "Answers", f, :hint => "Insert your answers in the order you want them to appear" \ No newline at end of file + = dynamic_association :answers, 'Answers', f, + hint: 'Insert your answers in the order you want them to appear' diff --git a/app/views/admin/questions/_questions.html.haml b/app/views/admin/questions/_questions.html.haml index 3638d6d0..9feda3aa 100644 --- a/app/views/admin/questions/_questions.html.haml +++ b/app/views/admin/questions/_questions.html.haml @@ -1,20 +1,28 @@ -%h2 +%h2 Questions for #{@conference.short_title} - if @questions_conference.count = "(#{@questions_conference.count})" -%i The questions will appear in the registration page of the conference +%i The questions will appear in the registration page of the conference %table.table - @questions.each do |q| %tr %td = hidden_field_tag "conference[question_ids][]", nil - = check_box_tag "conference[question_ids][]", q.id, @conference.question_ids.include?(q.id), id: dom_id(q) + = check_box_tag "conference[question_ids][]", q.id, + @conference.question_ids.include?(q.id), id: dom_id(q) %td = label_tag dom_id(q), q.title + %br = label_tag dom_id(q), "Type: #{q.question_type.title}" + = ',' = label_tag dom_id(q), "Answers: #{q.answers.map {|a| a.title}.join(', ')}" - %td= link_to "Edit", edit_admin_conference_question_path(@conference.short_title, q), :class => "btn btn-primary", :disabled => q.global == true && !has_role?(current_user, "Admin") - - %td= link_to "Delete", admin_conference_question_path(@conference.short_title, q), :method => :delete, :remote => true, :class => "btn btn-danger", :confirm => "Delete question '#{q.title}'?", :disabled => q.global == true && !has_role?(current_user, "Admin") \ No newline at end of file + %td= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q), + class: 'btn btn-primary', + disabled: q.global == true && !has_role?(current_user, 'Admin') + + %td= link_to 'Delete', admin_conference_question_path(@conference.short_title, q), + method: :delete, remote: true, class: 'btn btn-danger', + confirm: "Delete question '#{q.title}'?", + disabled: q.global == true && !has_role?(current_user, "Admin") diff --git a/app/views/admin/questions/edit.html.haml b/app/views/admin/questions/edit.html.haml index 826c9dfb..4b261f38 100644 --- a/app/views/admin/questions/edit.html.haml +++ b/app/views/admin/questions/edit.html.haml @@ -2,8 +2,8 @@ Edit Question %h3 "#{@question.title}" -= semantic_form_for(@question, :url => admin_conference_question_path(@conference.short_title, @question.id)) do |f| += semantic_form_for(@question, url: admin_conference_question_path(@conference.short_title, @question.id)) do |f| - = render :partial => "form", :locals => {:f => f} + = render partial: 'form', locals: {f: f} - = f.submit "Save", :class => "btn btn-primary", :confirm => "Are you sure you want to make these changes?" \ No newline at end of file + = f.submit 'Save', class: 'btn btn-primary', confirm: 'Are you sure you want to make these changes?' diff --git a/app/views/admin/questions/index.html.haml b/app/views/admin/questions/index.html.haml index 3e357b36..e34e997a 100644 --- a/app/views/admin/questions/index.html.haml +++ b/app/views/admin/questions/index.html.haml @@ -1,27 +1,28 @@ .row .col-md-8 .pull-right - %b= link_to "Create New Question","#", "data-toggle" => "modal", "data-target" => "#new-question", :class => "btn btn-success" + %b= link_to 'Create New Question','#', 'data-toggle' => 'modal', + 'data-target' => '#new-question', class: 'btn btn-success' %br %br - if @questions.count > 0 - = semantic_form_for(@conference, :url => admin_conference_questions_update_conference_path(@conference.short_title)) do |f| - .questions{:id => "myquestions"} - = render :partial => "questions" - = f.submit "Update Questions for #{@conference.short_title}", :class => "btn btn-primary", :confirm => "Are you sure you want to make these changes?" + = semantic_form_for(@conference, url: admin_conference_questions_update_conference_path(@conference.short_title)) do |f| + .questions{id: 'myquestions'} + = render partial: 'questions' + = f.submit "Update Questions for #{@conference.short_title}", class: 'btn btn-primary', + confirm: 'Are you sure you want to make these changes?' - - .modal.fade{:id => "new-question", "role" => "dialog", "aria-hidden" => "true"} + .modal.fade{id: 'new-question', 'role' => 'dialog', 'aria-hidden' => 'true'} .modal-dialog .modal-content .modal-header - %h3{:id => "new-question-header"} + %h3{id: 'new-question-header'} Add new question .modal-body - = semantic_form_for(@new_question, :url => admin_conference_questions_path(@conference.short_title), :method => :post) do |f| - = render :partial => "form", :locals => {:f => f} - %button{:class => "btn btn-primary"} + = semantic_form_for(@new_question, url: admin_conference_questions_path(@conference.short_title), method: :post) do |f| + = render partial: 'form', locals: {f: f} + %button{class: 'btn btn-primary'} Save .pull-right - %button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"} + %button{class: 'btn btn-danger', 'data-dismiss'=> 'modal', 'aria-hidden'=>'true'} Cancel