working on question_lists

This commit is contained in:
Jared Cosulich 2017-03-05 12:23:11 -05:00
parent d731049fc6
commit cc84c3bbda
26 changed files with 498 additions and 10 deletions

View file

@ -0,0 +1,20 @@
= form_for(question_list) do |f|
- if question_list.errors.any?
#error_explanation
%h2
= pluralize(question_list.errors.count, "error")
prohibited this question_list from being saved:
%ul
- question_list.errors.full_messages.each do |message|
%li= message
.field
= f.label :name
= f.text_field :name
.field
= f.label :description
= f.text_area :description
.field
= f.label :question_ids
= f.text_area :question_ids
.actions
= f.submit

View file

@ -0,0 +1,5 @@
%h1 Editing Question List
= render 'form', question_list: @question_list
= link_to 'Show', @question_list
|
= link_to 'Back', question_lists_path

View file

@ -0,0 +1,20 @@
%p#notice= notice
%h1 Question Lists
%table
%thead
%tr
%th Name
%th Description
%th Question ids
%th{:colspan => "3"}
%tbody
- @question_lists.each do |question_list|
%tr
%td= question_list.name
%td= question_list.description
%td= question_list.question_ids
%td= link_to 'Show', question_list
%td= link_to 'Edit', edit_question_list_path(question_list)
%td= link_to 'Destroy', question_list, method: :delete, data: { confirm: 'Are you sure?' }
%br/
= link_to 'New Question List', new_question_list_path

View file

@ -0,0 +1,4 @@
json.array!(@question_lists) do |question_list|
json.extract! question_list, :id, :name, :description, :question_ids
json.url question_list_url(question_list, format: :json)
end

View file

@ -0,0 +1,3 @@
%h1 New Question List
= render 'form', question_list: @question_list
= link_to 'Back', question_lists_path

View file

@ -0,0 +1,13 @@
%p#notice= notice
%p
%strong Name:
= @question_list.name
%p
%strong Description:
= @question_list.description
%p
%strong Question ids:
= @question_list.question_ids
= link_to 'Edit', edit_question_list_path(@question_list)
|
= link_to 'Back', question_lists_path

View file

@ -0,0 +1 @@
json.extract! @question_list, :id, :name, :description, :question_ids, :created_at, :updated_at