fix MR comments

This commit is contained in:
Bilal
2020-08-26 14:35:56 +03:00
parent 73b48c5a5b
commit 70a0c77054
6 changed files with 10 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ class BroadcastRecordingsController < ApplicationController
before_action :set_recording
def update
@recording.update(star: !@recording.star)
@recording.toggle_star
set_recordings
end

View File

@@ -18,4 +18,8 @@ class BroadcastRecording < ApplicationRecord
def download_file_name
"#{broadcast_name}_Date_#{created_at.in_time_zone(broadcast.shoot_location_time_zone).strftime("%Y-%m-%d")}_Time_#{created_at.in_time_zone(broadcast.shoot_location_time_zone).strftime("%T")}".parameterize
end
def toggle_star
toggle! :starred
end
end

View File

@@ -1,5 +1,4 @@
var dom_id = "<%= dom_id(@recording) %>"
$('[data-id="' + dom_id + '"]').remove();
$('[data-id="<%= dom_id(@recording) %>"]').remove();
<% if @recordings.empty? %>
$("#broadcast_recordings_nav").append('<p class="dropdown-item text-muted">Recordings will appear here</p>')
<% end %>

View File

@@ -7,8 +7,8 @@
<% if (controller.class.module_parent.to_s != "Public" && policy(BroadcastRecording).destroy?) %>
<%= link_to "Hide", [broadcast.project, broadcast, recording], class: "btn-sm btn-primary ml-1 text-decoration-none", remote: true, method: :delete, data: { confirm: t('.confirm_hide') } %>
<% end %>
<% if (controller.class.module_parent.to_s != "Public" && policy(BroadcastRecording).destroy?) %>
<%= link_to fa_icon("#{recording.star ? 'star' : 'star-o'} fw"), [broadcast.project, broadcast, recording], class: "text-warning", method: :put, remote: true %>
<% if (controller.class.module_parent.to_s != "Public" && policy(BroadcastRecording).update?) %>
<%= link_to fa_icon("#{recording.starred ? 'star' : 'star-o'} fw"), [broadcast.project, broadcast, recording], class: "text-warning", method: :put, remote: true %>
<% end %>
</li>
<% end %>

View File

@@ -1,5 +1,5 @@
class AddStarToBroadcastRecordings < ActiveRecord::Migration[6.0]
def change
add_column :broadcast_recordings, :star, :boolean
add_column :broadcast_recordings, :starred, :boolean, default: false
end
end

View File

@@ -542,7 +542,7 @@ CREATE TABLE public.broadcast_recordings (
updated_at timestamp(6) without time zone NOT NULL,
duration double precision,
hidden boolean DEFAULT false,
star boolean
starred boolean DEFAULT false
);