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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c0a338ff781d4e2f82be9357639ef61f67049a9
|
4
|
+
data.tar.gz: f539d91742b122aee9c3a15e3ca0dfb6af10ebbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
17
|
+
tabbed_fields = Set.new
|
17
18
|
|
18
|
-
|
19
|
+
if resource_data.include? 'tabs'
|
20
|
+
|
21
|
+
tabs = resource_data['tabs']
|
19
22
|
result = {}
|
20
23
|
tabs.each do |tab|
|
21
|
-
name = tab[
|
22
|
-
fields_list = fields_with(
|
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?
|
53
|
+
resource_data.include? 'tabs'
|
33
54
|
end
|
34
55
|
|
35
56
|
end
|
data/lib/faalis/version.rb
CHANGED
@@ -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
|
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 %>">
|