Fix lints in app/views/announcement

This commit is contained in:
Andreas Nedbal 2020-05-10 14:29:10 +02:00
parent 60b892e74e
commit 7639c20f64
6 changed files with 94 additions and 78 deletions

View File

@ -0,0 +1,37 @@
- provide(:title, generate_title('Edit announcement'))
.container.container--main
.card
.card-body
= bootstrap_form_for(@announcement, url: { action: 'update' }, method: 'PATCH') do |f|
- if @announcement.errors.any?
.row
.col-md-12
.alert.alert-danger
%strong
= pluralize(@announcement.errors.count, 'error')
prohibited this announcement from being saved:
%ul
- @announcement.errors.full_messages.each do |err|
%li= err
.row
.col-md-12
= f.text_area :content, label: 'Content'
.row
.col-md-6
= f.url_field :link_href, label: 'Link URL'
.col-md-6
= f.text_field :link_text, label: 'Link text'
.row
.col-md-6
= f.datetime_field :starts_at,
label: 'Start time',
class: 'datetimepicker-input',
data: { toggle: 'datetimepicker', target: '#announcement_starts_at', 'date-format': 'YYYY-MM-DD hh:mm A' }
.col-md-6
= f.datetime_field :ends_at,
label: 'End time',
class: 'datetimepicker-input',
data: { toggle: 'datetimepicker', target: '#announcement_ends_at', 'date-format': 'YYYY-MM-DD hh:mm A' }
.row
.col-md-12.text-right
= f.submit class: 'btn btn-primary'

View File

@ -1,31 +0,0 @@
- provide(:title, generate_title("Edit announcement"))
.container.container--main
.card
.card-body
= bootstrap_form_for(@announcement, url: {action: "update"}, method: "PATCH") do |f|
- if @announcement.errors.any?
.row
.col-md-12
.alert.alert-danger
%strong
= pluralize(@announcement.errors.count, "error")
prohibited this announcement from being saved:
%ul
- @announcement.errors.full_messages.each do |err|
%li= err
.row
.col-md-12
= f.text_area :content, label: "Content"
.row
.col-md-6
= f.url_field :link_href, label: "Link URL"
.col-md-6
= f.text_field :link_text, label: "Link text"
.row
.col-md-6
= f.datetime_field :starts_at, label: "Start time", class: "datetimepicker-input", data: { toggle: "datetimepicker", target: "#announcement_starts_at", "date-format": "YYYY-MM-DD hh:mm A" }
.col-md-6
= f.datetime_field :ends_at, label: "End time", class: "datetimepicker-input", data: { toggle: "datetimepicker", target: "#announcement_ends_at", "date-format": "YYYY-MM-DD hh:mm A" }
.row
.col-md-12.text-right
= f.submit class: "btn btn-primary"

View File

@ -0,0 +1,20 @@
- provide(:title, generate_title('Announcements'))
.container.container--main
- @announcements.each do |announcement|
.card
.card-body
.d-flex.w-100.justify-content-between
%p.mb-3= announcement.content
%small.text-muted= announcement.starts_at
.d-flex.w-100
= link_to 'Edit', announcement_edit_path(id: announcement.id), class: 'btn btn-link text-primary'
= button_to 'Delete',
announcement_destroy_path(id: announcement.id),
method: :delete,
class: 'btn btn-link text-danger',
confirm: 'Are you sure you want to delete this announcement?'
.row
.col-md-12
= link_to 'Add new', :announcement_new, class: 'btn btn-primary'

View File

@ -1,16 +0,0 @@
- provide(:title, generate_title("Announcements"))
.container.container--main
- @announcements.each do |announcement|
.card
.card-body
.d-flex.w-100.justify-content-between
%p.mb-3= announcement.content
%small.text-muted= announcement.starts_at
.d-flex.w-100
= link_to "Edit", announcement_edit_path(id: announcement.id), class: 'btn btn-link text-primary'
= button_to "Delete", announcement_destroy_path(id: announcement.id), method: :delete, class: 'btn btn-link text-danger', confirm: 'Are you sure you want to delete this announcement?'
.row
.col-md-12
= link_to "Add new", :announcement_new, class: "btn btn-primary"

View File

@ -0,0 +1,37 @@
- provide(:title, generate_title('Add new announcement'))
.container.container--main
.card
.card-body
= bootstrap_form_for(@announcement, url: { action: 'create' }) do |f|
- if @announcement.errors.any?
.row
.col-md-12
.alert.alert-danger
%strong
= pluralize(@announcement.errors.count, 'error')
prohibited this announcement from being saved:
%ul
- @announcement.errors.full_messages.each do |err|
%li= err
.row
.col-md-12
= f.text_area :content, label: 'Content'
.row
.col-md-6
= f.url_field :link_href, label: 'Link URL'
.col-md-6
= f.text_field :link_text, label: 'Link text'
.row
.col-md-6
= f.datetime_field :starts_at,
label: 'Start time',
class: 'datetimepicker-input',
data: { toggle: 'datetimepicker', target: '#announcement_starts_at', 'date-format': 'YYYY-MM-DD hh:mm A' }
.col-md-6
= f.datetime_field :ends_at,
label: 'End time',
class: 'datetimepicker-input',
data: { toggle: 'datetimepicker', target: '#announcement_ends_at', 'date-format': 'YYYY-MM-DD hh:mm A' }
.row
.col-md-12.text-right
= f.submit class: 'btn btn-primary'

View File

@ -1,31 +0,0 @@
- provide(:title, generate_title("Add new announcement"))
.container.container--main
.card
.card-body
= bootstrap_form_for(@announcement, url: {action: "create"}) do |f|
- if @announcement.errors.any?
.row
.col-md-12
.alert.alert-danger
%strong
= pluralize(@announcement.errors.count, "error")
prohibited this announcement from being saved:
%ul
- @announcement.errors.full_messages.each do |err|
%li= err
.row
.col-md-12
= f.text_area :content, label: "Content"
.row
.col-md-6
= f.url_field :link_href, label: "Link URL"
.col-md-6
= f.text_field :link_text, label: "Link text"
.row
.col-md-6
= f.datetime_field :starts_at, label: "Start time", class: "datetimepicker-input", data: { toggle: "datetimepicker", target: "#announcement_starts_at", "date-format": "YYYY-MM-DD hh:mm A" }
.col-md-6
= f.datetime_field :ends_at, label: "End time", class: "datetimepicker-input", data: { toggle: "datetimepicker", target: "#announcement_ends_at", "date-format": "YYYY-MM-DD hh:mm A" }
.row
.col-md-12.text-right
= f.submit class: "btn btn-primary"