faalis 0.26.2 → 0.26.3

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: 92d7b2d893edde43de939e15586954f6b8dc68aa
4
- data.tar.gz: c77cf59814dddbce2f6d1c0f68057f3f168c6acd
3
+ metadata.gz: 5c0a338ff781d4e2f82be9357639ef61f67049a9
4
+ data.tar.gz: f539d91742b122aee9c3a15e3ca0dfb6af10ebbd
5
5
  SHA512:
6
- metadata.gz: b3f36ee29389c4100a4de86bcbade9af8ca01f2b21b1ccfcfba9bc4a8847dff3a988d7c1db3ee806c44392dd0935bc954a03e1f3be1bee7e35f2b068e387c20f
7
- data.tar.gz: 234fd4c6a456e2dce2149d198ff264e5d54f30e0be048e88a15e36197266f58131149cc528e7195f5ec530a9145cda801730c1619e1b8e1e11f2a781403b2e2a
6
+ metadata.gz: 264b08d4bb16071c762e62597abc5f75bb7f45183f8a073f06c1a277e82b644e2109806c2d8654197b7553e93adf691adf36fb8f92c425f6151282ed286a20aa
7
+ data.tar.gz: 2f3222bbc2b265690cd13c77f024b9b0ef42d8441e41c1110588e1a630178ca21739449c5fa02a79ef020028d6fdfe47ef0b1785d858438a19751ecaf23a9f77
@@ -1,3 +1,5 @@
1
+ require 'set'
2
+
1
3
  module Faalis
2
4
  module Generators
3
5
  module Concerns
@@ -9,27 +11,46 @@ module Faalis
9
11
  module Tabs
10
12
 
11
13
  private
12
-
13
14
  # Process the user provided tabs
14
15
  # @return a Hash of tabs like
15
16
  def tabs
16
- if resource_data.include? "tabs"
17
+ tabbed_fields = Set.new
17
18
 
18
- tabs = resource_data["tabs"]
19
+ if resource_data.include? 'tabs'
20
+
21
+ tabs = resource_data['tabs']
19
22
  result = {}
20
23
  tabs.each do |tab|
21
- name = tab["name"]
22
- fields_list = fields_with("tab", tab["id"])
24
+ name = tab['name']
25
+ fields_list = fields_with('tab', tab['id'])
26
+ fields_list.each do |f|
27
+ tabbed_fields << f
28
+ end
23
29
  result[name] = fields_list
24
30
  end
31
+ all_fields = Set.new resource_data['fields']
32
+
33
+ result.each do |k, v|
34
+ if v.empty?
35
+ diff = (all_fields ^ tabbed_fields).to_a
36
+ result[k] = diff
37
+ end
38
+ end
25
39
  return result
26
40
  else
27
41
  {}
28
42
  end
29
43
  end
30
44
 
45
+ def tab_has_field?(tab_name, field_name)
46
+ it_does = tabs[tab_name].select do |f|
47
+ f['name'] == field_name
48
+ end
49
+ !it_does.empty?
50
+ end
51
+
31
52
  def any_tabs?
32
- resource_data.include? "tabs"
53
+ resource_data.include? 'tabs'
33
54
  end
34
55
 
35
56
  end
@@ -18,5 +18,5 @@
18
18
  # -----------------------------------------------------------------------------
19
19
 
20
20
  module Faalis
21
- VERSION = "0.26.2"
21
+ VERSION = "0.26.3"
22
22
  end
@@ -35,7 +35,7 @@
35
35
  <fieldset class="form" ng-show="current_tab == <%= tab_count %>">
36
36
  <legend ng-if="!editing"><span translate>New <%= name %></span></legend>
37
37
  <legend ng-if="editing"><span translate>Edit <%= name %></span></legend><% first = true %>
38
- <% fields.each do |field_name, field_type| %><% if tabs[name].include? field_name or tabs[name].include? "__all__" %>
38
+ <% fields.each do |field_name, field_type| %><% if tab_has_field?(name, field_name) or tabs[name].include? "__all__" %>
39
39
 
40
40
  <% if first %><div class="row"><% end %>
41
41
  <div class="small-4 columns <% if not first %>float-left small-offset-2<% end %>">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faalis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.2
4
+ version: 0.26.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sameer Rahmani