1 class LicensesController < ApplicationController
2 before_filter :authenticate_resource_reader, :only => [
3 :by_license_group, :by_system_picture, :count_by_license_group, :count_by_system_picture
5 before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
23 def show_html_format format
31 respond_to do |format|
32 show_html_format format
33 show_prof_format format
34 show_json_format format
39 @licenses = License.list_by_name(params[:name])
41 respond_to do |format|
43 format.json { render json: @licenses.to_json }
51 def count_by_license_group
55 def count_by_system_picture
68 @item = self.class.model.new
70 @item.attributes = params[:license]
71 @item.overwrite @operators
74 respond_to do |format|
75 flash[:notice] = I18n.t('flash.notice.created', :model => self.class.model.model_name.human)
76 format.html { redirect_to @item }
77 format.json { render json: @item.to_json(self.class.model.show_json_opt), status: :created, location: @item }
80 flash[:notice] = I18n.t('flash.notice.not_created', :model => self.class.model.model_name.human)
82 format.html { render action: "new" }
83 format.json { render json: @item.errors, status: :unprocessable_entity }
88 @item = self.class.model.edit(params[:id], @operators)
89 self.class.model.fold_extend_settings params
90 @item.attributes = params[:license]
92 respond_to do |format|
94 flash[:notice] = I18n.t('flash.notice.updated', :model => self.class.model.model_name.human)
95 format.html { redirect_to @item }
96 format.json { head :ok }
98 flash[:notice] = I18n.t('flash.notice.not_updated', :model => self.class.model.model_name.human)
99 format.html { render action: "edit" }
100 format.json { render json: @item.errors, status: :unprocessable_entity }
106 @item = self.class.model.edit(params[:id], @operators)
107 respond_to do |format|
108 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => self.class.model.model_name.human)
109 format.html { redirect_to @item }
110 format.json { render json: @item.errors, status: :unprocessable_entity }