klastera 1.1.0 → 1.1.1

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
  SHA256:
3
- metadata.gz: 12536c20cf2d30bd60e704036cd40ffc688caee158a0802fa39713e6e46c4c49
4
- data.tar.gz: 5b945c20beba1467597764507a6aaa373287c3c50663fa0d115f92d4d310d47b
3
+ metadata.gz: 568f218d96580bb10036134ae396871cf9db198f6d905ccc97edf835330572ba
4
+ data.tar.gz: 74ea879bcd781b13a0beb7513c56c008037860479aee43c0342df8375ab38a3d
5
5
  SHA512:
6
- metadata.gz: 0a6d3198aa48188ad3d7e847070a23bd84876de19f81ddcc34d44ed906ab274f2b678c4228e023bc2294ba36defb49a1518cb057905675ad97a243f7bf5c8b27
7
- data.tar.gz: 76183a671d08a2eca8885425562a7e93e2196c72f6405984239a28cd872ef53d83f16dd78a3a48b720b2a6ad15a5d72e3912a83928e5099fc0756c2d6c46ce75
6
+ metadata.gz: c2220db1e8c1e4aad4b6b7f05150bb24d833cde5a234ba6c1246ae38f3135db1f7b9b5f7085a0251758e2347d90bbdd013a8fd754ddb4a50289059677b1efe1d
7
+ data.tar.gz: 8eb5679f6cb3e2c96c682f17a9826cac713d9fe6550e158df88d1a2113f1896dc2c2140b273f8040eaef158d0e4c2bd25ba16a84b5e0f34a39485aec4333f6fc
@@ -52,6 +52,10 @@ module Klastera::Concerns::Cluster
52
52
  end
53
53
  can_destroy
54
54
  end
55
+
56
+ def display_name_nid
57
+ "#{name} (#{nid})"
58
+ end
55
59
  end
56
60
 
57
61
  module ClassMethods
@@ -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(:is_in_cluster_mode?) && self.is_a_cluster_user?
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
- <% other_visibility_reason = other_visibility_reason.nil? ? false : other_visibility_reason %>
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.id')
8
+ label = t('klastera.cluster.title')
6
9
  %>
7
- <% if f.is_a?(SimpleForm::FormBuilder) %>
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 %>
@@ -1,3 +1,3 @@
1
1
  module Klastera
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
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|cu.cluster}
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).map{|c|[c.name,c.id]}
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klastera
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gino Barahona