diff --git a/app/controllers/announcement_controller.rb b/app/controllers/admin/announcement_controller.rb similarity index 95% rename from app/controllers/announcement_controller.rb rename to app/controllers/admin/announcement_controller.rb index aaeef949..91cab689 100644 --- a/app/controllers/announcement_controller.rb +++ b/app/controllers/admin/announcement_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AnnouncementController < ApplicationController +class Admin::AnnouncementController < ApplicationController before_action :authenticate_user! def index diff --git a/app/views/announcement/edit.html.haml b/app/views/admin/announcement/edit.html.haml similarity index 100% rename from app/views/announcement/edit.html.haml rename to app/views/admin/announcement/edit.html.haml diff --git a/app/views/announcement/index.html.haml b/app/views/admin/announcement/index.html.haml similarity index 100% rename from app/views/announcement/index.html.haml rename to app/views/admin/announcement/index.html.haml diff --git a/app/views/announcement/new.html.haml b/app/views/admin/announcement/new.html.haml similarity index 100% rename from app/views/announcement/new.html.haml rename to app/views/admin/announcement/new.html.haml diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 1716af30..4addae93 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -78,15 +78,16 @@ en: twitter: "Share on Twitter" tumblr: "Share on Tumblr" other: "Share on other apps..." - announcement: - index: - title: :activerecord.models.announcement.other - confirm_delete: "Are you sure you want to delete this announcement?" - new: "Add Announcement" - new: - title: "Create Announcement" - edit: - title: "Edit Announcement" + admin: + announcement: + index: + title: :activerecord.models.announcement.other + confirm_delete: "Are you sure you want to delete this announcement?" + new: "Add Announcement" + new: + title: "Create Announcement" + edit: + title: "Edit Announcement" answerbox: header: anon_hint: :inbox.entry.anon_hint diff --git a/config/routes.rb b/config/routes.rb index 2097567e..865740b7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,12 +13,12 @@ Rails.application.routes.draw do mount PgHero::Engine, at: "/pghero", as: "pghero" get "/admin", to: "admin/dashboard#index", as: :admin_dashboard - get "/admin/announcements", to: "announcement#index", as: :announcement_index - post "/admin/announcements", to: "announcement#create", as: :announcement_create - get "/admin/announcements/new", to: "announcement#new", as: :announcement_new - get "/admin/announcements/:id/edit", to: "announcement#edit", as: :announcement_edit - patch "/admin/announcements/:id", to: "announcement#update", as: :announcement_update - delete "/admin/announcements/:id", to: "announcement#destroy", as: :announcement_destroy + get "/admin/announcements", to: "admin/announcement#index", as: :announcement_index + post "/admin/announcements", to: "admin/announcement#create", as: :announcement_create + get "/admin/announcements/new", to: "admin/announcement#new", as: :announcement_new + get "/admin/announcements/:id/edit", to: "admin/announcement#edit", as: :announcement_edit + patch "/admin/announcements/:id", to: "admin/announcement#update", as: :announcement_update + delete "/admin/announcements/:id", to: "admin/announcement#destroy", as: :announcement_destroy end # Routes only accessible by moderators (moderation panel) diff --git a/spec/controllers/announcement_controller_spec.rb b/spec/controllers/admin/announcement_controller_spec.rb similarity index 98% rename from spec/controllers/announcement_controller_spec.rb rename to spec/controllers/admin/announcement_controller_spec.rb index 47251eb6..a751de51 100644 --- a/spec/controllers/announcement_controller_spec.rb +++ b/spec/controllers/admin/announcement_controller_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -describe AnnouncementController, type: :controller do +describe Admin::AnnouncementController, type: :controller do let(:user) { FactoryBot.create(:user, roles: [:administrator]) } describe "#index" do