bolton-cms-padrino 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.components +9 -0
- data/.gitignore +15 -0
- data/Gemfile +15 -0
- data/README.md +185 -0
- data/Rakefile +6 -0
- data/bolton-cms-padrino.gemspec +38 -0
- data/bolton_cms/config/image_sizes.yml +27 -0
- data/bolton_cms/config/site.yml +11 -0
- data/bolton_cms/config/templates.yml +6 -0
- data/bolton_cms/display/app.rb +61 -0
- data/bolton_cms/display/assets/stylesheets/base/_colors.scss +26 -0
- data/bolton_cms/display/assets/stylesheets/base/_typography.scss +31 -0
- data/bolton_cms/display/assets/stylesheets/base/_units.scss +3 -0
- data/bolton_cms/display/assets/stylesheets/display.scss +10 -0
- data/bolton_cms/display/assets/stylesheets/layout/_layout.scss +169 -0
- data/bolton_cms/display/controllers/base.rb +33 -0
- data/bolton_cms/display/helpers/helper.rb +67 -0
- data/bolton_cms/display/views/errors/403.slim +11 -0
- data/bolton_cms/display/views/errors/404.slim +15 -0
- data/bolton_cms/display/views/errors/500.slim +13 -0
- data/bolton_cms/display/views/layouts/application.slim +52 -0
- data/bolton_cms/display/views/templates/default.slim +25 -0
- data/bolton_cms/manage/app.rb +87 -0
- data/bolton_cms/manage/assets/images/collapsible-collapse.svg +1 -0
- data/bolton_cms/manage/assets/images/collapsible-collapse.svg.base64 +1 -0
- data/bolton_cms/manage/assets/images/collapsible-collapse.svg.uri +1 -0
- data/bolton_cms/manage/assets/images/collapsible-expand.svg +1 -0
- data/bolton_cms/manage/assets/images/collapsible-expand.svg.base64 +1 -0
- data/bolton_cms/manage/assets/images/collapsible-expand.svg.uri +1 -0
- data/bolton_cms/manage/assets/images/delete.svg +1 -0
- data/bolton_cms/manage/assets/images/delete.svg.base64 +1 -0
- data/bolton_cms/manage/assets/images/delete.svg.uri +1 -0
- data/bolton_cms/manage/assets/images/menu.svg +1 -0
- data/bolton_cms/manage/assets/images/menu.svg.base64 +1 -0
- data/bolton_cms/manage/assets/images/menu.svg.uri +1 -0
- data/bolton_cms/manage/assets/images/page-add.svg +1 -0
- data/bolton_cms/manage/assets/images/page-add.svg.base64 +1 -0
- data/bolton_cms/manage/assets/images/page-add.svg.uri +1 -0
- data/bolton_cms/manage/assets/images/user.svg +1 -0
- data/bolton_cms/manage/assets/images/user.svg.base64 +1 -0
- data/bolton_cms/manage/assets/images/user.svg.uri +1 -0
- data/bolton_cms/manage/assets/javascripts/application.js +82 -0
- data/bolton_cms/manage/assets/javascripts/enquire.min.js +7 -0
- data/bolton_cms/manage/assets/javascripts/jquery.mobile.custom.min.js +3 -0
- data/bolton_cms/manage/assets/stylesheets/_mixins.scss +0 -0
- data/bolton_cms/manage/assets/stylesheets/_placeholders.scss +13 -0
- data/bolton_cms/manage/assets/stylesheets/base/_colors.scss +97 -0
- data/bolton_cms/manage/assets/stylesheets/base/_forms.scss +105 -0
- data/bolton_cms/manage/assets/stylesheets/base/_icons.scss +35 -0
- data/bolton_cms/manage/assets/stylesheets/base/_tables.scss +26 -0
- data/bolton_cms/manage/assets/stylesheets/base/_typography.scss +34 -0
- data/bolton_cms/manage/assets/stylesheets/base/_units.scss +3 -0
- data/bolton_cms/manage/assets/stylesheets/layout/_layout.scss +172 -0
- data/bolton_cms/manage/assets/stylesheets/layout/_page_form.scss +100 -0
- data/bolton_cms/manage/assets/stylesheets/layout/_session_new.scss +10 -0
- data/bolton_cms/manage/assets/stylesheets/manage.scss +17 -0
- data/bolton_cms/manage/assets/stylesheets/modules/_collapsible.scss +42 -0
- data/bolton_cms/manage/assets/stylesheets/modules/_flash.scss +30 -0
- data/bolton_cms/manage/assets/stylesheets/modules/_item.scss +64 -0
- data/bolton_cms/manage/assets/stylesheets/modules/_tree.scss +30 -0
- data/bolton_cms/manage/controllers/accounts.rb +85 -0
- data/bolton_cms/manage/controllers/base.rb +9 -0
- data/bolton_cms/manage/controllers/pages.rb +112 -0
- data/bolton_cms/manage/controllers/sessions.rb +28 -0
- data/bolton_cms/manage/helpers/helper.rb +39 -0
- data/bolton_cms/manage/views/accounts/_form.slim +20 -0
- data/bolton_cms/manage/views/accounts/confirm_destroy.slim +7 -0
- data/bolton_cms/manage/views/accounts/edit.slim +2 -0
- data/bolton_cms/manage/views/accounts/index.slim +17 -0
- data/bolton_cms/manage/views/accounts/new.slim +2 -0
- data/bolton_cms/manage/views/errors/403.slim +11 -0
- data/bolton_cms/manage/views/errors/404.slim +15 -0
- data/bolton_cms/manage/views/errors/500.slim +13 -0
- data/bolton_cms/manage/views/layouts/application.slim +49 -0
- data/bolton_cms/manage/views/pages/_asset_form.slim +36 -0
- data/bolton_cms/manage/views/pages/_form.slim +65 -0
- data/bolton_cms/manage/views/pages/_node.slim +22 -0
- data/bolton_cms/manage/views/pages/confirm_destroy.slim +7 -0
- data/bolton_cms/manage/views/pages/edit.slim +2 -0
- data/bolton_cms/manage/views/pages/index.slim +6 -0
- data/bolton_cms/manage/views/pages/new.slim +2 -0
- data/bolton_cms/manage/views/sessions/new.slim +24 -0
- data/config/apps.rb +37 -0
- data/config/boot.rb +51 -0
- data/config/database.rb +1 -0
- data/config/mongoid.yml +32 -0
- data/config.ru +9 -0
- data/db/seeds.rb +23 -0
- data/gems/bolton-cms-padrino-0.2.6.gem +0 -0
- data/lib/bolton-cms-padrino.rb +23 -0
- data/lib/bolton_cms/attachment_uploader.rb +55 -0
- data/lib/bolton_cms/config.rb +20 -0
- data/lib/bolton_cms/models/account.rb +55 -0
- data/lib/bolton_cms/models/asset.rb +18 -0
- data/lib/bolton_cms/models/fragment.rb +16 -0
- data/lib/bolton_cms/models/page.rb +98 -0
- data/lib/bolton_cms/userstamp.rb +12 -0
- data/lib/bolton_cms/version.rb +3 -0
- data/public/favicon.ico +0 -0
- data/spec/fixtures/files/test1.jpg +0 -0
- data/spec/fixtures/files/test2.jpg +0 -0
- data/spec/models/account_spec.rb +38 -0
- data/spec/models/asset_spec.rb +36 -0
- data/spec/models/fragment_spec.rb +38 -0
- data/spec/models/page_spec.rb +191 -0
- data/spec/spec.rake +13 -0
- data/spec/spec_config.rb +25 -0
- metadata +428 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Nzk4ZTllYTdhZTRkNmZmZGRkNDUzNjA3ZDQyYjY1MTM5ODUyYTI3Yw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NmFhODg0Y2ExYzdiOTRlM2IzNzc4OWM1N2VkMGY3ODQyZmZmNjkzYg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NmRjOTBiYTAwNzlmNDBhNDQwMWZiNjEwZmEwM2I5Nzc1NjcwOTE2MWQ2NTEx
|
10
|
+
YjRmZWNhZTRkM2I0NDNkYTI3Y2M1NTMxYTI3Y2Y0NTY4MjlhOWRmY2M0ZjEx
|
11
|
+
Mzc5YjhhMWEyMWI4MTc5NjdhNjNlYWUxY2JiZjRlMDdmMTEzNTk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YzA4ZmQ5YWVlMjMyZjE2NzY1MzY2ZDhhNmYzZDJjMTYyOGU4OGJhOTA5Yjk2
|
14
|
+
MDZhZGViOWYyMjE1MzI4MGY5ZmMxY2ZlZjE1YWVjODYxN2Q4MjE2ODg0YTA1
|
15
|
+
N2JmMmE0NzQ2NjY3MjEzZTExYjdlOGY3NDY5Yzc2MDZjYWM4NTY=
|
data/.components
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Distribute your app as a gem
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# Test requirements
|
7
|
+
group :test do
|
8
|
+
gem 'minitest', :require => 'minitest/autorun'
|
9
|
+
gem 'rack-test', :require => 'rack/test'
|
10
|
+
|
11
|
+
gem 'minitest-reporters', :require => "minitest/reporters"
|
12
|
+
gem 'mongoid-minitest', :require => "mongoid-minitest"
|
13
|
+
|
14
|
+
gem 'simplecov', :require => false
|
15
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
# Bolton CMS - Padrino
|
2
|
+
|
3
|
+
Bolton CMS is a gem that bolts a minimalistic CMS onto your Padrino project.
|
4
|
+
|
5
|
+
The Bolton CMS philosophy is that the CMs should only manage content, and that any layout
|
6
|
+
design and templating should be managed by the developer and require deployment. The
|
7
|
+
reasoning behind this is primarily that I'm sick of dealing with content producers and
|
8
|
+
clients who thrash their layouts instead of seeking professional guidance.
|
9
|
+
|
10
|
+
## Configuration
|
11
|
+
|
12
|
+
**Only Padrino versions '~>0.11' are supported**
|
13
|
+
|
14
|
+
### Mounting the Bolton CMS apps
|
15
|
+
|
16
|
+
Add the following to your `Gemfile`:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'bolton-cms-padrino'
|
20
|
+
```
|
21
|
+
|
22
|
+
There are two apps to mount withinin your `apps.rb`: `Manage` and `Display`.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
Padrino.mount('BoltonCms::Manage', :app_file => BoltonCms.root('bolton_cms/manage/app.rb')).to('/cms')
|
26
|
+
Padrino.mount('BoltonCms::Display', :app_file => BoltonCms.root('bolton_cms/display/app.rb')).to('/')
|
27
|
+
```
|
28
|
+
|
29
|
+
The mounted paths may be changed to fit your project.
|
30
|
+
|
31
|
+
### MongoDB and Mongoid
|
32
|
+
|
33
|
+
Bolton CMS uses MongoDB via the Mongoid gem. You must configure a Mongo session named
|
34
|
+
`bolton_cms`. A sample mongoid.yml configuration is as follows:
|
35
|
+
|
36
|
+
```yaml
|
37
|
+
production:
|
38
|
+
sessions:
|
39
|
+
bolton_cms:
|
40
|
+
database: bolton_cms
|
41
|
+
hosts:
|
42
|
+
- localhost:27017
|
43
|
+
options:
|
44
|
+
raise_not_found_error: false
|
45
|
+
```
|
46
|
+
|
47
|
+
### Bolton CMS Required Configuration
|
48
|
+
|
49
|
+
There are three configuration files that you must include in your project at the path
|
50
|
+
`bolton_cms/config`: `site.yml`, `templates.yml`, and `image_sizes.yml`.
|
51
|
+
|
52
|
+
#### `site.yml`
|
53
|
+
|
54
|
+
The `site.yml` file maintains simple configuration options, such as the site's display
|
55
|
+
name, the organization's name, and contact information.
|
56
|
+
|
57
|
+
```yaml
|
58
|
+
name: My Site
|
59
|
+
organization: My Company
|
60
|
+
contact:
|
61
|
+
name: Person or Department Name
|
62
|
+
email: contact@mycompany.com
|
63
|
+
phone: 1-310-310-3100
|
64
|
+
address: "100 Street Rd #200"
|
65
|
+
city: Los Angeles
|
66
|
+
state: CA
|
67
|
+
zip: 90012
|
68
|
+
country: USA
|
69
|
+
```
|
70
|
+
|
71
|
+
It is recommended to at least make use of the name and organization parameters.
|
72
|
+
|
73
|
+
#### `templates.yml`
|
74
|
+
|
75
|
+
Custom templates and their layouts are glued together using information in
|
76
|
+
`templates.yml`.
|
77
|
+
|
78
|
+
```yaml
|
79
|
+
article:
|
80
|
+
layout:
|
81
|
+
application
|
82
|
+
fragments:
|
83
|
+
- Footnotes
|
84
|
+
- About the Author
|
85
|
+
gallery:
|
86
|
+
layout:
|
87
|
+
some_other_layout
|
88
|
+
fragments:
|
89
|
+
- Artist Bio
|
90
|
+
- More Like This
|
91
|
+
```
|
92
|
+
|
93
|
+
Each entry is a template, which must correspond to a file found within
|
94
|
+
`bolton_cms/display/views/templates`. Likewise, the associated layout file must be placed
|
95
|
+
within `bolton_cms/display/views/layouts`.
|
96
|
+
|
97
|
+
Fragments are simple page content fields, similar to the default "Body" field, allowing
|
98
|
+
you to break up content within a page, without too much hassle. Currently, all content
|
99
|
+
fields may be configured on the edit screen to contain either markdown (via Redcarpet) or
|
100
|
+
raw HTML.
|
101
|
+
|
102
|
+
This system allows you to code your layouts and templates any way you'd like, without
|
103
|
+
being constrained to any CMS-specific methods or tag libraries. However, at this time,
|
104
|
+
templates and layouts are expected to be written using the SLIM templating language.
|
105
|
+
|
106
|
+
#### `image_sizes.yml`
|
107
|
+
|
108
|
+
Asset image processing is configurable within `image_sizes.yml`.
|
109
|
+
|
110
|
+
```yaml
|
111
|
+
default:
|
112
|
+
resize: limit
|
113
|
+
width: 1136
|
114
|
+
height: 1136
|
115
|
+
large:
|
116
|
+
resize: fit
|
117
|
+
width: 1024
|
118
|
+
height: 1024
|
119
|
+
medium:
|
120
|
+
resize: fit
|
121
|
+
width: 800
|
122
|
+
height: 800
|
123
|
+
small:
|
124
|
+
resize: pad
|
125
|
+
width: 640
|
126
|
+
height: 640
|
127
|
+
background: #99c
|
128
|
+
thumb:
|
129
|
+
resize: fill
|
130
|
+
width: 100
|
131
|
+
height: 100
|
132
|
+
```
|
133
|
+
|
134
|
+
Each entry is an image "size" that is generated on upload, to be accessed within layouts
|
135
|
+
and templates. Available resize options are `limit`, `fit`, `fill`, and `pad`.
|
136
|
+
|
137
|
+
- `limit` resizes the image only if it is larger than either of the given dimensions
|
138
|
+
- `fit` resizes the image to the closest given dimension
|
139
|
+
- `pad` resizes the image to the closest given dimension, but generates an image "padded out" to both given dimensions
|
140
|
+
- `fill` resizes the image to match both given dimensions, potentially cropping out portions of the image
|
141
|
+
|
142
|
+
If `pad` is chosen, an additional option "background" may be added, allowing you to
|
143
|
+
specify what color the padded potion should be.
|
144
|
+
|
145
|
+
Image "gravity" may be specified by the end user for each asset within the edit screen,
|
146
|
+
to further adjust how an image is cropped, if it may be cropped.
|
147
|
+
|
148
|
+
Bolton CMS uses Carrierwave to manage uploaded assets, and stores them locally.
|
149
|
+
|
150
|
+
## User Accounts
|
151
|
+
|
152
|
+
To generate the initial Administrator account, run `rake db:seed` from the command line,
|
153
|
+
and follow the prompts.
|
154
|
+
|
155
|
+
User accounts may be given a role of Producer, Editor, or Admin. Only the admin can
|
156
|
+
create and delete accounts. At this time, there is no real difference between a producer
|
157
|
+
and an editor.
|
158
|
+
|
159
|
+
In the future, the Account screens may be moved into a simple stand-alone Padrino gem app.
|
160
|
+
|
161
|
+
## Accessing CMS Data in Templates and Layouts
|
162
|
+
|
163
|
+
For the time being, the best way to understand all your options is to study this gem. The
|
164
|
+
models are in `lib/bolton_cms/models`, and the default layout and templates are in
|
165
|
+
`bolton_cms/display/views`.
|
166
|
+
|
167
|
+
## Development
|
168
|
+
|
169
|
+
For development, this gem can be run as a standalone Padrino application
|
170
|
+
as you would expect from a normal one:
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
$ bundle exec padrino start
|
174
|
+
```
|
175
|
+
|
176
|
+
The Rakefile also works like the normal Padrino one and supports all standard
|
177
|
+
components.
|
178
|
+
|
179
|
+
## Contributing
|
180
|
+
|
181
|
+
Feel free to fork this repo and submit a pull request. Thanks!
|
182
|
+
|
183
|
+
---
|
184
|
+
|
185
|
+
Created and maintained by Charles Hudson
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/bolton_cms/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ['Charles Hudson']
|
6
|
+
gem.email = ['phobetron@gmail.com']
|
7
|
+
gem.description = 'Bolt-on CMS for Padrino'
|
8
|
+
gem.summary = 'Padrino sub-apps that support CMS functionality, so you don\'t have to roll your own.'
|
9
|
+
gem.homepage = 'https://github.com/phobetron/bolton-cms-padrino'
|
10
|
+
gem.license = 'MIT'
|
11
|
+
|
12
|
+
gem.files = `git ls-files`.split($\)
|
13
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
|
+
gem.name = 'bolton-cms-padrino'
|
16
|
+
gem.require_paths = ['lib', 'models', 'bolton_cms']
|
17
|
+
gem.version = BoltonCms::VERSION
|
18
|
+
|
19
|
+
gem.add_dependency 'rake'
|
20
|
+
gem.add_dependency 'babosa'
|
21
|
+
gem.add_dependency 'padrino', '~>0.11.4'
|
22
|
+
gem.add_dependency 'padrino-sprockets'
|
23
|
+
gem.add_dependency 'sprockets-sass'
|
24
|
+
gem.add_dependency 'sass'
|
25
|
+
gem.add_dependency 'slim'
|
26
|
+
gem.add_dependency 'redcarpet'
|
27
|
+
gem.add_dependency 'mime-types'
|
28
|
+
gem.add_dependency 'bcrypt-ruby'
|
29
|
+
gem.add_dependency 'mongoid', '~>3.0.0'
|
30
|
+
gem.add_dependency 'mongoid_userstamp'
|
31
|
+
gem.add_dependency 'mongoid-tree'
|
32
|
+
gem.add_dependency 'mini_magick'
|
33
|
+
gem.add_dependency 'carrierwave'
|
34
|
+
gem.add_dependency 'carrierwave-mongoid'
|
35
|
+
gem.add_dependency 'compass'
|
36
|
+
gem.add_dependency 'breakpoint'
|
37
|
+
gem.add_dependency 'singularitygs'
|
38
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Available Resize Types:
|
2
|
+
# limit, fit, fill, pad
|
3
|
+
#
|
4
|
+
# Resize 'pad' can accept a 'background' option, default is 'transparent'
|
5
|
+
#
|
6
|
+
# Size 'default' is required.
|
7
|
+
|
8
|
+
default:
|
9
|
+
resize: limit
|
10
|
+
width: 1136
|
11
|
+
height: 1136
|
12
|
+
large:
|
13
|
+
resize: fit
|
14
|
+
width: 1024
|
15
|
+
height: 1024
|
16
|
+
medium:
|
17
|
+
resize: fit
|
18
|
+
width: 800
|
19
|
+
height: 800
|
20
|
+
small:
|
21
|
+
resize: pad
|
22
|
+
width: 640
|
23
|
+
height: 640
|
24
|
+
thumb:
|
25
|
+
resize: fill
|
26
|
+
width: 100
|
27
|
+
height: 100
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module BoltonCms
|
2
|
+
|
3
|
+
class Display < Padrino::Application
|
4
|
+
|
5
|
+
register Padrino::Rendering
|
6
|
+
register Padrino::Mailer
|
7
|
+
register Padrino::Helpers
|
8
|
+
register Padrino::Sprockets
|
9
|
+
|
10
|
+
##
|
11
|
+
# Caching support
|
12
|
+
#
|
13
|
+
# register Padrino::Cache
|
14
|
+
# enable :caching
|
15
|
+
#
|
16
|
+
# You can customize caching store engines:
|
17
|
+
#
|
18
|
+
# set :cache, Padrino::Cache::Store::Memcache.new(::Memcached.new('127.0.0.1:11211', exception_retry_limit: 1))
|
19
|
+
# set :cache, Padrino::Cache::Store::Memcache.new(::Dalli::Client.new('127.0.0.1:11211', exception_retry_limit: 1))
|
20
|
+
# set :cache, Padrino::Cache::Store::Redis.new(::Redis.new(host: '127.0.0.1', port: 6379, db: 0))
|
21
|
+
# set :cache, Padrino::Cache::Store::Memory.new(50)
|
22
|
+
# set :cache, Padrino::Cache::Store::File.new(Padrino.root('tmp', app_name.to_s, 'cache')) # default choice
|
23
|
+
#
|
24
|
+
|
25
|
+
##
|
26
|
+
# Application configuration options
|
27
|
+
#
|
28
|
+
# set :raise_errors, true # Raise exceptions (will stop application) (default for test)
|
29
|
+
# set :dump_errors, true # Exception backtraces are written to STDERR (default for production/development)
|
30
|
+
# set :show_exceptions, true # Shows a stack trace in browser (default for development)
|
31
|
+
# set :logging, true # Logging in STDOUT for development and file for production (default only for development)
|
32
|
+
# set :public_folder, 'foo/bar' # Location for static assets (default root/public)
|
33
|
+
# set :reload, false # Reload application files (default in development)
|
34
|
+
# set :default_builder, 'foo' # Set a custom form builder (default 'StandardFormBuilder')
|
35
|
+
# set :locale_path, 'bar' # Set path for I18n translations (default your_apps_root_path/locale)
|
36
|
+
# disable :sessions # Disabled sessions by default (enable if needed)
|
37
|
+
# disable :flash # Disables sinatra-flash (enabled by default if Sinatra::Flash is defined)
|
38
|
+
# layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
|
39
|
+
#
|
40
|
+
|
41
|
+
##
|
42
|
+
# You can configure for a specified environment like:
|
43
|
+
#
|
44
|
+
# configure :development do
|
45
|
+
# set :foo, :bar
|
46
|
+
# disable :asset_stamp # no asset timestamping for dev
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
|
50
|
+
sprockets
|
51
|
+
|
52
|
+
enable :sessions
|
53
|
+
|
54
|
+
# Custom error management
|
55
|
+
error(403) { @title = "Access Denied"; render('errors/403') }
|
56
|
+
error(404) { @title = "Document Not Found"; render('errors/404') }
|
57
|
+
error(500) { @title = "Internal Server Error"; render('errors/500') }
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// Base colors
|
2
|
+
$base-color: #333;
|
3
|
+
$base-background: #fff;
|
4
|
+
|
5
|
+
$link-color: #334;
|
6
|
+
$link-hover-color: #556;
|
7
|
+
$link-active-color: #667;
|
8
|
+
$link-visited-color: #666;
|
9
|
+
|
10
|
+
$global-header-background: #eee;
|
11
|
+
|
12
|
+
$global-nav-color: #ddd;
|
13
|
+
$global-nav-background: #666;
|
14
|
+
$global-nav-current-color: #fff;
|
15
|
+
$global-nav-current-background: #444;
|
16
|
+
$global-nav-hover-background: #555;
|
17
|
+
$global-nav-highlight: rgba(255,255,255,.3);
|
18
|
+
$global-nav-shadow: rgba(0,0,0,.3);
|
19
|
+
|
20
|
+
$global-footer-color: #999;
|
21
|
+
$global-footer-background: #eee;
|
22
|
+
$global-footer-copyright-color: #bbb;
|
23
|
+
|
24
|
+
$section-border-color: #ddd;
|
25
|
+
|
26
|
+
$assets-background: #f9f9f9;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
html {
|
2
|
+
color: $base-color;
|
3
|
+
font-size: 100%;
|
4
|
+
font-family: Verdana, sans-serif;
|
5
|
+
}
|
6
|
+
|
7
|
+
h1, h2, h3, h4, h5, h6, .btn {
|
8
|
+
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
|
9
|
+
}
|
10
|
+
h1, h2, h3 {
|
11
|
+
font-weight: normal;
|
12
|
+
}
|
13
|
+
|
14
|
+
a {
|
15
|
+
&:link {
|
16
|
+
color: $link-color;
|
17
|
+
}
|
18
|
+
&:hover {
|
19
|
+
color: $link-hover-color;
|
20
|
+
}
|
21
|
+
&:active, &:focus {
|
22
|
+
color: $link-active-color;
|
23
|
+
}
|
24
|
+
&:visited {
|
25
|
+
color: $link-visited-color;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
img {
|
30
|
+
vertical-align: middle;
|
31
|
+
}
|
@@ -0,0 +1,169 @@
|
|
1
|
+
html {
|
2
|
+
height: 100%;
|
3
|
+
}
|
4
|
+
body {
|
5
|
+
position: relative;
|
6
|
+
max-width: 64em;
|
7
|
+
min-height: 100%;
|
8
|
+
margin: 0 auto;
|
9
|
+
padding: 0;
|
10
|
+
}
|
11
|
+
|
12
|
+
#global-header, body > article, body > section {
|
13
|
+
padding: 0.01ex 1em;
|
14
|
+
}
|
15
|
+
|
16
|
+
#global-header {
|
17
|
+
background: $global-header-background;
|
18
|
+
h1 a {
|
19
|
+
text-decoration: none;
|
20
|
+
color: inherit;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
.site-sections {
|
24
|
+
margin: 0 -1em;
|
25
|
+
ul {
|
26
|
+
@include clearfix;
|
27
|
+
list-style-type: none;
|
28
|
+
margin-bottom: 3ex;
|
29
|
+
padding: 0;
|
30
|
+
background: $global-nav-background;
|
31
|
+
}
|
32
|
+
li {
|
33
|
+
float: left;
|
34
|
+
&:first-child {
|
35
|
+
border-left: 2px solid $global-nav-shadow;
|
36
|
+
}
|
37
|
+
&:last-child {
|
38
|
+
border-right: 2px solid $global-nav-highlight;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
a, strong {
|
42
|
+
display: inline-block;
|
43
|
+
padding: 1ex 1em;
|
44
|
+
border-left: 2px solid $global-nav-highlight;
|
45
|
+
border-right: 2px solid $global-nav-shadow;
|
46
|
+
}
|
47
|
+
a {
|
48
|
+
text-decoration: none;
|
49
|
+
color: $global-nav-color;
|
50
|
+
&:hover, &:active {
|
51
|
+
background: $global-nav-hover-background;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
strong {
|
55
|
+
font-weight: normal;
|
56
|
+
color: $global-nav-current-color;
|
57
|
+
background: $global-nav-current-background;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
body > article, body > section {
|
62
|
+
position: relative;
|
63
|
+
margin-bottom: 2ex;
|
64
|
+
article, section {
|
65
|
+
border-top: 2px dotted $section-border-color;
|
66
|
+
&:first-child {
|
67
|
+
border-top: 0;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
#global-footer {
|
73
|
+
@include clearfix;
|
74
|
+
background: $global-footer-background;
|
75
|
+
font-size: .9em;
|
76
|
+
text-align: center;
|
77
|
+
.site-links, .contact, .copyright {
|
78
|
+
padding: 1ex 1em;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
.site-links {
|
82
|
+
h1 {
|
83
|
+
position: absolute;
|
84
|
+
height: 1px;
|
85
|
+
width: 1px;
|
86
|
+
overflow: hidden;
|
87
|
+
margin: -1px;
|
88
|
+
padding: 0;
|
89
|
+
border: 0;
|
90
|
+
clip: rect(1px, 1px, 1px, 1px);
|
91
|
+
}
|
92
|
+
ul {
|
93
|
+
list-style-type: none;
|
94
|
+
margin: 0;
|
95
|
+
padding: 0;
|
96
|
+
}
|
97
|
+
li {
|
98
|
+
display: inline;
|
99
|
+
&:before {
|
100
|
+
content: ' | ';
|
101
|
+
}
|
102
|
+
&:first-child:before {
|
103
|
+
content: '';
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
.contact {
|
108
|
+
color: $global-footer-color;
|
109
|
+
h1, address {
|
110
|
+
display: inline;
|
111
|
+
font-size: 1em;
|
112
|
+
font-style: normal;
|
113
|
+
}
|
114
|
+
h1:after {
|
115
|
+
content: ':';
|
116
|
+
}
|
117
|
+
a {
|
118
|
+
color: inherit;
|
119
|
+
}
|
120
|
+
.name, .street, .city, .state, .zip {
|
121
|
+
&:after {
|
122
|
+
content: ',';
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
.copyright {
|
127
|
+
margin: 0;
|
128
|
+
font-size: .9em;
|
129
|
+
color: $global-footer-copyright-color;
|
130
|
+
}
|
131
|
+
|
132
|
+
.breadcrumbs {
|
133
|
+
position: absolute;
|
134
|
+
top: -3ex;
|
135
|
+
left: 1em;
|
136
|
+
ul, li {
|
137
|
+
list-item-type: none;
|
138
|
+
display: inline;
|
139
|
+
margin: 0;
|
140
|
+
padding: 0;
|
141
|
+
}
|
142
|
+
ul {
|
143
|
+
font-size: .7em;
|
144
|
+
}
|
145
|
+
li:before {
|
146
|
+
content: ' > ';
|
147
|
+
}
|
148
|
+
li:first-child:before {
|
149
|
+
content: '';
|
150
|
+
}
|
151
|
+
strong {
|
152
|
+
font-weight: normal;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
.assets-list {
|
157
|
+
@include clearfix;
|
158
|
+
list-style-type: none;
|
159
|
+
padding: 1.75ex 1em;
|
160
|
+
background: $assets-background;
|
161
|
+
li {
|
162
|
+
display: block;
|
163
|
+
float: left;
|
164
|
+
margin-left: 1em;
|
165
|
+
&:first-child {
|
166
|
+
margin-left: 0;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
BoltonCms::Display.controllers :base do
|
2
|
+
|
3
|
+
get :index, map: "/*path" do
|
4
|
+
@home = Page.where(parent: nil, position: 0).first
|
5
|
+
@sections = Page.where(parent: nil, :position.gt => 0)
|
6
|
+
|
7
|
+
if params[:path].first.size == 0
|
8
|
+
@page = @home
|
9
|
+
else
|
10
|
+
@page = Page.where(path: params[:path].join('/')).first
|
11
|
+
end
|
12
|
+
|
13
|
+
if @page
|
14
|
+
render_by_config(@page)
|
15
|
+
else
|
16
|
+
halt 404
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
define_method :render_by_config do |page|
|
21
|
+
view_root = Padrino.root('bolton_cms/display/views')
|
22
|
+
|
23
|
+
template = 'templates/' << page.template.to_s
|
24
|
+
layout = BoltonCms::TEMPLATES[page.template.to_s]['layout'].to_s
|
25
|
+
|
26
|
+
if Dir.glob(view_root+'/'+template+'.*').empty?
|
27
|
+
render 'templates/default', layout: 'application'
|
28
|
+
else
|
29
|
+
render template, layout: layout, views: view_root
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|