-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from ThePletch/unified-event-config
Merge poll editing into event form
- Loading branch information
Showing
21 changed files
with
107 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
- title t('event.form.title.edit', title: @event.title) | ||
%h1.title= t('event.form.header.edit', title: @event.title) | ||
= render 'form', event: @event | ||
= link_to t('form.show'), @event | ||
| | ||
= link_to t('back'), events_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
= bootstrap_form_for(form_object) do |f| | ||
- if poll.errors.any? | ||
#error_explanation | ||
%h2= t('poll.form.errors_msg', count: poll.errors.count) | ||
%ul | ||
- poll.errors.full_messages.each do |message| | ||
%li= message | ||
.form-group | ||
- row_id = f.object.persisted? ? "poll_#{f.object.id}" : "poll__timestamp_" | ||
- if f.object.errors.any? | ||
%div{class: "poll_error_explanation_#{f.object.id}"} | ||
%h2= t('poll.form.errors_msg', count: f.object.errors.count) | ||
%ul | ||
- f.object.errors.full_messages.each do |message| | ||
%li= message | ||
= f.form_group layout: :inline, class: 'row', "id" => row_id, data: {persisted: (!f.object.new_record?).to_s} do | ||
= f.hidden_field :id, value: f.object.id unless f.object.new_record? | ||
= f.hidden_field :_destroy, class: 'destroy', value: 0 | ||
.input-group | ||
= f.text_field :question, floating: true | ||
%button.btn.btn-danger.dynamic-list-delete{data: {dynamic_target_id: row_id}, onclick: "return false;"} X | ||
|
||
#example-responses | ||
= f.fields_for(:responses, poll.responses.example, layout: :inline) do |r| | ||
= render partial: 'poll_responses/edit_example_response', locals: {f: r, poll_response: r.object} | ||
= link_to_add_fields t('poll.form.add_option'), f, :responses, {partial: 'poll_responses/edit_example_response', target: "#example-responses", locals: { poll_response: f.object.responses.build }, layout: :inline}, class: 'btn btn-success', id: "add-response" | ||
.actions | ||
= f.submit class: 'btn btn-primary' | ||
- if poll.persisted? | ||
= button_to t('poll.form.destroy'), poll_path(poll), method: :delete, class: 'btn btn-danger', data: {confirm: t('poll.form.confirm_destroy')} | ||
.my-2.px-4 | ||
%div.mb-2{class: "example-responses-#{row_id}"} | ||
= f.fields_for(:responses, scope: :example, layout: :inline) do |r| | ||
= render partial: 'poll_responses/edit_example_response', locals: {f: r, poll_response: r.object} | ||
= link_to_add_fields t('poll.form.add_option'), f, :responses, {partial: 'poll_responses/edit_example_response', target: ".example-responses-#{row_id}", locals: { poll_response: f.object.responses.build }, layout: :inline, child_index: 'added_response'}, class: 'btn btn-success', id: "add-response" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# helpful functions for debugging and exploration | ||
|
||
module CoreExtensions | ||
module ConsoleMethods | ||
def unique_methods(thing) | ||
(thing.public_methods - Object.public_methods).sort | ||
end | ||
end | ||
end |