Sha256: a88aca8a3bec4b121160c941ce9e44bb46075254f046826ca7db887021769fe6
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
# -*- encoding : utf-8 -*- module KirguduBase class AdminController < ::KirguduBase::ApplicationController before_filter :authenticate_user layout "/layouts/application" def render *args self.create_breadcrumbs super end def left_menu_path "/admin/kirgudu_base/left_menu" end def current_entry @entry end def base_entry @current_portal end include KirguduBase::GuiHelper #before_filter :update_url_with_ajax_referer_url def create_breadcrumbs if self.class == ::Admin::DashboardController add_new_breadcrumb(I18n.t("#{::Admin::DashboardController.to_i18n}.index.title")) return end add_new_breadcrumb( I18n.t("#{::Admin::DashboardController.to_i18n}.index.title"), ::Admin::DashboardController.to_url_for ) 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") ) 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) else add_new_breadcrumb(entry.id) 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kirgudu_base-0.0.1 | app/controllers/kirgudu_base/admin_controller.rb |