diff --git a/app/assets/stylesheets/internal/layout.scss b/app/assets/stylesheets/internal/layout.scss index 16a08dc9d..5b607cbad 100644 --- a/app/assets/stylesheets/internal/layout.scss +++ b/app/assets/stylesheets/internal/layout.scss @@ -52,6 +52,7 @@ } .broadcast-wrapper { + display: flex; position: relative; z-index: auto; } diff --git a/app/controllers/internal/broadcasts_controller.rb b/app/controllers/internal/broadcasts_controller.rb index d5adcf5a5..600217ac6 100644 --- a/app/controllers/internal/broadcasts_controller.rb +++ b/app/controllers/internal/broadcasts_controller.rb @@ -9,6 +9,10 @@ class Internal::BroadcastsController < Internal::ApplicationController end.order(title: :asc) end + def show + @broadcast = Broadcast.find(params[:id]) + end + def new @broadcast = Broadcast.new end @@ -22,7 +26,7 @@ class Internal::BroadcastsController < Internal::ApplicationController if @broadcast.save flash[:success] = "Broadcast has been created!" - redirect_to internal_broadcasts_path + redirect_to internal_broadcast_path(@broadcast) else flash[:danger] = @broadcast.errors.full_messages.to_sentence render new_internal_broadcast_path @@ -34,7 +38,7 @@ class Internal::BroadcastsController < Internal::ApplicationController if @broadcast.update(broadcast_params) flash[:success] = "Broadcast has been updated!" - redirect_to internal_broadcasts_path + redirect_to internal_broadcast_path(@broadcast) else flash[:danger] = @broadcast.errors.full_messages.to_sentence render :edit diff --git a/app/views/internal/broadcasts/_form.html.erb b/app/views/internal/broadcasts/_form.html.erb index 3816ade84..98888bd3d 100644 --- a/app/views/internal/broadcasts/_form.html.erb +++ b/app/views/internal/broadcasts/_form.html.erb @@ -17,17 +17,4 @@ <%= label_tag :active, "Active:" %> <%= select_tag :active, options_for_select([false, true], selected: @broadcast.active) %> -
- -<% if @broadcast.processed_html %> -
-

Preview

- -

Please note: announcement broadcasts will render directly below the nav bar once activated.

-
-<% end %>
diff --git a/app/views/internal/broadcasts/edit.html.erb b/app/views/internal/broadcasts/edit.html.erb index 5158e09a5..9cda44ba6 100644 --- a/app/views/internal/broadcasts/edit.html.erb +++ b/app/views/internal/broadcasts/edit.html.erb @@ -5,6 +5,5 @@ <%= render "form" %> <%= submit_tag "Update Broadcast", class: "btn btn-primary float-right" %> <% end %> - <%= link_to "Destroy Broadcast", url_for(action: :destroy, id: @broadcast.id), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %>
diff --git a/app/views/internal/broadcasts/index.html.erb b/app/views/internal/broadcasts/index.html.erb index 3b3ab014a..773d07e72 100644 --- a/app/views/internal/broadcasts/index.html.erb +++ b/app/views/internal/broadcasts/index.html.erb @@ -19,30 +19,29 @@ -
-
-
Note: You must ensure that your Broadcast is active in order for it to be sent to users!
-
- <% @broadcasts.each do |broadcast| %> - -

Title: <%= broadcast.title %>

-

Broadcast Type: <%= broadcast.type_of %>

-

Content:

-

- <%= broadcast.processed_html %> -

-

Last Active On: <%= broadcast.active_status_updated_at&.strftime("%b %d, %Y %H:%M UTC") %>

-

Status:

-

- "> +
Note: You must ensure that your Broadcast is active in order for it to be sent to users!
+ + + + + + + + + + <% @broadcasts.each do |broadcast| %> + + + + + <% end %> + +
TitleStatus
<%= link_to broadcast.title, internal_broadcast_path(broadcast.id) %> +
+
"> <%= broadcast.active? ? "Active" : "Inactive" %> - - Broadcast Status -
- - <% end %> - - - + + +
<%= csrf_meta_tags %> diff --git a/app/views/internal/broadcasts/show.html.erb b/app/views/internal/broadcasts/show.html.erb new file mode 100644 index 000000000..7b2ecb7f3 --- /dev/null +++ b/app/views/internal/broadcasts/show.html.erb @@ -0,0 +1,39 @@ +
+
+
+ +

Title: <%= @broadcast.title %>

+

Broadcast Type: <%= @broadcast.type_of %>

+

Content:

+

+ <%= @broadcast.processed_html %> +

+

Last Active On: <%= @broadcast.active_status_updated_at&.strftime("%b %d, %Y %H:%M UTC") %>

+

Status:

+

+ "> + <%= @broadcast.active? ? "Active" : "Inactive" %> + + Broadcast Status +

+
+
+ <% if @broadcast.processed_html %> +
+

Preview

+ +

Please note: announcement broadcasts will render directly below the nav bar once activated.

+
+ <% end %> +
+ <%= link_to "Destroy Broadcast", url_for(action: :destroy, id: @broadcast.id), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %> + <%= link_to "Edit Broadcast", edit_internal_broadcast_path, class: "btn btn-primary float-right" %> +
+
+
+ +<%= csrf_meta_tags %> diff --git a/config/routes.rb b/config/routes.rb index cf0e455fa..6d49c5be9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,7 +46,7 @@ Rails.application.routes.draw do end resources :articles, only: %i[index show update] - resources :broadcasts, only: %i[index new create edit update destroy] + resources :broadcasts resources :buffer_updates, only: %i[create update] resources :listings, only: %i[index edit update destroy] resources :comments, only: [:index]