122 lines
3.1 KiB
Ruby
122 lines
3.1 KiB
Ruby
class Panel::PersonalHonor::BackEnd::HonorCategorysController < OrbitBackendController
|
|
include OrbitControllerLib::DivisionForDisable
|
|
|
|
open_for_manager :except => [:index]
|
|
|
|
def index
|
|
|
|
@honor_categorys = get_categories_for_index("HonorCategory")
|
|
@honor_category = HonorCategory.new(:display => 'List')
|
|
|
|
@url = panel_personal_honor_back_end_honor_categorys_path
|
|
|
|
respond_to do |format|
|
|
format.html # index.html.erb
|
|
format.js
|
|
end
|
|
end
|
|
|
|
# GET /honors/1
|
|
# GET /honors/1.xml
|
|
def show
|
|
|
|
@honor_category = HonorCategory.find(params[:id])
|
|
|
|
respond_to do |format|
|
|
format.html # show.html.erb
|
|
format.js
|
|
end
|
|
end
|
|
|
|
# GET /honors/new
|
|
# GET /honors/new.xml
|
|
def new
|
|
|
|
@honor_category = HonorCategory.new(:display => 'List')
|
|
|
|
@verb = :post
|
|
|
|
respond_to do |format|
|
|
format.html # new.html.erb
|
|
format.js
|
|
end
|
|
end
|
|
|
|
# GET /honors/1/edit
|
|
def edit
|
|
|
|
@honor_category = HonorCategory.find(params[:id])
|
|
|
|
# @url = panel_personal_honor_back_end_honor_category_path(@honor_category)
|
|
# @url = eval("panel_personal_honor_back_end_#{@app_type}_path(@honor_category)")
|
|
@url = polymorphic_path([:panel, :personal_honor, :back_end, @honor_category])
|
|
|
|
@verb = :put
|
|
|
|
respond_to do |format|
|
|
format.html
|
|
format.js
|
|
end
|
|
end
|
|
|
|
# POST /honors
|
|
# POST /honors.xml
|
|
def create
|
|
|
|
@honor_category = HonorCategory.new(params[:honor_category])
|
|
|
|
respond_to do |format|
|
|
if @honor_category.save
|
|
format.html { redirect_to(panel_personal_honor_back_end_honor_categorys_url, :notice => t('honor_category.create_honor_category_success')) }
|
|
format.js
|
|
else
|
|
format.html { render :action => "new" }
|
|
format.js { render action: "new" }
|
|
end
|
|
end
|
|
end
|
|
|
|
# PUT /honors/1
|
|
# PUT /honors/1.xml
|
|
def update
|
|
|
|
@honor_category = HonorCategory.find(params[:id])
|
|
# debugger
|
|
# @url = panel_personal_honor_back_end_honor_category_path(@honor_category)
|
|
# @url = eval("panel_personal_honor_back_end_#{@app_type}_path(#{@honor_category})")
|
|
@url = polymorphic_path([:panel, :personal_honor, :back_end, @honor_category])
|
|
|
|
respond_to do |format|
|
|
if @honor_category.update_attributes(params[:honor_category])
|
|
format.html { redirect_to(panel_personal_honor_back_end_honor_categorys_url, :notice => t('honor_category.update_honor_category_success')) }
|
|
# format.xml { head :ok }
|
|
format.js
|
|
else
|
|
format.html { render :action => "edit" }
|
|
format.js { render :action => "edit" }
|
|
end
|
|
end
|
|
end
|
|
|
|
# DELETE /honors/1
|
|
# DELETE /honors/1.xml
|
|
def destroy
|
|
|
|
@honor_category = HonorCategory.find(params[:id])
|
|
@honor_category.disable = @honor_category.disable ? false : true
|
|
|
|
if @honor_category.save!
|
|
respond_to do |format|
|
|
format.html { redirect_to(panel_personal_honor_back_end_honor_categorys_url) }
|
|
# format.xml { head :ok }
|
|
format.js
|
|
end
|
|
else
|
|
flash[:error] = t("honor_category.update_failed")
|
|
format.html { render :action => "index" }
|
|
end
|
|
|
|
end
|
|
|
|
end
|