thesis 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +147 -7
- data/lib/assets/javascripts/thesis/hallo.js +2949 -0
- data/lib/assets/javascripts/thesis/thesis.js.coffee +27 -0
- data/lib/assets/javascripts/thesis.js +2 -0
- data/lib/assets/stylesheets/thesis/thesis.css.scss +16 -0
- data/lib/assets/stylesheets/thesis.css +4 -0
- data/lib/generators/thesis/install/install_generator.rb +108 -0
- data/lib/generators/thesis/install/templates/migrations/create_page.rb +18 -0
- data/lib/generators/thesis/install/templates/migrations/create_page_content.rb +15 -0
- data/lib/generators/thesis/install/templates/page_templates/default.html.erb +38 -0
- data/lib/generators/thesis/install/templates/page_templates/default.html.haml +29 -0
- data/lib/generators/thesis/install/templates/page_templates/default.html.slim +29 -0
- data/lib/tasks/thesis_tasks.rake +4 -0
- data/lib/thesis/colorizer.rb +51 -0
- data/lib/thesis/controllers/controller_helpers.rb +39 -0
- data/lib/thesis/controllers/thesis_controller.rb +53 -0
- data/lib/thesis/engine.rb +5 -0
- data/lib/thesis/exceptions.rb +17 -0
- data/lib/thesis/models/page.rb +43 -0
- data/lib/thesis/models/page_content.rb +41 -0
- data/lib/thesis/railtie.rb +12 -0
- data/lib/thesis/routing/route_constraint.rb +7 -0
- data/lib/thesis/routing/routes.rb +10 -0
- data/lib/thesis/version.rb +1 -1
- data/lib/thesis.rb +10 -1
- data/spec/factories/page_contents.rb +7 -0
- data/spec/factories/pages.rb +9 -0
- data/spec/lib/thesis/controllers/thesis_controller_spec.rb +68 -0
- data/spec/lib/thesis/models/page_content_spec.rb +33 -0
- data/spec/lib/thesis/models/page_spec.rb +49 -0
- data/spec/spec_helper.rb +64 -0
- metadata +58 -14
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/Rakefile +0 -1
- data/lib/thesis/base.rb +0 -5
- data/thesis.gemspec +0 -19
data/README.md
CHANGED
@@ -1,20 +1,160 @@
|
|
1
1
|
# Thesis
|
2
2
|
|
3
|
-
### Thesis is a CMS that integrates as seamlessly as possible into your current website.
|
3
|
+
### Thesis is a CMS gem that integrates as seamlessly as possible into your current Rails website.
|
4
4
|
|
5
5
|
Most Rails content management systems make you conform to their system from the start,
|
6
6
|
making it difficult to just "drop in" the gem and make it work with your CMS. Thesis
|
7
|
-
tries to be a drop-in CMS that doesn't hijack your development workflow
|
7
|
+
tries to be a drop-in CMS that doesn't hijack your development workflow and stays out
|
8
|
+
of the way.
|
8
9
|
|
9
|
-
|
10
|
+
### Requirements
|
10
11
|
|
11
|
-
|
12
|
+
* Rails 3.2.x (or higher)
|
13
|
+
* Ruby 1.9.3 (or higher)
|
14
|
+
|
15
|
+
Thesis might work with earlier versions but that's not our focus.
|
16
|
+
|
17
|
+
## Getting Started
|
18
|
+
|
19
|
+
### Installation
|
20
|
+
|
21
|
+
In your Gemfile:
|
12
22
|
|
13
23
|
gem 'thesis'
|
24
|
+
|
25
|
+
Then run these from your command line:
|
26
|
+
|
27
|
+
bundle install
|
28
|
+
rails g thesis:install
|
29
|
+
rake db:migrate
|
30
|
+
|
31
|
+
This will install thesis and add the database tables.
|
32
|
+
|
33
|
+
### Authentication
|
34
|
+
|
35
|
+
**Thesis does not force you to use a particular authentication strategy.**
|
36
|
+
|
37
|
+
Instead, it adds a method into your application_controller.rb file that
|
38
|
+
allows you to hook up your own authentication logic.
|
39
|
+
|
40
|
+
* If you return `false` from this method, nothing will show up client-side nor will the page be editable.
|
41
|
+
* If you return `true` from this method, the Thesis editor will appear and the page will be editable.
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
# Thesis authentication
|
45
|
+
def page_is_editable?(page)
|
46
|
+
# Add your own criteria here for editing privileges. Examples:
|
47
|
+
# current_user.admin? # Basic admin
|
48
|
+
# can? :update, page # CanCan
|
49
|
+
true # EVERYONE has access right now.
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
### Page Templates
|
54
|
+
|
55
|
+
Thesis's installer will drop a `page_templates` folder into your `app/views` folder.
|
56
|
+
This is where you put different styles of pages for use in the CMS.
|
57
|
+
Thesis will install an ERB, [HAML](http://haml.info), or [Slim](http://slim-lang.com) version, depending on your configuration.
|
58
|
+
|
59
|
+
#### Meta information
|
60
|
+
|
61
|
+
Pages come with a few built-in fields for use in meta tags.
|
62
|
+
|
63
|
+
```haml
|
64
|
+
%title= current_page.title
|
65
|
+
%meta{ content: current_page.description, type: "description" }
|
66
|
+
```
|
67
|
+
|
68
|
+
#### Thesis Editor
|
69
|
+
|
70
|
+
Place this right after your opening `body` tag to embed the Thesis editor. It will only show
|
71
|
+
up if your `page_is_editable?` method returns `true`.
|
72
|
+
|
73
|
+
```haml
|
74
|
+
%body
|
75
|
+
= thesis_editor
|
76
|
+
```
|
77
|
+
|
78
|
+
#### Page title
|
79
|
+
|
80
|
+
```haml
|
81
|
+
%h1= current_page.title
|
82
|
+
```
|
83
|
+
|
84
|
+
#### Primary Navigation
|
85
|
+
|
86
|
+
Use `root_pages` to get a list of pages at the root level. You can use the
|
87
|
+
page's `name` and `path` accessors in your links.
|
88
|
+
|
89
|
+
```haml
|
90
|
+
%nav
|
91
|
+
%ul
|
92
|
+
%li= link_to "Home", root_path # You can mix and match dynamic and static pages
|
93
|
+
- root_pages.each do |p|
|
94
|
+
%li= link_to p.name, p.path
|
95
|
+
%li= link_to "Static Page", static_page_path
|
96
|
+
```
|
97
|
+
|
98
|
+
#### Page content
|
99
|
+
|
100
|
+
Content areas are accessible from any page using the `content` method. This method
|
101
|
+
takes two arguments: name and type. Type defaults to `:html`. The only other type
|
102
|
+
is `:text` (for now) which is plain text, no HTML accepted.
|
103
|
+
|
104
|
+
Both content types will wrap their content in a `<div>` or `<span>`.
|
105
|
+
|
106
|
+
Referencing a content area in a page template will create one if it doesn't exist already.
|
107
|
+
|
108
|
+
```haml
|
109
|
+
%article
|
110
|
+
= current_page.content("Main Content", :html)
|
111
|
+
%aside
|
112
|
+
= current_page.content("Sidebar Content", :html)
|
113
|
+
%footer
|
114
|
+
%p= current_page.content("Footer Content", :text)
|
115
|
+
```
|
116
|
+
|
117
|
+
### Routing
|
118
|
+
|
119
|
+
Thesis will also add a route handler to your `routes.rb` file. This will
|
120
|
+
automatically handle routes for pages you create with Thesis.
|
121
|
+
|
122
|
+
thesis_routes
|
123
|
+
|
124
|
+
**To improve performance, put it near the bottom of your `routes.rb` file.**
|
125
|
+
|
126
|
+
## Using the CMS
|
127
|
+
|
128
|
+
### Adding a Page
|
129
|
+
|
130
|
+
TODO
|
131
|
+
|
132
|
+
### Editing a Page
|
133
|
+
|
134
|
+
TODO
|
135
|
+
|
136
|
+
### Deleting a Page
|
137
|
+
|
138
|
+
TODO
|
139
|
+
|
140
|
+
### Rearranging Pages
|
141
|
+
|
142
|
+
TODO
|
143
|
+
|
144
|
+
## What Thesis Isn't
|
145
|
+
|
146
|
+
You can't have it all or it becomes the same as the other bloated content management systems
|
147
|
+
out there. This is a list of what it's not and what it's not ever likely to be.
|
14
148
|
|
15
|
-
|
149
|
+
We reserve the right to change our mind, however, especially with well planned and written
|
150
|
+
pull requests to help prod us in the right direction. :-)
|
16
151
|
|
17
|
-
|
152
|
+
1. A WordPress Replacement
|
153
|
+
2. A full featured CMS
|
154
|
+
3. A full featured WYSIWYG editor
|
155
|
+
4. An authentication or permission system
|
156
|
+
5. A gem that works well with Sinatra or non-ActiveRecord ORMs
|
157
|
+
6. Anything other than a basic editor for pages and page content
|
18
158
|
|
19
159
|
## Contributing
|
20
160
|
|
@@ -22,6 +162,6 @@ TODO: Write usage instructions here
|
|
22
162
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
23
163
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
24
164
|
4. Write tests for your new feature
|
25
|
-
5. Run `
|
165
|
+
5. Run `bundle exec rspec` in the root directory to ensure that all tests pass.
|
26
166
|
6. Push to the branch (`git push origin my-new-feature`)
|
27
167
|
7. Create new Pull Request
|