refinerycms 0.9.6.4 → 0.9.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/VERSION +1 -1
- data/db/seeds.rb +1 -1
- data/public/500.html +2 -3
- data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +4 -4
- data/vendor/plugins/images/rails/init.rb +8 -1
- data/vendor/plugins/news/rails/init.rb +5 -1
- data/vendor/plugins/pages/rails/init.rb +7 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/rails/init.rb +5 -1
- data/vendor/plugins/refinery/lib/refinery/activity.rb +27 -6
- data/vendor/plugins/refinery/plugins.md +29 -25
- data/vendor/plugins/refinery_settings/rails/init.rb +7 -1
- data/vendor/plugins/resources/rails/init.rb +8 -2
- data/vendor/plugins/themes/rails/init.rb +7 -4
- metadata +2 -2
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.6.
|
1
|
+
0.9.6.5
|
data/db/seeds.rb
CHANGED
@@ -118,7 +118,7 @@ Page.create(:title => "Down for maintenance",
|
|
118
118
|
})
|
119
119
|
|
120
120
|
# Install default themes.
|
121
|
-
|
121
|
+
Rails.root.join("themes").mkdir unless Rails.root.join("themes").directory?
|
122
122
|
Dir[File.join(%W(#{REFINERY_ROOT} themes *.zip))].each do |theme|
|
123
123
|
Theme.create(:uploaded_data => {
|
124
124
|
"size" => File.size(theme),
|
data/public/500.html
CHANGED
@@ -21,10 +21,9 @@
|
|
21
21
|
</head>
|
22
22
|
|
23
23
|
<body>
|
24
|
-
<!-- This file lives in public/500.html -->
|
25
24
|
<div class="dialog">
|
26
|
-
|
27
|
-
|
25
|
+
<h1>We're sorry, but something went wrong.</h1>
|
26
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
28
27
|
</div>
|
29
28
|
</body>
|
30
29
|
</html>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Admin::DashboardHelper
|
2
2
|
|
3
3
|
def activity_message_for(record)
|
4
|
-
|
4
|
+
if (activity = Refinery::Plugins.active.find_activity_by_model(record.class)).present? and activity.title.present?
|
5
5
|
title = record.send activity.title
|
6
|
-
link = link_to
|
7
|
-
|
8
|
-
|
6
|
+
link = link_to truncate(title, :length => 45),
|
7
|
+
eval("#{activity.url}(#{activity.nesting("record")}record)"),
|
8
|
+
:title => "See '#{title}'"
|
9
9
|
|
10
10
|
# next work out which action occured and how long ago it happened
|
11
11
|
action = record.updated_at.eql?(record.created_at) ? "created" : "updated"
|
@@ -3,5 +3,12 @@ Refinery::Plugin.register do |plugin|
|
|
3
3
|
plugin.description = "Manage images"
|
4
4
|
plugin.version = 1.0
|
5
5
|
plugin.menu_match = /admin\/((images)|(image_dialogs))$/
|
6
|
-
plugin.activity = {
|
6
|
+
plugin.activity = {
|
7
|
+
:class => Image,
|
8
|
+
:title => 'title',
|
9
|
+
:url_prefix => 'edit',
|
10
|
+
:conditions => "parent_id IS NULL",
|
11
|
+
:created_image => "image_add.png",
|
12
|
+
:updated_image => "image_edit.png"
|
13
|
+
}
|
7
14
|
end
|
@@ -3,5 +3,9 @@ Refinery::Plugin.register do |plugin|
|
|
3
3
|
plugin.description = "Provides a blog-like news section"
|
4
4
|
plugin.version = 1.0
|
5
5
|
plugin.menu_match = /admin\/((news)|(news_items))$/
|
6
|
-
plugin.activity = {
|
6
|
+
plugin.activity = {
|
7
|
+
:class => NewsItem,
|
8
|
+
:title => 'title',
|
9
|
+
:url_prefix => 'edit'
|
10
|
+
}
|
7
11
|
end
|
@@ -3,5 +3,11 @@ Refinery::Plugin.register do |plugin|
|
|
3
3
|
plugin.description = "Manage content pages"
|
4
4
|
plugin.version = 1.0
|
5
5
|
plugin.menu_match = /admin\/((pages)|(page_dialogs)|(page_parts))$/
|
6
|
-
plugin.activity = {
|
6
|
+
plugin.activity = {
|
7
|
+
:class => Page,
|
8
|
+
:url_prefix => "edit",
|
9
|
+
:title => "title",
|
10
|
+
:created_image => "page_add.png",
|
11
|
+
:updated_image => "page_edit.png"
|
12
|
+
}
|
7
13
|
end
|
@@ -2,5 +2,9 @@ Refinery::Plugin.register do |plugin|
|
|
2
2
|
plugin.title = "<%= class_name.pluralize.underscore.titleize %>"
|
3
3
|
plugin.description = "Manage <%= class_name.pluralize.underscore.titleize %>"
|
4
4
|
plugin.version = 1.0
|
5
|
-
plugin.activity = {
|
5
|
+
plugin.activity = {
|
6
|
+
:class => <%= class_name %>,
|
7
|
+
:url_prefix => "edit",
|
8
|
+
:title => '<%= attributes.first.name %>'
|
9
|
+
}
|
6
10
|
end
|
@@ -1,16 +1,37 @@
|
|
1
1
|
module Refinery
|
2
2
|
class Activity
|
3
3
|
|
4
|
-
attr_accessor :class, :
|
4
|
+
attr_accessor :class, :conditions, :created_image, :limit, :nested_with, :order, :title, :updated_image, :url, :url_prefix
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
# for nested_with, pass in the reverse order of ancestry e.g. [parent.parent_of_parent, parent]
|
7
|
+
def initialize(options={})
|
8
|
+
{
|
9
|
+
:class => nil,
|
10
|
+
:conditions => nil,
|
11
|
+
:created_image => "add.png",
|
12
|
+
:limit => 10,
|
13
|
+
:nested_with => [],
|
14
|
+
:order => 'updated_at DESC',
|
15
|
+
:title => nil,
|
16
|
+
:updated_image => "edit.png",
|
17
|
+
:url => nil,
|
18
|
+
:url_prefix => ""
|
19
|
+
}.merge(options).each { |key,value| self.instance_variable_set(:"@#{key}", value) }
|
20
|
+
end
|
21
|
+
|
22
|
+
# to use in a URL like edit_admin_group_individuals_url(record.group, record)
|
23
|
+
# which will help you if you're using nested routed.
|
24
|
+
def nesting(record_string="record")
|
25
|
+
self.nested_with.inject("") { |nest_chain, nesting| nest_chain << "#{record_string}.#{nesting}," }
|
9
26
|
end
|
10
27
|
|
11
28
|
def url_prefix
|
12
|
-
|
29
|
+
"#{"#{@url_prefix}_".gsub("__", "_") if @url_prefix.present?}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def url
|
33
|
+
"#{self.url_prefix}#{@url ||= "admin_#{self.class.name.underscore.downcase}_url"}"
|
13
34
|
end
|
14
35
|
|
15
36
|
end
|
16
|
-
end
|
37
|
+
end
|
@@ -13,23 +13,23 @@ The Refinery generator is a standard Rails generator that functions just like th
|
|
13
13
|
To see how to use the generator run
|
14
14
|
|
15
15
|
ruby script/generate refinery
|
16
|
-
|
16
|
+
|
17
17
|
Usage instructions should appear.
|
18
18
|
|
19
19
|
## Example of Using the Generator
|
20
20
|
|
21
21
|
Let's say you have a client who has a range of products they want to show on their website. You've considered using a few pages to manage the products but you've decided it would be much nicer if there was a separate place that had forms dedicated to managing products.
|
22
22
|
|
23
|
-
First decide what fields they need to manage. In our case, the client is going to want to edit the title and description of each product. They would also like a little "facts panel" to show on the right of the page.
|
23
|
+
First decide what fields they need to manage. In our case, the client is going to want to edit the title and description of each product. They would also like a little "facts panel" to show on the right of the page.
|
24
24
|
|
25
25
|
So go to the root of your project and run
|
26
26
|
|
27
27
|
ruby script/generate refinery
|
28
|
-
|
28
|
+
|
29
29
|
This will output the help on how to use the generator. To generate the new section we want to manage products we run:
|
30
30
|
|
31
31
|
ruby script/generate refinery product title:string description:text facts:text
|
32
|
-
|
32
|
+
|
33
33
|
The generator will output a list of files it generated. You'll notice there is a new plugin that has been added in ``vendor/plugins/products``. This is where both the backend and front end files are held for this new products area.
|
34
34
|
|
35
35
|
A new database migration has been added to add the products table in so run:
|
@@ -90,7 +90,7 @@ This bit is important. It's where all the controllers are held to manage pages i
|
|
90
90
|
:order => "position ASC", :paging => false
|
91
91
|
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
This single controller allows us to create, read, update and delete pages in the backend. With a little bit of Refinery magic we utilise the [crudify mixin](http://github.com/resolve/refinerycms/blob/master/vendor/plugins/refinery/crud.md) which gives us all of these regular features out of the box.
|
95
95
|
|
96
96
|
How crudify works is an entire topic of it's own. Checkout the [crudify documentation](http://github.com/resolve/refinerycms/blob/master/vendor/plugins/refinery/crud.md) to get an insight into how that works.
|
@@ -112,17 +112,19 @@ This file runs when your site is started up. All is does is registers this plugi
|
|
112
112
|
plugin.description = "Manage content pages"
|
113
113
|
plugin.version = 1.0
|
114
114
|
plugin.menu_match = /admin\/((pages)|(page_dialogs)|(page_parts))$/
|
115
|
-
plugin.activity = {
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
plugin.activity = {
|
116
|
+
:class => Page,
|
117
|
+
:url_prefix => "edit_",
|
118
|
+
:title => "title",
|
119
|
+
:created_image => "page_add.png",
|
120
|
+
:updated_image => "page_edit.png"
|
121
|
+
}
|
120
122
|
end
|
121
|
-
|
123
|
+
|
122
124
|
## Getting your Plugin to Report Activity in the Dashboard
|
123
|
-
|
125
|
+
|
124
126
|
Recent activity reporting is built right in, so all you need to do is follow the convention below and your plugin will start showing up in the recent activity list of the Dashboard.
|
125
|
-
|
127
|
+
|
126
128
|
In our example above we showed the use of ``plugin.activity`` for the pages plugin.
|
127
129
|
|
128
130
|
Refinery::Plugin.register do |plugin|
|
@@ -130,13 +132,15 @@ In our example above we showed the use of ``plugin.activity`` for the pages plug
|
|
130
132
|
plugin.description = "Manage content pages"
|
131
133
|
plugin.version = 1.0
|
132
134
|
plugin.menu_match = /admin\/((pages)|(page_dialogs)|(page_parts))$/
|
133
|
-
plugin.activity = {
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
plugin.activity = {
|
136
|
+
:class => Page,
|
137
|
+
:url_prefix => "edit_",
|
138
|
+
:title => "title",
|
139
|
+
:created_image => "page_add.png",
|
140
|
+
:updated_image => "page_edit.png"
|
141
|
+
}
|
138
142
|
end
|
139
|
-
|
143
|
+
|
140
144
|
Here's what the different activity options mean:
|
141
145
|
|
142
146
|
### Required
|
@@ -147,7 +151,7 @@ Here's what the different activity options mean:
|
|
147
151
|
:url_prefix
|
148
152
|
# Just use "_edit" if you're not sure how this works.
|
149
153
|
#
|
150
|
-
# When it says "'About Us' page was updated about 4 hours ago", the page title "About Us"
|
154
|
+
# When it says "'About Us' page was updated about 4 hours ago", the page title "About Us"
|
151
155
|
# is linked to that page in a way we specify. So by setting "_edit" as a :url_prefix what
|
152
156
|
# we're doing is making it link to the page that allows us to edit this page.
|
153
157
|
# So the next result is edit_admin_page_url(page)
|
@@ -159,8 +163,8 @@ Here's what the different activity options mean:
|
|
159
163
|
### Optional
|
160
164
|
|
161
165
|
:created_image and :updated_image
|
162
|
-
# the activity monitor knows if something is created or updated and shows a different icon
|
163
|
-
# depending on how you want that to look. You can specify the filename to any image you
|
166
|
+
# the activity monitor knows if something is created or updated and shows a different icon
|
167
|
+
# depending on how you want that to look. You can specify the filename to any image you
|
164
168
|
# want in the public/images/refinery/icons/ directory.
|
165
169
|
|
166
170
|
## Search Engine Optimisation: Improving the default URLs
|
@@ -170,14 +174,14 @@ In our example above we extended Refinery to manage a products area. The problem
|
|
170
174
|
To achieve this all you need to do is open up the product model (found in ``/vendor/plugins/products/app/models/product.rb``) and add the following line inside your class:
|
171
175
|
|
172
176
|
has_friendly_id :title, :use_slug => true
|
173
|
-
|
177
|
+
|
174
178
|
Note you want to change ``:title`` to the field which you want to show up in the URL.
|
175
179
|
|
176
180
|
This will work just fine for new products added from this point, but you'll want to migrate any existing products you have to use this new URL format. All you have to do is save each product you have in the database to make it create a nice URL for you.
|
177
181
|
|
178
182
|
ruby script/console
|
179
183
|
>> Product.all.each {|p| p.save };nil
|
180
|
-
|
184
|
+
|
181
185
|
Now all the products in your database will have nice URLs.
|
182
186
|
|
183
187
|
## How to get a WYSIWYG editor to show on your form fields
|
@@ -197,5 +201,5 @@ Again going back to our product plugin example if you had this in your ``vendor/
|
|
197
201
|
Just change that to:
|
198
202
|
|
199
203
|
<%= f.text_area :description, :class => "wymeditor" %>
|
200
|
-
|
204
|
+
|
201
205
|
Refresh and you're done.
|
@@ -4,5 +4,11 @@ Refinery::Plugin.register do |plugin|
|
|
4
4
|
plugin.version = 1.0
|
5
5
|
plugin.url = "/admin/settings"
|
6
6
|
plugin.menu_match = /admin\/((refinery_settings)|(settings))$/
|
7
|
-
plugin.activity = {
|
7
|
+
plugin.activity = {
|
8
|
+
:class => RefinerySetting,
|
9
|
+
:title => 'title',
|
10
|
+
:url_prefix => 'edit',
|
11
|
+
:created_image => "cog_add.png",
|
12
|
+
:updated_image => "cog_edit.png"
|
13
|
+
}
|
8
14
|
end
|
@@ -2,5 +2,11 @@ Refinery::Plugin.register do |plugin|
|
|
2
2
|
plugin.title = "Resources"
|
3
3
|
plugin.description = "Upload and link to files"
|
4
4
|
plugin.version = 1.0
|
5
|
-
plugin.activity = {
|
6
|
-
|
5
|
+
plugin.activity = {
|
6
|
+
:class => Resource,
|
7
|
+
:title => 'title',
|
8
|
+
:url_prefix => 'edit',
|
9
|
+
:created_image => "page_white_put.png",
|
10
|
+
:updated_image => "page_white_edit.png"
|
11
|
+
}
|
12
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
Refinery::Plugin.register do |plugin|
|
2
|
-
|
3
2
|
plugin.title = "Themes"
|
4
3
|
plugin.description = "Upload and manage themes"
|
5
4
|
plugin.version = 1.0
|
6
|
-
plugin.activity = {
|
7
|
-
|
8
|
-
|
5
|
+
plugin.activity = {
|
6
|
+
:class => Theme,
|
7
|
+
:title => 'title',
|
8
|
+
:url_prefix => 'edit',
|
9
|
+
:created_image => "layout_add.png",
|
10
|
+
:updated_image => "layout_edit.png"
|
11
|
+
}
|
9
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.6.
|
4
|
+
version: 0.9.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Resolve Digital
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-02-
|
14
|
+
date: 2010-02-09 00:00:00 +13:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|