Skip to content

Commit

Permalink
Merge branch 'master' into rails-3-2
Browse files Browse the repository at this point in the history
Conflicts:
	Gemfile
	core/lib/refinery/application_controller.rb
	core/refinerycms-core.gemspec
	pages/lib/refinery/pages/engine.rb
	templates/refinery/edge.rb
	testing/refinerycms-testing.gemspec
  • Loading branch information
parndt committed Jan 24, 2012
2 parents 9b9743a + 5bf475d commit 044baf8
Show file tree
Hide file tree
Showing 169 changed files with 1,109 additions and 817 deletions.
9 changes: 2 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,15 @@ unless defined?(JRUBY_VERSION)
gem 'pg'
end

# https://github.com/svenfuchs/routing-filter/issues/31
gem 'routing-filter', :git => 'git://github.com/svenfuchs/routing-filter.git'
# remove this after i18n-js gets past version 2.1.2
gem 'i18n-js', :git => 'git://github.com/fnando/i18n-js.git'

group :development, :test do
gem 'refinerycms-testing', '~> 2.0.0'
# Fixes timeouts in JRuby - see https://github.com/thoughtbot/capybara-webkit/pull/220
if defined? JRUBY_VERSION
gem 'capybara-webkit', :git => 'git://github.com/dnagir/capybara-webkit.git' #'~> 0.7.0'
else
gem 'capybara-webkit', '~> 0.7.2'
gem 'capybara-webkit', '~> 0.8.0'
end
gem 'generator_spec'
gem 'database_cleaner', :git => 'git://github.com/bmabey/database_cleaner.git'

platforms :mri_18 do
gem 'rcov'
Expand All @@ -64,6 +58,7 @@ group :development, :test do
if RbConfig::CONFIG['target_os'] =~ /darwin/i
gem 'rb-fsevent', '>= 0.3.9'
gem 'growl', '~> 1.0.3'
gem 'growl_notify'
end
if RbConfig::CONFIG['target_os'] =~ /linux/i
gem 'rb-inotify', '>= 0.5.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def create
@user.plugins = @selected_plugin_names
# if the user is a superuser and can assign roles according to this site's
# settings then the roles are set with the POST data.
unless current_refinery_user.has_role?(:superuser) and Refinery::Authentication.config.superuser_can_assign_roles
unless current_refinery_user.has_role?(:superuser) and Refinery::Authentication.superuser_can_assign_roles
@user.add_role(:refinery)
else
@user.roles = @selected_role_names.collect{|r| ::Refinery::Role[r.downcase.to_sym]}
Expand All @@ -43,7 +43,7 @@ def edit
def update
# Store what the user selected.
@selected_role_names = params[:user].delete(:roles) || []
unless current_refinery_user.has_role?(:superuser) and Refinery::Authentication.config.superuser_can_assign_roles
unless current_refinery_user.has_role?(:superuser) and Refinery::Authentication.superuser_can_assign_roles
@selected_role_names = @user.roles.collect{|r| r.title}
end
@selected_plugin_names = params[:user][:plugins]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module ::Refinery
class PasswordsController < ::Devise::PasswordsController
layout 'login'

skip_before_filter :find_pages_for_menu

before_filter :store_password_reset_return_to, :only => [:update]
def store_password_reset_return_to
session[:'refinery_user_return_to'] = main_app.refinery_admin_root_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module Refinery
class SessionsController < ::Devise::SessionsController
layout 'login'

skip_before_filter :find_pages_for_menu

before_filter :clear_unauthenticated_flash, :only => [:new]

def create
Expand Down
2 changes: 2 additions & 0 deletions authentication/app/controllers/refinery/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Refinery
class UsersController < ::Devise::RegistrationsController

skip_before_filter :find_pages_for_menu

# Protect these actions behind an admin login
before_filter :redirect?, :only => [:new, :create]

Expand Down
2 changes: 1 addition & 1 deletion authentication/app/mailers/refinery/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def reset_notification(user, request)

mail(:to => user.email,
:subject => t('subject', :scope => 'refinery.user_mailer.reset_notification'),
:from => "\"#{Refinery::Core.config.site_name}\" <no-reply@#{request.domain}>")
:from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>")
end

protected
Expand Down
2 changes: 1 addition & 1 deletion authentication/app/models/refinery/role.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Refinery
class Role < ActiveRecord::Base
class Role < Refinery::Core::Base

# TODO: This works around a bug in rails habtm with namespaces.
has_and_belongs_to_many :users, :join_table => ::Refinery::RolesUsers.table_name
Expand Down
2 changes: 1 addition & 1 deletion authentication/app/models/refinery/roles_users.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Refinery
class RolesUsers < ActiveRecord::Base
class RolesUsers < Refinery::Core::Base

belongs_to :role
belongs_to :user
Expand Down
2 changes: 1 addition & 1 deletion authentication/app/models/refinery/user.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'devise'

module Refinery
class User < ActiveRecord::Base
class User < Refinery::Core::Base
# TODO: This works around a bug in rails habtm with namespaces.
has_and_belongs_to_many :roles, :join_table => ::Refinery::RolesUsers.table_name

Expand Down
2 changes: 1 addition & 1 deletion authentication/app/models/refinery/user_plugin.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Refinery
class UserPlugin < ActiveRecord::Base
class UserPlugin < Refinery::Core::Base

belongs_to :user
attr_accessible :user_id, :name, :position
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</ul>
</div>

<% if current_refinery_user.has_role?(:superuser) and Refinery::Authentication.config.superuser_can_assign_roles %>
<% if current_refinery_user.has_role?(:superuser) and Refinery::Authentication.superuser_can_assign_roles %>
<div class='field role_access'>
<span class='label_with_help'>
<%= f.label :role_access, t('.role_access'), :class => "title_label" %>
Expand Down
3 changes: 2 additions & 1 deletion authentication/app/views/refinery/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<% content_for :header, t('fill_form', :scope => 'refinery.users.new') %>
<% content_for :header, t('there_are_no_users', :scope => 'refinery.welcome') %>
<%= form_for :user, :url => main_app.refinery_user_registration_path do |f| -%>
<%= render :partial => "/refinery/admin/error_messages",
Expand Down
4 changes: 2 additions & 2 deletions authentication/lib/refinery/authentication/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class Engine < ::Rails::Engine
plugin.pathname = root
plugin.name = 'refinery_users'
plugin.version = %q{2.0.0}
plugin.menu_match = /refinery\/users$/
plugin.menu_match = %r{refinery/users$}
plugin.activity = {
:class_name => :'refinery/user',
:title => 'username',
:url => "refinery_admin_user_path" # temp hack for namespacees
}
plugin.url = app.routes.url_helpers.refinery_admin_users_path
plugin.url = {:controller => '/refinery/admin/users'}
end
end

Expand Down
8 changes: 1 addition & 7 deletions authentication/spec/requests/refinery/sessions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,10 @@ module Refinery
end

describe 'when there are no users' do
it 'invites us to create a user' do
visit root_url
page.should have_content("There are no users yet, so we'll set you up first")
end

it 'allows user creation' do
# Verify that we can access the sign up page.
visit root_url
click_link "Continue..."
page.should have_content("Fill out your details below so that we can get you started.")
page.should have_content("There are no users yet, so we'll set you up first")

# Fill in user details.
fill_in 'Username', :with => 'rspec'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ var link_dialog = {

var link = $(this).children('a.page_link').get(0);
var port = (window.location.port.length > 0 ? (":" + window.location.port) : "");
var url = link.href.replace(window.location.protocol + "//" + window.location.hostname + port, "");
var url = link.href<%= %q{.replace(window.location.protocol + "//" + window.location.hostname + port, "")} unless Refinery::Pages.absolute_page_links %>;

link_dialog.update_parent(url, link.rel.replace(/\ ?<em>.+?<\/em>/, ''));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5080,9 +5080,6 @@ WYMeditor.WymClassSafari.prototype._exec = function(cmd,param) {
else this._doc.execCommand(cmd,'',null);
}

//set to P if parent = BODY
this.format_block();

};

/* @name selected
Expand Down
2 changes: 1 addition & 1 deletion core/app/helpers/refinery/image_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def content_fu(content, thumbnail)
content.gsub(%r{<img.+?src=['"](/system/images/.+?)/.+?/>}) do |image_match|
begin
uid = Dragonfly::Job.from_path(
"#{image_match.match(%r{(/system/images/.+?)/})[1]}", Dragonfly[:images]
"#{image_match.match(%r{(/system/images/.+?)/})[1]}", Dragonfly[:refinery_images]
).uid

image_fu Image.where(:image_uid => uid).first, thumbnail
Expand Down
4 changes: 2 additions & 2 deletions core/app/helpers/refinery/meta_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ def browser_title(yield_title=nil)
[
(yield_title if yield_title.present?),
@meta.browser_title.present? ? @meta.browser_title : @meta.path,
Refinery::Core.config.site_name
Refinery::Core.site_name
].compact.join(" - ")
end

# you can override the object used for the title by supplying options[:object]
def page_title(options = {})
object = options.fetch(:object, @meta)
options.delete(:object)
options = Refinery::Pages.config.page_title.merge(options)
options = Refinery::Pages.page_title.merge(options)

title = []
objects = (options[:chain_page_title] and object.respond_to?(:ancestors)) ? [object.ancestors, object] : [object]
Expand Down
11 changes: 11 additions & 0 deletions core/app/models/refinery/core/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# If any changes are made to this class then the application will require a restart
# This is because this class is added to autoload_once_paths in lib/refinery/core/engine.rb.
module Refinery
module Core
class Base < ActiveRecord::Base

self.abstract_class = true

end
end
end
2 changes: 1 addition & 1 deletion core/app/views/refinery/_footer.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p>
<%= t('.copyright', :year => Time.now.year,
:site_name => Refinery::Core.config.site_name) %>
:site_name => Refinery::Core.site_name) %>
</p>
2 changes: 1 addition & 1 deletion core/app/views/refinery/_google_analytics.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% page_code = Refinery::Core.config.google_analytics_page_code.to_s.strip %>
<% page_code = Refinery::Core.google_analytics_page_code.to_s.strip %>
<% unless local_request? or refinery_user? or page_code =~ /^(UA-xxxxxx-x)?$/ -%>
<!-- asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet -->
<script>var _gaq=[['_setAccount','<%= page_code %>'],['_trackPageview'],['_trackPageLoadTime']];(function(d,t){
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= raw(%(<meta name="description" content="#{@meta.meta_description}" />)) if @meta.meta_description.present? -%>
<%= raw(%(<meta name="keywords" content="#{@meta.meta_keywords}">)) if @meta.meta_keywords.present? -%>
<%= raw(%(<link rel="canonical" content="#{@canonical}" />)) if @canonical.present? -%>
<%= csrf_meta_tags if Refinery::Core.config.authenticity_token_on_frontend -%>
<%= csrf_meta_tags if Refinery::Core.authenticity_token_on_frontend -%>
<%= yield :meta %>
<%= stylesheet_link_tag "application", "formatting", "theme" %>
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1 id='logo'>
<%= link_to Refinery::Core.config.site_name, main_app.root_path %>
<%= link_to Refinery::Core.site_name, main_app.root_path %>
</h1>
<%= render(:partial => "/refinery/menu", :locals => {
:dom_id => 'menu',
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/_ie6check.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if Refinery::Core.config.ie6_upgrade_message_enabled -%>
<% if Refinery::Core.ie6_upgrade_message_enabled -%>
<% unless admin? %>
<!--[if lte IE 6]>
<div id="ie6msg_wrapper">
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/_menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if (roots = local_assigns[:roots] || (collection ||= @menu_pages).roots).present?
dom_id ||= 'menu'
css = [(css || 'menu'), 'clearfix'].flatten.join(' ')
hide_children = Refinery::Core.config.menu_hide_children if hide_children.nil?
hide_children = Refinery::Core.menu_hide_children if hide_children.nil?
-%>
<nav id='<%= dom_id %>' class='<%= css %>'>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/_site_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<div id='site_bar_branding'>
<span id='site_bar_company_name'>
<%= Refinery::Core.config.site_name %>
<%= Refinery::Core.site_name %>
</span>

<%= link_to t('.log_out', site_bar_translate_locale_args),
Expand Down
15 changes: 10 additions & 5 deletions core/app/views/refinery/admin/_form_actions.html.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<%
namespacing = if f && f.object.class.respond_to?(:model_name)
f.object.class.name.underscore.gsub(%r{/?#{f.object.class.model_name.param_key}($|/)}, '').gsub('/', '_')
else
'refinery'
end

unless (hide_submit ||= false)
submit_button_text ||= t('.save')
submit_button_id ||= "submit_button"
submit_button_title ||= nil
end

unless defined?(hide_cancel).presence
hide_cancel = from_dialog?
end
hide_cancel = from_dialog? unless defined?(hide_cancel).presence

unless hide_cancel
cancel_button_text ||= t('.cancel')
unless defined?(cancel_title)
cancel_title = t('.cancel_lose_changes')
end
cancel_button_id ||= "cancel_button"
cancel_url ||= (((back = url_for(:back)).include?('javascript') or action_name =~ /^(create|update)$/) ? main_app.send("refinery_admin_#{f.object_name.to_s.pluralize}_path") : back)
cancel_url ||= (((back = url_for(:back)).include?('javascript') or action_name =~ /^(create|update)$/) ? main_app.send("#{namespacing}_admin_#{f.object_name.to_s.pluralize}_path") : back)
end

continue_editing = defined?(continue_editing) ? continue_editing : (f.object.present? and f.object.persisted?)
Expand All @@ -31,7 +35,8 @@
delete_title ||= nil
delete_confirmation ||= nil
delete_button_id ||= "delete_button"
delete_url ||= eval("main_app.refinery_admin_#{f.object_name}_path(#{f.object.id})")
# we have to use eval rather than main_app.send because this url may not exist for HTTP GET
delete_url ||= eval("main_app.#{namespacing}_admin_#{f.object_name}_path(#{f.object.id})")
end
-%>
<% if from_dialog? %>
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/admin/_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta charset='<%= ::Rails.application.config.encoding %>' />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<%= yield :meta %>
<title><%= Refinery::Core.config.site_name -%> - Refinery</title>
<title><%= Refinery::Core.site_name -%> - Refinery</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'refinery/refinery' %>
<%= yield :stylesheets %>
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/admin/_image_picker.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class='current_image_container' style="margin-top: 10px<%= ";display: none" if toggle_image_display %>">
<a class='current_image_link dialog' href="<%= current_image_link_href %>" style='border: 0px' title='<%= current_image_title %>' name='<%= current_image_title %>'>
<% unless image.nil? -%>
<%= image_fu image, Refinery::Images.config.user_image_sizes[thumbnail.to_sym],
<%= image_fu image, Refinery::Images.user_image_sizes[thumbnail.to_sym],
:class => "brown_border",
:class => "current_picked_image" %>
<% else -%>
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/admin/_menu.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav id="menu">
<% ::Refinery::Plugins.active.in_menu.each do |plugin| -%>
<%= link_to plugin.title, plugin.url,
<%= link_to plugin.title, main_app.url_for(plugin.url),
:class => ("active" if plugin.highlighted?(params)),
:id => "plugin_#{plugin.name}" %>
<% end -%>
Expand Down
17 changes: 0 additions & 17 deletions core/app/views/refinery/welcome.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion core/config/locales/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cs:
close: Zavřít
image_picker:
none_selected: Zatím není vybrán žádný %{what}, klikněte zde pro přidání.
remove_current: Zmazat vybraný %{what}
remove_current: Smazat vybraný %{what}
change: Klikněte zde pro vybrání obrázku
show: Zobrazit
resource_picker:
Expand Down
6 changes: 0 additions & 6 deletions core/lib/generators/refinery/cms/cms_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ def generate
src_file_path = "app/decorators/#{decorator_namespace}/refinery/.gitkeep"
copy_file self.class.source_root.join(src_file_path), destination_path.join(src_file_path)
end

# Ensure i18n exists and is up to date.
if Refinery.i18n_enabled?
require 'generators/refinery/i18n_generator'
Refinery::I18nGenerator.start
end
end

protected
Expand Down
Loading

0 comments on commit 044baf8

Please sign in to comment.