Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into auth_wip

Conflicts:
	authentication/app/views/refinery/admin/users/_user.html.erb
	core/spec/support/refinery.rb
  • Loading branch information...
commit c5273d4a5538f5f73752aadffa699dff55e0b60a 2 parents efc7315 + c3c3dd7
@parndt parndt authored
Showing with 535 additions and 393 deletions.
  1. +1 −1  Gemfile
  2. +3 −1 authentication/app/views/refinery/admin/users/_user.html.erb
  3. +1 −1  authentication/lib/refinery/authenticated_system.rb
  4. +9 −2 changelog.md
  5. +31 −33 core/app/assets/javascripts/refinery/admin.js.erb
  6. +32 −31 core/app/assets/javascripts/refinery/modal_dialogs.js.erb
  7. +1 −0  core/app/assets/javascripts/refinery/submit_continue.js.coffee.erb
  8. +55 −45 core/app/assets/javascripts/wymeditor/lang/nl.js
  9. +12 −1 core/app/assets/javascripts/wymeditor/lang/pl.js
  10. +0 −1  core/app/controllers/refinery/admin_controller.rb
  11. +1 −1  core/app/helpers/refinery/menu_helper.rb
  12. +2 −0  core/app/models/refinery/core/base_model.rb
  13. +3 −1 core/app/views/refinery/admin/_form_actions.html.erb
  14. +16 −0 core/app/views/refinery/admin/_wysiwyg.html.erb
  15. +2 −2 core/lib/generators/refinery/dummy/dummy_generator.rb
  16. 0  core/lib/generators/refinery/dummy/templates/rails/{application.rb → application.rb.erb}
  17. 0  core/lib/generators/refinery/dummy/templates/rails/{boot.rb → boot.rb.erb}
  18. 0  ...s/app/controllers/refinery/namespace/admin/{plural_name_controller.rb → plural_name_controller.rb.erb}
  19. 0  ...mplates/app/controllers/refinery/namespace/{plural_name_controller.rb → plural_name_controller.rb.erb}
  20. 0  ...tors/refinery/engine/templates/app/models/refinery/namespace/{singular_name.rb → singular_name.rb.erb}
  21. +31 −32 core/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb
  22. 0  core/lib/generators/refinery/engine/templates/config/{routes.rb → routes.rb.erb}
  23. 0  ...ngine/templates/db/migrate/{1_create_namespace_plural_name.rb → 1_create_namespace_plural_name.rb.erb}
  24. 0  core/lib/generators/refinery/engine/templates/db/{seeds.rb → seeds.rb.erb}
  25. 0  .../lib/generators/refinery/{extension_plural_name_generator.rb → extension_plural_name_generator.rb.erb}
  26. 0  core/lib/generators/refinery/engine/templates/lib/refinery/{plural_name.rb → plural_name.rb.erb}
  27. 0  ...emplates/lib/refinery/plural_name/engine.rb → engine/templates/lib/refinery/plural_name/engine.rb.erb}
  28. 0  ...plates/lib/refinerycms-plural_name.rb → engine/templates/lib/refinerycms-extension_plural_name.rb.erb}
  29. 0  ...ry/engine/templates/spec/models/refinery/namespace/{singular_name_spec.rb → singular_name_spec.rb.erb}
  30. 0  ...ngine/templates/spec/requests/refinery/namespace/admin/{plural_name_spec.rb → plural_name_spec.rb.erb}
  31. +1 −1  core/lib/generators/refinery/engine/templates/spec/spec_helper.rb
  32. 0  ...rators/refinery/engine/templates/spec/support/factories/refinery/{plural_name.rb → plural_name.rb.erb}
  33. 0  ...s/app/controllers/refinery/namespace/admin/{plural_name_controller.rb → plural_name_controller.rb.erb}
  34. 0  ...mplates/app/controllers/refinery/namespace/admin/{settings_controller.rb → settings_controller.rb.erb}
  35. 0  ...mplates/app/controllers/refinery/namespace/{plural_name_controller.rb → plural_name_controller.rb.erb}
  36. 0  core/lib/generators/refinery/form/templates/app/mailers/refinery/namespace/{mailer.rb → mailer.rb.erb}
  37. 0  core/lib/generators/refinery/form/templates/app/models/refinery/namespace/{setting.rb → setting.rb.erb}
  38. 0  ...rators/refinery/form/templates/app/models/refinery/namespace/{singular_name.rb → singular_name.rb.erb}
  39. 0  core/lib/generators/refinery/form/templates/config/{routes.rb → routes.rb.erb}
  40. 0  .../generators/refinery/form/templates/db/migrate/{1_create_plural_name.rb → 1_create_plural_name.rb.erb}
  41. 0  core/lib/generators/refinery/form/templates/db/{seeds.rb → seeds.rb.erb}
  42. 0  ...inery/form/templates/lib/generators/refinery/{plural_name_generator.rb → plural_name_generator.rb.erb}
  43. 0  core/lib/generators/refinery/form/templates/lib/refinery/{plural_name.rb → plural_name.rb.erb}
  44. 0  .../templates/lib/refinery/plural_name/engine.rb → form/templates/lib/refinery/plural_name/engine.rb.erb}
  45. 0  ...emplates/lib/refinerycms-extension_plural_name.rb → form/templates/lib/refinerycms-plural_name.rb.erb}
  46. +1 −1  core/lib/refinery/application_controller.rb
  47. +84 −122 core/lib/refinery/cli.rb
  48. +8 −4 core/lib/refinery/crud.rb
  49. +8 −3 core/lib/refinery/extension_generation.rb
  50. +1 −1  core/lib/refinery/menu.rb
  51. +17 −17 core/spec/lib/refinery/application_controller_spec.rb
  52. +5 −5 core/spec/lib/refinery/cli_spec.rb
  53. +102 −0 core/spec/lib/refinery/crud_spec.rb
  54. +0 −1  core/spec/support/refinery.rb
  55. +28 −15 dashboard/app/helpers/refinery/admin/dashboard_helper.rb
  56. +7 −7 images/app/models/refinery/image.rb
  57. +3 −1 images/app/views/refinery/admin/images/_grid_view.html.erb
  58. +3 −1 images/app/views/refinery/admin/images/_list_view_image.html.erb
  59. +9 −0 images/db/migrate/20120625093918_remove_image_ext_from_refinery_images.rb
  60. +4 −0 images/spec/factories/image.rb
  61. BIN  images/spec/fixtures/beach-alternate.jpeg
  62. +12 −0 images/spec/models/refinery/image_spec.rb
  63. +1 −1  pages/app/controllers/refinery/pages_controller.rb
  64. +4 −29 pages/app/models/refinery/page.rb
  65. +3 −1 pages/app/views/refinery/admin/pages/_page.html.erb
  66. +1 −0  pages/config/locales/en.yml
  67. +7 −0 pages/config/locales/fr.yml
  68. +8 −6 pages/config/locales/pl.yml
  69. +14 −13 pages/db/seeds.rb
  70. +1 −1  pages/lib/refinery/pages/instance_methods.rb
  71. +3 −1 resources/app/views/refinery/admin/resources/_resource.html.erb
  72. +0 −1  testing/lib/refinery/testing.rb
  73. +0 −9 testing/lib/refinery/testing/url_helper.rb
  74. 0  tmp/pids/.gitkeep
View
2  Gemfile
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
gemspec
-gem 'refinerycms-authentication', path: '.'#:git => 'git://github.com/resolve/refinerycms.git', :branch => 'auth'
+gem 'refinerycms-authentication', :path => '.'#:git => 'git://github.com/resolve/refinerycms.git', :branch => 'auth'
# Add i18n support.
gem 'refinerycms-i18n', '~> 2.1.0.dev', :git => 'git://github.com/parndt/refinerycms-i18n.git'
View
4 authentication/app/views/refinery/admin/users/_user.html.erb
@@ -16,6 +16,8 @@
:class => "cancel confirm-delete",
:title => t('delete', :scope => 'refinery.admin.users'),
:method => :delete,
- :confirm => t('message', :scope => 'refinery.admin.delete', :title => user.username) if refinery_user.can_delete?(user) %>
+ :data => {
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => user.username)
+ } if refinery_user.can_delete?(user) %>
</span>
</li>
View
2  authentication/lib/refinery/authenticated_system.rb
@@ -4,7 +4,7 @@ module AuthenticatedSystem
#
# We can return to this location by calling #redirect_back_or_default.
def store_location
- session[:return_to] = request.fullpath.sub("//", "/")
+ session[:return_to] = request.fullpath
end
# Clear and return the stored location
View
11 changelog.md
@@ -1,11 +1,18 @@
## 2.1.0 [unreleased]
-* Added `Refinery::Page#canonical_slug` to allow us to retrieve a consistent slug across multiple translations of a page. Useful for CSS selectors. [#1457](https://github.com/resolve/refinerycms/issues/1457). [Philip Arndt](https://github.com/parndt)
+* Refactored wysiwyg fields into a partial. [#1796](https://github.com/resolve/refinerycms/pull/1796). [Rob Yurkowski](https://github.com/robyurkowski)
* Shortened all authentication helpers. [#1719](https://github.com/resolve/refinerycms/pull/1719). [Ryan Bigg](https://github.com/radar)
* [See full list](https://github.com/resolve/refinerycms/compare/2-0-stable...master)
-## 2.0.5 [unreleased]
+## 2.0.6 [unreleased]
+* Added `Refinery::Page#canonical_slug` to allow us to retrieve a consistent slug across multiple translations of a page. Useful for CSS selectors. [#1457](https://github.com/resolve/refinerycms/issues/1457). [Philip Arndt](https://github.com/parndt)
+* Fixed bug with 404 page not honoring custom view/layout template. [#1746](https://github.com/resolve/refinerycms/pull/1746). [Uģis Ozols](https://github.com/ugisozols)
+* Renamed all templates in generators which contained erb to *.rb.erb. [#1750](https://github.com/resolve/refinerycms/pull/1750). [Uģis Ozols](https://github.com/ugisozols)
+* Fixed page reorder issue on Ruby 1.8.x. [#1585](https://github.com/resolve/refinerycms/issues/1585). [Uģis Ozols](https://github.com/ugisozols) & [Philip Arndt](https://github.com/parndt).
+* Allowed to override presenters using `rake refinery:override`. [#1790](https://github.com/resolve/refinerycms/pull/1790). [Kevin Bullock](https://github.com/krbullock).
+
+## 2.0.5 [11 June 2012]
* Now extension/form generators will add all attributes to attr_accessible. [#1613](https://github.com/resolve/refinerycms/pull/1613). [Uģis Ozols](https://github.com/ugisozols)
* Fixed a bug where `refinerycms-images` was trying to load `refinerycms-resources`. [#1651](https://github.com/resolve/refinerycms/issues/1651). [Philip Arndt](https://github.com/parndt)
* Use new page part names (:body, :side_body) when generating extensions. [Uģis Ozols](https://github.com/ugisozols)
View
64 core/app/assets/javascripts/refinery/admin.js.erb
@@ -63,40 +63,38 @@ $.fn.applyMinimumHeightFromChildren = function() {
}
init_modal_dialogs = function(){
- $(document).on('click', 'a[href*="dialog=true"]:not(#dialog_container a)', function(e) {
- var $anchor = $(this),
- href = $anchor.attr('href'),
- width = parseInt($(href.match("width=([0-9]*)")).last().get(0), 10)||928,
- height = parseInt($(href.match("height=([0-9]*)")).last().get(0), 10)||473,
- title = $anchor.attr('title') || $anchor.attr('name') || $anchor.html() || null;
-
- href = href.replace(/((\&(amp\;)?)|\?)dialog\=true/, '')
- .replace(/((\&(amp\;)?)|\?)width\=\d+/, '')
- .replace(/((\&(amp\;)?)|\?)height\=\d+/, '')
- .replace(/(\?&(amp\;)?)/, '?')
- .replace(/\?$/, '');
-
- iframe_src = (iframe_src = href)
- + (iframe_src.indexOf('?') > -1 ? '&' : '?')
- + 'app_dialog=true&dialog=true';
-
- iframe = $("<iframe id='dialog_iframe' frameborder='0' marginheight='0' marginwidth='0' border='0'></iframe>");
- if(!$.browser.msie) { iframe.corner('8px'); }
- iframe.dialog({
- title: title
- , modal: true
- , resizable: false
- , autoOpen: true
- , width: width
- , height: height
- , open: onOpenDialog
- , close: onCloseDialog
- , open: function(event, ui) {
- iframe.attr('src', iframe_src);
- }
- });
+ $('a[href*="dialog=true"]').not('#dialog_container a').each(function(i, anchor) {
+ $(anchor).data({
+ 'dialog-width': parseInt($($(anchor).attr('href').match("width=([0-9]*)")).last().get(0), 10)||928
+ , 'dialog-height': parseInt($($(anchor).attr('href').match("height=([0-9]*)")).last().get(0), 10)||473
+ , 'dialog-title': ($(anchor).attr('title') || $(anchor).attr('name') || $(anchor).html() || null)
+ }).attr('href', $(anchor).attr('href').replace(/(\&(amp\;)?)?dialog\=true/, '')
+ .replace(/(\&(amp\;)?)?width\=\d+/, '')
+ .replace(/(\&(amp\;)?)?height\=\d+/, '')
+ .replace(/(\?&(amp\;)?)/, '?')
+ .replace(/\?$/, ''))
+ .click(function(e){
+ $anchor = $(this);
+ iframe_src = (iframe_src = $anchor.attr('href'))
+ + (iframe_src.indexOf('?') > -1 ? '&' : '?')
+ + 'app_dialog=true&dialog=true';
+
+ iframe = $("<iframe id='dialog_iframe' frameborder='0' marginheight='0' marginwidth='0' border='0'></iframe>");
+ if(!$.browser.msie) { iframe.corner('8px'); }
+ iframe.dialog({
+ title: $anchor.data('dialog-title')
+ , modal: true
+ , resizable: false
+ , autoOpen: true
+ , width: $anchor.data('dialog-width')
+ , height: $anchor.data('dialog-height')
+ , open: onOpenDialog
+ , close: onCloseDialog
+ });
- e.preventDefault();
+ iframe.attr('src', iframe_src);
+ e.preventDefault();
+ });
});
};
View
63 core/app/assets/javascripts/refinery/modal_dialogs.js.erb
@@ -1,36 +1,37 @@
+<%# encoding: utf-8 %>
init_modal_dialogs = function(){
- $(document).on('click', 'a[href*="dialog=true"]:not(#dialog_container a)', function(e) {
- var $anchor = $(this),
- href = $anchor.attr('href'),
- width = parseInt($(href.match("width=([0-9]*)")).last().get(0), 10)||928,
- height = parseInt($(href.match("height=([0-9]*)")).last().get(0), 10)||473,
- title = $anchor.attr('title') || $anchor.attr('name') || $anchor.html() || null;
-
- href = href.replace(/(\&(amp\;)?)?dialog\=true/, '')
- .replace(/(\&(amp\;)?)?width\=\d+/, '')
- .replace(/(\&(amp\;)?)?height\=\d+/, '')
- .replace(/(\?&(amp\;)?)/, '?')
- .replace(/\?$/, '');
-
- iframe_src = (iframe_src = href)
- + (iframe_src.indexOf('?') > -1 ? '&' : '?')
- + 'app_dialog=true&dialog=true';
-
- iframe = $("<iframe id='dialog_iframe' frameborder='0' marginheight='0' marginwidth='0' border='0'></iframe>");
- if(!$.browser.msie) { iframe.corner('8px'); }
- iframe.dialog({
- title: title
- , modal: true
- , resizable: false
- , autoOpen: true
- , width: width
- , height: height
- , open: onOpenDialog
- , close: onCloseDialog
+ $('a[href*="dialog=true"]').not('#dialog_container a').each(function(i, anchor) {
+ $(anchor).data({
+ 'dialog-width': parseInt($($(anchor).attr('href').match("width=([0-9]*)")).last().get(0), 10)||928
+ , 'dialog-height': parseInt($($(anchor).attr('href').match("height=([0-9]*)")).last().get(0), 10)||473
+ , 'dialog-title': ($(anchor).attr('title') || $(anchor).attr('name') || $(anchor).html() || null)
+ }).attr('href', $(anchor).attr('href').replace(/(\&(amp\;)?)?dialog\=true/, '')
+ .replace(/(\&(amp\;)?)?width\=\d+/, '')
+ .replace(/(\&(amp\;)?)?height\=\d+/, '')
+ .replace(/(\?&(amp\;)?)/, '?')
+ .replace(/\?$/, ''))
+ .click(function(e){
+ $anchor = $(this);
+ iframe_src = (iframe_src = $anchor.attr('href'))
+ + (iframe_src.indexOf('?') > -1 ? '&' : '?')
+ + 'app_dialog=true&dialog=true';
+
+ iframe = $("<iframe id='dialog_iframe' frameborder='0' marginheight='0' marginwidth='0' border='0'></iframe>");
+ if(!$.browser.msie) { iframe.corner('8px'); }
+ iframe.dialog({
+ title: $anchor.data('dialog-title')
+ , modal: true
+ , resizable: false
+ , autoOpen: true
+ , width: $anchor.data('dialog-width')
+ , height: $anchor.data('dialog-height')
+ , open: onOpenDialog
+ , close: onCloseDialog
+ });
+
+ iframe.attr('src', iframe_src);
+ e.preventDefault();
});
-
- iframe.attr('src', iframe_src);
- e.preventDefault();
});
};
View
1  core/app/assets/javascripts/refinery/submit_continue.js.coffee.erb
@@ -1,3 +1,4 @@
+<%# encoding: utf-8 %>
@init_submit_continue = ->
$("#submit_continue_button").click submit_and_continue
$("form").change (e) ->
View
100 core/app/assets/javascripts/wymeditor/lang/nl.js
@@ -1,47 +1,57 @@
WYMeditor.STRINGS['nl'] = {
- Strong: 'Sterk benadrukken',
- Bold: 'Vet',
- Emphasis: 'Benadrukken',
- Superscript: 'Bovenschrift',
- Subscript: 'Onderschrift',
- Ordered_List: 'Geordende lijst',
- Unordered_List: 'Ongeordende lijst',
- Indent: 'Inspringen',
- Outdent: 'Terugspringen',
- Undo: 'Ongedaan maken',
- Redo: 'Opnieuw uitvoeren',
- Link: 'Linken',
- Unlink: 'Ontlinken',
- Image: 'Afbeelding',
- Table: 'Tabel',
- HTML: 'HTML',
- Paragraph: 'Paragraaf',
- Heading_1: 'Kop 1',
- Heading_2: 'Kop 2',
- Heading_3: 'Kop 3',
- Heading_4: 'Kop 4',
- Heading_5: 'Kop 5',
- Heading_6: 'Kop 6',
- Preformatted: 'Voorgeformatteerd',
- Blockquote: 'Citaat',
- Table_Header: 'Tabel-kop',
- URL: 'URL',
- Title: 'Titel',
- Alternative_Text: 'Alternatieve tekst',
- Caption: 'Bijschrift',
- Summary: 'Summary',
- Number_Of_Rows: 'Aantal rijen',
- Number_Of_Cols: 'Aantal kolommen',
- Insert: 'Invoegen',
- Submit: 'Versturen',
- Cancel: 'Annuleren',
- Choose: 'Kiezen',
- Preview: 'Voorbeeld bekijken',
- Paste_From_Word: 'Plakken uit Word',
- Tools: 'Hulpmiddelen',
- Containers: 'Teksttypes',
- Classes: 'Klassen',
- Status: 'Status',
- Source_Code: 'Broncode',
- Css_Class: 'Gebruik CSS klasse'
+ Strong: 'Sterk benadrukken',
+ Bold: 'Vet',
+ Emphasis: 'Benadrukken',
+ Superscript: 'Bovenschrift',
+ Subscript: 'Onderschrift',
+ Ordered_List: 'Geordende lijst',
+ Unordered_List: 'Ongeordende lijst',
+ Indent: 'Inspringen',
+ Outdent: 'Terugspringen',
+ Undo: 'Ongedaan maken',
+ Redo: 'Opnieuw uitvoeren',
+ Link: 'Linken',
+ Unlink: 'Ontlinken',
+ Image: 'Afbeelding',
+ Table: 'Tabel',
+ HTML: 'HTML',
+ Paragraph: 'Paragraaf',
+ Heading_1: 'Kop 1',
+ Heading_2: 'Kop 2',
+ Heading_3: 'Kop 3',
+ Heading_4: 'Kop 4',
+ Heading_5: 'Kop 5',
+ Heading_6: 'Kop 6',
+ Preformatted: 'Voorgeformatteerd',
+ Blockquote: 'Citaat',
+ Table_Header: 'Tabel-kop',
+ URL: 'URL',
+ Title: 'Titel',
+ Alternative_Text: 'Alternatieve tekst',
+ Caption: 'Bijschrift',
+ Summary: 'Overzicht',
+ Number_Of_Rows: 'Aantal rijen',
+ Number_Of_Cols: 'Aantal kolommen',
+ Insert: 'Invoegen',
+ Submit: 'Versturen',
+ Cancel: 'Annuleren',
+ Choose: 'Kiezen',
+ Preview: 'Voorbeeld bekijken',
+ Paste_From_Word: 'Plakken uit Word',
+ Tools: 'Hulpmiddelen',
+ Containers: 'Teksttypes',
+ Classes: 'Klassen',
+ Status: 'Status',
+ Source_Code: 'Broncode',
+ Text_Align: 'Tekst uitlijnen',
+ Image_Align: 'Afbeelding uitlijnen',
+ Font_Size: 'Lettertype grootte',
+ Left: 'Links',
+ Right: 'Rechts',
+ Center: 'Midden',
+ Justify: 'Uitgevuld',
+ Small: 'Klein',
+ Normal: 'Normaal',
+ Large: 'Groot',
+ Apply_Style: 'Stijl'
};
View
13 core/app/assets/javascripts/wymeditor/lang/pl.js
@@ -40,6 +40,17 @@ WYMeditor.STRINGS['pl'] = {
Containers: 'Format',
Classes: 'Styl',
Status: 'Status',
- Source_Code: 'Kod źródłowy'
+ Source_Code: 'Kod źródłowy',
+ Apply_Style: 'Określ styl',
+ Text_Align: "Wyrównanie tekstu",
+ Left: "Do lewej",
+ Right: "Do prawej",
+ Center: "Do środka",
+ Justify: "Wyjustuj",
+ Image_Align: "Wyrównanie obrazka",
+ Font_Size: "Rozmiar teksru",
+ Small: "Mały",
+ Normal: "Normalny",
+ Large: "Duży"
};
View
1  core/app/controllers/refinery/admin_controller.rb
@@ -6,7 +6,6 @@ class AdminController < ::ActionController::Base
helper ApplicationHelper
helper Refinery::Core::Engine.helpers
include Refinery::Admin::BaseController
- include Refinery::AuthenticationHelper
end
end
View
2  core/app/helpers/refinery/menu_helper.rb
@@ -40,7 +40,7 @@ def selected_page_or_descendant_page_selected?(page)
# Determine whether the supplied page is the currently open page according to Refinery.
# Also checks whether Rails thinks it is selected after that using current_page?
def selected_page?(page)
- path = request.path.sub("//", "/")
+ path = request.path
path = path.force_encoding('utf-8') if path.respond_to?(:force_encoding)
# Ensure we match the path without the locale, if present.
View
2  core/app/models/refinery/core/base_model.rb
@@ -1,3 +1,5 @@
+require 'active_record'
+
module Refinery
module Core
class BaseModel < ActiveRecord::Base
View
4 core/app/views/refinery/admin/_form_actions.html.erb
@@ -64,7 +64,9 @@
:title => delete_title,
:id => delete_button_id,
:method => :delete,
- :confirm => delete_confirmation,
+ :data => {
+ :confirm => delete_confirmation
+ },
:class => "button confirm-delete") unless hide_delete %>
<%= local_assigns[:after_delete_button] -%>
</div>
View
16 core/app/views/refinery/admin/_wysiwyg.html.erb
@@ -0,0 +1,16 @@
+<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
+ <ul id='page_parts'>
+ <% fields.each_with_index do |part, part_index| %>
+ <li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
+ <%= link_to t("#{part}", :scope => "activerecord.attributes.refinery/#{object}", :default => part.to_s.titleize), "##{part}" %>
+ </li>
+ <% end %>
+ </ul>
+ <div id='page_part_editors'>
+ <% fields.each do |part| %>
+ <div class='page_part' id='<%= part %>'>
+ <%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
+ </div>
+ <% end %>
+ </div>
+</div>
View
4 core/lib/generators/refinery/dummy/dummy_generator.rb
@@ -31,8 +31,8 @@ def test_dummy_config
@database = options[:database]
template "rails/database.yml", "#{dummy_path}/config/database.yml", :force => true
- template "rails/boot.rb", "#{dummy_path}/config/boot.rb", :force => true
- template "rails/application.rb", "#{dummy_path}/config/application.rb", :force => true
+ template "rails/boot.rb.erb", "#{dummy_path}/config/boot.rb", :force => true
+ template "rails/application.rb.erb", "#{dummy_path}/config/application.rb", :force => true
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", :force => true
template "rails/Rakefile", "#{dummy_path}/Rakefile", :force => true
end
View
0  ...ors/refinery/dummy/templates/rails/application.rb → ...refinery/dummy/templates/rails/application.rb.erb
File renamed without changes
View
0  ...generators/refinery/dummy/templates/rails/boot.rb → ...rators/refinery/dummy/templates/rails/boot.rb.erb
File renamed without changes
View
0  ...efinery/namespace/admin/plural_name_controller.rb → ...ery/namespace/admin/plural_name_controller.rb.erb
File renamed without changes
View
0  ...lers/refinery/namespace/plural_name_controller.rb → .../refinery/namespace/plural_name_controller.rb.erb
File renamed without changes
View
0  ...es/app/models/refinery/namespace/singular_name.rb → ...pp/models/refinery/namespace/singular_name.rb.erb
File renamed without changes
View
63 core/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb
@@ -6,62 +6,61 @@
<%%= render '/refinery/admin/error_messages',
:object => @<%= singular_name %>,
:include_object_name => true %>
-<% if localized? %>
+
+<% if localized? -%>
<%%= render "locale_picker",
- :current_locale => Globalize.locale if Refinery.i18n_enabled? %>
-<% end %>
- <% attributes.each_with_index do |attribute, index| %>
-<% if attribute.field_type.to_s != 'text_area' -%>
- <div class='field'>
- <%%= f.label :<%= attribute.name %> -%>
+ :current_locale => Globalize.locale if Refinery.i18n_enabled? -%>
+
<% end -%>
+<% attributes.each_with_index do |attribute, index| -%>
<% if attribute.type.to_s == 'image' -%>
+ <div class='field'>
+ <%%= f.label :<%= attribute.name %> -%>
<%%= render '/refinery/admin/image_picker',
:f => f,
:field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>,
:image => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %>,
- :toggle_image_display => false %>
+ :toggle_image_display => false -%>
+ </div>
+
<% elsif attribute.type.to_s == 'resource' -%>
+ <div class='field'>
+ <%%= f.label :<%= attribute.name %> -%>
<%%= render '/refinery/admin/resource_picker',
:f => f,
:field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>,
- :resource => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %> %>
+ :resource => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %> -%>
+ </div>
+
<% elsif attribute.field_type.to_s == "text_area" and !generated_text_areas -%>
<div class='field'>
- <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
- <ul id='page_parts'>
- <%% <%= text_areas.map{|t| t.name.to_sym}.inspect -%>.each_with_index do |part, part_index| %>
- <li class='ui-state-default<%%= ' ui-state-active' if part_index == 0 %>'>
- <%%= link_to t("#{part}", :scope => "activerecord.attributes.refinery/<%= namespacing.underscore %>/<%= singular_name %>", :default => part.to_s.titleize), "##{part}" %>
- </li>
- <%% end %>
- </ul>
- <div id='page_part_editors'>
- <%% <%= text_areas.map{|t| t.name.to_sym}.inspect -%>.each do |part| %>
- <div class='page_part' id='<%%= part %>'>
- <%%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
- </div>
- <%% end %>
- </div>
- </div>
+ <%%= render '/refinery/admin/wysiwyg',
+ :f => f,
+ :fields => <%= text_areas.map{|t| t.name.to_sym}.inspect -%>,
+ :object => "<%= namespacing.underscore -%>/<%= singular_name -%>" -%>
+ </div>
+
<% generated_text_areas = true -%>
<% elsif attribute.field_type.to_s != 'text_area' -%>
- <%%= f.<%= attribute.field_type -%> :<%= attribute.name -%><%= ", :class => 'larger widest'" if (index == 0 && attribute.field_type == :text_field) -%><%= ", :checked => @#{singular_name}[:#{attribute.name}]" if attribute.field_type == :check_box %> -%>
-<% end -%>
-
+ <div class='field'>
+ <%%= f.label :<%= attribute.name %> -%>
+ <%%= f.<%= attribute.field_type -%> :<%= attribute.name -%><%= ", :class => 'larger widest'" if (index == 0 && attribute.field_type == :text_field) -%><%= ", :checked => @#{singular_name}[:#{attribute.name}]" if attribute.field_type == :check_box %> -%>
</div>
- <% end %>
+
+<% end -%>
+<% end -%>
<%%= render '/refinery/admin/form_actions', :f => f,
:continue_editing => false,
:delete_title => t('delete', :scope => 'refinery.<%= plural_name %>.admin.<%= plural_name %>.<%= singular_name %>'),
- :delete_confirmation => t('message', :scope => 'refinery.admin.delete'<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>, :title => @<%= singular_name %>.<%= title.name %><% end %>) %>
+ :delete_confirmation => t('message', :scope => 'refinery.admin.delete'<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>, :title => @<%= singular_name %>.<%= title.name %><% end %>) -%>
<%% end -%>
<% if text_areas.any? -%>
-<%% content_for :javascripts do %>
+
+<%% content_for :javascripts do -%>
<script>
$(document).ready(function(){
page_options.init(false, '', '');
});
</script>
-<%% end %>
+<%% end -%>
<% end -%>
View
0  ...rators/refinery/engine/templates/config/routes.rb → ...rs/refinery/engine/templates/config/routes.rb.erb
File renamed without changes
View
0  ...ates/db/migrate/1_create_namespace_plural_name.rb → .../db/migrate/1_create_namespace_plural_name.rb.erb
File renamed without changes
View
0  .../generators/refinery/engine/templates/db/seeds.rb → ...erators/refinery/engine/templates/db/seeds.rb.erb
File renamed without changes
View
0  ...ators/refinery/extension_plural_name_generator.rb → ...s/refinery/extension_plural_name_generator.rb.erb
File renamed without changes
View
0  ...nery/engine/templates/lib/refinery/plural_name.rb → .../engine/templates/lib/refinery/plural_name.rb.erb
File renamed without changes
View
0  ...form/templates/lib/refinery/plural_name/engine.rb → .../templates/lib/refinery/plural_name/engine.rb.erb
File renamed without changes
View
0  ...ery/form/templates/lib/refinerycms-plural_name.rb → ...ates/lib/refinerycms-extension_plural_name.rb.erb
File renamed without changes
View
0  ...c/models/refinery/namespace/singular_name_spec.rb → ...dels/refinery/namespace/singular_name_spec.rb.erb
File renamed without changes
View
0  ...ests/refinery/namespace/admin/plural_name_spec.rb → .../refinery/namespace/admin/plural_name_spec.rb.erb
File renamed without changes
View
2  core/lib/generators/refinery/engine/templates/spec/spec_helper.rb
@@ -8,7 +8,7 @@ def setup_environment
# Require the path to the refinerycms application this is vendored inside.
require File.expand_path('../../../../../config/environment', __FILE__)
else
- raise "Could not find a config/environment.rb file to require. Please specify this in #{File.expand_path(__FILE__)}"
+ puts "Could not find a config/environment.rb file to require. Please specify this in #{File.expand_path(__FILE__)}"
end
require 'rspec/rails'
View
0  ...es/spec/support/factories/refinery/plural_name.rb → ...pec/support/factories/refinery/plural_name.rb.erb
File renamed without changes
View
0  ...efinery/namespace/admin/plural_name_controller.rb → ...ery/namespace/admin/plural_name_controller.rb.erb
File renamed without changes
View
0  ...s/refinery/namespace/admin/settings_controller.rb → ...finery/namespace/admin/settings_controller.rb.erb
File renamed without changes
View
0  ...lers/refinery/namespace/plural_name_controller.rb → .../refinery/namespace/plural_name_controller.rb.erb
File renamed without changes
View
0  ...emplates/app/mailers/refinery/namespace/mailer.rb → ...ates/app/mailers/refinery/namespace/mailer.rb.erb
File renamed without changes
View
0  ...emplates/app/models/refinery/namespace/setting.rb → ...ates/app/models/refinery/namespace/setting.rb.erb
File renamed without changes
View
0  ...es/app/models/refinery/namespace/singular_name.rb → ...pp/models/refinery/namespace/singular_name.rb.erb
File renamed without changes
View
0  ...nerators/refinery/form/templates/config/routes.rb → ...tors/refinery/form/templates/config/routes.rb.erb
File renamed without changes
View
0  ...form/templates/db/migrate/1_create_plural_name.rb → .../templates/db/migrate/1_create_plural_name.rb.erb
File renamed without changes
View
0  ...ib/generators/refinery/form/templates/db/seeds.rb → ...enerators/refinery/form/templates/db/seeds.rb.erb
File renamed without changes
View
0  .../lib/generators/refinery/plural_name_generator.rb → .../generators/refinery/plural_name_generator.rb.erb
File renamed without changes
View
0  ...finery/form/templates/lib/refinery/plural_name.rb → ...ry/form/templates/lib/refinery/plural_name.rb.erb
File renamed without changes
View
0  ...gine/templates/lib/refinery/plural_name/engine.rb → .../templates/lib/refinery/plural_name/engine.rb.erb
File renamed without changes
View
0  ...emplates/lib/refinerycms-extension_plural_name.rb → ...form/templates/lib/refinerycms-plural_name.rb.erb
File renamed without changes
View
2  core/lib/refinery/application_controller.rb
@@ -48,7 +48,7 @@ def from_dialog?
end
def home_page?
- refinery.root_path =~ %r{^#{Regexp.escape(request.path.sub("//", "/"))}}
+ refinery.root_path =~ %r{^#{Regexp.escape(request.path)}}
end
def just_installed?
View
206 core/lib/refinery/cli.rb
@@ -4,128 +4,65 @@ module Refinery
class CLI < Thor
include Thor::Actions
+ OVERRIDES = {
+ :view => {
+ :glob => '*.{erb,builder}',
+ :dir => 'views',
+ :desc => 'view template',
+ },
+ :controller => {
+ :glob => '*.rb',
+ :dir => 'controllers',
+ :desc => 'controller',
+ },
+ :model => {
+ :glob => '*.rb',
+ :dir => 'models',
+ :desc => 'model',
+ },
+ :presenter => {
+ :glob => '*.rb',
+ :dir => 'presenters',
+ :desc => 'presenter',
+ },
+ :javascript => {
+ :glob => '*.js{,.*}',
+ :dir => 'assets/javascripts',
+ :desc => 'javascript',
+ },
+ :stylesheet => {
+ :glob => '*.css.scss',
+ :dir => 'assets/stylesheets',
+ :desc => 'stylesheet',
+ },
+ }
+
desc "override", "copies files from any Refinery extension that you are using into your application"
def override(env)
- if (view = env["view"]).present?
- pattern = "{refinery#{File::SEPARATOR},}#{view.split("/").join(File::SEPARATOR)}*.{erb,builder}"
- looking_for = ::Refinery::Plugins.registered.pathnames.map{|p| p.join("app", "views", pattern).to_s}
-
- # copy in the matches
- if (matches = looking_for.map{|d| Dir[d]}.flatten.compact.uniq).any?
- matches.each do |match|
- dir = match.split("/app/views/").last.split('/')
- file = dir.pop # get rid of the file.
- dir = dir.join(File::SEPARATOR) # join directory back together
-
- destination_dir = Rails.root.join("app", "views", dir)
- FileUtils.mkdir_p(destination_dir)
- FileUtils.cp match, (destination = File.join(destination_dir, file))
-
- puts "Copied view template file to #{destination.gsub("#{Rails.root.to_s}#{File::SEPARATOR}", '')}"
- end
- else
- puts "Couldn't match any view template files in any extensions like #{view}"
- end
- elsif (controller = env["controller"]).present?
- pattern = "{refinery#{File::SEPARATOR},}#{controller.split("/").join(File::SEPARATOR)}*.rb"
- looking_for = ::Refinery::Plugins.registered.pathnames.map{|p| p.join("app", "controllers", pattern).to_s}
-
- # copy in the matches
- if (matches = looking_for.map{|d| Dir[d]}.flatten.compact.uniq).any?
- matches.each do |match|
- dir = match.split("/app/controllers/").last.split('/')
- file = dir.pop # get rid of the file.
- dir = dir.join(File::SEPARATOR) # join directory back together
-
- destination_dir = Rails.root.join("app", "controllers", dir)
- FileUtils.mkdir_p(destination_dir)
- FileUtils.cp match, (destination = File.join(destination_dir, file))
-
- puts "Copied controller file to #{destination.gsub("#{Rails.root.to_s}#{File::SEPARATOR}", '')}"
- end
- else
- puts "Couldn't match any controller files in any extensions like #{controller}"
- end
- elsif (model = env["model"]).present?
- pattern = "{refinery#{File::SEPARATOR},}#{model.split("/").join(File::SEPARATOR)}*.rb"
- looking_for = ::Refinery::Plugins.registered.pathnames.map{|p| p.join("app", "models", pattern).to_s}
-
- # copy in the matches
- if (matches = looking_for.map{|d| Dir[d]}.flatten.compact.uniq).any?
- matches.each do |match|
- dir = match.split("/app/models/").last.split('/')
- file = dir.pop # get rid of the file.
- dir = dir.join(File::SEPARATOR) # join directory back together
-
- destination_dir = Rails.root.join("app", "models", dir)
- FileUtils.mkdir_p(destination_dir)
- FileUtils.cp match, (destination = File.join(destination_dir, file))
-
- puts "Copied model file to #{destination.gsub("#{Rails.root.to_s}#{File::SEPARATOR}", '')}"
- end
- else
- puts "Couldn't match any model files in any extensions like #{model}"
- end
- elsif (javascripts = env["javascript"]).present?
- pattern = "#{javascripts.split("/").join(File::SEPARATOR)}*.js{,.*}"
- looking_for = ::Refinery::Plugins.registered.pathnames.map{|p| p.join("app", "assets", "javascripts", pattern).to_s}
-
- # copy in the matches
- if (matches = looking_for.map{|d| Dir[d]}.flatten.compact.uniq).any?
- matches.each do |match|
- dir = match.split("/app/assets/javascripts/").last.split('/')
- file = dir.pop # get rid of the file.
- dir = dir.join(File::SEPARATOR) # join directory back together
-
- destination_dir = Rails.root.join("app", "assets", "javascripts", dir)
- FileUtils.mkdir_p(destination_dir)
- FileUtils.cp match, (destination = File.join(destination_dir, file))
-
- puts "Copied javascript file to #{destination.gsub("#{Rails.root.to_s}#{File::SEPARATOR}", '')}"
- end
- else
- puts "Couldn't match any javascript files in any extensions like #{javascripts}"
+ OVERRIDES.keys.each do |kind|
+ if (which = env[kind.to_s]).present?
+ return _override(kind, which)
end
- elsif (stylesheets = env["stylesheet"]).present?
- pattern = "#{stylesheets.split("/").join(File::SEPARATOR)}*.css.scss"
- looking_for = ::Refinery::Plugins.registered.pathnames.map{|p| p.join("app", "assets", "stylesheets", pattern).to_s}
-
- # copy in the matches
- if (matches = looking_for.map{|d| Dir[d]}.flatten.compact.uniq).any?
- matches.each do |match|
- dir = match.split("/app/assets/stylesheets/").last.split('/')
- file = dir.pop # get rid of the file.
- dir = dir.join(File::SEPARATOR) # join directory back together
-
- destination_dir = Rails.root.join("app", "assets", "stylesheets", dir)
- FileUtils.mkdir_p(destination_dir)
- FileUtils.cp match, (destination = File.join(destination_dir, file))
+ end
- puts "Copied stylesheet file to #{destination.gsub("#{Rails.root.to_s}#{File::SEPARATOR}", '')}"
- end
- else
- puts "Couldn't match any stylesheet files in any extensions like #{stylesheets}"
- end
- else
- puts "You didn't specify anything to override. Here are some examples:"
- {
- :view => ['pages/home', 'refinery/pages/home', '**/*menu', '_menu_branch'],
- :javascript => %w(admin refinery/site_bar),
- :stylesheet => %w(home refinery/site_bar),
- :controller => %w(pages),
- :model => %w(page refinery/page)
- }.each do |type, examples|
- examples.each do |example|
- puts "rake refinery:override #{type}=#{example}"
- end
+ puts "You didn't specify anything valid to override. Here are some examples:"
+ {
+ :view => ['pages/home', 'refinery/pages/home', '**/*menu', '_menu_branch'],
+ :javascript => %w(admin refinery/site_bar),
+ :stylesheet => %w(home refinery/site_bar),
+ :controller => %w(pages),
+ :model => %w(page refinery/page),
+ :presenter => %w(refinery/page_presenter)
+ }.each do |type, examples|
+ examples.each do |example|
+ puts "rake refinery:override #{type}=#{example}"
end
end
-
end
desc "uncrudify", "shows you the code that your controller using crudify is running for a given action"
def uncrudify(controller, action)
- unless (controller_name = controller).present? and (action = action).present?
+ unless (controller_name = controller).present? && (action = action).present?
abort <<-HELPDOC.strip_heredoc
You didn't specify anything to uncrudify. Here's some examples:
rake refinery:uncrudify controller=refinery/admin/pages action=create
@@ -141,22 +78,47 @@ def uncrudify(controller, action)
end
crud_lines = Refinery.roots(:'refinery/core').join('lib', 'refinery', 'crud.rb').read
- if (matches = crud_lines.scan(/(\ +)(def #{action}.+?protected)/m).first).present? and
+ if (matches = crud_lines.scan(/(\ +)(def #{action}.+?protected)/m).first).present? &&
(method_lines = "#{matches.last.split(%r{^#{matches.first}end}).first.strip}\nend".split("\n")).many?
- indent = method_lines.second.index(%r{[^ ]})
- crud_method = method_lines.join("\n").gsub(/^#{" " * indent}/, " ")
+ indent = method_lines.second.index %r{[^ ]}
+ crud_method = method_lines.join("\n").gsub /^#{" " * indent}/, " "
crud_options = controller_class.try(:crudify_options) || {}
- crud_method.gsub!('#{options[:redirect_to_url]}', crud_options[:redirect_to_url].to_s)
- crud_method.gsub!('#{options[:conditions].inspect}', crud_options[:conditions].inspect)
- crud_method.gsub!('#{options[:title_attribute]}', crud_options[:title_attribute])
- crud_method.gsub!('#{singular_name}', crud_options[:singular_name])
- crud_method.gsub!('#{class_name}', crud_options[:class_name])
- crud_method.gsub!('#{plural_name}', crud_options[:plural_name])
- crud_method.gsub!('\\#{', '#{')
+ crud_method.gsub! '#{options[:redirect_to_url]}', crud_options[:redirect_to_url].to_s
+ crud_method.gsub! '#{options[:conditions].inspect}', crud_options[:conditions].inspect
+ crud_method.gsub! '#{options[:title_attribute]}', crud_options[:title_attribute]
+ crud_method.gsub! '#{singular_name}', crud_options[:singular_name]
+ crud_method.gsub! '#{class_name}', crud_options[:class_name]
+ crud_method.gsub! '#{plural_name}', crud_options[:plural_name]
+ crud_method.gsub! '\\#{', '#{'
puts crud_method
end
end
+
+ private
+
+ def _override(kind, which)
+ override_kind = OVERRIDES[kind]
+ pattern = "{refinery#{File::SEPARATOR},}#{which.split("/").join(File::SEPARATOR)}#{override_kind[:glob]}"
+ looking_for = ::Refinery::Plugins.registered.pathnames.map{|p| p.join("app", override_kind[:dir], pattern).to_s}
+
+ # copy in the matches
+ if (matches = looking_for.map{|d| Dir[d]}.flatten.compact.uniq).any?
+ matches.each do |match|
+ dir = match.split("/app/#{override_kind[:dir]}/").last.split('/')
+ file = dir.pop # get rid of the file.
+ dir = dir.join(File::SEPARATOR) # join directory back together
+
+ destination_dir = Rails.root.join('app', override_kind[:dir], dir)
+ FileUtils.mkdir_p(destination_dir)
+ FileUtils.cp match, (destination = File.join(destination_dir, file))
+
+ puts "Copied #{override_kind[:desc]} file to #{destination.gsub("#{Rails.root.to_s}#{File::SEPARATOR}", '')}"
+ end
+ else
+ puts "Couldn't match any #{override_kind[:desc]} files in any extensions like #{which}"
+ end
+ end
end
end
View
12 core/lib/refinery/crud.rb
@@ -266,8 +266,11 @@ def reorder
def update_positions
previous = nil
params[:ul].each do |_, list|
- list.each do |index, hash|
- moved_item_id = hash['id'].split(/#{singular_name}\\_?/)
+ # After we drop Ruby 1.8.x support the following line can be changed back to
+ # list.each do |index, hash|
+ # because there won't be an ordering issue (see https://github.com/resolve/refinerycms/issues/1585)
+ list.sort.map { |item| item[1] }.each_with_index do |hash, index|
+ moved_item_id = hash['id'].split(/#{singular_name}\_?/).reject(&:empty?).first
@current_#{singular_name} = #{class_name}.find_by_id(moved_item_id)
if @current_#{singular_name}.respond_to?(:move_to_root)
@@ -293,8 +296,9 @@ def update_positions
end
def update_child_positions(_node, #{singular_name})
- _node['children']['0'].each do |_, child|
- child_id = child['id'].split(/#{singular_name}\_?/)
+ list = _node['children']['0']
+ list.sort.map { |item| item[1] }.each_with_index do |child, index|
+ child_id = child['id'].split(/#{singular_name}\_?/).reject(&:empty?).first
child_#{singular_name} = #{class_name}.where(:id => child_id).first
child_#{singular_name}.move_to_child_of(#{singular_name})
View
11 core/lib/refinery/extension_generation.rb
@@ -139,7 +139,12 @@ def evaluate_templates!
reject_template?(f)
}.sort.each do |path|
if (template_path = extension_path_for(path, extension_name)).present?
- next if path.to_s =~ /seeds.rb/
+ next if path.to_s =~ /seeds.rb.erb/
+
+ unless path.to_s =~ /views/
+ template_path = template_path.to_s.sub(".erb", "")
+ end
+
template path, template_path
end
end
@@ -211,8 +216,8 @@ def merge_locales!
end
def copy_or_merge_seeds!
- source_seed_file = source_pathname.join("db/seeds.rb")
- destination_seed_file = destination_pathname.join(extension_path_for(source_seed_file, extension_name))
+ source_seed_file = source_pathname.join("db/seeds.rb.erb")
+ destination_seed_file = destination_pathname.join(extension_path_for(source_seed_file.to_s.sub(".erb", ""), extension_name))
if existing_extension?
# create temp seeds file
View
2  core/lib/refinery/menu.rb
@@ -15,7 +15,7 @@ def items
end
def roots
- @roots ||= items.select {|item| item.parent_id.nil?}
+ @roots ||= items.select {|item| !item.has_parent?}
end
def to_s
View
34 core/spec/lib/refinery/application_controller_spec.rb
@@ -2,6 +2,14 @@
module Refinery
describe ApplicationController, :type => :controller do
+ before do
+ Rails.application.routes.draw { get "anonymous/index" }
+ end
+
+ after do
+ Rails.application.reload_routes!
+ end
+
controller do
include ::Refinery::ApplicationController
@@ -47,7 +55,7 @@ def index
end
it "is false so standard HTTP is used" do
- Refinery::Core.config.force_ssl = false
+ Refinery::Core.stub(:force_ssl).and_return(false)
get :index
@@ -55,28 +63,20 @@ def index
end
it "is true so HTTPS is used" do
- begin
- Refinery::Core.config.force_ssl = true
-
- get :index
+ Refinery::Core.stub(:force_ssl).and_return(true)
+
+ get :index
- response.should be_redirect
- ensure
- Refinery::Core.config.force_ssl = false
- end
+ response.should be_redirect
end
it "is true but HTTPS is not used because admin? is false" do
- begin
- controller.stub(:admin?).and_return(false)
- Refinery::Core.config.force_ssl = true
+ controller.stub(:admin?).and_return(false)
+ Refinery::Core.stub(:force_ssl).and_return(true)
- get :index
+ get :index
- response.should_not be_redirect
- ensure
- Refinery::Core.config.force_ssl = false
- end
+ response.should_not be_redirect
end
end
View
10 core/spec/lib/refinery/cli_spec.rb
@@ -13,8 +13,8 @@
context "when called with no args" do
it "shows info message" do
msg = capture(:stdout) { rake["refinery:override"].invoke }
-
- msg.should match("You didn't specify anything to override. Here are some examples:")
+
+ msg.should match("You didn't specify anything valid to override. Here are some examples:")
msg.should match("rake refinery:override view=pages/home")
msg.should match("rake refinery:override view=refinery/pages/home")
msg.should match(%r{rake refinery:override view=\*\*/\*menu})
@@ -33,7 +33,7 @@
context "specified file doesn't exist" do
it "shows message" do
ENV[env] = "non-existent"
-
+
msg = capture(:stdout) { rake["refinery:override"].invoke }
msg.should eq(not_found_message)
@@ -41,10 +41,10 @@
end
context "specified file exist" do
- let (:file_name) do
+ let (:file_name) do
Dir.entries(file_location).reject { |e| e =~ %r{^\.+} || e !~ %r{\..+} }.first
end
-
+
after do
FileUtils.rm_f(Rails.root.join(copied_file_location))
ENV[env] = nil
View
102 core/spec/lib/refinery/crud_spec.rb
@@ -0,0 +1,102 @@
+require "spec_helper"
+
+ActiveRecord::Schema.define do
+ create_table :refinery_crud_dummies, :force => true do |t|
+ t.integer :parent_id
+ t.integer :lft
+ t.integer :rgt
+ t.integer :depth
+ end
+end
+
+module Refinery
+ class CrudDummy < ActiveRecord::Base
+ attr_accessible :parent_id
+ acts_as_nested_set
+ end
+
+ class CrudDummyController < ::ApplicationController
+ crudify :'refinery/crud_dummy'
+ end
+end
+
+module Refinery
+ describe CrudDummyController, :type => :controller do
+
+ describe "#update_positions" do
+ let!(:crud_dummy_one) { Refinery::CrudDummy.create! }
+ let!(:crud_dummy_two) { Refinery::CrudDummy.create! }
+ let!(:crud_dummy_three) { Refinery::CrudDummy.create! }
+
+ it "orders dummies" do
+ post :update_positions, {
+ "ul" => {
+ "0" => {
+ "0" => {"id" => "crud_dummy_#{crud_dummy_three.id}"},
+ "1" => {"id" => "crud_dummy_#{crud_dummy_two.id}"},
+ "2" => {"id" => "crud_dummy_#{crud_dummy_one.id}"}
+ }
+ }
+ }
+
+ dummy = crud_dummy_three.reload
+ dummy.lft.should eq(1)
+ dummy.rgt.should eq(2)
+
+ dummy = crud_dummy_two.reload
+ dummy.lft.should eq(3)
+ dummy.rgt.should eq(4)
+
+ dummy = crud_dummy_one.reload
+ dummy.lft.should eq(5)
+ dummy.rgt.should eq(6)
+ end
+
+ it "orders nested dummies" do
+ nested_crud_dummy_one = Refinery::CrudDummy.create! :parent_id => crud_dummy_one.id
+ nested_crud_dummy_two = Refinery::CrudDummy.create! :parent_id => crud_dummy_one.id
+
+ post :update_positions, {
+ "ul" => {
+ "0" => {
+ "0" => {
+ "id" => "crud_dummy_#{crud_dummy_three.id}",
+ "children" => {
+ "0" => {
+ "0" => {"id" => "crud_dummy_#{nested_crud_dummy_one.id}"},
+ "1" => {"id" => "crud_dummy_#{nested_crud_dummy_two.id}"}
+ }
+ }
+ },
+ "1" => {"id" => "crud_dummy_#{crud_dummy_two.id}"},
+ "2" => {"id" => "crud_dummy_#{crud_dummy_one.id}"}
+ }
+ }
+ }
+
+ dummy = crud_dummy_three.reload
+ dummy.lft.should eq(1)
+ dummy.rgt.should eq(6)
+
+ dummy = nested_crud_dummy_one.reload
+ dummy.lft.should eq(2)
+ dummy.rgt.should eq(3)
+ dummy.parent_id.should eq(crud_dummy_three.id)
+
+ dummy = nested_crud_dummy_two.reload
+ dummy.lft.should eq(4)
+ dummy.rgt.should eq(5)
+ dummy.parent_id.should eq(crud_dummy_three.id)
+
+ dummy = crud_dummy_two.reload
+ dummy.lft.should eq(7)
+ dummy.rgt.should eq(8)
+
+ dummy = crud_dummy_one.reload
+ dummy.lft.should eq(9)
+ dummy.rgt.should eq(10)
+ end
+ end
+
+ end
+end
View
1  core/spec/support/refinery.rb
@@ -4,5 +4,4 @@
config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller
config.include Refinery::Testing::ControllerMacros::Methods, :type => :controller
config.extend Refinery::Testing::RequestMacros::Authentication, :type => :request
- config.include Refinery::Testing::UrlHelper
end
View
43 dashboard/app/helpers/refinery/admin/dashboard_helper.rb
@@ -3,21 +3,34 @@ module Admin
module DashboardHelper
def activity_message_for(record)
- if (plugin = Refinery::Plugins.active.find_by_model(record.class)) &&
- (activity = plugin.activity_by_class_name(record.class.name).first)
- # work out which action occured
- action = record.updated_at.eql?(record.created_at) ? 'created' : 'updated'
-
- # get article to define gender of model name, some languages require this for proper grammar
- article = t('article', :scope => "refinery.plugins.#{plugin.name}.", :default => 'the')
-
- # now create a link to the notification's corresponding record.
- link_to t('.latest_activity_message',
- :what => record.send(activity.title),
- :kind => record.class.model_name.human,
- :action => t("with_article \"#{article}\"", :scope => "refinery.#{action}")
- ).downcase.capitalize, eval("#{activity.url}(#{activity.nesting("record")})")
- end
+ return if (plugin = find_plugin(record)).blank? || (activity = find_activity(record, plugin)).blank?
+
+ link_to t('.latest_activity_message',
+ :what => record.send(activity.title),
+ :kind => record.class.model_name.human,
+ :action => t("with_article \"#{plugin_article(plugin)}\"",
+ :scope => "refinery.#{record_action(record)}")
+ ).downcase.capitalize, eval("#{activity.url}(#{activity.nesting('record')})")
+ end
+
+ private
+
+ def find_plugin(record)
+ Refinery::Plugins.active.find_by_model record.class
+ end
+
+ def find_activity(record, plugin = nil)
+ plugin ||= find_plugin(record) # avoid double lookup if we already have it
+ plugin.activity_by_class_name(record.class.name).first
+ end
+
+ def record_action(record)
+ record.updated_at.eql?(record.created_at) ? 'created' : 'updated'
+ end
+
+ # get article to define gender of model name, some languages require this for proper grammar
+ def plugin_article(plugin)
+ article = t('article', :scope => "refinery.plugins.#{plugin.name}.", :default => 'the')
end
end
View
14 images/app/models/refinery/image.rb
@@ -56,16 +56,16 @@ def thumbnail_dimensions(geometry)
width = original_width = self.image_width.to_f
height = original_height = self.image_height.to_f
geometry_width, geometry_height = geometry.split(%r{\#{1,2}|\+|>|!|x}im)[0..1].map(&:to_f)
- if (original_width * original_height > 0) && geometry =~ ::Dragonfly::ImageMagick::Processor::THUMB_GEOMETRY
- if geometry =~ ::Dragonfly::ImageMagick::Processor::RESIZE_GEOMETRY
- if geometry !~ %r{\d+x\d+>} || (geometry =~ %r{\d+x\d+>} && (width > geometry_width.to_f || height > geometry_height.to_f))
+ if (original_width * original_height > 0) && ::Dragonfly::ImageMagick::Processor::THUMB_GEOMETRY === geometry
+ if ::Dragonfly::ImageMagick::Processor::RESIZE_GEOMETRY === geometry
+ if geometry !~ %r{\d+x\d+>} || (%r{\d+x\d+>} === geometry && (width > geometry_width.to_f || height > geometry_height.to_f))
# Try scaling with width factor first. (wf = width factor)
- wf_width = (original_width * (geometry_width / width)).ceil
- wf_height = (original_height * (geometry_width / width)).ceil
+ wf_width = (original_width * geometry_width / width).round
+ wf_height = (original_height * geometry_width / width).round
# Scale with height factor (hf = height factor)
- hf_width = (original_width * (geometry_height / height)).ceil
- hf_height = (original_height * (geometry_height / height)).ceil
+ hf_width = (original_width * geometry_height / height).round
+ hf_height = (original_height * geometry_height / height).round
# Take the highest value that doesn't exceed either axis limit.
use_wf = wf_width <= geometry_width && wf_height <= geometry_height
View
4 images/app/views/refinery/admin/images/_grid_view.html.erb
@@ -13,7 +13,9 @@
refinery.admin_image_path(image),
:class => "cancel confirm-delete",
:title => t('delete', :scope => 'refinery.admin.images'),
- :confirm => t('message', :scope => 'refinery.admin.delete', :title => image.title),
+ :data => {
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => image.title)
+ },
:method => :delete %>
</span>
</li>
View
4 images/app/views/refinery/admin/images/_list_view_image.html.erb
@@ -13,7 +13,9 @@
refinery.admin_image_path(list_view_image),
:class => "cancel confirm-delete",
:title => t('delete', :scope => 'refinery.admin.images'),
- :confirm => t('message', :scope => 'refinery.admin.delete', :title => list_view_image.title),
+ :data => {
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => list_view_image.title)
+ },
:method => :delete %>
</span>
</li>
View
9 images/db/migrate/20120625093918_remove_image_ext_from_refinery_images.rb
@@ -0,0 +1,9 @@
+class RemoveImageExtFromRefineryImages < ActiveRecord::Migration
+ def up
+ remove_column :refinery_images, :image_ext
+ end
+
+ def down
+ add_column :refinery_images, :image_ext, :string
+ end
+end
View
4 images/spec/factories/image.rb
@@ -2,4 +2,8 @@
factory :image, :class => ::Refinery::Image do
image Refinery.roots(:'refinery/images').join("spec/fixtures/beach.jpeg")
end
+
+ factory :alternate_image, :class => ::Refinery::Image do
+ image Refinery.roots(:'refinery/images').join("spec/fixtures/beach-alternate.jpeg")
+ end
end
View
BIN  images/spec/fixtures/beach-alternate.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
12 images/spec/models/refinery/image_spec.rb
@@ -112,6 +112,18 @@ module Refinery
end
end
+ describe '#thumbnail_dimensions returns correctly with' do
+ let(:created_alternate_image) { FactoryGirl.create(:alternate_image) }
+
+ it 'nil' do
+ created_alternate_image.thumbnail_dimensions(nil).should == { :width => 376, :height => 184 }
+ end
+
+ it '225x255>' do
+ created_alternate_image.thumbnail_dimensions('225x255>').should == { :width => 225, :height => 110 }
+ end
+ end
+
describe "validations" do
describe "valid #image" do
before(:each) do
View
2  pages/app/controllers/refinery/pages_controller.rb
@@ -100,7 +100,7 @@ def set_canonical
def write_cache?
if Refinery::Pages.cache_pages_full && !refinery_user?
- cache_page(response.body, File.join('', 'refinery', 'cache', 'pages', request.path.sub("//", "/")).to_s)
+ cache_page(response.body, File.join('', 'refinery', 'cache', 'pages', request.path).to_s)
end
end
end
View
33 pages/app/models/refinery/page.rb
@@ -61,8 +61,7 @@ class Translation
before_save { |m| m.translation.save }
before_create :ensure_locale, :if => proc { ::Refinery.i18n_enabled? }
before_destroy :deletable?
- after_save :reposition_parts!, :invalidate_cached_urls, :expire_page_caching
- after_update :invalidate_cached_urls
+ after_save :reposition_parts!, :expire_page_caching
after_destroy :expire_page_caching
class << self
@@ -98,7 +97,7 @@ def find_by_path_or_id(path, id)
end
end
- # Finds a page using its title. This method is necessary because pages
+ # Finds pages by their title. This method is necessary because pages
# are translated which means the title attribute does not exist on the
# pages table thus requiring us to find the attribute on the translations table
# and then join to the pages table again to return the associated record.
@@ -106,7 +105,7 @@ def by_title(title)
with_globalize(:title => title)
end
- # Finds a page using its slug. See by_title
+ # Finds pages by their slug. See by_title
def by_slug(slug, conditions={})
locales = Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : ::I18n.locale
with_globalize({ :locale => locales, :slug => slug }.merge(conditions))
@@ -303,19 +302,7 @@ def uncached_nested_url
# Returns the string version of nested_url, i.e., the path that should be generated
# by the router
def nested_path
- Rails.cache.fetch(path_cache_key) { ['', nested_url].join('/') }
- end
-
- def path_cache_key(locale = Globalize.locale)
- [cache_key(locale), 'nested_path'].join('#')
- end
-
- def url_cache_key(locale = Globalize.locale)
- [cache_key(locale), 'nested_url'].join('#')
- end
-
- def cache_key(locale)
- [Refinery::Core.base_cache_key, 'page', locale, id].compact.join('/')
+ ['', nested_url].join('/')
end
# Returns true if this page is "published"
@@ -434,18 +421,6 @@ def normalize_friendly_id_with_marketable_urls(slug_string)
private
- def invalidate_cached_urls
- return true unless Refinery::Pages.marketable_urls
-
- [self, children].flatten.each do |page|
- ((Refinery.i18n_enabled? && Refinery::I18n.frontend_locales) || [::I18n.locale]).each do |locale|
- Rails.cache.delete(page.url_cache_key(locale))
- Rails.cache.delete(page.path_cache_key(locale))
- end
- end
- end
- alias_method :invalidate_child_cached_url, :invalidate_cached_urls
-
# Make sures that a translation exists for this page.
# The translation is set to the default frontend locale.
def ensure_locale
View
4 pages/app/views/refinery/admin/pages/_page.html.erb
@@ -36,7 +36,9 @@
refinery.admin_page_path(page.uncached_nested_url),
:class => "cancel confirm-delete",
:title => t('delete', :scope => 'refinery.admin.pages'),
- :confirm => t('message', :scope => 'refinery.admin.delete', :title => page.title_with_meta.gsub(/\ ?<em>.*<\/em>/, "")),
+ :data => {
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => page.title_with_meta.gsub(/\ ?<em>.*<\/em>/, ""))
+ },
:method => :delete if page.deletable? %>
</span>
</div>
View
1  pages/config/locales/en.yml
@@ -49,6 +49,7 @@ en:
create_content_section: Add content section
delete_content_section: Delete content section
reorder_content_section: Reorder content sections
+ reorder_content_section_done: I'm done reordering the content sections
form_advanced_options:
toggle_advanced_options: Access meta tag settings and menu options
page_options: Page Options
View
7 pages/config/locales/fr.yml
@@ -34,10 +34,15 @@ fr:
pages:
delete: Supprimer définitivement cette page
edit: Modifier cette page
+ new: Ajouter une nouvelle sous-page
+ expand_collapse: Développer ou réduire les sous-pages
page:
view_live_html: Voir cette page<br/><em>(Ouvre une nouvelle fenêtre)</em>
hidden: caché
draft: brouillon
+ form:
+ preview: Prévisualiser
+ preview_changes: Prévisualiser vos changements avant de les appliquer
form_new_page_parts:
title: Titre
form_page_parts:
@@ -48,6 +53,7 @@ fr:
page_options: Page Options
parent_page: Page parente
advanced_options: Options avancées
+ menu_title: Titre dans le menu
custom_title: Titre personnalisé
show_in_menu_title: Placer dans le menu
show_in_menu_description: Placer cette page dans le menu du site
@@ -59,6 +65,7 @@ fr:
link_url: Cette page redirige le visiteur vers un autre site ou une autre page
link_url_help: "Si vous souhaitez que cette page mène à un autre site internet ou à une autre page lorsque l'on clique dessus dans le menu, entrez une URL '(par exemple http://google.com)'. Sinon laissez ce champ vide."
parent_page_help: "Vous pouvez placer une page sous une autre page en la sélectionnant dans la liste. Si vous voulez que cette page soit une page parente, laissez ce champ vide."
+ menu_title_help: Si vous voulez que le menu affiche un titre différent que celui qui sera affiché sur la page, entrez-le ici.
custom_title_help: "Si vous voulez que la page ait un titre différent de celui qui apparaît dans le menu, sélectionnez &apos;Text&apos; et entrez-le ici."
actions:
create_new_page: Créer une nouvelle page
View
14 pages/config/locales/pl.yml
@@ -18,14 +18,14 @@ pl:
location: Lokacja
new_window: Nowe okno
new_window_label: Zaznacz tę kratkę aby link otwierał się w nowym oknie.
- not_sure: Nie wiesz, co wstawić w pole powyżej?
+ not_sure: 'Nie wiesz, co wstawić w pole powyżej?'
step1: Znajdź stronę w sieci do której chcesz linkować.
step2: Wklej adres z pola adresu Twojej przeglądarki i wklej go do pola powyżej.
email_address:
tab_name: Adres e-mail
subject_line_optional: Opcjonalny temat
body_optional: Opcjonalna treść
- not_sure: Nie wiesz, co wstawić w pola powyżej?
+ not_sure: 'Nie wiesz, co wstawić w pola powyżej?'
step1_html: Wpisz lub wklej (np. z książki adresowej) adres e-mail do którego ma prowadzić link w pole '<stron>Adres e-mail</strong> powyżej.
step2_html: Użyj pola '<strong>Temat</strong> aby wiadomość miała wstępnie określony temat.
step3_html: Użyj pola '<strong>Treść</strong> aby wiadomość miała wstępnie określoną treść.
@@ -52,15 +52,17 @@ pl:
custom_title: Inny tytuł
show_in_menu_title: Pokaż w menu
show_in_menu_description: Wyświetl tę stronę w menu witryny
- show_in_menu_help: Odznacz tę kratkę aby usunąć tę stronę z menu witryny. To może być przydatne jeżeli chcesz linkować do tej strony, ale nie chcesz aby była widoczna w menu.
+ show_in_menu_help: 'Odznacz tę kratkę aby usunąć tę stronę z menu witryny. To może być przydatne jeżeli chcesz linkować do tej strony, ale nie chcesz aby była widoczna w menu.'
save_as_draft: Zapisz jako szkic
skip_to_first_child: Pomiń stronę najwyższego poziomu
skip_to_first_child_label: Przekieruj odwiedzających do pierwszej strony potomnej.
- skip_to_first_child_help: Ta opcja sprawia, że ta strona kieruje do pierwszej strony pod nią. To może być przydatne przy grupowaniu stron razem.
+ skip_to_first_child_help: 'Ta opcja sprawia, że ta strona kieruje do pierwszej strony pod nią. To może być przydatne przy grupowaniu stron razem.'
link_url: Przekieruj tę stronę do innej strony lub witryny
- link_url_help: Jeżeli chcesz, aby ta strona prowadziła do innej strony lub witryny kiedy klikniesz ją w menu, wpisz tu adres URL, na przykład http://google.com.W innym wypadku pozostaw to pole pustym.
+ link_url_help: 'Jeżeli chcesz, aby ta strona prowadziła do innej strony lub witryny kiedy klikniesz ją w menu, wpisz tu adres URL, na przykład http://google.com.W innym wypadku pozostaw to pole pustym.'
parent_page_help: Możesz umieścić tę stronę pod inną wybierając stronę nadrzędną z listy. Jeżeli ta strona ma być stroną najwyższego poziomu pozostaw to pole pustym.
- custom_title_help: Jeżeli chcesz aby ta strona miała inny tytuł niż ten widoczny w menu wybierz &apos;Tekst&apos; i wpisz go tutaj.
+ custom_title_help: 'Jeżeli chcesz aby ta strona miała inny tytuł niż ten widoczny w menu wybierz &apos;Tekst&apos; i wpisz go tutaj.'
+ menu_title: Tytuł w menu
+ menu_title_help: 'Jeżeli chcesz aby ta strona miała inny tytuł w menu wybierz &apos;Tekst&apos; i wpisz go tutaj.'
actions:
create_new_page: Dodaj nową stronę
reorder_pages: Zmień kolejność stron
View
27 pages/db/seeds.rb
@@ -24,22 +24,23 @@
:body => "<h2>Sorry, there was a problem...</h2><p>The page you requested was not found.</p><p><a href='/'>Return to the home page</a></p>",
:position => 0
})
-end
-if Refinery::Page.by_title("About").empty?
- about_us_page = ::Refinery::Page.create(:title => "About")
- about_us_page.parts.create({
- :title => "Body",
- :body => "<p>This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.</p>",
- :position => 0
- })
- about_us_page.parts.create({
- :title => "Side Body",
- :body => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.</p>",
- :position => 1
- })
+ if Refinery::Page.by_title("About").empty?
+ about_us_page = ::Refinery::Page.create(:title => "About")
+ about_us_page.parts.create({
+ :title => "Body",
+ :body => "<p>This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.</p>",
+ :position => 0
+ })
+ about_us_page.parts.create({
+ :title => "Side Body",
+ :body => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.</p>",
+ :position => 1
+ })
+ end
end
+
(Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
I18n.locale = lang
Refinery::Page.find_by_title("Home").update_attributes(:slug => "home")
View
2  pages/lib/refinery/pages/instance_methods.rb
@@ -10,7 +10,7 @@ def self.included(base)
def error_404(exception=nil)
if (@page = ::Refinery::Page.where(:menu_match => "^/404$").includes(:parts).first).present?
# render the application's custom 404 page with layout and meta.
- render :template => '/refinery/pages/show', :formats => [:html], :status => 404
+ render_with_templates?(:status => 404)
return false
else
super
View
4 resources/app/views/refinery/admin/resources/_resource.html.erb
@@ -14,7 +14,9 @@
refinery.admin_resource_path(resource),
:class => "cancel confirm-delete",
:title => t('delete', :scope => 'refinery.admin.resources'),
- :confirm => t('message', :scope => 'refinery.admin.delete', :title => resource.title),
+ :data => {
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => resource.title)
+ },
:method => :delete %>
</span>
</li>
View
1  testing/lib/refinery/testing.rb
@@ -25,7 +25,6 @@ def load_factories
end
require 'refinery/testing/railtie'
- require 'refinery/testing/url_helper'
autoload :ControllerMacros, 'refinery/testing/controller_macros'
autoload :RequestMacros, 'refinery/testing/request_macros'
View
9 testing/lib/refinery/testing/url_helper.rb
@@ -1,9 +0,0 @@
-module Refinery
- module Testing
- module UrlHelper
- def refinery
- Refinery::Core::Engine.routes.url_helpers
- end
- end
- end
-end
View
0  tmp/pids/.gitkeep
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.