-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0650aa4
commit 1099a08
Showing
4 changed files
with
31 additions
and
51 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
= form_with model: [:admin, @album], local: true do |form| | ||
- if @album.errors.any? | ||
.alert.alert-danger | ||
h2 = "#{pluralize(@album.errors.count, "error")} prohibited this album from being saved:" | ||
ul | ||
- @album.errors.each do |error| | ||
li = error.full_message | ||
|
||
.mb-3 | ||
= form.label :name, class: 'form-label' | ||
= form.text_field :name, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :artist_id, class: 'form-label' | ||
= form.select :artist_id, Artist.all.collect {|artist| [ artist.name, artist.id ] }, {}, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :release_year, class: 'form-label' | ||
= form.number_field :release_year, class: 'form-control' | ||
|
||
div | ||
= form.submit class: 'btn btn-primary' |
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,38 +1,17 @@ | ||
== render "layouts/navbar" | ||
== render 'layouts/navbar' | ||
|
||
.container-fluid | ||
.row.lyrics-site-content | ||
== render "layouts/sidebar" | ||
== render 'layouts/sidebar' | ||
|
||
main.col-md-9.col-lg-10.mt-2.mb-2 | ||
h1 Editing album | ||
|
||
= form_with scope: :album, url: admin_album_path(@album), method: :patch do |form| | ||
- if @album.errors.any? | ||
div.alert.alert-danger | ||
h2 = "#{pluralize(@album.errors.count, "error")} prohibited this album from being saved:" | ||
ul | ||
- @album.errors.each do |error| | ||
li = error.full_message | ||
|
||
.mb-3 | ||
= form.label :name, class: 'form-label' | ||
= form.text_field :name, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :artist_id, class: 'form-label' | ||
= form.select :artist_id, Artist.all.collect {|artist| [ artist.name, artist.id ] }, {}, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :release_year, class: 'form-label' | ||
= form.number_field :release_year, class: 'form-control' | ||
|
||
div | ||
= form.submit 'Save Album', class: 'btn btn-primary' | ||
== render 'form', album: @album | ||
|
||
br | ||
|
||
div | ||
= link_to "Back to albums", admin_albums_path, class: 'btn btn-secondary' | ||
= link_to 'Back to albums', admin_albums_path, class: 'btn btn-secondary' | ||
|
||
== render 'layouts/footer' |
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,38 +1,17 @@ | ||
== render "layouts/navbar" | ||
== render 'layouts/navbar' | ||
|
||
.container-fluid | ||
.row.lyrics-site-content | ||
== render "layouts/sidebar" | ||
== render 'layouts/sidebar' | ||
|
||
main.col-md-9.col-lg-10.mt-2.mb-2 | ||
h1 New album | ||
|
||
= form_with scope: :album, url: admin_albums_path do |form| | ||
- if @album.errors.any? | ||
.alert.alert-danger | ||
h2 = "#{pluralize(@album.errors.count, "error")} prohibited this album from being saved:" | ||
ul | ||
- @album.errors.each do |error| | ||
li = error.full_message | ||
|
||
.mb-3 | ||
= form.label :name, class: 'form-label' | ||
= form.text_field :name, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :artist_id, class: 'form-label' | ||
= form.select :artist_id, Artist.all.collect {|artist| [ artist.name, artist.id ] }, {}, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :release_year, class: 'form-label' | ||
= form.number_field :release_year, class: 'form-control' | ||
|
||
div | ||
= form.submit 'Create Album', class: 'btn btn-primary' | ||
== render 'form', album: @album | ||
|
||
br | ||
|
||
div | ||
= link_to "Back to albums", admin_albums_path, class: 'btn btn-secondary' | ||
= link_to 'Back to albums', admin_albums_path, class: 'btn btn-secondary' | ||
|
||
== render 'layouts/footer' |