Updated routes for admins dashboard

• Updated:
- routes for admins dashboard (expenses, group categories, promotions, trending hashtags) that were in the /settings path but are now in the /admin path
- /filters to be in /settings/filters

• Removed:
- authorize_follow route
This commit is contained in:
mgabdev
2021-01-13 18:06:45 -05:00
parent 27389883dd
commit 8aeae9c45d
21 changed files with 50 additions and 53 deletions

View File

@@ -1,11 +1,11 @@
class Settings::ExpensesController < Admin::BaseController
class Admin::ExpensesController < Admin::BaseController
def index
@amount = Redis.current.get("monthly_funding_amount") || 0
end
def create
Redis.current.set("monthly_funding_amount", params[:amount])
redirect_to settings_expenses_path
redirect_to admin_expenses_path
end
end

View File

@@ -1,4 +1,4 @@
class Settings::GroupCategoriesController < Admin::BaseController
class Admin::GroupCategoriesController < Admin::BaseController
before_action :set_category, except: [:index, :new, :create]
def index
@@ -14,7 +14,7 @@ class Settings::GroupCategoriesController < Admin::BaseController
if @category.save
log_action :create, @category
redirect_to settings_group_categories_path, notice: I18n.t('promotions.created_msg')
redirect_to admin_group_categories_path, notice: I18n.t('promotions.created_msg')
else
render :new
end
@@ -24,7 +24,7 @@ class Settings::GroupCategoriesController < Admin::BaseController
@category.destroy!
log_action :destroy, @category
flash[:notice] = I18n.t('promotions.destroyed_msg')
redirect_to settings_group_categories_path
redirect_to admin_group_categories_path
end
private

View File

@@ -1,4 +1,4 @@
class Settings::PromotionsController < Admin::BaseController
class Admin::PromotionsController < Admin::BaseController
before_action :set_promotion, except: [:index, :new, :create]
def index
@@ -14,7 +14,7 @@ class Settings::PromotionsController < Admin::BaseController
if @promotion.save
log_action :create, @promotion
redirect_to settings_promotions_path, notice: I18n.t('promotions.created_msg')
redirect_to admin_promotions_path, notice: I18n.t('promotions.created_msg')
else
render :new
end
@@ -30,14 +30,14 @@ class Settings::PromotionsController < Admin::BaseController
else
flash[:alert] = I18n.t('promotions.update_failed_msg')
end
redirect_to settings_promotions_path
redirect_to admin_promotions_path
end
def destroy
@promotion.destroy!
log_action :destroy, @promotion
flash[:notice] = I18n.t('promotions.destroyed_msg')
redirect_to settings_promotions_path
redirect_to admin_promotions_path
end
private

View File

@@ -1,10 +1,10 @@
class Settings::TrendingHashtagsController < Admin::BaseController
class Admin::TrendingHashtagsController < Admin::BaseController
def index
@trending_hashtags = Redis.current.get("admin_trending_hashtags") || ''
end
def create
Redis.current.set("admin_trending_hashtags", params[:trending_hashtags])
redirect_to settings_trending_hashtags_path
redirect_to admin_trending_hashtags_path
end
end

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class FiltersController < ApplicationController
class Settings::FiltersController < Settings::BaseController
include Authorization
layout 'admin'
@@ -8,6 +8,7 @@ class FiltersController < ApplicationController
before_action :set_filters, only: :index
before_action :set_filter, only: [:edit, :update, :destroy]
before_action :set_body_classes
before_action :authenticate_user!
def index
@filters = current_account.custom_filters
@@ -21,7 +22,7 @@ class FiltersController < ApplicationController
@filter = current_account.custom_filters.build(resource_params)
if @filter.save
redirect_to filters_path
redirect_to settings_filters_path
else
render action: :new
end
@@ -31,7 +32,7 @@ class FiltersController < ApplicationController
def update
if @filter.update(resource_params)
redirect_to filters_path
redirect_to settings_filters_path
else
render action: :edit
end
@@ -39,7 +40,7 @@ class FiltersController < ApplicationController
def destroy
@filter.destroy
redirect_to filters_path
redirect_to settings_filters_path
end
private

View File

@@ -1,6 +1,6 @@
- content_for :page_title do
= t('monthly_funding.title')
= form_tag settings_expenses_url, :method => :post do
= form_tag admin_expenses_url, :method => :post do
= text_field_tag "amount", "", placeholder: "0-100", :value => @amount
= submit_tag "Submit"

View File

@@ -0,0 +1,5 @@
%tr
%td= group_categories.created_at
%td= group_categories.text
%td
= table_link_to 'trash', t('group_categories.delete'), admin_group_categories_url(group_categories), method: :delete

View File

@@ -1,7 +1,7 @@
- content_for :page_title do
= t('group_categories.title')
= form_tag settings_group_categories_url, method: 'POST', class: 'simple_form' do
= form_tag admin_group_categories_url, method: 'POST', class: 'simple_form' do
.fields-group
.input.string.optional
= text_field_tag :text, params[:text], class: 'string optional', placeholder: I18n.t("group_categories.text")

View File

@@ -0,0 +1,8 @@
%tr
%td= promotion.timeline_id
%td= promotion.status_id
%td= promotion.expires_at
%td= promotion.position
%td
= table_link_to 'pencil', t('promotions.edit'), edit_admin_promotion_path(promotion)
= table_link_to 'trash', t('promotions.delete'), admin_promotion_path(promotion), method: :delete, data: { confirm: t('settings.promotions.are_you_sure') }

View File

@@ -1,7 +1,7 @@
- content_for :page_title do
= t('promotions.title')
= simple_form_for @promotion, url: settings_promotion_path(@promotion) do |f|
= simple_form_for @promotion, url: admin_promotion_path(@promotion) do |f|
= render 'shared/error_messages', object: @promotion
.fields-group

View File

@@ -13,4 +13,4 @@
%tbody
= render @promotions
= link_to t('promotions.create'), new_settings_promotion_path, class: 'button'
= link_to t('promotions.create'), new_admin_promotion_path, class: 'button'

View File

@@ -1,7 +1,7 @@
- content_for :page_title do
= t('.title')
= simple_form_for @promotion, url: settings_promotions_path do |f|
= simple_form_for @promotion, url: admin_promotions_path do |f|
= render 'shared/error_messages', object: @promotion
.fields-group

View File

@@ -1,6 +1,6 @@
- content_for :page_title do
= 'Trending Hashtags'
= form_tag settings_trending_hashtags_url, :method => :post do
= form_tag admin_trending_hashtags_url, :method => :post do
= text_field_tag "trending_hashtags", "", :style => 'width:400px', placeholder: "StopTheSteal, Trump2020, Election2020", :value => @trending_hashtags
= submit_tag "Submit"

View File

@@ -1,7 +1,7 @@
- content_for :page_title do
= t('filters.edit.title')
= simple_form_for @filter, url: filter_path(@filter), method: :put do |f|
= simple_form_for @filter, url: settings_filter_path(@filter), method: :put do |f|
= render 'fields', f: f
.actions

View File

@@ -14,7 +14,7 @@
%td= filter.phrase
%td= filter.context.map { |context| I18n.t("filters.contexts.#{context}") }.join(', ')
%td
= table_link_to 'pencil', t('filters.edit.title'), edit_filter_path(filter)
= table_link_to 'times', t('filters.index.delete'), filter_path(filter), method: :delete
= table_link_to 'pencil', t('filters.edit.title'), edit_settings_filter_path(filter)
= table_link_to 'times', t('filters.index.delete'), settings_filter_path(filter), method: :delete
= link_to t('filters.new.title'), new_filter_path, class: 'button'
= link_to t('filters.new.title'), new_settings_filter_path, class: 'button'

View File

@@ -1,7 +1,7 @@
- content_for :page_title do
= t('filters.new.title')
= simple_form_for @filter, url: filters_path do |f|
= simple_form_for @filter, url: settings_filters_path do |f|
= render 'fields', f: f
.actions

View File

@@ -1,5 +0,0 @@
%tr
%td= group_categories.created_at
%td= group_categories.text
%td
= table_link_to 'trash', t('group_categories.delete'), settings_group_categories_path(group_categories), method: :delete

View File

@@ -1,8 +0,0 @@
%tr
%td= promotion.timeline_id
%td= promotion.status_id
%td= promotion.expires_at
%td= promotion.position
%td
= table_link_to 'pencil', t('promotions.edit'), edit_settings_promotion_path(promotion)
= table_link_to 'trash', t('promotions.delete'), settings_promotion_path(promotion), method: :delete, data: { confirm: t('settings.promotions.are_you_sure') }