tramway-core 1.4.1 → 1.5

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: 994dc695ba2dc38fd2129f36854ff420c72df91d12280817202b633007c8ba79
4
- data.tar.gz: ee4ae37df4da03658b732fd08c826ddcc1bfb6b41f9793bd205ccdf9960a7fd1
3
+ metadata.gz: 2fb47273ad7fbf8b69de9fee539923577bd3f6306128825f6e1090ecbaf4dd64
4
+ data.tar.gz: 5704003c0d2aa42b1252a902165dddf278221d9023bfcf8973e0e2adc72b9ab6
5
5
  SHA512:
6
- metadata.gz: 5de17fd604471cb1d94289cd21524831bae1a8aca1a3336d2ba6cc4319fe8b53aa45f324ab7cd8a13287532695106dc33f9503ba1ed2924d3bd4f80958c8dfd1
7
- data.tar.gz: 3a4361115d88899f10cdd077b5f04a6be9feb4b33c180f9f748e7e2e6e05264adfc78a618016b4dfa2a9a19d5568c4129d6e6e2bee06982eb7ff23716ae3b222
6
+ metadata.gz: 1b4a09691cd871d95dd2d20a2bfb024d261519932e2b14f65bf564268e5d688a6b54d1b4d312c401248a2b69e4ff0c0fe10f4a02d9d564288be122a6d522b7d0
7
+ data.tar.gz: 67daeb423c28eb53e65eb7ffda0481855680a247b4d9394ea5df719787003e4a753148b71db9e2ce66c86ce26f407b963f04f7ccd3e110d9ef466ad5bbe8235c
@@ -3,5 +3,7 @@
3
3
  *= require_self
4
4
  */
5
5
 
6
+ @import "font-awesome"
7
+
6
8
  .datepicker-inline
7
9
  display: none !important
@@ -1,5 +1,19 @@
1
1
  module Tramway::Core
2
2
  class ApplicationForm < ::Reform::Form
3
+ def initialize(object)
4
+ super(object).tap do
5
+ @@associations&.each do |association|
6
+ class_name = object.class.reflect_on_all_associations(:belongs_to).select do |a|
7
+ a.name == association.to_sym
8
+ end.first.options[:class_name].constantize
9
+
10
+ self.class.send(:define_method, "#{association}=") do |value|
11
+ super class_name.find value
12
+ end
13
+ end
14
+ end
15
+ end
16
+
3
17
  def submit(params)
4
18
  raise 'ApplicationForm::Params should not be nil'.inspect unless params
5
19
  save if validate params
@@ -12,5 +26,13 @@ module Tramway::Core
12
26
  def properties
13
27
  @form_properties
14
28
  end
29
+
30
+ class << self
31
+ def association(property)
32
+ properties property
33
+ @@associations ||= []
34
+ @@associations << property
35
+ end
36
+ end
15
37
  end
16
38
  end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Core
3
- VERSION = '1.4.1'
3
+ VERSION = '1.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: '1.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-16 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reform-rails