releaf-core 1.1.11 → 1.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b630a015d5b90273ddac8d6833a1e3e4593d5692
4
- data.tar.gz: 3a5a40a7016c526ee7661c39f44f6e34263729f5
3
+ metadata.gz: 774aa55ef930837a7e646278f436c3fe676ecb97
4
+ data.tar.gz: 5fb2eaaa8ac74dc233a5cbe37ce9da17eeb84c2d
5
5
  SHA512:
6
- metadata.gz: 1758b1b03be6700dbbeb322bd826f02cb5333301969b9bfb26cfe4d585331c5e1567fbe4533b3e745f39db7f6955590a6788a5bb630e9db5bc4b557ab9b83631
7
- data.tar.gz: 15df83b1989316d55197c1c70387fec7ab8dc712916ae85b12ca845a9fee48731466fce662cf214cfaa86beeaa22c953a9be32b3110ccce4b22d9039655edaab
6
+ metadata.gz: 05b5fe1d0263450f196132267005e31814af72959b6bd9c497d6f5dd1a356f0a066eb4448476f2a83cad9455e4cba85574e95acc1f172cc0f6dd03978929280e
7
+ data.tar.gz: 444fa055b95f9801ef4ba5ee5ace5347bcdfb9bf53084d3eb16342457074607d2ae7e1609483ddb3530289ca0f7f239c9ed86e9e569be2ee9f781a3c5c1c97a3
@@ -10,7 +10,7 @@ module Releaf::Builders::Page
10
10
 
11
11
  def active?(item)
12
12
  instance_cache("active_#{item.class.name}_#{item.name}") do
13
- if controller_group?(item)
13
+ if item.group?
14
14
  item.controllers.find{|subitem| active?(subitem) }.present?
15
15
  else
16
16
  item.controller_name == controller.short_name
@@ -25,7 +25,7 @@ module Releaf::Builders::Page
25
25
 
26
26
  def menu_item(item)
27
27
  tag(:li, item_attributes(item)) do
28
- if controller_group?(item)
28
+ if item.group?
29
29
  menu_item_group(item)
30
30
  else
31
31
  menu_item_single(item)
@@ -33,10 +33,6 @@ module Releaf::Builders::Page
33
33
  end
34
34
  end
35
35
 
36
- def controller_group?(item)
37
- item.respond_to? :controllers
38
- end
39
-
40
36
  def menu_item_single(item)
41
37
  tag(:a, class: "trigger", href: item.path) do
42
38
  item_name_content(item)
@@ -50,7 +46,7 @@ module Releaf::Builders::Page
50
46
  end
51
47
 
52
48
  def collapsed_item?(item)
53
- controller_group?(item) && !active?(item) && layout_settings("releaf.menu.collapsed.#{item.name}") == true
49
+ item.group? && !active?(item) && layout_settings("releaf.menu.collapsed.#{item.name}") == true
54
50
  end
55
51
 
56
52
  def item_attributes(item)
@@ -13,6 +13,10 @@ class Releaf::ControllerDefinition
13
13
  self.helper = "#{options[:helper]}_path" if options[:helper]
14
14
  end
15
15
 
16
+ def group?
17
+ false
18
+ end
19
+
16
20
  def localized_name
17
21
  I18n.t(name, scope: "admin.controllers")
18
22
  end
@@ -9,4 +9,8 @@ class Releaf::ControllerGroupDefinition
9
9
  def localized_name
10
10
  I18n.t(name, scope: "admin.controllers")
11
11
  end
12
+
13
+ def group?
14
+ true
15
+ end
12
16
  end
@@ -69,4 +69,10 @@ describe Releaf::ControllerDefinition do
69
69
  end
70
70
  end
71
71
  end
72
+
73
+ describe "#group?" do
74
+ it "returns false" do
75
+ expect(subject.group?).to be false
76
+ end
77
+ end
72
78
  end
@@ -24,4 +24,10 @@ describe Releaf::ControllerGroupDefinition do
24
24
  expect(subject.localized_name).to eq("poiugasd")
25
25
  end
26
26
  end
27
+
28
+ describe "#group?" do
29
+ it "returns true" do
30
+ expect(subject.group?).to be true
31
+ end
32
+ end
27
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: releaf-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
4
+ version: 1.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - CubeSystems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-16 00:00:00.000000000 Z
11
+ date: 2018-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails