-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related to #52 Modify the `app/views/mythologies/_form.html.erb` file to include the form for adding a new mythology. * Add `name` and `description` fields to the form. * Add a submit button to save the new mythology. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/mattlindsey/mythographer/issues/52?shareId=XXXX-XXXX-XXXX-XXXX).
- Loading branch information
1 parent
dbef2b9
commit dd00f15
Showing
4 changed files
with
48 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
<%= form.hidden_field :id %> | ||
<div class="nested-form-wrapper" data-new-record="<%= form.object.new_record? %>"> | ||
<%= form.input mythology_id, collection: @mythologies, label_method: :name, value_method: :id, | ||
default: @mythologies.first, | ||
input_html: { class: 'rounded', style: 'margin-left: 62px;' } %> | ||
<%= f.input :description, | ||
input_html: { class: 'rounded mt-5', style: 'margin-left: 7px;' } %> | ||
<%= simple_form_for @mythology do |f| %> | ||
<% if @mythology.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@mythology.errors.count, "error") %> prohibited this mythology from being saved:</h2> | ||
<ul> | ||
<% @mythology.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<button type="button" data-action="nested-form#remove">Remove mythology</button> | ||
<%= form.hidden_field :_destroy %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :name %> | ||
<%= f.text_field :name %> | ||
</div> | ||
|
||
<div class="field"> | ||
<%= f.label :description %> | ||
<%= f.text_area :description %> | ||
</div> | ||
|
||
<div class="actions"> | ||
<%= f.submit "Save Mythology" %> | ||
</div> | ||
<% end %> |
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