Skip to content

Commit 4e629b3

Browse files
authored
Merge branch 'master' into feature/consistent-dummy-app
2 parents 9438b3f + d11c780 commit 4e629b3

29 files changed

+197
-109
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ end
3535
if !ENV['TRAVIS'] || ENV['DB'] == 'postgresql'
3636
group :postgres, :postgresql do
3737
gem 'activerecord-jdbcpostgresql-adapter', '>= 1.3.0.rc1', platform: :jruby
38-
gem 'pg', platform: :ruby
38+
gem 'pg', '~> 0.21', platform: :ruby
3939
end
4040
end
4141

contributing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ inclusion.
3333

3434
## Links ##
3535

36-
See also the [Contributing to Refinery](http://refinerycms.com/guides/contributing-to-refinery) guide.
36+
See also the [Contributing to Refinery](https://www.refinerycms.com/guides/contributing-to-refinery) guide.

core/app/views/refinery/_site_bar.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div id='site_bar'>
77
<div id='site_bar_content' class='clearfix'>
88
9-
<%= link_to 'http://refinerycms.com', :id => 'site_bar_refinery_cms_logo', :target => '_blank' do %>
9+
<%= link_to 'https://www.refinerycms.com', :id => 'site_bar_refinery_cms_logo', :target => '_blank' do %>
1010
<%= image_tag 'refinery/refinery-cms-logo.svg', alt: 'Refinery CMS™' %>
1111
<% end %>
1212
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<%= f.submit t('.save_and_continue_editing'),
2-
:id => "submit_continue_button",
3-
:class => "wymupdate button" if f.object.persisted? %>
2+
id: 'submit_continue_button',
3+
class: 'wymupdate button',
4+
data: { disable_with: false } if f.object.persisted? %>
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<%
22
unless (hide_submit ||= false)
33
submit_button_text ||= t('.save')
4-
submit_button_id ||= "submit_button"
4+
submit_button_id ||= 'submit_button'
55
submit_button_title ||= nil
6+
submit_button_data ||= { disable_with: false }
67
end
78

89
hide_cancel = from_dialog? unless defined?(hide_cancel).presence
@@ -12,8 +13,8 @@
1213
unless defined?(cancel_title)
1314
cancel_title = t('.cancel_lose_changes')
1415
end
15-
cancel_button_id ||= "cancel_button"
16-
cancel_url ||= (((back = url_for(:back)).include?('javascript') or action_name =~ /^(create|update)$/) ? refinery.send(Refinery.route_for_model(f.object.class, :plural => true)) : back)
16+
cancel_button_id ||= 'cancel_button'
17+
cancel_url ||= (((back = url_for(:back)).include?('javascript') or action_name =~ /^(create|update)$/) ? refinery.send(Refinery.route_for_model(f.object.class, plural: true)) : back)
1718
end
1819

1920
continue_editing = defined?(continue_editing) ? continue_editing : (f.object.present? and f.object.persisted?)
@@ -28,7 +29,7 @@
2829
delete_button_text ||= t('.delete')
2930
delete_title ||= nil
3031
delete_confirmation ||= nil
31-
delete_button_id ||= "delete_button"
32+
delete_button_id ||= 'delete_button'
3233
# we have to use eval rather than refinery.send because this url may not exist for HTTP GET
3334
delete_url ||= eval("refinery.#{Refinery.route_for_model(f.object.class)}(#{f.object.id})")
3435
end
@@ -38,37 +39,42 @@
3839
<input type='hidden' name='dialog' value='true' />
3940
<% end %>
4041

41-
<div class='form-actions<%= ' form-actions-dialog' if from_dialog? %>'>
42-
<div class='form-actions-left'>
42+
<%= content_tag :div, class: "form-actions#{' form-actions-dialog' if from_dialog?}" do %>
43+
<%= content_tag :div, class: 'form-actions-left' do %>
4344
<%= submit_tag submit_button_text,
44-
:id => submit_button_id,
45-
:name => nil,
46-
:class => "wymupdate button",
47-
:tooltip => submit_button_title unless hide_submit %>
45+
id: submit_button_id,
46+
name: nil,
47+
class: 'wymupdate button',
48+
data: submit_button_data,
49+
tooltip: submit_button_title unless hide_submit %>
4850

49-
<%= render '/refinery/admin/continue_editing', :f => f if continue_editing -%>
51+
<%= render '/refinery/admin/continue_editing', f: f if continue_editing -%>
5052
<%= hidden_field_tag :continue_editing, false if continue_editing %>
5153

5254
<%= local_assigns[:before_cancel_button] -%>
5355

54-
<%= link_to(cancel_button_text, cancel_url,
55-
:title => cancel_title,
56-
:id => cancel_button_id,
57-
:class => "close_dialog button") unless hide_cancel %>
56+
<%= link_to cancel_button_text, cancel_url,
57+
title: cancel_title,
58+
id: cancel_button_id,
59+
class: 'close_dialog button' unless hide_cancel %>
5860

5961
<%= local_assigns[:after_cancel_button] -%>
60-
<i id='spinner' class='loading_icon hidden_icon'></i>
61-
</div>
62-
<div class='form-actions-right'>
62+
63+
<%= content_tag :i, nil, id: 'spinner', class: 'loading_icon hidden_icon' %>
64+
<% end %>
65+
66+
<%= content_tag :div, class: 'form-actions-right' do %>
6367
<%= local_assigns[:before_delete_button] -%>
64-
<%= link_to(delete_button_text, delete_url,
65-
:title => delete_title,
66-
:id => delete_button_id,
67-
:method => :delete,
68-
:data => {
69-
:confirm => delete_confirmation
68+
69+
<%= link_to delete_button_text, delete_url,
70+
title: delete_title,
71+
id: delete_button_id,
72+
method: :delete,
73+
data: {
74+
confirm: delete_confirmation
7075
},
71-
:class => "button confirm-delete") unless hide_delete %>
76+
class: 'button confirm-delete' unless hide_delete %>
77+
7278
<%= local_assigns[:after_delete_button] -%>
73-
</div>
74-
</div>
79+
<% end %>
80+
<% end %>

core/lib/generators/refinery/cms/cms_generator.rb

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'mkmf'
12
require 'pathname'
23
require 'refinery/core/environment_checker'
34

@@ -78,14 +79,14 @@ def append_gitignore!
7879
def append_heroku_gems!
7980
production_gems = [
8081
"gem 'dragonfly-s3_data_store'",
81-
"gem 'rails_12factor'",
82-
"gem 'puma'"
82+
"gem 'rails_12factor'"
8383
]
84+
production_gems << "gem 'puma'" unless destination_gemfile_has_puma?
8485
production_gems << "gem 'pg'" unless destination_gemfile_has_postgres?
8586

8687
append_file "Gemfile", %Q{
8788
# The Ruby version is specified here so that Heroku uses the right version.
88-
ruby #{ENV['RUBY_VERSION'].inspect}
89+
ruby #{current_ruby_version.inspect}
8990
9091
# Gems that have been added for Heroku support
9192
group :production do
@@ -94,6 +95,10 @@ def append_heroku_gems!
9495
}.sub("{{production_gems}}", production_gems.join("\n "))
9596
end
9697

98+
def current_ruby_version
99+
ENV['RUBY_VERSION'].presence || RUBY_VERSION
100+
end
101+
97102
def bundle!
98103
run 'bundle install'
99104
end
@@ -204,16 +209,24 @@ def forced_overwriting?
204209
end
205210

206211
def destination_gemfile_has_postgres?
212+
destination_gemfile_has_gem?('pg')
213+
end
214+
215+
def destination_gemfile_has_puma?
216+
destination_gemfile_has_gem?('puma')
217+
end
218+
219+
def destination_gemfile_has_gem?(gem_name)
207220
destination_path.join('Gemfile').file? &&
208-
destination_path.join('Gemfile').read =~ %r{gem ['"]pg['"]}
221+
destination_path.join('Gemfile').read =~ %r{gem ['"]#{gem_name}['"]}
209222
end
210223

211224
def heroku?
212225
options[:heroku].present?
213226
end
214227

215228
def heroku_toolbelt_missing?
216-
!!system("heroku --version")
229+
find_executable("heroku").nil?
217230
end
218231

219232
def manage_roadblocks!

core/lib/refinery/crud.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def self.default_options(model_name)
2626
{
2727
:conditions => '',
2828
:include => [],
29-
:order => ('position ASC' if this_class.table_exists? && this_class.column_names.include?('position')),
29+
:order => ('position ASC' if this_class.connected? && this_class.table_exists? && this_class.column_names.include?('position')),
3030
:paging => true,
3131
:per_page => false,
3232
:redirect_to_url => "refinery.#{Refinery.route_for_model(class_name.constantize, :plural => true)}",
@@ -67,7 +67,8 @@ def new
6767
end
6868
6969
def create
70-
if (@#{singular_name} = #{class_name}.create(#{singular_name}_params)).valid?
70+
@#{singular_name} = #{class_name}.new(#{singular_name}_params)
71+
if @#{singular_name}.save
7172
flash.notice = t(
7273
'refinery.crudify.created',
7374
:what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'"

core/refinerycms-core.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
1111
s.summary = %q{Core extension for Refinery CMS}
1212
s.description = %q{The core of Refinery CMS. This handles the common functionality and is required by most extensions}
1313
s.email = %q{[email protected]}
14-
s.homepage = %q{http://refinerycms.com}
14+
s.homepage = %q{https://www.refinerycms.com}
1515
s.rubyforge_project = %q{refinerycms}
1616
s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski']
1717
s.license = %q{MIT}

doc/guides/1 - Getting Started/2 - Getting Started.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The extensions Refinery comes with are:
5656

5757
## Creating a new Refinery project
5858

59-
![](/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTJfMDdfMTRfNjQ3X3JpY2tfYXN0bGV5X25ldmVyX2dvbm5hX2dpdmVfeW91X3VwLmpwZyJdXQ/rick-astley-never-gonna-give-you-up.jpg?sha=d5fdafec8a158121)
59+
![Never gonna give you up](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTJfMDdfMTRfNjQ3X3JpY2tfYXN0bGV5X25ldmVyX2dvbm5hX2dpdmVfeW91X3VwLmpwZyJdXQ/rick-astley-never-gonna-give-you-up.jpg?sha=d5fdafec8a158121)
6060

6161
If you follow this guide, you'll create a Refinery site called `rickrockstar` that will have a custom design. Then you'll be ready to go further in the following guide and add events extension to allow Rick to tell his fans when his next gig is.
6262

@@ -137,7 +137,7 @@ $ rails server
137137

138138
This will fire up an instance of the built-in Rails web server by default (called WEBrick). To see your application in action, open a browser window and navigate to <http://localhost:3000/refinery>. You should be greeted with a screen prompting you to create your first Refinery user.
139139

140-
![](/system/images/W1siZiIsIjIwMTIvMDMvMDQvMTRfMTFfMjRfOTkzX3NldF91cF95b3VyX2ZpcnN0X3VzZXIucG5nIl1d/set-up-your-first-user.png?sha=42b2ae6479070760)
140+
![Set up your first user](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTIvMDMvMDQvMTRfMTFfMjRfOTkzX3NldF91cF95b3VyX2ZpcnN0X3VzZXIucG5nIl1d/set-up-your-first-user.png?sha=42b2ae6479070760)
141141

142142
__TIP__: To stop the web server, hit `Ctrl+C` in the terminal window where it's running.
143143

@@ -151,7 +151,7 @@ Fill out the sign up form to create your first user. This will be the super user
151151

152152
Once you've created your first user you'll see Refinery's admin.
153153

154-
![](/system/images/W1siZiIsIjIwMTMvMDYvMDkvMjNfNTdfNDRfNzIxX2Rhc2hib2FyZC5wbmciXV0/dashboard.png?sha=d05ed9da6bb78669)
154+
![Old Dashboard image](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTMvMDYvMDkvMjNfNTdfNDRfNzIxX2Rhc2hib2FyZC5wbmciXV0/dashboard.png?sha=d05ed9da6bb78669)
155155

156156
### Setting Your Site Name
157157

@@ -173,13 +173,13 @@ Now you're setup, click around the various tabs in the backend and become famili
173173

174174
### Switching to your front-end
175175

176-
![](/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTJfNTdfMDZfNDIyX3N3aXRjaF90b193ZWJzaXRlLnBuZyJdXQ/switch-to-website.png?sha=a13b44877a69739e)
176+
![Website Frontend](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTJfNTdfMDZfNDIyX3N3aXRjaF90b193ZWJzaXRlLnBuZyJdXQ/switch-to-website.png?sha=a13b44877a69739e)
177177

178178
You're currently in the back-end Refinery site editor. To see the front-end site, click "Switch to your website".
179179

180180
As you can see, Refinery is already displaying a basic menu and layout ready for you to customise.
181181

182-
![](/system/images/W1siZiIsIjIwMTIvMDMvMjUvMjNfMjVfMThfNjg1X3JlZmluZXJ5X2RlZmF1bHRfZnJvbnRfZW5kX3NtYWxsLnBuZyJdXQ/refinery-default-front-end-small.png?sha=021f1e16d298eb86)
182+
![Default Basic Layout](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTIvMDMvMjUvMjNfMjVfMThfNjg1X3JlZmluZXJ5X2RlZmF1bHRfZnJvbnRfZW5kX3NtYWxsLnBuZyJdXQ/refinery-default-front-end-small.png?sha=021f1e16d298eb86)
183183

184184
### Customising the Design
185185

@@ -234,7 +234,7 @@ As you can see we're going to render a view with some HTML5 tags and along with
234234

235235
When you edit the About page you'll see something like this:
236236

237-
![](/system/images/W1siZiIsIjIwMTMvMDYvMDkvMjNfNTdfNDRfNDg5X2Fib3V0X3BhZ2VfZWRpdC5wbmciXV0/about_page_edit.png?sha=6d88aaa196ad01a2)
237+
![Editing the about page](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTMvMDYvMDkvMjNfNTdfNDRfNDg5X2Fib3V0X3BhZ2VfZWRpdC5wbmciXV0/about_page_edit.png?sha=6d88aaa196ad01a2)
238238

239239
You'll notice two tabs on the page: "Body" and "Side Body". These are `PageParts`, or in other words, a single piece of content attached to this page that you can render in your view. There is a "Body" tab with some content on this screen. To render that same content in your view, put:
240240

@@ -286,7 +286,7 @@ __TIP__: You can add CSS for specific pages by using their slug with `-page`. Th
286286

287287
Now when you view your front-end at <http://localhost:3000/about> you'll notice your site has a grey background, with a horizontal menu and two white content areas.
288288

289-
![](/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTRfMjRfNTFfMjI3X2RlZmF1bHRfZGVzaWduX3NtYWxsLnBuZyJdXQ/default-design-small.png?sha=84c3f6a40328b9a6)
289+
![Default design - small image](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTRfMjRfNTFfMjI3X2RlZmF1bHRfZGVzaWduX3NtYWxsLnBuZyJdXQ/default-design-small.png?sha=84c3f6a40328b9a6)
290290

291291
### What we just did
292292

doc/guides/1 - Getting Started/3 - Generate an Extension to Use Your MVCs.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ __WARNING__: This guide is based on Refinery CMS 2.1.0 so some of the code shown
1111

1212
## Guide Assumptions
1313

14-
This guide continues the Rick Rock Star example from the [Getting Started](/guide/getting-started/) guide. You will need to have Refinery installed and running as explained in that guide.
14+
This guide continues the Rick Rock Star example from the [Getting Started](/guides/getting-started/) guide. You will need to have Refinery installed and running as explained in that guide.
1515

16-
This guide does not assume that you have any prior experience with Refinery beyond what is covered in the [Getting Started](/guide/getting-started/) guide, but it does assume that you are somewhat familiar with Rails. If you are not familiar with Rails, you will still be able to step through the guide but you may not fully understand all of the commands or code. Here are some resources to learn more about Rails:
16+
This guide does not assume that you have any prior experience with Refinery beyond what is covered in the [Getting Started](/guides/getting-started/) guide, but it does assume that you are somewhat familiar with Rails. If you are not familiar with Rails, you will still be able to step through the guide but you may not fully understand all of the commands or code. Here are some resources to learn more about Rails:
1717

1818
* [Ruby on Rails](http://rubyonrails.org/)
1919
* [Ruby on Rails Guides for v3.2](http://guides.rubyonrails.org/v3.2.14/) - Note that these are the guides for Rails version `3.2` since that is the version Refinery requires.
@@ -47,7 +47,7 @@ Here is a list of the most often used field types and what they give you:
4747
-------------------- -------------------------------------------------------------------------------------------------------
4848
```
4949
50-
If you remember from the [Getting Started](/guide/getting-started/) guide, we told Rick that we'll give him an area to post up events he'll be at. Although we could technically create a new page in Refinery to add the event content there, areas that have special functionality are much better suited as an extension.
50+
If you remember from the [Getting Started](/guides/getting-started/) guide, we told Rick that we'll give him an area to post up events he'll be at. Although we could technically create a new page in Refinery to add the event content there, areas that have special functionality are much better suited as an extension.
5151
5252
Rick is going to want to enter the following information about each event:
5353
@@ -131,7 +131,7 @@ __TIP__: Models in Refinery extensions expect a string field that acts as the ti
131131
Now go to the backend of your Refinery site ([http://localhost:3000/refinery](http://localhost:3000/refinery)) and
132132
you'll notice a new tab called "Events". Click on "Add new event" and you'll see something like this:
133133
134-
![](/system/images/W1siZiIsIjIwMTMvMDYvMDkvMjNfNTdfNDRfODYwX2V2ZW50X3BhZ2VfZWRpdC5wbmciXV0/event_page_edit.png?sha=d45dd13cf1a97d8f)
134+
![Adding an event](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTMvMDYvMDkvMjNfNTdfNDRfODYwX2V2ZW50X3BhZ2VfZWRpdC5wbmciXV0/event_page_edit.png?sha=d45dd13cf1a97d8f)
135135
136136
You'll see the entire form has been generated for you based off the field types you specified when generating the events section. The blurb has a visual editor, the date field is a date picker and the photo allows you to pick or upload a new photo from a built-in Refinery dialog.
137137
@@ -141,9 +141,9 @@ Now click on "Switch to your website", and navigate to <http://localhost:3000/ev
141141
142142
You'll notice not only has Refinery generated the backend "Events" tab but also a new menu item called "Events" and two new front-end views,`index.html.erb` and `show.html.erb`, located in `vendor/extensions/events/app/views/refinery/events/` for you to customise.
143143
144-
![](/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTRfMjRfNTFfNDE1X2V2ZW50c19lbmdpbmVfc21hbGwucG5nIl1d/events-engine-small.png?sha=d3af41646dd136ba)
144+
![Events frontend with undesired ordering](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTRfMjRfNTFfNDE1X2V2ZW50c19lbmdpbmVfc21hbGwucG5nIl1d/events-engine-small.png?sha=d3af41646dd136ba)
145145
146-
As you can see, Refinery makes it insanely easy to quickly add new extensions to manage various areas of a site.
146+
As you can see, Refinery makes it really easy to quickly add new extensions to manage various areas of a site.
147147
148148
But I've noticed one problem. The "2011 Music Awards" is showing up in the middle when it makes more sense to order the events with the latest event at the top. To fix this we need to understand what's happening under the hood of a Refinery extension. Let's dive in.
149149
@@ -218,7 +218,7 @@ end
218218
219219
Now when you look at <http://localhost:3000/events> you'll notice they're now being sorted by the event date.
220220
221-
![](/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTRfMjRfNTFfMzE0X2V2ZW50c19lbmdpbmVfZml4ZWRfc21hbGwucG5nIl1d/events-engine-fixed-small.png?sha=452dcc1cbd2522c3)
221+
![Finished events frontend](https://www.refinerycms.com/system/images/W1siZiIsIjIwMTAvMTIvMDIvMTRfMjRfNTFfMzE0X2V2ZW50c19lbmdpbmVfZml4ZWRfc21hbGwucG5nIl1d/events-engine-fixed-small.png?sha=452dcc1cbd2522c3)
222222
223223
## What's Next?
224224

0 commit comments

Comments
 (0)