mirror of
https://github.com/projekteuler/projekteuler.git
synced 2025-12-10 08:46:41 +01:00
Remove edit, update, destroy actions for translations
This commit is contained in:
parent
2b812f297d
commit
3cfb19a009
@ -1,5 +1,5 @@
|
|||||||
class TranslationsController < ApplicationController
|
class TranslationsController < ApplicationController
|
||||||
before_action :set_translation, only: [:show, :edit, :update, :destroy]
|
before_action :set_translation, only: :show
|
||||||
|
|
||||||
# GET /translations
|
# GET /translations
|
||||||
# GET /translations.json
|
# GET /translations.json
|
||||||
@ -17,10 +17,6 @@ class TranslationsController < ApplicationController
|
|||||||
@translation = Translation.new
|
@translation = Translation.new
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /translations/1/edit
|
|
||||||
def edit
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /translations
|
# POST /translations
|
||||||
# POST /translations.json
|
# POST /translations.json
|
||||||
def create
|
def create
|
||||||
@ -37,30 +33,6 @@ class TranslationsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# PATCH/PUT /translations/1
|
|
||||||
# PATCH/PUT /translations/1.json
|
|
||||||
def update
|
|
||||||
respond_to do |format|
|
|
||||||
if @translation.update(translation_params)
|
|
||||||
format.html { redirect_to @translation, notice: 'Translation was successfully updated.' }
|
|
||||||
format.json { render :show, status: :ok, location: @translation }
|
|
||||||
else
|
|
||||||
format.html { render :edit }
|
|
||||||
format.json { render json: @translation.errors, status: :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# DELETE /translations/1
|
|
||||||
# DELETE /translations/1.json
|
|
||||||
def destroy
|
|
||||||
@translation.destroy
|
|
||||||
respond_to do |format|
|
|
||||||
format.html { redirect_to translations_url, notice: 'Translation was successfully destroyed.' }
|
|
||||||
format.json { head :no_content }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_translation
|
def set_translation
|
||||||
|
|||||||
@ -14,4 +14,3 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<%= link_to 'Dieses Problem auf projecteuler.net', @translation.problem.original_url, target: '_blank' %>
|
<%= link_to 'Dieses Problem auf projecteuler.net', @translation.problem.original_url, target: '_blank' %>
|
||||||
</div>
|
</div>
|
||||||
<%= link_to 'Edit', edit_translation_path(@translation), class: 'btn btn-default' %>
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
resources :problems, only: [:index, :show]
|
resources :problems, only: [:index, :show]
|
||||||
resources :translations
|
resources :translations, only: [:index, :show, :new, :create]
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|||||||
@ -33,22 +33,4 @@ class TranslationsControllerTest < ActionController::TestCase
|
|||||||
get :show, id: @translation
|
get :show, id: @translation
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should get edit" do
|
|
||||||
get :edit, id: @translation
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should update translation" do
|
|
||||||
patch :update, id: @translation, translation: @update
|
|
||||||
assert_redirected_to translation_path(assigns(:translation))
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should destroy translation" do
|
|
||||||
assert_difference('Translation.count', -1) do
|
|
||||||
delete :destroy, id: @translation
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_redirected_to translations_path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user