Sha256: 672fc4057fcff3121d6f6334c5f91132f3eccc4a91e88ce2ea221f65fbe22adc

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

class Admin::DashboardController < Admin::ApplicationController

  layout 'admin/application'

  def index
    @admin_applications = Spud::Core.admin_applications.select do |admin_application|
      current_user.can_view_app?(admin_application)
    end
  end

  def badges
    data = []
    @admin_applications = Spud::Core.admin_applications.select do |admin_application|
      if current_user.can_view_app?(admin_application)
        if admin_application[:badge]
          begin
            data << {:key => admin_application[:key], :badge_count => admin_application[:badge].call(current_user)}
          rescue Exception => e
            logger.error e
          end
        end
      end
    end
    render :json => {:data => data}
  end

  def switch
    if !params[:multisite_select].blank?
      if Spud::Core.multisite_config.select{|p| p[:site_id].to_i == params[:multisite_select].to_i}.blank? == false
        session[:admin_site] = params[:multisite_select].to_i
      else
        flash[:error] = "Site does not exist."
      end
    else
      session[:admin_site] = 0
    end
    redirect_to(back_or_default(!request.referer.blank? ? request.referer : admin_root_path)) and return
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tb_core-1.3.0.beta2 app/controllers/admin/dashboard_controller.rb
tb_core-1.3.0.beta1 app/controllers/admin/dashboard_controller.rb
tb_core-1.2.8 app/controllers/admin/dashboard_controller.rb
tb_core-1.2.7 app/controllers/admin/dashboard_controller.rb
tb_core-1.2.6 app/controllers/admin/dashboard_controller.rb
tb_core-1.2.4 app/controllers/admin/dashboard_controller.rb
tb_core-1.2.3 app/controllers/admin/dashboard_controller.rb
tb_core-1.2.2 app/controllers/admin/dashboard_controller.rb