trabajo-afectivo/app/controllers/translations_controller.rb

57 lines
1.2 KiB
Ruby
Raw Normal View History

# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
2012-05-18 14:24:00 +00:00
class TranslationsController < ApplicationController
before_filter :authentication_check, :except => [:load]
# GET /translations/:lang
def load
translations = Translation.where( :locale => params[:locale] )
list = []
translations.each { |item|
data = [
item.id,
item.source,
item.target,
]
list.push data
}
2012-11-23 08:36:12 +00:00
timestamp_map_default = 'yyyy-mm-dd HH:MM'
timestamp_map = {
:de => 'dd.mm.yyyy HH:MM',
}
timestamp = timestamp_map[ params[:locale].to_sym ] || timestamp_map_default
2012-09-25 06:20:52 +00:00
render :json => {
:list => list,
2012-11-23 08:36:12 +00:00
:timestampFormat => timestamp,
2012-09-25 06:20:52 +00:00
}
2012-05-18 14:24:00 +00:00
end
# GET /translations
def index
model_index_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
# GET /translations/1
def show
model_show_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
# POST /translations
def create
model_create_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
# PUT /translations/1
def update
model_update_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
# DELETE /translations/1
def destroy
model_destory_render(Translation, params)
2012-05-18 14:24:00 +00:00
end
end