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")) - provide(:title, generate_title("Edit announcement"))
.container.container--main .container.container--main
= bootstrap_form_for(@announcement, url: {action: "update"}, method: "PATCH") do |f| .card
- if @announcement.errors.any? .card-body
.row = bootstrap_form_for(@announcement, url: {action: "update"}, method: "PATCH") do |f|
.col-md-12 - if @announcement.errors.any?
.alert.alert-danger .row
%strong .col-md-12
= pluralize(@announcement.errors.count, "error") .alert.alert-danger
prohibited this announcement from being saved: %strong
%ul = pluralize(@announcement.errors.count, "error")
- @announcement.errors.full_messages.each do |err| prohibited this announcement from being saved:
%li= err %ul
.row - @announcement.errors.full_messages.each do |err|
.col-md-12 %li= err
= f.text_area :content, label: "Content" .row
.row .col-md-12
.col-md-6 = f.text_area :content, label: "Content"
= f.url_field :link_href, label: "Link URL" .row
.col-md-6 .col-md-6
= f.datetime_field :link_text, label: "Link text" = f.url_field :link_href, label: "Link URL"
.row .col-md-6
.col-md-6 = f.text_field :link_text, label: "Link text"
= f.datetime_field :starts_at, label: "Start time" .row
.col-md-6 .col-md-6
= f.datetime_field :ends_at, label: "End time" = 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" }
.row .col-md-6
.col-md-12.text-right = 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" }
= f.submit class: "btn btn-primary" .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")) - provide(:title, generate_title("Add new announcement"))
.container.container--main .container.container--main
= bootstrap_form_for(@announcement, url: {action: "create"}) do |f| .card
- if @announcement.errors.any? .card-body
.row = bootstrap_form_for(@announcement, url: {action: "create"}) do |f|
.col-md-12 - if @announcement.errors.any?
.alert.alert-danger .row
%strong .col-md-12
= pluralize(@announcement.errors.count, "error") .alert.alert-danger
prohibited this announcement from being saved: %strong
%ul = pluralize(@announcement.errors.count, "error")
- @announcement.errors.full_messages.each do |err| prohibited this announcement from being saved:
%li= err %ul
.row - @announcement.errors.full_messages.each do |err|
.col-md-12 %li= err
= f.text_area :content, label: "Content" .row
.row .col-md-12
.col-md-6 = f.text_area :content, label: "Content"
= f.url_field :link_href, label: "Link URL" .row
.col-md-6 .col-md-6
= f.datetime_field :link_text, label: "Link text" = f.url_field :link_href, label: "Link URL"
.row .col-md-6
.col-md-6 = f.text_field :link_text, label: "Link text"
= f.datetime_field :starts_at, label: "Start time" .row
.col-md-6 .col-md-6
= f.datetime_field :ends_at, label: "End time" = 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" }
.row .col-md-6
.col-md-12.text-right = 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" }
= f.submit class: "btn btn-primary" .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| - @active_announcements.each do |announcement|
.alert.alert-announcement.alert-info.alert-dismissable.hidden{ data: { 'announcement-id': announcement.id } } .alert.announcement.alert-info.alert-dismissable.hidden{ data: { 'announcement-id': announcement.id } }
%button.close{ type: "button", "data-dismiss" => "alert" } .container
%span{ "aria-hidden" => "true" } × %button.close{ type: "button", "data-dismiss" => "alert" }
%p= announcement.content %span{ "aria-hidden" => "true" } ×
- if announcement.link_present? %p
%a.alert-link{ href: announcement.link_href }= announcement.link_text = announcement.content
- if announcement.link_present?
%a.alert-link{ href: announcement.link_href }= announcement.link_text