caseadilla 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/app/assets/fonts/caseadilla/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/caseadilla/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/fonts/caseadilla/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/caseadilla/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/images/caseadilla/caseadilla.png +0 -0
- data/app/assets/javascripts/caseadilla/bootstrap.js +2114 -0
- data/app/assets/javascripts/caseadilla/bootstrap3-wysihtml5.js +521 -0
- data/app/assets/javascripts/caseadilla/caseadilla.js +51 -0
- data/app/assets/javascripts/caseadilla/html5shiv.js +8 -0
- data/app/assets/javascripts/caseadilla/wysihtml5-0.3.0.min.js +261 -0
- data/app/assets/stylesheets/caseadilla/bootstrap-glyphicons.css.scss +2 -0
- data/app/assets/stylesheets/caseadilla/bootstrap-theme.css +442 -0
- data/app/assets/stylesheets/caseadilla/bootstrap-wysihtml5.css +102 -0
- data/app/assets/stylesheets/caseadilla/bootstrap.css +6203 -0
- data/app/assets/stylesheets/caseadilla/caseadilla-bootstrap-overrides.css.scss +80 -0
- data/app/assets/stylesheets/caseadilla/caseadilla.scss +270 -0
- data/app/assets/stylesheets/caseadilla/login.css.scss +81 -0
- data/app/controllers/caseadilla/caseadilla_controller.rb +57 -0
- data/app/controllers/caseadilla/caseadilla_user_sessions_controller.rb +36 -0
- data/app/controllers/caseadilla/password_resets_controller.rb +64 -0
- data/app/controllers/caseadilla/roles_controller.rb +65 -0
- data/app/controllers/caseadilla/users_controller.rb +118 -0
- data/app/helpers/caseadilla/caseadilla_helper.rb +262 -0
- data/app/mailers/caseadilla/caseadilla_notification.rb +39 -0
- data/app/views/caseadilla/caseadilla/blank.html.erb +12 -0
- data/app/views/caseadilla/caseadilla_notification/generate_new_password.erb +12 -0
- data/app/views/caseadilla/caseadilla_notification/new_user_information.erb +12 -0
- data/app/views/caseadilla/caseadilla_notification/password_reset_instructions.erb +11 -0
- data/app/views/caseadilla/caseadilla_user_sessions/new.html.erb +39 -0
- data/app/views/caseadilla/roles/_form.html.erb +11 -0
- data/app/views/caseadilla/roles/_table.html.erb +28 -0
- data/app/views/caseadilla/roles/index.html.erb +15 -0
- data/app/views/caseadilla/roles/new.html.erb +18 -0
- data/app/views/caseadilla/roles/show.html.erb +18 -0
- data/app/views/caseadilla/users/index.html.erb +37 -0
- data/app/views/caseadilla/users/new.html.erb +50 -0
- data/app/views/caseadilla/users/show.html.erb +39 -0
- data/app/views/layouts/caseadilla_auth.html.erb +36 -0
- data/app/views/layouts/caseadilla_main.html.erb +119 -0
- data/caseadilla.gemspec +49 -0
- data/config/initializers/will_paginate.rb +40 -0
- data/config/routes.rb +23 -0
- data/lib/caseadilla.rb +14 -0
- data/lib/caseadilla/engine.rb +35 -0
- data/lib/caseadilla/version.rb +3 -0
- data/lib/generators/caseadilla/install/install_generator.rb +154 -0
- data/lib/generators/caseadilla/install/templates/app/assets/javascripts/caseadilla/custom.js +2 -0
- data/lib/generators/caseadilla/install/templates/app/assets/stylesheets/caseadilla/custom.css.scss +2 -0
- data/lib/generators/caseadilla/install/templates/app/helpers/caseadilla/config_helper.rb +45 -0
- data/lib/generators/caseadilla/install/templates/app/models/user.rb +24 -0
- data/lib/generators/caseadilla/install/templates/app/views/caseadilla/layouts/_tab_navigation.html.erb +2 -0
- data/lib/generators/caseadilla/install/templates/app/views/caseadilla/layouts/_top_navigation.html.erb +4 -0
- data/lib/generators/caseadilla/install/templates/public/robots.txt +5 -0
- data/lib/generators/caseadilla/install/templates/steak/config/initializers/caseadilla.rb +8 -0
- data/lib/generators/caseadilla/install/templates/steak/db/migrate/add_name_to_users.rb +9 -0
- data/lib/generators/caseadilla/install/templates/veggie/config/initializers/caseadilla.rb +8 -0
- data/lib/generators/caseadilla/scaffold/scaffold_generator.rb +111 -0
- data/lib/generators/caseadilla/scaffold/templates/controller.rb +72 -0
- data/lib/generators/caseadilla/scaffold/templates/migration.rb +13 -0
- data/lib/generators/caseadilla/scaffold/templates/model.rb +3 -0
- data/lib/generators/caseadilla/scaffold/templates/views/_form.html.erb +12 -0
- data/lib/generators/caseadilla/scaffold/templates/views/_table.html.erb +19 -0
- data/lib/generators/caseadilla/scaffold/templates/views/index.html.erb +15 -0
- data/lib/generators/caseadilla/scaffold/templates/views/new.html.erb +18 -0
- data/lib/generators/caseadilla/scaffold/templates/views/show.html.erb +18 -0
- data/lib/railties/tasks.rake +32 -0
- metadata +231 -0
data/caseadilla.gemspec
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'caseadilla/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "caseadilla"
|
8
|
+
spec.version = Caseadilla::VERSION
|
9
|
+
spec.authors = ["Xavier Bick"]
|
10
|
+
spec.email = ["fxb9500@gmail.com"]
|
11
|
+
spec.description = "Caseadilla is a CMS for Rails based on Casein and Comfortable Mexican Sofa. It is designed to allow you to easily fit the CMS to your app, not the other way around. By default, Caseadilla installs with Devise for authentication and Declarative Authorization, however it can be installed without either if you want to use an existing auth system."
|
12
|
+
spec.summary = "A powerful yet unobtrusive CMS and data management system for Rails."
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
if spec.respond_to? :specification_version then
|
24
|
+
spec.specification_version = 4
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
+
spec.add_runtime_dependency(%q<caseadilla>, [">= 0"])
|
28
|
+
spec.add_runtime_dependency(%q<will_paginate>, ["= 3.0.5"])
|
29
|
+
spec.add_runtime_dependency(%q<devise>, [">= 3.2"])
|
30
|
+
spec.add_runtime_dependency(%q<declarative_authorization>, [">= 0.5.7"])
|
31
|
+
spec.add_runtime_dependency(%q<scrypt>, ["= 1.2.1"])
|
32
|
+
spec.add_runtime_dependency(%q<jquery-rails>, [">= 0"])
|
33
|
+
else
|
34
|
+
spec.add_dependency(%q<caseadilla>, [">= 0"])
|
35
|
+
spec.add_dependency(%q<will_paginate>, ["= 3.0.5"])
|
36
|
+
spec.add_dependency(%q<devise>, [">= 3.2"])
|
37
|
+
spec.add_dependency(%q<declarative_authorization>, [">= 0.5.7"])
|
38
|
+
spec.add_dependency(%q<scrypt>, ["= 1.2.1"])
|
39
|
+
spec.add_dependency(%q<jquery-rails>, [">= 0"])
|
40
|
+
end
|
41
|
+
else
|
42
|
+
spec.add_dependency(%q<caseadilla>, [">= 0"])
|
43
|
+
spec.add_dependency(%q<will_paginate>, ["= 3.0.5"])
|
44
|
+
spec.add_dependency(%q<devise>, ["= 3.2"])
|
45
|
+
spec.add_dependency(%q<declarative_authorization>, [">= 0.5.7"])
|
46
|
+
spec.add_dependency(%q<scrypt>, ["= 1.2.1"])
|
47
|
+
spec.add_dependency(%q<jquery-rails>, [">= 0"])
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# config/initializers/will_paginate.rb
|
2
|
+
#
|
3
|
+
# This extension code was written by Isaac Bowen, originally found
|
4
|
+
# at http://isaacbowen.com/blog/using-will_paginate-action_view-and-bootstrap/
|
5
|
+
|
6
|
+
require 'will_paginate/view_helpers/action_view'
|
7
|
+
|
8
|
+
module WillPaginate
|
9
|
+
module ActionView
|
10
|
+
|
11
|
+
def will_paginate(collection = nil, options = {})
|
12
|
+
options, collection = collection, nil if collection.is_a? Hash
|
13
|
+
# Taken from original will_paginate code to handle if the helper is not passed a collection object.
|
14
|
+
collection ||= infer_collection_from_controller
|
15
|
+
options[:renderer] ||= BootstrapLinkRenderer
|
16
|
+
super.try :html_safe
|
17
|
+
end
|
18
|
+
|
19
|
+
class BootstrapLinkRenderer < LinkRenderer
|
20
|
+
protected
|
21
|
+
|
22
|
+
def html_container(html)
|
23
|
+
tag :div, tag(:ul, html, :class => "pagination"), container_attributes
|
24
|
+
end
|
25
|
+
|
26
|
+
def page_number(page)
|
27
|
+
tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
|
28
|
+
end
|
29
|
+
|
30
|
+
def gap
|
31
|
+
tag :li, link('…'.html_safe, '#'), :class => 'disabled'
|
32
|
+
end
|
33
|
+
|
34
|
+
def previous_or_next_page(page, text, classname)
|
35
|
+
tag :li, link(text, page || '#'),
|
36
|
+
:class => [(classname[0..3] if @options[:page_links]), (classname if @options[:page_links]), ('disabled' unless page)].join(' ')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
match "/admin" => redirect("/caseadilla"), :via => :get
|
4
|
+
|
5
|
+
namespace :caseadilla do
|
6
|
+
|
7
|
+
if Caseadilla::Engine.flavor = :steak
|
8
|
+
resources :users do
|
9
|
+
# member do
|
10
|
+
# patch :update_password, :reset_password
|
11
|
+
# end
|
12
|
+
end
|
13
|
+
resources :roles
|
14
|
+
|
15
|
+
match "/sign_in" => "caseadilla_user_sessions#new", via: :get
|
16
|
+
# resource :password_reset, :only => [:create, :edit, :update]
|
17
|
+
end
|
18
|
+
|
19
|
+
match "/blank" => "caseadilla#blank", :via => :get
|
20
|
+
root :to => "caseadilla#index"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/caseadilla.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "caseadilla/version"
|
2
|
+
|
3
|
+
if defined?(Rails) && Rails::VERSION::MAJOR == 4
|
4
|
+
require 'caseadilla/engine'
|
5
|
+
require 'will_paginate'
|
6
|
+
if Caseadilla::Engine.flavor = :steak
|
7
|
+
require 'devise'
|
8
|
+
require 'declarative_authorization'
|
9
|
+
end
|
10
|
+
else
|
11
|
+
puts("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
12
|
+
puts("!!! WARNING !!! Caseadilla requires Rails >= 4.x !!!")
|
13
|
+
puts("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
14
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "caseadilla"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
module Caseadilla
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
@flavor = nil
|
7
|
+
|
8
|
+
class << self
|
9
|
+
attr_accessor :flavor
|
10
|
+
end
|
11
|
+
|
12
|
+
config.after_initialize do
|
13
|
+
Rails.application.config.assets.paths << root.join("app", "assets", "fonts")
|
14
|
+
end
|
15
|
+
|
16
|
+
initializer "caseadilla.assets.precompile" do |app|
|
17
|
+
app.config.assets.precompile += %w(caseadilla/*.svg caseadilla/*.eot caseadilla/*.woff caseadilla/*.ttf caseadilla/login.css caseadilla/caseadilla.css caseadilla/caseadilla.js caseadilla/html5shiv.js caseadilla/custom.css caseadilla/custom.js caseadilla/*.png)
|
18
|
+
end
|
19
|
+
|
20
|
+
rake_tasks do
|
21
|
+
load "railties/tasks.rake"
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
class RouteConstraint
|
27
|
+
|
28
|
+
def matches?(request)
|
29
|
+
return false if request.fullpath.include?("/caseadilla")
|
30
|
+
return false if request.fullpath.include?("/admin")
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
module Caseadilla
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
3
|
+
|
4
|
+
include Rails::Generators::Migration
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :flavor, type: :string, default: "auto"
|
7
|
+
class_option :no_commit, type: :boolean, default: false, desc: 'Skip bundle install and rake tasks such as migrate and seed'
|
8
|
+
class_option :skip_decl_auth, type: :boolean, default: false, desc: 'Skip installation of declarative_authorization'
|
9
|
+
class_option :auth_model, type: :string, default: "User", desc: 'Name of Model to be created for auth'
|
10
|
+
class_option :user_habtm_roles, type: :boolean, default: false, desc: 'Allow users to have multiple roles by setting up a HABTM association between roles'
|
11
|
+
|
12
|
+
def self.next_migration_number dirname
|
13
|
+
if ActiveRecord::Base.timestamped_migrations
|
14
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
15
|
+
else
|
16
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def install_flavor
|
21
|
+
@flavor = self.flavor
|
22
|
+
if @flavor == "auto"
|
23
|
+
puts "\nWelcome to Caseadilla! Please enter a flavor to install:"
|
24
|
+
puts "\n[steak] This is recommended for a fresh Rails app. Caseadilla will set up Devise and Declarative Authorization for you, along with an admin user and various authorization roles."
|
25
|
+
puts "\n[chicken] Select this if you have auth in place already or plan to use something other than Devise or Declarative Authorization. Caseadilla will use methods such as `current_user.is_admin?` to help with auth integration. See the readme for more details."
|
26
|
+
puts "\n[veggie] This flavor will install Caseadilla as minimally as possible, without any auth support. You will be responsible for implementing authorization and authentication into Caseadilla.\n\n"
|
27
|
+
flavor_choice = STDIN.gets.chomp
|
28
|
+
@flavor = flavor_choice
|
29
|
+
end
|
30
|
+
|
31
|
+
case @flavor
|
32
|
+
when "steak"
|
33
|
+
@target = "steak"
|
34
|
+
|
35
|
+
gem 'simple_form'
|
36
|
+
gem 'devise'
|
37
|
+
gem 'declarative_authorization', git: 'git://github.com/zeiv/declarative_authorization', branch: '1.0.0' unless options[:skip_decl_auth]
|
38
|
+
gem 'best_in_place'
|
39
|
+
gem 'mercury-rails'
|
40
|
+
Bundler.with_clean_env do
|
41
|
+
run 'bundle install' unless options[:no_commit]
|
42
|
+
end
|
43
|
+
|
44
|
+
generate 'devise:install'
|
45
|
+
generate 'devise', "#{options[:auth_model].capitalize}"
|
46
|
+
generate 'devise:views'
|
47
|
+
rake 'db:migrate' unless options[:no_commit]
|
48
|
+
|
49
|
+
generate "authorization:install","#{options[:auth_model].capitalize} --commit --user-belongs-to-role" unless options[:skip_decl_auth] or options[:no_commit] or options[:user_habtm_roles]
|
50
|
+
generate "authorization:install","#{options[:auth_model].capitalize} --commit" if options[:user_habtm_roles] and not options[:skip_decl_auth]
|
51
|
+
generate "authorization:install","#{options[:auth_model].capitalize}" if options[:no_commit] and not options[:skip_decl_auth]
|
52
|
+
|
53
|
+
migration_template 'steak/db/migrate/add_name_to_users.rb', "db/migrate/add_name_to_users.rb"
|
54
|
+
rake 'db:migrate' unless options[:no_commit]
|
55
|
+
|
56
|
+
inject_into_file "app/models/#{options[:auth_model].downcase}.rb", " before_create :add_user_role", after: "belongs_to :role\n"
|
57
|
+
inject_into_file "app/models/#{options[:auth_model].downcase}.rb", after: /def role_symbols.*?end\n/m do <<-'RUBY'
|
58
|
+
|
59
|
+
def name
|
60
|
+
"#{first_name} #{last_name}"
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def add_user_role
|
66
|
+
self.role = Role.find_by_title 'user'
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
RUBY
|
71
|
+
end
|
72
|
+
|
73
|
+
inject_into_file 'app/helpers/application_helper.rb', after: "module ApplicationHelper\n" do <<-'RUBY'
|
74
|
+
def resource_name
|
75
|
+
:user
|
76
|
+
end
|
77
|
+
|
78
|
+
def resource
|
79
|
+
@resource ||= User.new
|
80
|
+
end
|
81
|
+
|
82
|
+
def devise_mapping
|
83
|
+
@devise_mapping ||= Devise.mappings[:user]
|
84
|
+
end
|
85
|
+
RUBY
|
86
|
+
end
|
87
|
+
|
88
|
+
inject_into_file 'app/controllers/application_controller.rb', after: "ActionController::Base\n" do <<-'RUBY'
|
89
|
+
before_action :configure_permitted_parameters, if: :devise_controller?
|
90
|
+
|
91
|
+
RUBY
|
92
|
+
end
|
93
|
+
|
94
|
+
inject_into_file 'app/controllers/application_controller.rb', before: "\nend" do <<-'RUBY'
|
95
|
+
|
96
|
+
|
97
|
+
protected
|
98
|
+
|
99
|
+
def configure_permitted_parameters
|
100
|
+
devise_parameter_sanitizer.for(:account_update) { |u| u.permit({ role_ids: [] }, :email, :password, :password_confirmation, :current_password, :first_name, :last_name, :time_zone) }
|
101
|
+
end
|
102
|
+
RUBY
|
103
|
+
end
|
104
|
+
|
105
|
+
inject_into_file 'config/authorization_rules.rb', after: "authorization do\n" do <<-'RUBY'
|
106
|
+
|
107
|
+
role :admin do
|
108
|
+
has_permission_on :caseadilla_users, to: :manage
|
109
|
+
has_permission_on :caseadilla_roles, to: :manage
|
110
|
+
end
|
111
|
+
|
112
|
+
RUBY
|
113
|
+
end
|
114
|
+
when "chicken"
|
115
|
+
@target = "chicken"
|
116
|
+
when "veggie"
|
117
|
+
@target = "veggie"
|
118
|
+
else
|
119
|
+
puts "That flavor is not recognized. Please enter steak, chicken, or veggie. E.g., for a full install use `rails g caseadilla:install steak`"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def flavor_files
|
124
|
+
copy_file "#{@target}/config/initializers/caseadilla.rb", "config/initializers/caseadilla.rb"
|
125
|
+
end
|
126
|
+
|
127
|
+
def common_files
|
128
|
+
puts "*** WARNING - Generating configuration files. Make sure you have backed up any files before overwriting them. ***"
|
129
|
+
|
130
|
+
#config helper
|
131
|
+
copy_file "app/helpers/caseadilla/config_helper.rb", "app/helpers/caseadilla/config_helper.rb"
|
132
|
+
|
133
|
+
#initial view partials
|
134
|
+
copy_file "app/views/caseadilla/layouts/_tab_navigation.html.erb", "app/views/caseadilla/layouts/_tab_navigation.html.erb"
|
135
|
+
copy_file "app/views/caseadilla/layouts/_top_navigation.html.erb", "app/views/caseadilla/layouts/_top_navigation.html.erb"
|
136
|
+
|
137
|
+
#blank stylesheets and JavaScript files
|
138
|
+
copy_file "app/assets/stylesheets/caseadilla/custom.css.scss", "app/assets/stylesheets/caseadilla/custom.css.scss"
|
139
|
+
copy_file "app/assets/javascripts/caseadilla/custom.js", "app/assets/javascripts/caseadilla/custom.js"
|
140
|
+
end
|
141
|
+
|
142
|
+
def copy_robots
|
143
|
+
puts " ** Overwrite if you haven't yet modified your robots.txt, otherwise add disallow rules for /caseadilla and /admin manually **"
|
144
|
+
copy_file "public/robots.txt", "public/robots.txt"
|
145
|
+
end
|
146
|
+
|
147
|
+
# protected
|
148
|
+
# attr_reader :flavor
|
149
|
+
|
150
|
+
# def assign_flavor!(f)
|
151
|
+
# @flavor = f
|
152
|
+
# end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Caseadilla
|
2
|
+
module ConfigHelper
|
3
|
+
|
4
|
+
# Name of website or client — used throughout Caseadilla.
|
5
|
+
def caseadilla_config_website_name
|
6
|
+
'Caseadilla'
|
7
|
+
end
|
8
|
+
|
9
|
+
# Filename of logo image. Ideally, it should be a transparent PNG around 140x30px
|
10
|
+
def caseadilla_config_logo
|
11
|
+
'caseadilla/caseadilla.png'
|
12
|
+
end
|
13
|
+
|
14
|
+
# The server hostname where Caseadilla will run
|
15
|
+
def caseadilla_config_hostname
|
16
|
+
if Rails.env.production?
|
17
|
+
'http://www.caseadillacms.com'
|
18
|
+
else
|
19
|
+
'http://0.0.0.0:3000'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# The sender address used for email notifications
|
24
|
+
def caseadilla_config_email_from_address
|
25
|
+
'donotreply@caseadillacms.com'
|
26
|
+
end
|
27
|
+
|
28
|
+
# The initial page the user is shown after they sign in or click the logo. Probably this should be set to the first tab.
|
29
|
+
# Do not point this at caseadilla/index!
|
30
|
+
def caseadilla_config_dashboard_url
|
31
|
+
url_for :controller => :caseadilla, :action => :blank
|
32
|
+
end
|
33
|
+
|
34
|
+
# A list of stylesheets to include. Do not remove the core caseadilla/caseadilla, but you can change the load order, if required.
|
35
|
+
def caseadilla_config_stylesheet_includes
|
36
|
+
%w[caseadilla/caseadilla caseadilla/custom]
|
37
|
+
end
|
38
|
+
|
39
|
+
# A list of JavaScript files to include. Do not remove the core caseadilla/caseadilla, but you can change the load order, if required.
|
40
|
+
def caseadilla_config_javascript_includes
|
41
|
+
%w[caseadilla/caseadilla caseadilla/custom]
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
belongs_to :role
|
3
|
+
before_create :add_user_role
|
4
|
+
# Include default devise modules. Others available are:
|
5
|
+
# :confirmable, :lockable, :timeoutable and :omniauthable
|
6
|
+
devise :database_authenticatable, :registerable,
|
7
|
+
:recoverable, :rememberable, :trackable, :validatable
|
8
|
+
|
9
|
+
|
10
|
+
def name
|
11
|
+
"#{first_name} #{last_name}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def role_symbols
|
15
|
+
[role.title.to_sym]
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def add_user_role
|
21
|
+
self.role = Role.find_by_title 'user'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<!-- NOTE: add "hidden-sm" class to li elements you want to be hidden at small browser widths -->
|
2
|
+
<!-- e.g. <li class="hidden-sm"><%= link_to "Visit site", caseadilla_config_hostname, :target => "_blank" %></li> -->
|
3
|
+
|
4
|
+
<li><%= link_to "Visit site", caseadilla_config_hostname, :target => "_blank" %></li>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
######################################################
|
2
|
+
## Note: It is HIGHLY recommended that you use the
|
3
|
+
## the caseadilla installer to change the flavor by
|
4
|
+
## overwriting existing files. Example:
|
5
|
+
## $ rails g caseadilla:install veggie
|
6
|
+
######################################################
|
7
|
+
|
8
|
+
Caseadilla::Engine.flavor = :steak
|