mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-27 02:28:50 +01:00
Prefill original title and content from projecteuler.net
This commit is contained in:
@@ -1,16 +1,11 @@
|
||||
class Admin::DashboardController < AdminController
|
||||
def index
|
||||
@current_problem_count = Problem.count
|
||||
@most_recent_pull = Problem.maximum(:pulled_at)
|
||||
end
|
||||
|
||||
def update_problem_count
|
||||
begin
|
||||
new_problem_count = params[:problem_count].to_i
|
||||
raise t('no_problem_count') unless new_problem_count
|
||||
Problem.update_count(new_problem_count)
|
||||
redirect_to({:controller => 'admin/dashboard', :action => :index}, notice: t('.success_message'))
|
||||
rescue => e
|
||||
redirect_to({:controller => 'admin/dashboard', :action => :index}, alert: t('.failure_message', error: e.message))
|
||||
end
|
||||
def pull_problems
|
||||
PullProblemsJob.perform_later
|
||||
redirect_to({:controller => 'admin/dashboard', :action => :index}, notice: t('.pull_problems_initiated'))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,9 +7,6 @@ class ProblemsController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
unless @problem.is_translated?
|
||||
render action: "untranslated"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -8,6 +8,9 @@ class TranslationsController < ApplicationController
|
||||
if @problem.is_translated?
|
||||
@translation.title = @problem.translation.title
|
||||
@translation.content = @problem.translation.content
|
||||
else
|
||||
@translation.title = @problem.original_title
|
||||
@translation.content = @problem.original_content
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user