azahara_schema 0.3.17 → 0.3.18
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f339717ae966d3bfbe9c8ef8be59b5b79813ea3851fe1b4cba89b0c88649912
|
4
|
+
data.tar.gz: cc3a7ebbbc45efaaf1af6d2eb48a4c4e5fa747026bb3c8276c1e2d63ab45d2da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d305d3195b8684d35358ab52f372b4bf8204a673b956948029928c4a4605b9ca34dcd93b1d4d10b8d73fb97f61f767d8829ffdb43977901bd1a882263b3be3f
|
7
|
+
data.tar.gz: ec87e93e7995de58d6241744b1ed194327f7da96df453d700dfc293cb77c61ac6cc65d344198a8c782ef4e4a6f000b9227d3e65761c36d14d6b20b60ca2c3293
|
@@ -69,11 +69,11 @@ module AzaharaSchema
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def azahara_attribute_for(model, name)
|
72
|
-
AzaharaSchema::Schema.schema_class_for(model).attribute(model, name)
|
72
|
+
::AzaharaSchema::Schema.schema_class_for(model).attribute(model, name)
|
73
73
|
end
|
74
74
|
|
75
75
|
def attribute_formatter_for(schema_or_model, **options)
|
76
|
-
|
76
|
+
::AzaharaSchema::Presenter.formatter_for(schema_or_model).new(schema_or_model, self, options)
|
77
77
|
end
|
78
78
|
|
79
79
|
def unfilled_attribute_message
|
@@ -2,6 +2,8 @@
|
|
2
2
|
create_attributes ||= {}
|
3
3
|
create_model ||= schema.model
|
4
4
|
create_model = create_model.new
|
5
|
+
create_scope ||= []
|
6
|
+
create_scope = create_scope.dup.push(create_model)
|
5
7
|
%>
|
6
8
|
|
7
9
|
<% if local_assigns.fetch(:filters, true) %>
|
@@ -11,7 +13,7 @@
|
|
11
13
|
<div class="btn-toolbar text-right" role="toolbar" aria-label="Toolbar">
|
12
14
|
<% if can?(:create, create_model) %>
|
13
15
|
<div class="btn-group" role="group" aria-label="<%= t('label_actions') %>">
|
14
|
-
<%= link_to label_record_action(create_model), new_polymorphic_path(
|
16
|
+
<%= link_to label_record_action(create_model), new_polymorphic_path(create_scope, create_attributes), class: 'btn btn-primary' %>
|
15
17
|
</div>
|
16
18
|
<% end %>
|
17
19
|
</div>
|
data/lib/azahara_schema.rb
CHANGED
@@ -8,7 +8,7 @@ require 'azahara_schema/outputs'
|
|
8
8
|
require 'azahara_schema/output'
|
9
9
|
require 'azahara_schema/schema'
|
10
10
|
require 'azahara_schema/model_schema'
|
11
|
-
require 'azahara_schema/
|
11
|
+
require 'azahara_schema/presenter'
|
12
12
|
|
13
13
|
if Object.const_defined?('Rails')
|
14
14
|
require "azahara_schema/engine"
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module AzaharaSchema
|
2
|
-
class
|
2
|
+
class Presenter
|
3
3
|
|
4
4
|
def self.default_formatter=(formatter_klass)
|
5
5
|
@default_formatter = formatter_klass
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.default_formatter
|
9
|
-
@default_formatter || AzaharaSchema::
|
9
|
+
@default_formatter || AzaharaSchema::Presenter
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.formatter_for(schema_or_entity)
|
@@ -19,7 +19,7 @@ module AzaharaSchema
|
|
19
19
|
klasses << klass
|
20
20
|
end
|
21
21
|
klasses.each do |kls|
|
22
|
-
schema_klass = "#{kls.name}
|
22
|
+
schema_klass = "#{kls.name}Presenter".safe_constantize || "Presenters::#{kls.name}Presenter".safe_constantize
|
23
23
|
return schema_klass if schema_klass
|
24
24
|
end
|
25
25
|
default_formatter
|
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.18
|
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-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -71,7 +71,6 @@ files:
|
|
71
71
|
- lib/azahara_schema/aggregation_attribute.rb
|
72
72
|
- lib/azahara_schema/association_attribute.rb
|
73
73
|
- lib/azahara_schema/attribute.rb
|
74
|
-
- lib/azahara_schema/attribute_formatter.rb
|
75
74
|
- lib/azahara_schema/attribute_name.rb
|
76
75
|
- lib/azahara_schema/cancan/controller_resource_patch.rb
|
77
76
|
- lib/azahara_schema/controller_additions.rb
|
@@ -81,6 +80,7 @@ files:
|
|
81
80
|
- lib/azahara_schema/model_schema.rb
|
82
81
|
- lib/azahara_schema/output.rb
|
83
82
|
- lib/azahara_schema/outputs.rb
|
83
|
+
- lib/azahara_schema/presenter.rb
|
84
84
|
- lib/azahara_schema/schema.rb
|
85
85
|
- lib/azahara_schema/version.rb
|
86
86
|
- lib/tasks/azahara_schema_tasks.rake
|