Sha256: 5bd5ee2e67f133eb145bc72d09c999bf4b3cabd250f37e33eb2e6004c2ae9531

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 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 = ::Blogaze::Models::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.2 lib/blogaze/controllers/init.rb