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