mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-27 02:28:50 +01:00
Move translation viewing to admin namespace
This commit is contained in:
4
app/controllers/admin/dashboard_controller.rb
Normal file
4
app/controllers/admin/dashboard_controller.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class Admin::DashboardController < AdminController
|
||||
def index
|
||||
end
|
||||
end
|
||||
18
app/controllers/admin/translations_controller.rb
Normal file
18
app/controllers/admin/translations_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Admin::TranslationsController < AdminController
|
||||
before_action :set_translation, only: :show
|
||||
|
||||
# GET /translations
|
||||
# GET /translations.json
|
||||
def index
|
||||
@translations = Translation.paginate(page: params[:page])
|
||||
end
|
||||
|
||||
# GET /translations/1
|
||||
# GET /translations/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
def set_translation
|
||||
@translation = Translation.find(params[:id])
|
||||
end
|
||||
end
|
||||
3
app/controllers/admin_controller.rb
Normal file
3
app/controllers/admin_controller.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class AdminController < ApplicationController
|
||||
before_action :authenticate_admin!
|
||||
end
|
||||
@@ -2,5 +2,4 @@ class ApplicationController < ActionController::Base
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
before_action :authenticate_admin!
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class ProblemsController < ApplicationController
|
||||
skip_before_action :authenticate_admin!, only: [:index, :show]
|
||||
before_action :set_problem, only: [:show]
|
||||
|
||||
def index
|
||||
|
||||
@@ -1,19 +1,6 @@
|
||||
class TranslationsController < ApplicationController
|
||||
skip_before_action :authenticate_admin!, only: [:new, :create]
|
||||
before_action :set_translation, only: :show
|
||||
before_action :set_problem, only: [:new, :create]
|
||||
|
||||
# GET /translations
|
||||
# GET /translations.json
|
||||
def index
|
||||
@translations = Translation.paginate(page: params[:page])
|
||||
end
|
||||
|
||||
# GET /translations/1
|
||||
# GET /translations/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /translations/new
|
||||
def new
|
||||
@translation = @problem.translations.build
|
||||
@@ -40,11 +27,6 @@ class TranslationsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_translation
|
||||
@translation = Translation.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def translation_params
|
||||
params.require(:translation).permit(:title, :content)
|
||||
|
||||
Reference in New Issue
Block a user