trabajo-afectivo/app/controllers/translations_controller.rb

72 lines
1.7 KiB
Ruby
Raw Normal View History

2014-02-03 19:24:49 +00:00
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
2012-05-18 14:24:00 +00:00
class TranslationsController < ApplicationController
before_action :authentication_check, except: [:load]
2012-05-18 14:24:00 +00:00
# GET /translations/lang/:locale
2012-05-18 14:24:00 +00:00
def load
render json: Translation.list( params[:locale] )
2012-05-18 14:24:00 +00:00
end
2015-06-28 00:16:47 +00:00
# PUT /translations/push
def push
return if deny_if_not_role(Z_ROLENAME_ADMIN)
start = Time.zone.now
Translation.push(params[:locale])
if start > Time.zone.now - 5.seconds
sleep 4
end
render json: { message: 'ok' }, status: :ok
end
# POST /translations/sync
def sync
return if deny_if_not_role(Z_ROLENAME_ADMIN)
Translation.load
render json: { message: 'ok' }, status: :ok
end
# POST /translations/reset
def reset
return if deny_if_not_role(Z_ROLENAME_ADMIN)
Translation.reset(params[:locale])
render json: { message: 'ok' }, status: :ok
end
# GET /translations/admin/lang/:locale
def admin
return if deny_if_not_role(Z_ROLENAME_ADMIN)
render json: Translation.list( params[:locale], true )
end
2012-05-18 14:24:00 +00:00
# GET /translations
def index
2015-06-28 00:16:47 +00:00
return if deny_if_not_role(Z_ROLENAME_ADMIN)
model_index_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
# GET /translations/1
def show
2015-06-28 00:16:47 +00:00
return if deny_if_not_role(Z_ROLENAME_ADMIN)
model_show_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
# POST /translations
def create
return if deny_if_not_role(Z_ROLENAME_ADMIN)
model_create_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
# PUT /translations/1
def update
return if deny_if_not_role(Z_ROLENAME_ADMIN)
model_update_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
# DELETE /translations/1
def destroy
return if deny_if_not_role(Z_ROLENAME_ADMIN)
model_destory_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
end