-
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
543e670
commit ade6880
Showing
3 changed files
with
60 additions
and
137 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
= form_with model: [:admin, @song], local: true do |form| | ||
- if @song.errors.any? | ||
.alert.alert-danger | ||
h2 = "#{pluralize(@song.errors.count, "error")} prohibited this song from being saved:" | ||
ul | ||
- @song.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 :link, class: 'form-label' | ||
= form.text_field :link, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :tempo, class: 'form-label' | ||
= form.number_field :tempo, class: 'form-control' | ||
|
||
= form.fields_for :artists_songs_attributes do |artists_song| | ||
/ Main Artist. | ||
.mb-3 | ||
= artists_song.label 'Main Artist', class: 'form-label' | ||
= select_tag 'song[artists_songs_attributes][][artist_id]', options_from_collection_for_select(Artist.all, 'id', 'name'), class: 'form-control' | ||
= hidden_field_tag 'song[artists_songs_attributes][][artist_type]', 'main' | ||
|
||
div[data-controller='artists-songs'] | ||
= button_tag 'Add Featuring Artist', type: 'button', data: { action: 'artists-songs#addFeaturingArtist' }, class: 'btn btn-link mb-3' | ||
div[data-artists-songs-target='featuringArtistsList'] | ||
.featuring-field-template[style="display: none;"] | ||
/ Feature Artist. | ||
.mb-3[data-artists-songs-target='featuringArtist'] | ||
.row | ||
.col-md-10.offset-md-1 | ||
= artists_song.label 'Featuring Artist', class: 'form-label' | ||
= select_tag 'song[artists_songs_attributes][][artist_id]', options_from_collection_for_select(Artist.all, 'id', 'name'), class: 'form-control', disabled: true | ||
= hidden_field_tag 'song[artists_songs_attributes][][artist_type]', 'featuring', disabled: true | ||
= hidden_field_tag 'song[artists_songs_attributes][][_destroy]', '0', disabled: true | ||
|
||
.col-md-1 | ||
= button_tag '', type: 'button', data: { action: 'artists-songs#removeFeaturingArtist' }, class: 'btn btn-danger' do | ||
span.bi.bi-x-square-fill | ||
|
||
.mb-3 | ||
= form.label :genre_id, class: 'form-label' | ||
= form.select :genre_id, Genre.all.collect {|genre| [ genre.name, genre.id ] }, {}, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :album_id, class: 'form-label' | ||
= form.select :album_id, Album.all.collect {|album| [ album.name, album.id ] }, {}, class: 'form-control' | ||
|
||
.mb-3 | ||
= form.label :lyric, class: 'form-label' | ||
= form.text_area :lyric, class: 'form-control', rows: 20 | ||
|
||
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
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