1
0
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:
2015-02-16 09:37:13 +01:00
parent 49c7d97a41
commit 6b463417ba
26 changed files with 96 additions and 39 deletions

View File

@@ -0,0 +1,4 @@
class Admin::DashboardController < AdminController
def index
end
end

View 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

View File

@@ -0,0 +1,3 @@
class AdminController < ApplicationController
before_action :authenticate_admin!
end

View File

@@ -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

View File

@@ -1,5 +1,4 @@
class ProblemsController < ApplicationController
skip_before_action :authenticate_admin!, only: [:index, :show]
before_action :set_problem, only: [:show]
def index

View File

@@ -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)