# -*- encoding : utf-8 -*- module KirguduBase class CabinetController < ::KirguduBase::ApplicationController before_action :authenticate_user layout "/layouts/application" before_action :authenticate_user # def left_menu_path # "/admin/kirgudu_base/left_menu" # end def current_entry @entry end def base_entry @current_portal end include GuiHelper #before_action :update_url_with_ajax_referer_url # def create_breadcrumbs # # if @current_user.user_at_portals.count > 1 # add_new_breadcrumb I18n.t("select_portal.index.title"), url_for(controller: ::ErpZone::SelectPortalController.to_route_path, action: :index) # end # # add_new_breadcrumb @current_portal.name, url_for(controller: ::AdminZone::DashboarController.to_route_path) if @current_portal # # # if self.class.to_s == ::AdminZone::DashboardController # add_new_breadcrumb(I18n.t("#{self.to_i18n}.index.title")) # return # end # # if self.action_name == "index" # add_new_breadcrumb(I18n.t("#{self.to_i18n}.index.title")) # else # add_new_breadcrumb( # I18n.t("#{self.to_i18n}.index.title"), # url_for(controller: ::ChupakabraTools::ClassHelper.controller_underscore(self), action: "index", id: @container)) # # if ['new', 'create'].include?(self.action_name) # add_new_breadcrumb(I18n.t("#{self.to_i18n}.new.title")) # elsif ['edit', 'update', 'show'].include?(self.action_name) # entry = self.current_entry # # if entry && entry.respond_to?(:name_for_breadcrumbs) # add_new_breadcrumb(entry.name_for_breadcrumbs) # end # end # end # end protected rescue_from ActiveRecord::RecordNotFound do flash[:error] = I18n.t("#{self.to_i18n}.entry_not_found", entry_id: params[:id]) respond_to do |format| format.html { render_redirect url_for(action: 'index') } format.json { render_json_not_found(message: flash[:error]) } end end private def before_entry_create(entry, filter_params, options) entry.creator = @current_user entry.updater = @current_user end def before_entry_update(entry, filter_params, options) entry.updater = @current_user end end end