Skip to content

Commit

Permalink
create view
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazingRockStorm committed Aug 19, 2024
1 parent 0ae22c3 commit e13b1b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
14 changes: 14 additions & 0 deletions app/views/admin/genres/_form.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
= form_with model: [:admin, @genre], local: true do |form|
- if @genre.errors.any?
.alert.alert-danger
h2 = "#{pluralize(@genre.errors.count, "error")} prohibited this genre from being saved:"
ul
- @genre.errors.each do |error|
li = error.full_message

.mb-3
= form.label :name, class: 'form-label'
= form.text_field :name, class: 'form-control'

div
= form.submit 'Create Genre', class: 'btn btn-primary'
15 changes: 1 addition & 14 deletions app/views/admin/genres/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,7 @@
main.col-md-9.col-lg-10.mt-2.mb-2
h1 New genre

= form_with scope: :genre, url: admin_genres_path do |form|
- if @genre.errors.any?
.alert.alert-danger
h2 = "#{pluralize(@genre.errors.count, "error")} prohibited this genre from being saved:"
ul
- @genre.errors.each do |error|
li = error.full_message

.mb-3
= form.label :name, class: 'form-label'
= form.text_field :name, class: 'form-control'

div
= form.submit 'Create Genre', class: 'btn btn-primary'
== render "form", genre: @genre

br

Expand Down

0 comments on commit e13b1b1

Please sign in to comment.