Skip to content

Commit

Permalink
Merge branch 'master' into friendly_id_4
Browse files Browse the repository at this point in the history
Conflicts:
	settings/app/models/refinery/setting.rb
	settings/db/migrate/20100913234710_create_refinerycms_settings_schema.rb
  • Loading branch information
parndt committed Feb 25, 2012
2 parents 09e168f + 55d1460 commit 38eedc2
Show file tree
Hide file tree
Showing 135 changed files with 834 additions and 2,624 deletions.
4 changes: 2 additions & 2 deletions authentication/spec/models/refinery/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ module Refinery

it "adds registered plugins" do
first_user.plugins.collect(&:name).should eq(
["refinery_settings", "refinery_users", "refinery_dashboard",
"refinery_images", "refinery_pages", "refinery_files"]
["refinery_users", "refinery_dashboard", "refinery_images",
"refinery_files", "refinery_pages"]
)
end

Expand Down
2 changes: 0 additions & 2 deletions core/app/assets/javascripts/i18n-messages.js

This file was deleted.

6 changes: 4 additions & 2 deletions core/app/assets/javascripts/modernizr-min.js

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion core/app/assets/javascripts/refinery/admin.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,24 @@ init_modal_dialogs = function(){
});
};

refinery_dialog_success = function(e) {
close_dialog();

$.ajax({
url: window.location.pathname,
cache: false,
success: function(data) {
$('.pagination_container').html(data);

$('#flash_container > #flash').remove();
$('#flash_container').append($('.pagination_container').find('#flash'));

$('#flash').css({'width': 'auto', 'visibility': ''}).fadeIn(550);
init_ajaxy_pagination();
}
});
}

trigger_reordering = function(e, enable) {
$menu = $("#menu");
e.preventDefault();
Expand Down Expand Up @@ -972,7 +990,9 @@ close_dialog = function(e) {
the_body.removeClass('hide-overflow');
the_dialog.filter(':data(dialog)').dialog('close');
the_dialog.remove();
e.preventDefault();
if (e && e.preventDefault) {
e.preventDefault();
}
}
};

Expand Down
6 changes: 1 addition & 5 deletions core/app/assets/javascripts/refinery/boot_wym.js.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof(I18n) != 'undefined') {
I18n.locale = "<%= I18n.locale %>";
}

onOpenDialog = function(dialog) {
(dialog = $('.ui-dialog')).find('.ui-dialog-titlebar').corner('1px top');
if(!$.browser.msie){
Expand Down Expand Up @@ -228,7 +224,7 @@ var wymeditor_boot_options = $.extend({
);
}
}
, lang: ((typeof(I18n) != 'undefined' && I18n.locale != null) ? I18n.locale : 'en')
, lang: '<%= ::Refinery::i18n_enabled? ? ::Refinery::I18n.current_locale : 'en' %>'
}, custom_wymeditor_boot_options);

WYMeditor.editor.prototype.loadIframe = function(iframe) {
Expand Down
2 changes: 1 addition & 1 deletion core/app/assets/javascripts/refinery/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ init_flash_messages = function(){
'opacity': 0
, 'visibility':'visible'
}).animate({'opacity': '1'}, 550);
$('#flash_close').click(function(e) {
$('#flash_close').live('click', function(e) {
try {
$('#flash').animate({
'opacity': 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ init_submit_continue = function(){
if ((continue_editing_button = $('#continue_editing')).length > 0 && continue_editing_button.attr('rel') != 'no-prompt') {
$('#editor_switch a').click(function(e) {
if ($('form[data-changes-made]').length > 0) {
if (!confirm(I18n.t('js.admin.confirm_changes'))) {
if (!confirm('<%= ::I18n.t('js.admin.confirm_changes') %>')) {
e.preventDefault();
}
}
Expand Down
1 change: 0 additions & 1 deletion core/app/assets/javascripts/refinery/refinery.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*= require jquery_ujs
*= require jquery-ui
*= require ../modernizr-min
<% require_asset 'i18n' if defined?(Refinery::I18n::Engine) %>
*= require ../jquery/jquery.corner
*= require ../jquery/jquery.textTruncate
*= require ../jquery/jquery.html5-placeholder-shim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$("#submit_continue_button").click submit_and_continue
$("form").change (e) ->
$(this).attr "data-changes-made", true

if (continue_editing_button = $("#continue_editing")).length > 0 and continue_editing_button.attr("rel") != "no-prompt"
$("#editor_switch a").click (e) ->
e.preventDefault() unless confirm(I18n.t("js.admin.confirm_changes")) if $("form[data-changes-made]").length > 0
e.preventDefault() unless confirm("<%= ::I18n.t("js.admin.confirm_changes") %>") if $("form[data-changes-made]").length > 0
6 changes: 5 additions & 1 deletion core/app/controllers/refinery/fast_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
module ::Refinery
module Refinery
class FastController < ActionController::Base

def wymiframe
render :template => "/refinery/wymiframe", :layout => false
end

def message
render :partial => '/refinery/message', :layout => false
end

end
end
6 changes: 3 additions & 3 deletions core/app/helpers/refinery/menu_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def menu_branch_css(local_assigns)
options.update(:sibling_count => options[:menu_branch].shown_siblings.length) unless options[:sibling_count]

css = []
css << 'selected' if selected_page_or_descendant_page_selected?(local_assigns[:menu_branch])
css << 'first' if options[:menu_branch_counter] == 0
css << 'last' if options[:menu_branch_counter] == options[:sibling_count]
css << Refinery::Core.menu_css[:selected] if selected_page_or_descendant_page_selected?(local_assigns[:menu_branch]) unless Refinery::Core.menu_css[:selected].nil?
css << Refinery::Core.menu_css[:first] if options[:menu_branch_counter] == 0 unless Refinery::Core.menu_css[:first].nil?
css << Refinery::Core.menu_css[:last] if options[:menu_branch_counter] == options[:sibling_count] unless Refinery::Core.menu_css[:last].nil?
css
end

Expand Down
24 changes: 14 additions & 10 deletions core/app/views/layouts/refinery/admin_dialog.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<!DOCTYPE html>
<%= render '/refinery/html_tag' %>
<%= render '/refinery/admin/head' %>
<body id='dialog_container' class='dialog <%= I18n.locale %><%= ' wym_iframe_body' if params[:wymeditor].presence %>'>
<div id='tooltip_container'></div>
<div id="flash_container">
<%= render '/refinery/message' %>
</div>
<div id='content' class='clearfix'>
<%= yield %>
</div>
</body>
<% if @dialog_successful ||= params[:dialog_successful] %>
<%= render '/refinery/admin/dialog_success' %>
<% else %>
<%= render '/refinery/admin/head' %>
<body id='dialog_container' class='dialog <%= I18n.locale %><%= ' wym_iframe_body' if params[:wymeditor].presence %>'>
<div id='tooltip_container'></div>
<div id="flash_container">
<%= render '/refinery/message' %>
</div>
<div id='content' class='clearfix'>
<%= yield %>
</div>
</body>
<% end %>
</html>
2 changes: 2 additions & 0 deletions core/app/views/layouts/refinery/flash.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= render :partial => '/refinery/message' if request.xhr? %>
<%= yield %>
63 changes: 1 addition & 62 deletions core/app/views/refinery/_content_page.html.erb
Original file line number Diff line number Diff line change
@@ -1,63 +1,2 @@
<%
# provide a default array for collecting CSS for sections
css = []

# if 'sections' is passed in as a local_assigns, all of this is ignored.
if local_assigns[:sections].blank?
# always have a title
sections = [{:yield => :body_content_title, :fallback => page_title, :title => true}]

# append sections from this page.
@page.parts.inject(sections) do |s, part|
# we have some default yields, body_content_left and body_content_right
# these map to 'body' and 'side_body' fields in default Refinery.
section = {:fallback => part.body}
section[:yield] = case (title_symbol = part.title.to_s.gsub(/\ /, '').underscore.to_sym)
when :body then :body_content_left
when :side_body then :body_content_right
else title_symbol
end

# add section to the list unless we were specifically requested not to.
# otherwise, add css saying it's been removed.
unless (local_assigns[:hide_sections]||=[]).include?(section[:yield])
s << section
else
css << "no_#{section[:yield]}"
end
end unless @page.nil? or @page.parts.blank?

# Ensure that even without @page.parts we still have body_content_left and body_content_right
all_yields = sections.map{|s| s[:yield]}
sections << {:yield => :body_content_left} unless all_yields.include?(:body_content_left)
sections << {:yield => :body_content_right} unless all_yields.include?(:body_content_right)
end

# you can add more sections to the list using something like this:
# sections |= [{:yield => :something_else, :fallback => another_method, :id => 'something'}]

sections.each do |section|
section[:html] = yield(section[:yield]) if section[:yield].present?

if section[:html].blank? and !local_assigns[:show_empty_sections] and
!local_assigns[:remove_automatic_sections] and section.keys.include?(:fallback) and
section[:fallback].present?
section[:html] = raw(section[:fallback])
end

dom_id = section[:id] || section[:yield]
if section[:html].present?
if section[:title]
section[:html] = content_tag(:h1,section[:html], :id => dom_id)
else
section[:html] = content_tag(:section, content_tag(:div, section[:html], :class => 'inner'), :id => dom_id)
end
else
css << "no_#{dom_id}"
end
end
-%>
<section id='body_content'<%= " class='#{css.join(' ')}'" if css.present? %>>
<%= raw sections.map{|section| section[:html]}.join("\n") -%>
</section>
<%= render_content_page(@page, {:hide_sections => local_assigns[:hide_sections], :can_use_fallback => !local_assigns[:show_empty_sections] && !local_assigns[:remove_automatic_sections]}) %>
<%= render :partial => '/refinery/draft_page_message' unless @page.nil? or @page.live? -%>
7 changes: 2 additions & 5 deletions core/app/views/refinery/_message.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<% flash.each do |key, value| %>
<div id='flash' class="flash flash_<%= key %>" style='visibility: hidden;' >
<%= value %>
<% if key.to_s == "message" %>
<%= link_to t('.close_this_message'), "", {:id => "flash_close"} %>
<% else %>
<%= link_to t('.close'), "", {:id => "flash_close"} %>
<% end %>
<%= link_to t(".close#{'_this_message' if key.to_s == "message"}"), "",
:id => "flash_close" %>
</div>
<% end %>
5 changes: 5 additions & 0 deletions core/app/views/refinery/admin/_dialog_success.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<head>
<script>parent.refinery_dialog_success();</script>
</head>
<body>
</body>
2 changes: 1 addition & 1 deletion core/app/views/refinery/admin/_form_actions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
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)$/) ? refinery.send(Refinery.route_for_model(f.object.class)) : back)
cancel_url ||= (((back = url_for(:back)).include?('javascript') or action_name =~ /^(create|update)$/) ? refinery.send(Refinery.route_for_model(f.object.class, plural_route=true)) : back)
end

continue_editing = defined?(continue_editing) ? continue_editing : (f.object.present? and f.object.persisted?)
Expand Down
1 change: 1 addition & 0 deletions core/app/views/refinery/admin/_javascripts.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%= javascript_include_tag 'admin' -%>
<%= javascript_include_tag 'refinery/refinery' -%>
<%= javascript_include_tag 'refinery/wymeditor', "wymeditor/lang/#{::I18n.locale}", "wymeditor/skins/refinery/skin" %>
<%= yield :after_javascript_libraries -%>
Expand Down
5 changes: 3 additions & 2 deletions core/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Refinery::Core::Engine.routes.draw do
filter(:refinery_locales) if defined?(RoutingFilter::RefineryLocales) # optionally use i18n.
match 'wymiframe(/:id)', :to => 'fast#wymiframe', :as => :wymiframe
get 'wymiframe(/:id)', :to => 'fast#wymiframe', :as => :wymiframe
get 'refinery/message', :to => 'fast#message', :as => :message

namespace :admin, :path => 'refinery' do
root :to => 'dashboard#index'
Expand All @@ -9,5 +10,5 @@

match '/refinery/update_menu_positions', :to => 'admin/refinery_core#update_plugin_positions'

match '/sitemap.xml' => 'sitemap#index', :defaults => { :format => 'xml' }
get '/sitemap.xml' => 'sitemap#index', :defaults => { :format => 'xml' }
end
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ development:
pool: 5
username: postgres
password: postgres
min_messages: warning

# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
Expand All @@ -45,6 +46,7 @@ test:
pool: 5
username: postgres
password: postgres
min_messages: warning

production:
adapter: postgresql
Expand All @@ -53,3 +55,4 @@ production:
pool: 5
username: postgres
password: postgres
min_messages: warning
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Refinery::Core.configure do |config|
# Hide/show child pages in menu
# config.menu_hide_children = <%= Refinery::Core.menu_hide_children.inspect %>

# CSS class selectors for menu helper
# config.menu_css = <%= Refinery::Core.menu_css.inspect %>

# Should set this if concerned about DOS attacks. See
# http://markevans.github.com/dragonfly/file.Configuration.html#Configuration
# config.dragonfly_secret = <%= Refinery::Core.dragonfly_secret.inspect %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ login: &login
pool: 5
username: postgres
password: postgres
min_messages: warning
<% else %>
adapter: sqlite3
pool: 5
Expand Down
5 changes: 3 additions & 2 deletions core/lib/generators/refinery/engine/engine_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def attributes_for_translation_table
def generate
destination_pathname = Pathname.new(self.destination_root)
clash_file = Pathname.new(File.expand_path('../clash_keywords.yml', __FILE__))
clash_keywords = File.open(clash_file) { |f| doc = YAML.load(f) }
clash_keywords = YAML.load_file(clash_file)
if clash_keywords.member?(singular_name.downcase)
puts "Please choose a different name. Generated code would fail for class '#{singular_name}'"
puts "Please choose a different name. Generated code would fail for class '#{singular_name}'"
puts ""
exit(1)
end
Expand Down Expand Up @@ -147,6 +147,7 @@ def generate
puts "bundle install"
puts "rails generate refinery:#{engine_plural_name}"
puts "rake db:migrate"
puts "rake db:seed"
puts "------------------------"
end
else
Expand Down
1 change: 0 additions & 1 deletion core/lib/generators/refinery/engine/templates/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source "http://rubygems.org"

gemspec

git 'git'
gem 'refinerycms', '~> 2.0.0', :git => 'git://github.com/resolve/refinerycms.git'

# Refinery/rails should pull in the proper versions of these
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class <%= class_name %> < Refinery::Core::BaseModel
<% if (string_attributes = attributes.select{ |a| a.type.to_s =~ /string|text/ }.uniq).any? %>
acts_as_indexed :fields => <%= string_attributes.map{|s| s.name.to_sym}.inspect %>

validates <%= string_attributes.first.inspect %>, :presence => true, :uniqueness => true
validates <%= string_attributes.first.name.to_sym.inspect %>, :presence => true, :uniqueness => true
<% else %>
# def title was created automatically because you didn't specify a string field
# when you ran the refinery:engine generator. <3 <3 Refinery CMS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@
</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>
<% 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>
<% end %>
<%%= render '/refinery/admin/form_actions', :f => f,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<%%= will_paginate @<%= plural_name %> %>
<%%= will_paginate @<%= plural_name %> if Refinery::<%= namespacing %>::Admin::<%= class_name.pluralize %>.pageable? %>
<%%= render 'sortable_list' %>
Loading

0 comments on commit 38eedc2

Please sign in to comment.