Sha256: 9afbf42356a8d7a5acfff373c55a63724ccfd8e25bad749820152100966ce525

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

#
# Blogaze
# Copyright (C) 2011-2013 Jack Polgar
#
# Blogaze is released under the BSD 3-clause license.
# @license http://opensource.org/licenses/BSD-3-Clause
#

module Blogaze
  class Controller < Ramaze::Controller
    layout :default
    helper :xhtml, :maruku, :blue_form, :formatting
    engine :etanni

    def initialize
      super

      # Get user info
      if session[:logged_in]
        @userinfo = User[1]
      end

      # Get settings
      get_settings

      Theme.use @settings[:theme]
    end

    def view_file(path)
      path = path.to_s if not path.is_a?(String)
      view_path = File.join(Theme.current.templates, "#{path}.xhtml")
      layout_path = File.join(Theme.current.templates + "/layouts/#{ancestral_trait[:layout]}.xhtml")
      return render_file(layout_path, :content => render_file(view_path))
    end

    def get_settings
      @settings = {}
      Blogaze.database[:settings].all.each do |setting|
        @settings[setting[:setting].to_sym] = setting[:value]
      end
    end
  end
end

# Here go your requires for subclasses of Controller:
Dir.glob(File.dirname(__FILE__) + '/*.rb').each do |controller|
  require(controller)
end

# Admin controllers
require __DIR__('admin/init')

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blogaze-0.0.1 lib/blogaze/controller/init.rb