Update announcement styling and adjust announcement views

This commit is contained in:
Andreas Nedbal 2020-05-07 19:30:13 +02:00
parent 501a2cce42
commit 5d63d0ba27
4 changed files with 83 additions and 61 deletions

View File

@ -0,0 +1,16 @@
.announcement {
width: 100%;
border-radius: 0;
text-align: center;
p {
margin-bottom: 0;
}
&__container {
position: fixed;
top: $navbar-height;
width: 100%;
z-index: 1024;
}
}

View File

@ -1,29 +1,31 @@
- provide(:title, generate_title("Edit announcement"))
.container.container--main
= 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.datetime_field :link_text, label: "Link text"
.row
.col-md-6
= f.datetime_field :starts_at, label: "Start time"
.col-md-6
= f.datetime_field :ends_at, label: "End time"
.row
.col-md-12.text-right
= f.submit class: "btn btn-primary"
.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,29 +1,31 @@
- provide(:title, generate_title("Add new announcement"))
.container.container--main
= 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.datetime_field :link_text, label: "Link text"
.row
.col-md-6
= f.datetime_field :starts_at, label: "Start time"
.col-md-6
= f.datetime_field :ends_at, label: "End time"
.row
.col-md-12.text-right
= f.submit class: "btn btn-primary"
.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,8 +1,10 @@
.container.announcements
.announcement__container
- @active_announcements.each do |announcement|
.alert.alert-announcement.alert-info.alert-dismissable.hidden{ data: { 'announcement-id': announcement.id } }
%button.close{ type: "button", "data-dismiss" => "alert" }
%span{ "aria-hidden" => "true" } ×
%p= announcement.content
- if announcement.link_present?
%a.alert-link{ href: announcement.link_href }= announcement.link_text
.alert.announcement.alert-info.alert-dismissable.hidden{ data: { 'announcement-id': announcement.id } }
.container
%button.close{ type: "button", "data-dismiss" => "alert" }
%span{ "aria-hidden" => "true" } ×
%p
= announcement.content
- if announcement.link_present?
%a.alert-link{ href: announcement.link_href }= announcement.link_text