azahara_schema 0.3.10 → 0.3.11

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: cd521cb7f65eb4e2da7a431528c37f93118e64fe747a18b25f2b21d68cd71715
4
- data.tar.gz: 22be1abf8722e4b5dce3540161ef6f0f3a39a8af458c84c16ab49b72e1a5cef5
3
+ metadata.gz: d4ebb4cfbf9b88aedd63379c567022ffd313d71ab6496b1b4c15abd85c7bc795
4
+ data.tar.gz: c90d23fd01a59ba6668d7439e269398c8481d4f906dcb13a680bc65d5f6f0869
5
5
  SHA512:
6
- metadata.gz: e55554f1443c80a2bc5a2468a6a80789e6687e9bf72664c63ac1bed6c0d333986d32d50524deadb45dc25b33ea32903f0ddd3e04080c8d54ad39112d2870202b
7
- data.tar.gz: e9c300edc0cafb02a0829f854075feddefd34385b05e1a1bc509b6191ec5681aa24045c50bab4364d79e73eec4774f42f345e9a22418bd8574aa5e69104293d8
6
+ metadata.gz: 33378116e789f9ab91ac6b952480d630212db2b3e847a2efbd15a9c3c1b59932ade15d2b60f18dc7d261fffef1460cca1f19bf784507ab31d34d78016ac5482f
7
+ data.tar.gz: a8a150f7d0c0d4c5295fde70aaaebd52cb973d362dc07d3813f50968acbf6212aeaa6711747cef612831337be839f6bc6385aac9373df58dbfb7c33ebca32129
@@ -4,13 +4,13 @@
4
4
  <%= azahara_filter_row(schema, filter, name) %>
5
5
  <% end %>
6
6
  </div>
7
- <% if schema.collapsable_filters.any? || lookup_context.template_exists?("#{schema.model.model_name.plural}/_additional_filters") %>
7
+ <% if schema.collapsable_filters.any? || lookup_context.template_exists?("#{ActiveSupport::Inflector.tableize(schema.model.name)}/_additional_filters") %>
8
8
  <div id="filters_collapsable" class="collapse">
9
9
  <% schema.collapsable_filters.each do |name, filter| %>
10
10
  <%= azahara_filter_row(schema, filter, name) %>
11
11
  <% end %>
12
- <% if lookup_context.template_exists?("#{schema.model.model_name.plural}/_additional_filters") %>
13
- <%= render "#{schema.model.model_name.plural}/additional_filters", schema: schema %>
12
+ <% if lookup_context.template_exists?("#{ActiveSupport::Inflector.tableize(schema.model.name)}/_additional_filters") %>
13
+ <%= render "#{ActiveSupport::Inflector.tableize(schema.model.name)}/additional_filters", schema: schema %>
14
14
  <% end %>
15
15
  </div>
16
16
  <div class="collapse-actions" style="text-align: center;">
@@ -21,7 +21,9 @@ module AzaharaSchema
21
21
  end
22
22
 
23
23
  def value(parent)
24
- attribute.attribute.add_join( parent.send(attribute.association.name) ).sum(attribute.arel_field).to_f
24
+ val = attribute.attribute.add_join( parent.send(attribute.association.name) ).sum(attribute.arel_field)
25
+ val = BigDecimal.new(val.to_s) unless val.is_a?(BigDecimal)
26
+ val
25
27
  end
26
28
 
27
29
  end
@@ -132,6 +132,10 @@ module AzaharaSchema
132
132
  def available_operators
133
133
  ['=']
134
134
  end
135
+
136
+ def searchable?
137
+ false
138
+ end
135
139
  end
136
140
 
137
141
  class LoveFormat < ListFormat
@@ -23,11 +23,11 @@ module AzaharaSchema
23
23
  end
24
24
 
25
25
  def visibility_scope!(ability, authorization_action=:index)
26
- @entity_scope = entity_scope.accessible_by(ability, authorization_action)
26
+ @base_scope = base_scope.accessible_by(ability, authorization_action)
27
27
  end
28
28
 
29
- def entity_scope
30
- @entity_scope || super
29
+ def base_scope
30
+ @base_scope || super
31
31
  end
32
32
 
33
33
  # dummy implementations for rewrite
@@ -243,8 +243,12 @@ module AzaharaSchema
243
243
  query.split if query
244
244
  end
245
245
 
246
- def entity_scope
247
- scope = model.respond_to?(:visible) ? model.visible : model.all
246
+ def base_scope
247
+ model.all
248
+ end
249
+
250
+ def entity_scope(scope=base_scope)
251
+ scope = scope.visible if scope.respond_to?(:visible)
248
252
  scope = scope.send(self.default_scope) if self.default_scope
249
253
  scope
250
254
  end
@@ -1,3 +1,3 @@
1
1
  module AzaharaSchema
2
- VERSION = '0.3.10'
2
+ VERSION = '0.3.11'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azahara_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails