klastera 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/klastera/concerns/cluster.rb +4 -0
- data/app/models/klastera/concerns/user.rb +1 -1
- data/app/views/layouts/klastera/_cluster_filter.html.erb +1 -1
- data/app/views/layouts/klastera/_cluster_selector.html.erb +11 -5
- data/lib/klastera/version.rb +1 -1
- data/lib/klastera.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 568f218d96580bb10036134ae396871cf9db198f6d905ccc97edf835330572ba
|
4
|
+
data.tar.gz: 74ea879bcd781b13a0beb7513c56c008037860479aee43c0342df8375ab38a3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2220db1e8c1e4aad4b6b7f05150bb24d833cde5a234ba6c1246ae38f3135db1f7b9b5f7085a0251758e2347d90bbdd013a8fd754ddb4a50289059677b1efe1d
|
7
|
+
data.tar.gz: 8eb5679f6cb3e2c96c682f17a9826cac713d9fe6550e158df88d1a2113f1896dc2c2140b273f8040eaef158d0e4c2bd25ba16a84b5e0f34a39485aec4333f6fc
|
@@ -28,7 +28,7 @@ module Klastera::Concerns::User
|
|
28
28
|
def is_not_a_cluster_user?; ! self.is_a_cluster_user?; end
|
29
29
|
|
30
30
|
def need_cluster_assignation?
|
31
|
-
self.try(:organization).try(:
|
31
|
+
self.try(:organization).try(:required_suborganization_mode?) && self.is_a_cluster_user?
|
32
32
|
end
|
33
33
|
|
34
34
|
def can_admin_clusters?
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<%=yield(f)%>
|
8
8
|
|
9
9
|
<% if cluster_organization.is_in_cluster_mode? %>
|
10
|
-
<% cluster_collection = cluster_clusters %>
|
10
|
+
<% cluster_collection = cluster_clusters.map{|c|[c.name,c.id]} %>
|
11
11
|
<% if cluster_collection.size > 1 %>
|
12
12
|
<div class="inline-label-control-block">
|
13
13
|
<%= f.input :cluster_id, collection: cluster_collection, prompt: t('klastera.clusters.all'), label: false, wrapper: false %>
|
@@ -1,14 +1,20 @@
|
|
1
|
-
<%
|
1
|
+
<%
|
2
|
+
f = f.nil? ? nil : f
|
3
|
+
other_visibility_reason = other_visibility_reason.nil? ? false : other_visibility_reason
|
4
|
+
%>
|
2
5
|
<% if cluster_organization.is_in_cluster_mode? || other_visibility_reason %>
|
3
6
|
<%
|
4
7
|
cluster_collection = cluster_clusters
|
5
|
-
label = t('klastera.cluster.
|
8
|
+
label = t('klastera.cluster.title')
|
6
9
|
%>
|
7
|
-
<% if f.
|
10
|
+
<% if f.nil? %>
|
11
|
+
<%= label_tag(:cluster_id, label, class: 'control-label') %>
|
12
|
+
<%= select_tag(:cluster_id, options_from_collection_for_select(cluster_collection, 'id', 'display_name_nid'), class: 'form-control', prompt: 'Seleccione') %>
|
13
|
+
<% elsif f.is_a?(SimpleForm::FormBuilder) %>
|
8
14
|
<% if cluster_collection.size == 1 %>
|
9
15
|
<%= f.input :lonely_cluster, as: :hidden, html_input: { value: true } %>
|
10
16
|
<% else %>
|
11
|
-
<%= f.input :cluster_id, collection: cluster_collection, label: label %>
|
17
|
+
<%= f.input :cluster_id, collection: cluster_collection.map{|c|[c.name,c.id]}, label: label %>
|
12
18
|
<% end %>
|
13
19
|
<% else %>
|
14
20
|
<% if cluster_collection.size == 1 %>
|
@@ -16,7 +22,7 @@
|
|
16
22
|
<% else %>
|
17
23
|
<div class="form-group">
|
18
24
|
<%= f.label label %>
|
19
|
-
<%= f.select :cluster_id, cluster_collection, { include_blank: true }, { class: 'form-control' } %>
|
25
|
+
<%= f.select :cluster_id, cluster_collection.map{|c|[c.name,c.id]}, { include_blank: true }, { class: 'form-control' } %>
|
20
26
|
</div>
|
21
27
|
<% end %>
|
22
28
|
<% end %>
|
data/lib/klastera/version.rb
CHANGED
data/lib/klastera.rb
CHANGED
@@ -40,7 +40,7 @@ module Klastera
|
|
40
40
|
if organization.is_in_cluster_mode?
|
41
41
|
unless user.can_admin_clusters?
|
42
42
|
# TODO: return a Cluster::ActiveRecord_Relation and then remove to_a in ::Cluster.of line
|
43
|
-
clusters = ::ClusterUser.of(user,organization).map{|cu
|
43
|
+
clusters = ::ClusterUser.of(user,organization).map{|cu|::Cluster.find(cu.cluster_id)} # TODO: fix call to ::Cluster instead of Klastera::Cluster
|
44
44
|
else
|
45
45
|
# TODO: remove "to_a" after ClusterUser.of result became a Cluster::ActiveRecord_Relation object
|
46
46
|
clusters = ::Cluster.of(organization).to_a
|
@@ -58,6 +58,7 @@ module Klastera
|
|
58
58
|
helper_method :cluster_user
|
59
59
|
helper_method :cluster_organization
|
60
60
|
helper_method :cluster_clusters
|
61
|
+
# helper_method :cluster_clusters_ids
|
61
62
|
end
|
62
63
|
if respond_to?(:hide_action)
|
63
64
|
hide_action :cluster_scope
|
@@ -70,6 +71,8 @@ module Klastera
|
|
70
71
|
hide_action :cluster_organization=
|
71
72
|
hide_action :cluster_clusters
|
72
73
|
hide_action :cluster_clusters=
|
74
|
+
# hide_action :cluster_clusters_ids
|
75
|
+
# hide_action :cluster_clusters_ids=
|
73
76
|
end
|
74
77
|
before_action :set_the_lonely_cluster, only: %i[ create update ]
|
75
78
|
end
|
@@ -96,9 +99,13 @@ module Klastera
|
|
96
99
|
end
|
97
100
|
|
98
101
|
def cluster_clusters
|
99
|
-
Klastera.session_clusters(cluster_user,cluster_organization)
|
102
|
+
Klastera.session_clusters(cluster_user,cluster_organization)
|
100
103
|
end
|
101
104
|
|
105
|
+
# def cluster_clusters_ids
|
106
|
+
# cluster_clusters.map(&:id)
|
107
|
+
# end
|
108
|
+
|
102
109
|
def set_cluster_filter
|
103
110
|
@filter = ::ClusterFilter.new(cluster_filter_params)
|
104
111
|
end
|