refinerycms-core 0.9.9.16 → 0.9.9.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,3 @@
1
- <%
2
- if (yielded_head = yield(:head)).present?
3
- logger.warn "\n-- DEPRECATION WARNING --"
4
- logger.warn "The use of 'content_for :head' is DEPRECATED for the admin layouts."
5
- logger.warn "For stylesheets, use content_for :stylesheets"
6
- logger.warn "For javascripts, use content_for :javascripts"
7
- logger.warn "For meta tags, use content_for :meta"
8
- logger.warn "This change is necessary so that we can deliver a performant experience for the user."
9
- logger.warn "Called from: #{caller.detect{|c| c =~ %r{#{Rails.root.to_s}}}.inspect.to_s.split(':in').first}\n\n"
10
- end
11
- if (yielded_head_libraries = yield(:head)).present?
12
- logger.warn "\n-- DEPRECATION WARNING --"
13
- logger.warn "The use of 'content_for :head_libraries' is DEPRECATED for the admin layouts."
14
- logger.warn "Please use content_for :before_javascript_libraries or content_for :after_javascript_libraries instead."
15
- logger.warn "This change is necessary so that we can deliver a performant experience for the user."
16
- logger.warn "Called from: #{caller.detect{|c| c =~ %r{#{Rails.root.to_s}}}.inspect.to_s.split(':in').first}\n\n"
17
- end
18
- -%>
19
1
  <head>
20
2
  <meta charset='<%= ::Refinery::Application.config.encoding %>' />
21
3
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@@ -36,8 +18,4 @@
36
18
  <%= yield :stylesheets %>
37
19
 
38
20
  <%= javascript_include_tag 'modernizr-min' %>
39
-
40
- <% #TODO: REMOVE yielded_head and yielded_head_libraries and deprecation notice 0.9.9 <=> 1.0 %>
41
- <%= yielded_head_libraries %>
42
- <%= yielded_head %>
43
21
  </head>
@@ -1,21 +1,3 @@
1
- <%
2
- if (yielded_head = yield(:head)).present?
3
- logger.warn "\n-- DEPRECATION WARNING --"
4
- logger.warn "The use of 'content_for :head' is DEPRECATED for the frontend layouts."
5
- logger.warn "For stylesheets, use content_for :stylesheets"
6
- logger.warn "For javascripts, use content_for :javascripts"
7
- logger.warn "For meta tags, use content_for :meta"
8
- logger.warn "This change is necessary so that we can deliver a performant experience for the user."
9
- logger.warn "Called from: #{caller.detect{|c| c =~ %r{#{Rails.root.to_s}}}.inspect.to_s.split(':in').first}\n\n"
10
- end
11
- if (yielded_head_libraries = yield(:head_libraries)).present?
12
- logger.warn "\n-- DEPRECATION WARNING --"
13
- logger.warn "The use of 'content_for :head_libraries' is DEPRECATED for the frontend layouts."
14
- logger.warn "Please use content_for :before_javascript_libraries or content_for :after_javascript_libraries instead."
15
- logger.warn "This change is necessary so that we can deliver a performant experience for the user."
16
- logger.warn "Called from: #{caller.detect{|c| c =~ %r{#{Rails.root.to_s}}}.inspect.to_s.split(':in').first}\n\n"
17
- end
18
- %>
19
1
  <head>
20
2
  <meta charset='<%= ::Refinery::Application.config.encoding %>' />
21
3
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@@ -25,18 +7,14 @@
25
7
  <%= csrf_meta_tag if RefinerySetting.find_or_set(:authenticity_token_on_frontend, true)-%>
26
8
  <%= yield :meta %>
27
9
 
28
- <%= stylesheet_link_tag stylesheets_for_head(stylesheets||=%w(application formatting theme), theme ||= false),
10
+ <%= stylesheet_link_tag stylesheets_for_head(stylesheets||=%w(application formatting theme), theme ||= nil),
29
11
  :cache => ("cache/application" if Rails.root.writable? and
30
12
  RefinerySetting.find_or_set(:use_resource_caching, true) and
31
- request.env['HTTP_USER_AGENT'] !~ /MSIE/ and (theme ||= false).blank?) %>
13
+ request.env['HTTP_USER_AGENT'] !~ /MSIE/ and (theme ||= nil).blank?) %>
32
14
  <%= stylesheet_link_tag "home", :theme => theme if home_page? %>
33
15
 
34
16
  <%= yield :stylesheets %>
35
17
  <%= render :partial => '/shared/google_analytics' unless local_request? %>
36
18
 
37
19
  <%= javascript_include_tag 'modernizr-min' %>
38
-
39
- <% #TODO: REMOVE yielded_head and yielded_head_libraries and deprecation notice 0.9.9 <=> 1.0 %>
40
- <%= yielded_head_libraries %>
41
- <%= yielded_head %>
42
20
  </head>
@@ -1,8 +1,15 @@
1
1
  <h1 id='logo'>
2
2
  <%= link_to RefinerySetting.find_or_set(:site_name, "Company Name"), root_path %>
3
3
  </h1>
4
- <%= render :partial => "/shared/menu",
5
- :locals => {
6
- :dom_id => 'menu',
7
- :css => 'menu'
8
- } -%>
4
+ <%=
5
+ ::Fiber.new {
6
+ ::Fiber.yield(
7
+ render(:partial => "/shared/menu", :locals => {
8
+ :dom_id => 'menu',
9
+ :css => 'menu',
10
+ :roots => @menu_pages.where(:parent_id => nil),
11
+ :collection => @menu_pages.where(@menu_pages.arel_table[:parent_id].not_eq(nil)),
12
+ :selected_item => (@page if defined?(::Page))
13
+ })
14
+ )
15
+ }.resume %>
@@ -1,22 +1,21 @@
1
1
  <%
2
2
  dom_id ||= 'menu'
3
- css ||= 'menu'
4
- hide_children = RefinerySetting.find_or_set(:menu_hide_children, false) if hide_children.nil?
5
- # Select top menu items unless 'roots' is supplied.
6
- collection ||= @menu_pages
7
3
  caching = (cache_menu ||= RefinerySetting.find_or_set(:cache_menu, false))
8
- cache_if(caching, [Refinery.base_cache_key, "pages_menus", dom_id, Globalize.locale, cache_path ||= request.path].join('_')) do
9
- if (roots ||= collection.select{|p| p.parent_id.nil?}).present?
4
+ cache_key = [Refinery.base_cache_key, 'pages_menus', dom_id, Globalize.locale, cache_path ||= request.path].join('_')
5
+ cache_if(caching, cache_key) do
6
+ # Select top menu items unless 'roots' is supplied.
7
+ if (roots ||= (collection ||= @menu_pages).where(:parent_id => nil)).present?
8
+ css = [(css || 'menu'), 'clearfix'].flatten.join(' ')
10
9
  # In order to match items that aren't shown in menu and highlight their associations.
11
10
  # This can be supplied if the logic is different in your case.
12
11
  unless defined?(selected_item)
13
- selected_item = collection.detect{|page| selected_page?(page)}
14
- selected_item = @page if selected_item.nil?
12
+ selected_item = @page || collection.detect{|page| selected_page?(page)}
15
13
  end
14
+ hide_children = RefinerySetting.find_or_set(:menu_hide_children, false) if hide_children.nil?
16
15
  -%>
17
- <nav id='<%= dom_id %>' class='<%= %W(#{css} clearfix).join(' ') %>'>
16
+ <nav id='<%= dom_id %>' class='<%= css %>'>
18
17
  <ul>
19
- <%= render :partial => "/shared/menu_branch",
18
+ <%= render :partial => '/shared/menu_branch',
20
19
  :collection => roots,
21
20
  :locals => {
22
21
  :hide_children => hide_children,
@@ -1,14 +1,12 @@
1
1
  <%
2
- if !!local_assigns[:apply_css] and (classes = css_for_menu_branch(menu_branch, menu_branch_counter, sibling_count||=nil, collection, selected_item ||= nil)).any?
2
+ if !!local_assigns[:apply_css] and (classes = menu_branch_css(local_assigns)).any?
3
3
  css = "class='#{classes.join(' ')}'"
4
4
  end
5
- dom_id = ("id='item_#{menu_branch_counter}'" if menu_branch.parent_id.nil? and menu_branch.title.present?)
5
+ dom_id = "id='item_#{menu_branch_counter}'"
6
6
 
7
- hide_children = (defined?(hide_children) && hide_children)
8
- children = if (hide_children || !menu_branch.has_descendants?)
9
- []
10
- else
11
- collection.select { |p| p.parent_id == menu_branch.id }
7
+ children = []
8
+ if !hide_children && menu_branch.has_descendants?
9
+ children = collection.where(:parent_id => menu_branch.id)
12
10
  end
13
11
  -%>
14
12
  <li<%= ['', css, dom_id].compact.join(' ').gsub(/\ *$/, '') %>>
@@ -16,11 +14,11 @@
16
14
  <% if children.present? -%>
17
15
  <ul class='clearfix'>
18
16
  <%=
19
- render :partial => "/shared/menu_branch",
17
+ render :partial => '/shared/menu_branch',
20
18
  :collection => children,
21
19
  :locals => {
22
20
  :apply_css => local_assigns[:apply_css],
23
- :hide_children => hide_children,
21
+ :hide_children => !!hide_children,
24
22
  :collection => collection,
25
23
  :selected_item => selected_item,
26
24
  :sibling_count => children.size - 1
data/lib/gemspec.rb CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency 'friendly_id_globalize3', '~> 3.2.1'
27
27
  s.add_dependency 'globalize3', '>= 0.1.0.beta'
28
28
  s.add_dependency 'moretea-awesome_nested_set', '~> 1.4'
29
- s.add_dependency 'rails', '~> 3.0.6'
29
+ s.add_dependency 'rails', '~> 3.0.7.rc1'
30
30
  s.add_dependency 'rdoc', '>= 2.5.11' # helps fix ubuntu
31
31
  s.add_dependency 'truncate_html', '~> 0.5'
32
32
  s.add_dependency 'will_paginate', '~> 3.0.pre'
@@ -1,11 +1,3 @@
1
1
  ::Refinery::Application.routes.draw do
2
- match '/admin(/*path)', :to => redirect {|params, request|
3
- request.flash[:message] = "<p>
4
- The URL '/<strong>admin</strong>#{"/#{params[:path]}" unless params[:path].blank?}' will be removed in Refinery CMS version 1.0
5
- <br/>
6
- Please use '/<strong>refinery</strong>#{"/#{params[:path]}" unless params[:path].blank?}' instead.
7
- </p>".html_safe
8
- "/refinery#{"/#{params[:path]}" unless params[:path].blank?}"
9
- }
10
2
  match '/refinery/*path' => 'admin/base#error_404'
11
3
  end
data/lib/refinery/crud.rb CHANGED
@@ -42,8 +42,8 @@ module Refinery
42
42
  def crudify(model_name, options = {})
43
43
  options = ::Refinery::Crud.default_options(model_name).merge(options)
44
44
 
45
- singular_name = model_name.to_s
46
- class_name = singular_name.camelize
45
+ class_name = model_name.to_s.camelize
46
+ singular_name = class_name.demodulize.underscore
47
47
  plural_name = singular_name.pluralize
48
48
 
49
49
  module_eval %(
@@ -16,14 +16,37 @@ module Refinery
16
16
 
17
17
  # This was extracted from app/views/shared/_menu_branch.html.erb
18
18
  # to remove the complexity of that template by reducing logic in the view.
19
- def css_for_menu_branch(menu_branch, menu_branch_counter, sibling_count = nil, collection = [], selected_item = nil)
19
+ def css_for_menu_branch(menu_branch, menu_branch_counter, sibling_count = nil, collection = [], selected_item = nil, warning = true)
20
+ # DEPRECATION. Remove at version 1.1
21
+ if warning
22
+ warn "\n-- DEPRECATION WARNING --"
23
+ warn "The use of 'css_for_menu_branch' is deprecated."
24
+ warn "Please use menu_branch_css(local_assigns) instead."
25
+ warn "Called from: #{caller.detect{|c| c =~ %r{#{Rails.root.to_s}}}.inspect.to_s.split(':in').first}\n\n"
26
+ end
27
+
20
28
  css = []
21
29
  css << "selected" if selected_page_or_descendant_page_selected?(menu_branch, collection, selected_item)
22
30
  css << "first" if menu_branch_counter == 0
23
- css << "last" if menu_branch_counter == (sibling_count ||= menu_branch.shown_siblings.size)
31
+ css << "last" if menu_branch_counter == sibling_count
24
32
  css
25
33
  end
26
34
 
35
+ # New method which accepts the local_assigns hash.
36
+ # This maps to the older css_for_menu_branch method.
37
+ def menu_branch_css(local_assigns)
38
+ options = {:collection => []}.merge(local_assigns)
39
+ if options.keys.exclude?(:sibling_count) || options[:sibling_count].nil?
40
+ options.update(:sibling_count => options[:menu_branch].shown_siblings.size)
41
+ end
42
+ css_for_menu_branch(options[:menu_branch],
43
+ options[:menu_branch_counter],
44
+ options[:sibling_count],
45
+ options[:collection],
46
+ options[:selected_item],
47
+ false)
48
+ end
49
+
27
50
  # Determines whether any page underneath the supplied page is the current page according to rails.
28
51
  # Just calls selected_page? for each descendant of the supplied page.
29
52
  # if you pass a collection it won't check its own descendants but use the collection supplied.
@@ -132,8 +132,8 @@ namespace :refinery do
132
132
  desc "Un-crudify a method on a controller that uses crudify"
133
133
  task :uncrudify => :environment do
134
134
  if (model_name = ENV["model"]).present? and (action = ENV["action"]).present?
135
- singular_name = model_name.to_s
136
- class_name = singular_name.camelize
135
+ class_name = model_name.to_s.camelize
136
+ singular_name = class_name.demodulize.underscore
137
137
  plural_name = singular_name.pluralize
138
138
 
139
139
  crud_lines = Refinery.roots('core').join('lib', 'refinery', 'crud.rb').read
@@ -725,7 +725,6 @@ var page_options = {
725
725
  page_options.tabs.find('> ul li a').corner('top 5px');
726
726
 
727
727
  $('#new_page_part_dialog').dialog('close');
728
- $('#new_page_part_dialog').remove();
729
728
  }
730
729
  );
731
730
  }else{
@@ -1339,6 +1339,29 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1339
1339
  end = selection.focusOffset;
1340
1340
  }
1341
1341
 
1342
+ // for https://github.com/resolve/refinerycms/issues/581
1343
+ if (typeof (start_node.insertData) === 'undefined') {
1344
+ var j = start_node.childNodes.length - 1,
1345
+ tmp_start_node = start_node;
1346
+
1347
+ // @todo what then if function insertData is not found?
1348
+ while (typeof(end_node.insertData) !== 'function' || !j) {
1349
+ start_node = tmp_start_node.childNodes[j--];
1350
+ }
1351
+
1352
+ start = 0;
1353
+ }
1354
+
1355
+ if (typeof (end_node.insertData) === 'undefined') {
1356
+ var i = end_node.childNodes.length - 1,
1357
+ tmp_end_node = end_node;
1358
+ while (typeof(end_node.insertData) !== 'function' || !i) {
1359
+ end_node = tmp_end_node.childNodes[i--];
1360
+ }
1361
+
1362
+ end = end_node.length;
1363
+ }
1364
+
1342
1365
  // because .insertData only inserts text, we have to insert some 'meaningful' *text* only interpolation tags (no html).
1343
1366
  start_tag = '%%' + wym._current_unique_stamp + '%%';
1344
1367
  end_tag = '$$' + wym._current_unique_stamp + '$$';
@@ -2,10 +2,10 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{refinerycms-core}
5
- s.version = %q{0.9.9.16}
5
+ s.version = %q{0.9.9.17}
6
6
  s.summary = %q{Core engine for Refinery CMS}
7
7
  s.description = %q{The core of Refinery CMS. This handles the common functionality and is required by most engines}
8
- s.date = %q{2011-04-07}
8
+ s.date = %q{2011-04-15}
9
9
  s.email = %q{info@refinerycms.com}
10
10
  s.homepage = %q{http://refinerycms.com}
11
11
  s.rubyforge_project = %q{refinerycms}
@@ -14,14 +14,14 @@ Gem::Specification.new do |s|
14
14
  s.require_paths = %w(lib)
15
15
  s.executables = %w()
16
16
 
17
- s.add_dependency 'refinerycms-base', '= 0.9.9.16'
18
- s.add_dependency 'refinerycms-settings', '= 0.9.9.16'
17
+ s.add_dependency 'refinerycms-base', '= 0.9.9.17'
18
+ s.add_dependency 'refinerycms-settings', '= 0.9.9.17'
19
19
  s.add_dependency 'refinerycms-generators', '~> 1.0'
20
20
  s.add_dependency 'acts_as_indexed', '~> 0.7'
21
21
  s.add_dependency 'friendly_id_globalize3', '~> 3.2.1'
22
22
  s.add_dependency 'globalize3', '>= 0.1.0.beta'
23
23
  s.add_dependency 'moretea-awesome_nested_set', '~> 1.4'
24
- s.add_dependency 'rails', '~> 3.0.6'
24
+ s.add_dependency 'rails', '~> 3.0.7.rc1'
25
25
  s.add_dependency 'rdoc', '>= 2.5.11' # helps fix ubuntu
26
26
  s.add_dependency 'truncate_html', '~> 0.5'
27
27
  s.add_dependency 'will_paginate', '~> 3.0.pre'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refinerycms-core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.9.16
5
+ version: 0.9.9.17
6
6
  platform: ruby
7
7
  authors:
8
8
  - Resolve Digital
@@ -13,8 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-04-07 00:00:00 +12:00
17
- default_executable:
16
+ date: 2011-04-15 00:00:00 Z
18
17
  dependencies:
19
18
  - !ruby/object:Gem::Dependency
20
19
  name: refinerycms-base
@@ -24,7 +23,7 @@ dependencies:
24
23
  requirements:
25
24
  - - "="
26
25
  - !ruby/object:Gem::Version
27
- version: 0.9.9.16
26
+ version: 0.9.9.17
28
27
  type: :runtime
29
28
  version_requirements: *id001
30
29
  - !ruby/object:Gem::Dependency
@@ -35,7 +34,7 @@ dependencies:
35
34
  requirements:
36
35
  - - "="
37
36
  - !ruby/object:Gem::Version
38
- version: 0.9.9.16
37
+ version: 0.9.9.17
39
38
  type: :runtime
40
39
  version_requirements: *id002
41
40
  - !ruby/object:Gem::Dependency
@@ -101,7 +100,7 @@ dependencies:
101
100
  requirements:
102
101
  - - ~>
103
102
  - !ruby/object:Gem::Version
104
- version: 3.0.6
103
+ version: 3.0.7.rc1
105
104
  type: :runtime
106
105
  version_requirements: *id008
107
106
  - !ruby/object:Gem::Dependency
@@ -480,7 +479,6 @@ files:
480
479
  - public/wymeditor/README
481
480
  - refinerycms-core.gemspec
482
481
  - spec/lib/refinery/plugins_spec.rb
483
- has_rdoc: true
484
482
  homepage: http://refinerycms.com
485
483
  licenses:
486
484
  - MIT
@@ -504,7 +502,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
504
502
  requirements: []
505
503
 
506
504
  rubyforge_project: refinerycms
507
- rubygems_version: 1.6.1
505
+ rubygems_version: 1.7.2
508
506
  signing_key:
509
507
  specification_version: 3
510
508
  summary: Core engine for Refinery CMS