Sha256: 27057d2fbe9db3abfe97cb031f7a8c4ee6a92e87e46620ce29ae7b7c813359b4

Contents?: true

Size: 926 Bytes

Versions: 4

Compression:

Stored size: 926 Bytes

Contents

say "Building admin"
generate(:controller, "admin/dashboard index")
route("match 'admin' => 'admin/dashboard#index'")

# Do layout and SASS stuff
apply File.expand_path("../admin/sass.rb", __FILE__)
apply File.expand_path("../admin/layout.rb", __FILE__)

create_file 'app/controllers/admin/base_controller.rb' do
<<-RUBY
class Admin::BaseController < ApplicationController
  layout 'admin'
  before_filter :authenticate_user!  
  before_filter :verify_admin

private
  def verify_admin
    redirect_to root_url unless current_user.role? :admin
  end
end
RUBY
end

gsub_file 'app/controllers/admin/dashboard_controller.rb', /ApplicationController/, 'Admin::BaseController'

# make a user admin
apply File.expand_path("../admin/users.rb", __FILE__)
apply File.expand_path("../admin/dashboard_spec.rb", __FILE__)
apply File.expand_path("../admin/users_spec.rb", __FILE__)
apply File.expand_path("../admin/cucumber.rb", __FILE__)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prologue-0.6.0 templates/default/lib/admin.rb
prologue-0.5.5 templates/admin.rb
prologue-0.5.0 templates/admin.rb
prologue-0.4.0 templates/admin.rb