Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/halorgium/mephisto.git
Search Repo:
francois (author)
Mon Mar 10 19:50:19 -0700 2008
commit  752c317ef3e42ccd14c4cb53a8ca7c37734513ac
tree    6f908f6b7462f7e7b790c00e4fe5cb03797a05d1
parent  2772ec18227b04b3cb618748a2900a7b93b84d94
mephisto / app / controllers / admin / base_controller.rb
100644 26 lines (22 sloc) 1.065 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Admin::BaseController < ApplicationController
  class_inheritable_reader :member_actions
  write_inheritable_attribute :member_actions, []
  before_filter { |c| UserMailer.default_url_options[:host] = c.request.host_with_port }
  before_filter :login_required, :except => :feed
 
  protected
    # standard authorization method. allow logged in users that are admins, or members in certain actions
    def authorized?
      logged_in? && (admin? || member_actions.include?(action_name) || allow_member?)
    end
 
    # further customize the authorization process, for those special methods that require extra validation
    def allow_member?
      true
    end
 
    def find_and_sort_templates
      @layouts, @templates = site.templates.partition { |t| t.dirname.to_s =~ /layouts$/ }
    end
    
    def self.clear_empty_templates_for(model, *attributes)
      options = attributes.last.is_a?(Hash) ? attributes.pop : {}
      before_filter(options) { |c| attributes.each { |attr| c.params[model][attr] = nil if c.params[model][attr] == '-' } }
    end
end