Commit 67821442 authored by mgabdev's avatar mgabdev

Added settings page for deleting scheduled statuses

parent 3fe4a75b
# 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
\ No newline at end of file
- 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
......@@ -903,7 +903,11 @@ en:
profile: Profile
relationships: Follows and followers
two_factor_authentication: Two-factor Auth
posts: Posts
scheduled_posts: Scheduled Posts
statuses:
are_you_sure: 'Are you sure?'
scheduled_title: 'Schedule'
attached:
description: 'Attached: %{attached}'
image:
......
......@@ -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
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 :billing, safe_join([fa_icon('usd fw'), t('settings.billing')]), settings_billing_transactions_url do |s|
......
......@@ -90,7 +90,7 @@ Rails.application.routes.draw do
end
resources :promotions, only: [:index, :new, :create, :edit, :update, :destroy]
namespace :verifications do
get :moderation, to: 'moderation#index', as: :moderation
get 'moderation/:id/approve', to: 'moderation#approve', as: :approve
......@@ -127,6 +127,7 @@ Rails.application.routes.draw do
resources :sessions, only: [:destroy]
resources :featured_tags, only: [:index, :create, :destroy]
resources :scheduled_statuses, only: [:index, :destroy]
end
resources :media, only: [:show] do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment