azahara_schema 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/azahara_schema/_schema.html.erb +1 -1
- data/lib/azahara_schema/attribute_formatter.rb +1 -1
- data/lib/azahara_schema/model_schema.rb +1 -1
- data/lib/azahara_schema/output.rb +4 -0
- data/lib/azahara_schema/schema.rb +6 -2
- data/lib/azahara_schema/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 196087578480940bd53363da2e160d13b2af3eb4cd42f4bedfef44493993f2bf
|
4
|
+
data.tar.gz: 1c63360964ae78ff48f082219b9c8a1a75d07a63a74562380432cd67a62e67b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68c48995f02cc99264f29bfb43cb231c2edee15eb66dacc5dce937d60e689d02855e69c4e44191b5b25f5f085e3c6ebc4834acdb186b64e20386ed093e370561
|
7
|
+
data.tar.gz: 420e5d0d41851c0a60783a6746c8514f4e44c99ad6e8b4afecbc2c84621d5797940aaab391288d7470d3272c3414114a21c9b0b5d3ef7d8a8c00a5c31a9d8109
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= render 'azahara_schema/index_form', schema: schema %>
|
3
3
|
<% end %>
|
4
4
|
<% schema.outputs.each do |output| %>
|
5
|
-
<%= render output %>
|
5
|
+
<%= render output, schema: schema %>
|
6
6
|
<% end %>
|
7
7
|
<div class="exports text-right">
|
8
8
|
<% if (csv_path = azahara_export_path(schema, :csv)) %>
|
@@ -23,7 +23,7 @@ module AzaharaSchema
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def visibility_scope!(ability, authorization_action=:index)
|
26
|
-
@entity_scope =
|
26
|
+
@entity_scope = entity_scope.accessible_by(ability, authorization_action)
|
27
27
|
end
|
28
28
|
|
29
29
|
def entity_scope
|
@@ -62,7 +62,7 @@ module AzaharaSchema
|
|
62
62
|
end
|
63
63
|
|
64
64
|
attr_accessor :model, :enabled_outputs, :association, :parent_schema
|
65
|
-
attr_accessor :search_query
|
65
|
+
attr_accessor :search_query, :default_scope
|
66
66
|
attr_accessor :offset, :limit
|
67
67
|
|
68
68
|
def initialize(model, **attributes)
|
@@ -242,7 +242,9 @@ module AzaharaSchema
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def entity_scope
|
245
|
-
model.respond_to?(:visible) ? model.visible : model.all
|
245
|
+
scope = model.respond_to?(:visible) ? model.visible : model.all
|
246
|
+
scope.send(self.default_scope) if self.default_scope
|
247
|
+
scope
|
246
248
|
end
|
247
249
|
|
248
250
|
def filtered_scope
|
@@ -329,6 +331,7 @@ module AzaharaSchema
|
|
329
331
|
add_sort(sort[:path], sort['desc'] == 'true' ? :desc : :asc )
|
330
332
|
end
|
331
333
|
end
|
334
|
+
self.default_scope = params[:default_scope] if params[:default_scope]
|
332
335
|
self.search_query = params[:q] if params[:q]
|
333
336
|
self.offset = params[:offset] if params[:offset]
|
334
337
|
self.limit = params[:limit] if params[:limit]
|
@@ -340,6 +343,7 @@ module AzaharaSchema
|
|
340
343
|
filters.each do |fname, attrs|
|
341
344
|
params[:f][fname] = "#{attrs[:o]}|#{Array(attrs[:v]).collect{|v| v.to_s}.join('\\')}"
|
342
345
|
end
|
346
|
+
params[:default_scope] = default_scope if default_scope
|
343
347
|
params[:c] = column_names
|
344
348
|
params[:q] = search_query if params[:q]
|
345
349
|
params[:offset] = offset
|
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.
|
4
|
+
version: 0.3.4
|
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-04-
|
11
|
+
date: 2018-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|