Added settings page for deleting scheduled statuses

This commit is contained in:
mgabdev 2019-09-18 20:33:03 -04:00
parent 3fe4a75b85
commit 67821442da
5 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,33 @@
# frozen_string_literal: true
class Settings::ScheduledStatusesController < Settings::BaseController
layout 'admin'
before_action :authenticate_user!
before_action :set_account
before_action :set_scheduled_statuses, only: :index
before_action :set_scheduled_status, only: :destroy
def index
@scheduled_statuses
end
def destroy
@scheduled_status.destroy!
redirect_to settings_scheduled_statuses_path
end
private
def set_account
@account = current_user.account
end
def set_scheduled_statuses
@scheduled_statuses = @account.scheduled_statuses
end
def set_scheduled_status
@scheduled_status = @account.scheduled_statuses.find(params[:id])
end
end

View File

@ -0,0 +1,30 @@
- content_for :page_title do
= t('settings.scheduled_posts')
- unless @account.is_pro?
%span= t('scheduled_statuses.upgrade_to_pro_to_schedule_statuses')
%br
%br
= link_to "Upgrade to GabPRO", 'https://pro.gab.com', :class => "button"
%br
%br
- if @scheduled_statuses.empty?
%span= t('scheduled_statuses.no_scheduled_statuses_to_display')
- else
.table-wrapper
%table.table
%thead
%tr
%th= t('scheduled_statuses.id')
%th= t('scheduled_statuses.scheduled_at')
%th= t('scheduled_statuses.text')
%th
%tbody
- @scheduled_statuses.each do |scheduled_status|
%tr
%td= scheduled_status.id
%td= scheduled_status.scheduled_at
%td= scheduled_status.params['text']
%td
= table_link_to 'trash', t('scheduled_statuses.delete'), settings_scheduled_status_path(scheduled_status), method: :delete

View File

@ -903,7 +903,11 @@ en:
profile: Profile profile: Profile
relationships: Follows and followers relationships: Follows and followers
two_factor_authentication: Two-factor Auth two_factor_authentication: Two-factor Auth
posts: Posts
scheduled_posts: Scheduled Posts
statuses: statuses:
are_you_sure: 'Are you sure?'
scheduled_title: 'Schedule'
attached: attached:
description: 'Attached: %{attached}' description: 'Attached: %{attached}'
image: image:

View File

@ -20,6 +20,10 @@ SimpleNavigation::Configuration.run do |navigation|
s.item :authorized_apps, safe_join([fa_icon('list fw'), t('settings.authorized_apps')]), oauth_authorized_applications_url s.item :authorized_apps, safe_join([fa_icon('list fw'), t('settings.authorized_apps')]), oauth_authorized_applications_url
end end
n.item :posts, safe_join([fa_icon('bars fw'), t('settings.posts')]), settings_scheduled_statuses_url do |s|
s.item :scheduled_posts, safe_join([fa_icon('calendar fw'), t('settings.scheduled_posts')]), settings_scheduled_statuses_url
end
n.item :requests, safe_join([fa_icon('id-card-o fw'), t('verifications.requests.title')]), settings_verifications_requests_url n.item :requests, safe_join([fa_icon('id-card-o fw'), t('verifications.requests.title')]), settings_verifications_requests_url
n.item :billing, safe_join([fa_icon('usd fw'), t('settings.billing')]), settings_billing_transactions_url do |s| n.item :billing, safe_join([fa_icon('usd fw'), t('settings.billing')]), settings_billing_transactions_url do |s|

View File

@ -90,7 +90,7 @@ Rails.application.routes.draw do
end end
resources :promotions, only: [:index, :new, :create, :edit, :update, :destroy] resources :promotions, only: [:index, :new, :create, :edit, :update, :destroy]
namespace :verifications do namespace :verifications do
get :moderation, to: 'moderation#index', as: :moderation get :moderation, to: 'moderation#index', as: :moderation
get 'moderation/:id/approve', to: 'moderation#approve', as: :approve get 'moderation/:id/approve', to: 'moderation#approve', as: :approve
@ -127,6 +127,7 @@ Rails.application.routes.draw do
resources :sessions, only: [:destroy] resources :sessions, only: [:destroy]
resources :featured_tags, only: [:index, :create, :destroy] resources :featured_tags, only: [:index, :create, :destroy]
resources :scheduled_statuses, only: [:index, :destroy]
end end
resources :media, only: [:show] do resources :media, only: [:show] do