Skip to content

Commit

Permalink
Merge pull request #1726 from codebar/migrate-admin-announcements-pag…
Browse files Browse the repository at this point in the history
…es-to-bootstrap

Migrate admin edit announcements page to Bootstrap 5, add Edit buttons to announcements index page
  • Loading branch information
matyikriszta committed Apr 5, 2022
2 parents 34f63fe + 6f5cd27 commit c13c8d4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 36 deletions.
11 changes: 7 additions & 4 deletions app/views/admin/announcements/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#container
.row
.large-12.columns
.container-fluid
.row.mb-4
.col
%h1 Edit announcement
.row.mb-4
.col
= simple_form_for [:admin, @announcement] do |f|
= f.association :groups, label_method: :to_s
= f.input :message
= f.input :expires_at, as: :string
= f.submit :update, class: 'button tiny'
= f.button :button, :update, class: 'btn btn-primary'
58 changes: 29 additions & 29 deletions app/views/admin/announcements/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
.container-fluid
.row.mb-3
.row.mb-4
.col
%h1 Announcements
.row
.row.border-bottom.border-primary
.col
.row.border-bottom.border-primary
.col-3
%p.mb-2 Created by
.col-3
%p.mb-2 Message
.col-3
%p.mb-2 Groups
.col-3
%p.mb-2 Expires at
- @announcements.each do |announcement|
.row.mt-3
.col-3
.row
.col-2
= image_tag(announcement.created_by.avatar(24), alt: announcement.created_by.full_name)
.col-10
%p= announcement.created_by.full_name
.col-3
= dot_markdown(announcement.message)
.col-3
%ul
- announcement.groups.each do |group|
%li
%p.mb-2= group.to_s
.col-3
- if announcement.expires_at.present?
%p=l(announcement.expires_at, format: :date)
%p.mb-2 Created by
.col-4
%p.mb-2 Message
.col
%p.mb-2 Groups
.col
%p.mb-2 Expires at
.col
%p.mb-2 Edit
- @announcements.each do |announcement|
.row.mt-3
.col
.d-flex.align-items-start
= image_tag(announcement.created_by.avatar(25), alt: announcement.created_by.full_name)
%p.ml-2.mb-0= announcement.created_by.full_name
.col-4
= dot_markdown(announcement.message)
.col
%ul
- announcement.groups.each do |group|
%li
%p.mb-2= group.to_s
.col
- if announcement.expires_at.present?
%p= l(announcement.expires_at, format: :date)
.col
= link_to 'Edit', edit_admin_announcement_path(announcement), class: 'border-0'
6 changes: 3 additions & 3 deletions app/views/admin/announcements/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.container-fluid
.row
.row.mb-4
.col
%h1 New Announcement
%h1 New announcement
.row.mb-4
.col
= simple_form_for [:admin, @announcement] do |f|
= f.association :groups, label_method: :to_s
= f.input :message
= f.input :expires_at, as: :string
= f.submit :create, class: 'btn btn-primary'
= f.button :button, :create, class: 'btn btn-primary'

0 comments on commit c13c8d4

Please sign in to comment.