Sha256: ee437c96e75a3eae806dc26212d4ae42d3d29f9b76215d80ab73a5257b77186e

Contents?: true

Size: 647 Bytes

Versions: 11

Compression:

Stored size: 647 Bytes

Contents

class Admin::BaseController < ActionController::Base
  layout 'admin'
  before_filter :authenticate_manager!
  include AdminHelper

  def welcome
  end

  private

  def redirect_or_edit(obj, saved, notice = nil)
    if saved
      redirect_to url_for_obj(obj), notice: notice_for(obj, notice)
    else
      render 'edit'
    end
  end

  def notice_for(obj, notice = nil)
    notice ||= 'сохранен'
    "#{obj.class.model_name.human} #{notice}."
  end

  def url_for_obj(obj)
    return [:edit, :admin, obj] if params[:commit] == 'Применить'
    [:admin, obj.class.model_name.plural.to_sym]
  end
end

Version data entries

11 entries across 6 versions & 1 rubygems

Version Path
redde-0.1.18 spec/dummy/app/controllers/admin/base_controller.rb
redde-0.1.18 lib/generators/redde/layout/templates/controllers/base_controller.rb
redde-0.1.17 lib/generators/redde/layout/templates/controllers/base_controller.rb
redde-0.1.17 spec/dummy/app/controllers/admin/base_controller.rb
redde-0.1.16 lib/generators/redde/layout/templates/controllers/base_controller.rb
redde-0.1.16 spec/dummy/app/controllers/admin/base_controller.rb
redde-0.1.15 spec/dummy/app/controllers/admin/base_controller.rb
redde-0.1.15 lib/generators/redde/layout/templates/controllers/base_controller.rb
redde-0.1.14 lib/generators/redde/layout/templates/controllers/base_controller.rb
redde-0.1.14 spec/dummy/app/controllers/admin/base_controller.rb
redde-0.1.13 lib/generators/redde/layout/templates/controllers/base_controller.rb