From 4b3693ed429bb6bd9d0dff3d5368da2813f1d9a1 Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Sun, 5 Mar 2017 20:47:42 -0500 Subject: [PATCH] working on question lists --- app/views/question_lists/_form.html.haml | 16 +++++++++------- app/views/question_lists/new.html.haml | 9 ++++++--- app/views/recipient_lists/_form.html.haml | 2 +- app/views/recipient_lists/new.html.haml | 2 +- app/views/recipient_lists/show.html.haml | 2 +- app/views/schools/show.html.haml | 4 ++++ spec/views/question_lists/edit.html.erb_spec.rb | 2 +- spec/views/question_lists/new.html.erb_spec.rb | 2 +- 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/app/views/question_lists/_form.html.haml b/app/views/question_lists/_form.html.haml index 04f5ff5a..68f7c2a6 100644 --- a/app/views/question_lists/_form.html.haml +++ b/app/views/question_lists/_form.html.haml @@ -9,12 +9,14 @@ %li= message .field = f.label :name - = f.text_field :name + = f.text_field :name, class: 'form-control' .field = f.label :description - = f.text_area :description - .field - = f.label :question_ids - = f.text_area :question_ids - .actions - = f.submit + = f.text_area :description, class: 'form-control' + .form-group + = f.label :question_id_array, 'Questions' + %br/ + .form-check.form-check-collection + = f.collection_check_boxes(:question_id_array, Question.all, :id, :text) { |c| c.label(class: 'form-check-label') { c.check_box(class: 'form-check-input') + " #{c.text}" } } + .form-group + = f.submit 'Save List', class: 'btn btn-primary' diff --git a/app/views/question_lists/new.html.haml b/app/views/question_lists/new.html.haml index ad8f1932..53f3a697 100644 --- a/app/views/question_lists/new.html.haml +++ b/app/views/question_lists/new.html.haml @@ -1,3 +1,6 @@ -%h1 New Question List -= render 'form', question_list: @question_list -= link_to 'Back', question_lists_path +.row + .offset-sm-2.col-sm-8 + %h3 Create A Question List + = render 'form', question_list: @question_list + %br + %p= link_to 'Back', root_path diff --git a/app/views/recipient_lists/_form.html.haml b/app/views/recipient_lists/_form.html.haml index 3ced760f..6910be24 100644 --- a/app/views/recipient_lists/_form.html.haml +++ b/app/views/recipient_lists/_form.html.haml @@ -16,7 +16,7 @@ %br/ = f.text_area :description, class: 'form-control' .form-group - = f.label :recipient_ids, 'Recipients' + = f.label :recipient_id_array, 'Recipients' %br/ .form-check.form-check-collection = f.collection_check_boxes(:recipient_id_array, @school.recipients.all, :id, :name) { |c| c.label(class: 'form-check-label') { c.check_box(class: 'form-check-input') + " #{c.text}" } } diff --git a/app/views/recipient_lists/new.html.haml b/app/views/recipient_lists/new.html.haml index 1b190b31..dab5a4fd 100644 --- a/app/views/recipient_lists/new.html.haml +++ b/app/views/recipient_lists/new.html.haml @@ -1,6 +1,6 @@ .row .offset-sm-2.col-sm-8 %h3 Create A Recipient List For This School - = render 'form' + = render 'form', recipient_list: @recipient_list %br %p= link_to 'Back',@school diff --git a/app/views/recipient_lists/show.html.haml b/app/views/recipient_lists/show.html.haml index b92cee78..efbd416b 100644 --- a/app/views/recipient_lists/show.html.haml +++ b/app/views/recipient_lists/show.html.haml @@ -1,6 +1,6 @@ %p %b School: - = @school.name + = link_to @school.name, @school %p %b Name: = @recipient_list.name diff --git a/app/views/schools/show.html.haml b/app/views/schools/show.html.haml index 600002c1..0150c8e3 100644 --- a/app/views/schools/show.html.haml +++ b/app/views/schools/show.html.haml @@ -11,6 +11,10 @@ %p= link_to "Create Recipient List", new_school_recipient_list_path(@school) +%p= link_to "Create A Question List", new_question_list_path() + +-#%p= link_to "Create A Schedule", new_school_schedule_path(@school) + = link_to 'Edit', edit_school_path(@school) | = link_to 'Back', root_path diff --git a/spec/views/question_lists/edit.html.erb_spec.rb b/spec/views/question_lists/edit.html.erb_spec.rb index c6921c7d..222db034 100644 --- a/spec/views/question_lists/edit.html.erb_spec.rb +++ b/spec/views/question_lists/edit.html.erb_spec.rb @@ -18,7 +18,7 @@ RSpec.describe "question_lists/edit", type: :view do assert_select "textarea#question_list_description[name=?]", "question_list[description]" - assert_select "textarea#question_list_question_ids[name=?]", "question_list[question_ids]" + assert_select "input[name=?]", "question_list[question_id_array][]" end end end diff --git a/spec/views/question_lists/new.html.erb_spec.rb b/spec/views/question_lists/new.html.erb_spec.rb index b36fbe8a..b22fe34b 100644 --- a/spec/views/question_lists/new.html.erb_spec.rb +++ b/spec/views/question_lists/new.html.erb_spec.rb @@ -18,7 +18,7 @@ RSpec.describe "question_lists/new", type: :view do assert_select "textarea#question_list_description[name=?]", "question_list[description]" - assert_select "textarea#question_list_question_ids[name=?]", "question_list[question_ids]" + assert_select "input[name=?]", "question_list[question_id_array][]" end end end