moved form errors to partial
This commit is contained in:
parent
77684b2c3e
commit
8209a2293b
@ -3,7 +3,7 @@
|
|||||||
<ul data-id="input_option_list">
|
<ul data-id="input_option_list">
|
||||||
<% question.input_options.each do | option | %>
|
<% question.input_options.each do | option | %>
|
||||||
<li>
|
<li>
|
||||||
<%= text_field_tag 'question[input_options][]', option, { disabled: (disable ||= false), data: { last: option } } %>
|
<%= text_field_tag 'question[multi_choice][]', option, { disabled: (disable ||= false), data: { last: option } } %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn tertiary-btn" data-id="input_option_adder"> Add option </div>
|
<div class="btn tertiary-btn" data-id="input_option_adder"> Add option </div>
|
||||||
<li style="display: none;">
|
<li style="display: none;">
|
||||||
<%= text_field_tag 'question[input_options][]', nil, { disabled: (disable ||= false), data: { last: nil } } %>
|
<%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
<% if flash[:error].present? %>
|
<%= render partial: 'shared/form_model_errors', locals: { obj: question} %>
|
||||||
<div class="error">
|
|
||||||
<%= flash[:error] %>
|
|
||||||
<p>
|
|
||||||
<% question.errors.messages.each do |k,v| %>
|
|
||||||
<%= "#{k.to_s} #{v.join(' and ')}" %><br />
|
|
||||||
<% end %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= form_for question, url: action do |form| %>
|
<%= form_for question, url: action do |form| %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= form.label :quiz_id, 'Quiz' %>
|
<%= form.label :quiz_id, 'Quiz' %>
|
||||||
|
@ -11,17 +11,17 @@
|
|||||||
<div data-id="live-coder-answer">
|
<div data-id="live-coder-answer">
|
||||||
<div class="code-input">
|
<div class="code-input">
|
||||||
<label for="question_input_options_html">HTML</label>
|
<label for="question_input_options_html">HTML</label>
|
||||||
<%= text_area_tag 'question[input_options][html]', options['html'], { data: {id: 'code-html', last: options['html']}, class: 'code-answer code-html' } %>
|
<%= text_area_tag 'question[live_code][html]', options['html'], { data: {id: 'code-html', last: options['html']}, class: 'code-answer code-html' } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="code-input">
|
<div class="code-input">
|
||||||
<label for="question_input_options_css">CSS</label>
|
<label for="question_input_options_css">CSS</label>
|
||||||
<%= text_area_tag 'question[input_options][css]', options['css'], { data: {id: 'code-css', last: options['css']}, class: 'code-answer code-css' } %>
|
<%= text_area_tag 'question[live_code][css]', options['css'], { data: {id: 'code-css', last: options['css']}, class: 'code-answer code-css' } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="code-input">
|
<div class="code-input">
|
||||||
<label for="question_input_options_js">JS</label>
|
<label for="question_input_options_js">JS</label>
|
||||||
<%= text_area_tag 'question[input_options][js]', options['js'], { data: {id: 'code-js', last: options['js']}, class: 'code-answer code-js' } %>
|
<%= text_area_tag 'question[live_code][js]', options['js'], { data: {id: 'code-js', last: options['js']}, class: 'code-answer code-js' } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="results" data-id="results"></div>
|
<div class="results" data-id="results"></div>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<ul data-id="input_option_list">
|
<ul data-id="input_option_list">
|
||||||
<% question.input_options.each do | option | %>
|
<% question.input_options.each do | option | %>
|
||||||
<li>
|
<li>
|
||||||
<%= text_field_tag 'question[input_options][]', option, { disabled: (disable ||= false), data: { last: option } } %>
|
<%= text_field_tag 'question[multi_choice][]', option, { disabled: (disable ||= false), data: { last: option } } %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn tertiary-btn" data-id="input_option_adder"> Add option </div>
|
<div class="btn tertiary-btn" data-id="input_option_adder"> Add option </div>
|
||||||
<li style="display: none;">
|
<li style="display: none;">
|
||||||
<%= text_field_tag 'question[input_options][]', nil, { disabled: (disable ||= false), data: { last: nil } } %>
|
<%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
<% if flash[:error].present? %>
|
<%= render partial: 'shared/form_model_errors', locals: { obj: quiz} %>
|
||||||
<div class="error">
|
|
||||||
<%= flash[:error] %>
|
|
||||||
<p>
|
|
||||||
<% quiz.errors.messages.each do |k,v| %>
|
|
||||||
<%= "#{k.to_s} #{v.join(' and ')}" %><br />
|
|
||||||
<% end %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= form_for quiz, url: action do |form| %>
|
<%= form_for quiz, url: action do |form| %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= form.label :name, "Quiz Description" %>
|
<%= form.label :name, "Quiz Description" %>
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
<% if flash[:error].present? %>
|
<%= render partial: 'shared/form_model_errors', locals: { obj: user} %>
|
||||||
<div class="error">
|
|
||||||
<%= flash[:error] %>
|
|
||||||
<p>
|
|
||||||
<% user.errors.messages.each do |k,v| %>
|
|
||||||
<%= "#{k.to_s} #{v.join(' and ')}" %><br />
|
|
||||||
<% end %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= form_for user, url: action do |form| %>
|
<%= form_for user, url: action do |form| %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= form.label :name, "Full Name" %>
|
<%= form.label :name, "Full Name" %>
|
||||||
|
@ -1,17 +1,7 @@
|
|||||||
<main class="intro_tpl">
|
<main class="intro_tpl">
|
||||||
<h1>New Candidate</h1>
|
<h1>New Candidate</h1>
|
||||||
|
|
||||||
<% if flash[:error].present? %>
|
<%= render partial: 'shared/form_model_errors', locals: { obj: @candidate } %>
|
||||||
<div class="error">
|
|
||||||
<%= flash[:error] %>
|
|
||||||
<p>
|
|
||||||
<% @candidate.errors.messages.each do |k,v| %>
|
|
||||||
<%= "#{k.to_s} #{v.join(' and ')}" %><br />
|
|
||||||
<% end %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= form_for @candidate, url: create_candidate_path do |form| %>
|
<%= form_for @candidate, url: create_candidate_path do |form| %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= form.label :name, "Candidate name" %>
|
<%= form.label :name, "Candidate name" %>
|
||||||
|
10
app/views/shared/_form_model_errors.html.erb
Normal file
10
app/views/shared/_form_model_errors.html.erb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<% if flash[:error].present? %>
|
||||||
|
<div class="error">
|
||||||
|
<%= flash[:error] %>
|
||||||
|
<p>
|
||||||
|
<% obj.errors.messages.each do |k,v| %>
|
||||||
|
<%= "#{k.to_s} #{v.join(' and ')}" %><br />
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
Loading…
Reference in New Issue
Block a user