refinerycms-core 0.9.9.19 → 0.9.9.20
Sign up to get free protection for your applications and to get access to all the features.
- data/app/views/shared/_header.html.erb +4 -12
- data/app/views/shared/_menu.html.erb +20 -21
- data/app/views/shared/_menu_branch.html.erb +4 -12
- data/lib/generators/refinerycms_generator.rb +1 -0
- data/lib/refinery/helpers/menu_helper.rb +21 -20
- data/lib/refinery/helpers/meta_helper.rb +1 -1
- data/lib/refinery/helpers/script_helper.rb +1 -1
- data/lib/refinery/plugin.rb +4 -6
- data/lib/refinerycms-core.rb +0 -2
- data/public/javascripts/jquery-min.js +3 -3
- data/public/javascripts/jquery.js +807 -609
- data/public/javascripts/rails.js +245 -123
- data/public/javascripts/refinery/admin.js +1 -1
- data/public/javascripts/refinery/core.js +2 -0
- data/public/javascripts/wymeditor/lang/de.js +12 -12
- data/public/javascripts/wymeditor/lang/sk.js +45 -0
- data/public/stylesheets/refinery/refinery.css +4 -2
- data/refinerycms-core.gemspec +6 -4
- data/spec/lib/refinery/plugin_spec.rb +142 -0
- metadata +7 -4
@@ -1,15 +1,7 @@
|
|
1
1
|
<h1 id='logo'>
|
2
2
|
<%= link_to RefinerySetting.find_or_set(:site_name, "Company Name"), root_path %>
|
3
3
|
</h1>
|
4
|
-
<%=
|
5
|
-
|
6
|
-
|
7
|
-
|
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 %>
|
4
|
+
<%= render(:partial => "/shared/menu", :locals => {
|
5
|
+
:dom_id => 'menu',
|
6
|
+
:css => 'menu'
|
7
|
+
}) %>
|
@@ -1,33 +1,32 @@
|
|
1
1
|
<%
|
2
2
|
dom_id ||= 'menu'
|
3
3
|
caching = (cache_menu ||= RefinerySetting.find_or_set(:cache_menu, false))
|
4
|
-
cache_key = [Refinery.base_cache_key, 'pages_menus', dom_id, Globalize.locale
|
5
|
-
|
4
|
+
cache_key = [Refinery.base_cache_key, 'pages_menus', dom_id, Globalize.locale].join('_')
|
5
|
+
# cache the pages first
|
6
|
+
collection = if caching
|
7
|
+
Rails.cache.fetch(cache_key) { (collection ||= @menu_pages).to_a }
|
8
|
+
else
|
9
|
+
(collection ||= @menu_pages).to_a
|
10
|
+
end
|
11
|
+
|
12
|
+
# cache the generation of the menu based on the pages.
|
13
|
+
cache_if(caching, ([cache_key, cache_path ||= request.path].join('_'))) do
|
6
14
|
# Select top menu items unless 'roots' is supplied.
|
7
|
-
if (roots ||=
|
15
|
+
if (roots ||= collection.select{|c| c.parent_id.nil?}).present?
|
8
16
|
css = [(css || 'menu'), 'clearfix'].flatten.join(' ')
|
9
|
-
# In order to match items that aren't shown in menu and highlight their associations.
|
10
|
-
# This can be supplied if the logic is different in your case.
|
11
|
-
unless defined?(selected_item)
|
12
|
-
selected_item = @page || collection.detect{|page| selected_page?(page)}
|
13
|
-
end
|
14
17
|
hide_children = RefinerySetting.find_or_set(:menu_hide_children, false) if hide_children.nil?
|
15
18
|
-%>
|
16
19
|
<nav id='<%= dom_id %>' class='<%= css %>'>
|
17
20
|
<ul>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
:apply_css => true #if you don't care about class='first' class='last' or class='selected' set apply_css to false for speed.
|
28
|
-
}
|
29
|
-
-%>
|
30
|
-
<% end %>
|
21
|
+
<%= render :partial => '/shared/menu_branch',
|
22
|
+
:collection => roots,
|
23
|
+
:locals => {
|
24
|
+
:hide_children => hide_children,
|
25
|
+
:sibling_count => (roots.length - 1),
|
26
|
+
:collection => collection,
|
27
|
+
:apply_css => true #if you don't care about class='first' class='last' or class='selected' set apply_css to false for speed.
|
28
|
+
}
|
29
|
+
-%>
|
31
30
|
</ul>
|
32
31
|
</nav>
|
33
32
|
<% end -%>
|
@@ -4,28 +4,20 @@
|
|
4
4
|
end
|
5
5
|
dom_id = "id='item_#{menu_branch_counter}'"
|
6
6
|
|
7
|
-
children =
|
8
|
-
if !hide_children && menu_branch.has_descendants?
|
9
|
-
children = collection.where(:parent_id => menu_branch.id)
|
10
|
-
end
|
7
|
+
children = menu_branch.children.live.in_menu unless hide_children
|
11
8
|
-%>
|
12
9
|
<li<%= ['', css, dom_id].compact.join(' ').gsub(/\ *$/, '') %>>
|
13
10
|
<%= link_to menu_branch.title, menu_branch.url -%>
|
14
11
|
<% if children.present? -%>
|
15
12
|
<ul class='clearfix'>
|
16
|
-
|
17
|
-
|
18
|
-
render :partial => '/shared/menu_branch',
|
13
|
+
<%= render :partial => '/shared/menu_branch',
|
14
|
+
:collection => children,
|
19
15
|
:locals => {
|
20
|
-
:menu_branch => child,
|
21
|
-
:menu_branch_counter => index,
|
22
16
|
:apply_css => local_assigns[:apply_css],
|
23
17
|
:hide_children => !!hide_children,
|
24
18
|
:collection => collection,
|
25
|
-
:
|
26
|
-
:sibling_count => children.size - 1
|
19
|
+
:sibling_count => children.length - 1
|
27
20
|
} -%>
|
28
|
-
<% end %>
|
29
21
|
</ul>
|
30
22
|
<% end -%>
|
31
23
|
</li>
|
@@ -82,6 +82,7 @@ class RefinerycmsGenerator < ::Refinery::Generators::EngineInstaller
|
|
82
82
|
|
83
83
|
|
84
84
|
# Append seeds.
|
85
|
+
create_file "db/seeds.rb" unless Rails.root.join('db', 'seeds.rb').file?
|
85
86
|
append_file 'db/seeds.rb', :verbose => true do
|
86
87
|
self.class.source_root.join('db', 'seeds.rb').read
|
87
88
|
end
|
@@ -20,7 +20,7 @@ module Refinery
|
|
20
20
|
# DEPRECATION. Remove at version 1.1
|
21
21
|
if warning
|
22
22
|
warn "\n-- DEPRECATION WARNING --"
|
23
|
-
warn "The use of 'css_for_menu_branch' is deprecated."
|
23
|
+
warn "The use of 'css_for_menu_branch' is deprecated and will be removed at version 1.1."
|
24
24
|
warn "Please use menu_branch_css(local_assigns) instead."
|
25
25
|
warn "Called from: #{caller.detect{|c| c =~ %r{#{Rails.root.to_s}}}.inspect.to_s.split(':in').first}\n\n"
|
26
26
|
end
|
@@ -36,14 +36,13 @@ module Refinery
|
|
36
36
|
# This maps to the older css_for_menu_branch method.
|
37
37
|
def menu_branch_css(local_assigns)
|
38
38
|
options = {:collection => []}.merge(local_assigns)
|
39
|
-
|
40
|
-
|
41
|
-
end
|
39
|
+
options.update(:sibling_count => options[:menu_branch].shown_siblings.size) unless options[:sibling_count]
|
40
|
+
|
42
41
|
css_for_menu_branch(options[:menu_branch],
|
43
42
|
options[:menu_branch_counter],
|
44
43
|
options[:sibling_count],
|
45
44
|
options[:collection],
|
46
|
-
options[:selected_item],
|
45
|
+
options[:selected_item], # TODO: DEPRECATED, remove at 1.1
|
47
46
|
false)
|
48
47
|
end
|
49
48
|
|
@@ -51,30 +50,31 @@ module Refinery
|
|
51
50
|
# Just calls selected_page? for each descendant of the supplied page.
|
52
51
|
# if you pass a collection it won't check its own descendants but use the collection supplied.
|
53
52
|
def descendant_page_selected?(page, collection = [], selected_item = nil)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
else
|
59
|
-
page.descendants
|
53
|
+
if selected_item
|
54
|
+
warn "\n-- DEPRECATION WARNING --"
|
55
|
+
warn "The use of 'selected_item' is deprecated and will be removed at version 1.1."
|
56
|
+
warn "Called from: #{caller.detect{|c| c =~ %r{#{Rails.root.to_s}}}.inspect.to_s.split(':in').first}\n\n"
|
60
57
|
end
|
61
58
|
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
return false unless page.has_descendants?
|
60
|
+
return false unless selected_item.nil? or !selected_item.in_menu?
|
61
|
+
|
62
|
+
page.descendants.any? { |descendant|
|
63
|
+
!selected_item ? selected_page?(descendant) : selected_item == descendant
|
64
|
+
}
|
65
65
|
end
|
66
66
|
|
67
67
|
def selected_page_or_descendant_page_selected?(page, collection = [], selected_item = nil)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
selected
|
68
|
+
return true if selected_page?(page) || selected_item === page
|
69
|
+
return true if descendant_page_selected?(page, collection, selected_item)
|
70
|
+
false
|
72
71
|
end
|
73
72
|
|
74
73
|
# Determine whether the supplied page is the currently open page according to Refinery.
|
75
74
|
# Also checks whether Rails thinks it is selected after that using current_page?
|
76
75
|
def selected_page?(page)
|
77
76
|
path = request.path
|
77
|
+
path = path.force_encoding('utf-8') if path.respond_to?(:force_encoding)
|
78
78
|
|
79
79
|
# Ensure we match the path without the locale, if present.
|
80
80
|
if defined?(::Refinery::I18n) and ::Refinery::I18n.enabled? and path =~ %r{^/#{::I18n.locale}}
|
@@ -84,8 +84,9 @@ module Refinery
|
|
84
84
|
|
85
85
|
# Match path based on cascading rules.
|
86
86
|
(path =~ Regexp.new(page.menu_match) if page.menu_match.present?) or
|
87
|
-
|
88
|
-
|
87
|
+
path == page.link_url or
|
88
|
+
path == page.nested_path or
|
89
|
+
URI.decode(path) == page.nested_path or
|
89
90
|
current_page?(page)
|
90
91
|
end
|
91
92
|
|
@@ -25,7 +25,7 @@ module Refinery
|
|
25
25
|
else
|
26
26
|
"#{javascript_include_tag("http://www.google.com/jsapi").gsub(".js", "")}
|
27
27
|
<script>
|
28
|
-
google.load('jquery', '1.5.
|
28
|
+
google.load('jquery', '1.5.2');
|
29
29
|
#{"google.load('jqueryui', '1.8.9');" if options[:jquery_ui]}
|
30
30
|
</script>".html_safe
|
31
31
|
end
|
data/lib/refinery/plugin.rb
CHANGED
@@ -78,14 +78,12 @@ module Refinery
|
|
78
78
|
|
79
79
|
# Returns a hash that can be used to create a url that points to the administration part of the plugin.
|
80
80
|
def url
|
81
|
-
|
82
|
-
|
83
|
-
if self.controller.present?
|
84
|
-
@url = {:controller => "/admin/#{self.controller}"}
|
81
|
+
@url ||= if self.controller.present?
|
82
|
+
{:controller => "/admin/#{self.controller}"}
|
85
83
|
elsif self.directory.present?
|
86
|
-
|
84
|
+
{:controller => "/admin/#{self.directory.split('/').pop}"}
|
87
85
|
else
|
88
|
-
|
86
|
+
{:controller => "/admin/#{self.name}"}
|
89
87
|
end
|
90
88
|
end
|
91
89
|
|