tramway-core 1.16.2 → 1.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +79 -0
- data/app/assets/javascripts/tramway/core/application.js +51 -0
- data/app/decorators/tramway/core/application_decorator.rb +7 -41
- data/app/decorators/tramway/core/associations/class_helper.rb +46 -0
- data/app/decorators/tramway/core/associations/object_helper.rb +13 -0
- data/app/decorators/tramway/core/delegating/class_helper.rb +7 -0
- data/app/forms/tramway/core/application_form.rb +9 -30
- data/app/forms/tramway/core/extendable_form.rb +14 -5
- data/app/helpers/tramway/core/copy_to_clipboard_helper.rb +6 -4
- data/app/uploaders/photo_uploader.rb +1 -1
- data/app/views/tramway/core/shared/input_extended_types/_checkbox.html.haml +1 -1
- data/config/locales/en/helpers.yml +1 -0
- data/lib/tramway/core/version.rb +1 -1
- metadata +25 -22
- data/app/assets/javascripts/tramway/core/application.js.coffee +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c40b8698ddbb5a6d4a3bcd28c91178aea7c2b69ecbd91a3aa0c1c52935acff9
|
4
|
+
data.tar.gz: fa1d9920ee66893ad98b227d48806ba71e932216f927e33124ebd0c98be4d4b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289701396c7578d7202d1bbf7bcfd794e360ef258c0396b82b98eacc76049a974a75e122a63e48893bb1cc8fd966e921c0fcc8a642c7dcfde2e45c8bb39b1eb7
|
7
|
+
data.tar.gz: f69609928571b316461d3ddf7d25fc59b5abadb0d0d788c53572d146be06f585400a8736f44d64adab5b7935eca4c3e6387086890f3e3ee2a47bb3f80c1896e6
|
data/README.md
CHANGED
@@ -33,7 +33,53 @@ Tramway::Core.initialize_application model_class: ::Tramway::Conference::Unity #
|
|
33
33
|
Rails.application.config.assets.precompile += %w( *.jpg *.png *.js )
|
34
34
|
```
|
35
35
|
# Usage
|
36
|
+
|
36
37
|
## Decorators
|
38
|
+
### Associations
|
39
|
+
|
40
|
+
Your can decorate association models. Supporting all types of association
|
41
|
+
|
42
|
+
*app/decorators/your_model_decorator.rb*
|
43
|
+
```ruby
|
44
|
+
class YourModelDecorator < Tramway::Core::ApplicationDecorator
|
45
|
+
decorate_association :some_model
|
46
|
+
decorate_association :another_model, decorator: SpecificDecoratorForThisCase
|
47
|
+
decorate_association :another_one_model, as: :repeat_here_as_parameter_from_model
|
48
|
+
decorate_association :something_else_model, state_machines: [ :here_array_of_state_machines_you_want_to_see_in_YourModel_show_page ] # support from tramway-admin gem
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
You can decorate a lot of models in one line
|
53
|
+
|
54
|
+
*app/decorators/your_model_decorator.rb*
|
55
|
+
```ruby
|
56
|
+
class YourModelDecorator < Tramway::Core::ApplicationDecorator
|
57
|
+
decorate_associations :some_model, :another_model, :another_one_model, :something_else_model
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
Also, you can configurate what associations you want to see in YourModel page in admin panel *support only for [tramway-admin](https://rubygems.org/gems/tramway-admin) gem*
|
62
|
+
|
63
|
+
*app/decorators/your_model_decorator.rb*
|
64
|
+
```ruby
|
65
|
+
class YourModelDecorator < Tramway::Core::ApplicationDecorator
|
66
|
+
class << self
|
67
|
+
def show_associations
|
68
|
+
[ :some_model, :another_model, :another_one_model ]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
### Delegating attributes
|
75
|
+
|
76
|
+
*app/decorators/your_model_decorator.rb*
|
77
|
+
```ruby
|
78
|
+
class YourModelDecorator < Tramway::Core::ApplicationDecorator
|
79
|
+
delegate_attributes :title, :something_else, :another_atttribute
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
37
83
|
### Helper methods
|
38
84
|
|
39
85
|
#### date_view
|
@@ -106,6 +152,39 @@ Something like this:
|
|
106
152
|
copy_to_clipboard "some_id" # some_id is HTML id of element. Content of this element will be copied to the clipboard after pressing the button
|
107
153
|
```
|
108
154
|
|
155
|
+
## How to create model that will be an Application Model for the Tramway
|
156
|
+
|
157
|
+
#### 1. Generate model that you to use. We create Organization, for example
|
158
|
+
|
159
|
+
```shell
|
160
|
+
rails g model organization name:text public_name:text tagline:text address:text phone:text coordinates:point, state: text # remember! State field is required, if you use tramway-admin
|
161
|
+
rails db:migrate
|
162
|
+
```
|
163
|
+
|
164
|
+
#### 2. Add model_class to Initializer
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
Tramway::Core.initialize_application model_class: Organization
|
168
|
+
```
|
169
|
+
|
170
|
+
#### 3. Create 1 instance of Organization model
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
rails c
|
174
|
+
Organization.create! public_name: 'Tramway', name: :organization, tagline: 'Tramway is not buggy, LOL!'
|
175
|
+
```
|
176
|
+
|
177
|
+
#### 4. Add model to singleton to the `tramway-admin` admin panel to be able to change its data
|
178
|
+
|
179
|
+
```ruby
|
180
|
+
Tramway::Admin.set_singleton_models Organization, project: :organization # now you should use organization.name here
|
181
|
+
```
|
182
|
+
|
183
|
+
#### 5. Then continue configuration of your model in admin panel with tramway-admin gem [instruction, starting from point 8](https://github.com/ulmic/tramway-dev/tree/develop/tramway-admin#8-configurate-navbar)
|
184
|
+
|
185
|
+
#### 6. Now you are able to change your application main info in admin panel
|
186
|
+
|
187
|
+
## In Russian
|
109
188
|
|
110
189
|
# Базовые классы
|
111
190
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery_ujs
|
3
|
+
//= require jquery3
|
4
|
+
//= require popper
|
5
|
+
//= require bootstrap
|
6
|
+
//= require bootstrap-datepicker-1.8.0
|
7
|
+
//= require bootstrap-datepicker-1.8.0.ru.min
|
8
|
+
//= require font_awesome5
|
9
|
+
//= require clipboard
|
10
|
+
//= require_tree .
|
11
|
+
|
12
|
+
window.i18n_locale = function(locale) {
|
13
|
+
switch (locale) {
|
14
|
+
case 'en':
|
15
|
+
return({ date_format: 'yyyy-mm-dd', locale: locale });
|
16
|
+
break;
|
17
|
+
case 'ru':
|
18
|
+
return({ date_format: 'dd.mm.yyyy', locale: locale });
|
19
|
+
break;
|
20
|
+
default:
|
21
|
+
return({ date_format: 'yyyy-mm-dd', locale: locale });
|
22
|
+
break;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
$(document).ready(function() {
|
27
|
+
if (!(window.current_locale)) {
|
28
|
+
console.log('You should set `window.current_locale` before all Javascript code');
|
29
|
+
}
|
30
|
+
|
31
|
+
if ($('.date_picker').length != 0) {
|
32
|
+
$('.date_picker').datepicker({
|
33
|
+
format: window.current_locale.date_format,
|
34
|
+
language: window.current_locale.locale
|
35
|
+
});
|
36
|
+
}
|
37
|
+
|
38
|
+
$('.link').click(function() {
|
39
|
+
const href = $(this).data('href');
|
40
|
+
if (href) {
|
41
|
+
location.href = href;
|
42
|
+
} else {
|
43
|
+
const anchor = $(this).data('anchor');
|
44
|
+
if (!$(anchor).offset() == undefined) {
|
45
|
+
$(window).scrollTop($(anchor).offset().top);
|
46
|
+
}
|
47
|
+
};
|
48
|
+
});
|
49
|
+
|
50
|
+
let clipboard = new Clipboard('.clipboard-btn');
|
51
|
+
});
|
@@ -7,6 +7,7 @@ class Tramway::Core::ApplicationDecorator
|
|
7
7
|
include ActionView::Context
|
8
8
|
include ::FontAwesome5::Rails::IconHelper
|
9
9
|
include ::Tramway::Core::CopyToClipboardHelper
|
10
|
+
include ::Tramway::Core::Associations::ObjectHelper
|
10
11
|
|
11
12
|
def initialize(object)
|
12
13
|
@object = object
|
@@ -21,7 +22,13 @@ class Tramway::Core::ApplicationDecorator
|
|
21
22
|
raise error.message
|
22
23
|
end
|
23
24
|
|
25
|
+
delegate :id, to: :object
|
26
|
+
delegate :human_state_name, to: :object
|
27
|
+
|
24
28
|
class << self
|
29
|
+
include ::Tramway::Core::Associations::ClassHelper
|
30
|
+
include ::Tramway::Core::Delegating::ClassHelper
|
31
|
+
|
25
32
|
def collections
|
26
33
|
[:all]
|
27
34
|
end
|
@@ -49,45 +56,6 @@ class Tramway::Core::ApplicationDecorator
|
|
49
56
|
end
|
50
57
|
end
|
51
58
|
|
52
|
-
def decorate_association(association_name, decorator: nil, as: nil, state_machines: [])
|
53
|
-
@@decorated_associations ||= []
|
54
|
-
@@decorated_associations << association_name
|
55
|
-
|
56
|
-
define_method association_name do
|
57
|
-
association = object.class.reflect_on_association(association_name)
|
58
|
-
if association.nil?
|
59
|
-
error = Tramway::Error.new(plugin: :core, method: :decorate_association, message: "Model #{object.class} does not have association named `#{association_name}`")
|
60
|
-
raise error.message
|
61
|
-
end
|
62
|
-
class_name = if association.polymorphic?
|
63
|
-
object.send(association_name).class
|
64
|
-
else
|
65
|
-
unless association.options[:class_name]
|
66
|
-
error = Tramway::Error.new(plugin: :core, method: :decorate_association, message: "Please, specify `#{association_name}` association class_name in #{object.class} model. For example: `has_many :#{association_name}, class_name: '#{association_name.to_s.singularize.camelize}'`")
|
67
|
-
raise error.message
|
68
|
-
end
|
69
|
-
association.options[:class_name]
|
70
|
-
end
|
71
|
-
decorator_class_name = decorator || "#{class_name.to_s.singularize}Decorator".constantize
|
72
|
-
if association.class == ActiveRecord::Reflection::HasManyReflection
|
73
|
-
return object.send(association_name).active.map do |association_object|
|
74
|
-
decorator_class_name.decorate association_object
|
75
|
-
end
|
76
|
-
end
|
77
|
-
if association.class == ActiveRecord::Reflection::BelongsToReflection
|
78
|
-
return decorator_class_name.decorate object.send association_name
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
define_method "#{association_name}_as" do
|
83
|
-
as
|
84
|
-
end
|
85
|
-
|
86
|
-
define_method "#{association_name}_state_machines" do
|
87
|
-
state_machines
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
59
|
def model_class
|
92
60
|
to_s.sub(/Decorator$/, '').constantize
|
93
61
|
end
|
@@ -97,8 +65,6 @@ class Tramway::Core::ApplicationDecorator
|
|
97
65
|
end
|
98
66
|
end
|
99
67
|
|
100
|
-
delegate :id, to: :object
|
101
|
-
delegate :human_state_name, to: :object
|
102
68
|
|
103
69
|
def link
|
104
70
|
if object.try :file
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Tramway::Core::Associations::ClassHelper
|
2
|
+
def decorate_association(association_name, decorator: nil, as: nil, state_machines: [])
|
3
|
+
@@decorated_associations ||= []
|
4
|
+
@@decorated_associations << association_name
|
5
|
+
|
6
|
+
define_main_association_method association_name, decorator
|
7
|
+
|
8
|
+
define_method "#{association_name}_as" do
|
9
|
+
as
|
10
|
+
end
|
11
|
+
|
12
|
+
define_method "#{association_name}_state_machines" do
|
13
|
+
state_machines
|
14
|
+
end
|
15
|
+
|
16
|
+
define_method "add_#{association_name}_form" do
|
17
|
+
"Admin::#{object.class.to_s.pluralize}::Add#{association_name.to_s.camelize.singularize}Form".constantize.new object
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def decorate_associations(*association_names)
|
22
|
+
association_names.each do |association_name|
|
23
|
+
decorate_association association_name
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def define_main_association_method(association_name, decorator)
|
29
|
+
define_method association_name do
|
30
|
+
association = object.class.reflect_on_association(association_name)
|
31
|
+
if association.nil?
|
32
|
+
error = Tramway::Error.new(plugin: :core, method: :decorate_association, message: "Model #{object.class} does not have association named `#{association_name}`")
|
33
|
+
raise error.message
|
34
|
+
end
|
35
|
+
decorator_class_name = decorator || "#{class_name(association).to_s.singularize}Decorator".constantize
|
36
|
+
if association.class.in? [ ActiveRecord::Reflection::HasManyReflection, ActiveRecord::Reflection::HasAndBelongsToManyReflection ]
|
37
|
+
return object.send(association_name).active.map do |association_object|
|
38
|
+
decorator_class_name.decorate association_object
|
39
|
+
end
|
40
|
+
end
|
41
|
+
if association.class == ActiveRecord::Reflection::BelongsToReflection
|
42
|
+
return decorator_class_name.decorate object.send association_name
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Tramway::Core::Associations::ObjectHelper
|
2
|
+
def class_name(association)
|
3
|
+
if association.polymorphic?
|
4
|
+
object.send(association_name).class
|
5
|
+
else
|
6
|
+
unless association.options[:class_name]
|
7
|
+
error = Tramway::Error.new(plugin: :core, method: :decorate_association, message: "Please, specify `#{association_name}` association class_name in #{object.class} model. For example: `has_many :#{association_name}, class_name: '#{association_name.to_s.singularize.camelize}'`")
|
8
|
+
raise error.message
|
9
|
+
end
|
10
|
+
association.options[:class_name]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -12,11 +12,13 @@ module Tramway::Core
|
|
12
12
|
self.class.full_class_name_associations.each do |association, class_name|
|
13
13
|
if class_name.is_a? Array
|
14
14
|
self.class.send(:define_method, "#{association}=") do |value|
|
15
|
-
association_class =
|
15
|
+
association_class = value.split('_')[0..-2].join('_').camelize
|
16
|
+
association_class = association_class.constantize if association_class.is_a? String
|
16
17
|
if association_class.nil?
|
17
18
|
raise Tramway::Error.new(plugin: :core, method: :initialize, message: 'Polymorphic association class is nil. Maybe, you should write `assocation #{association_name}` after `properties #{association_name}_id, #{association_name}_type`')
|
18
19
|
else
|
19
|
-
super association_class.
|
20
|
+
super association_class.find value.split('_')[-1]
|
21
|
+
send "#{association}_type=", association_class.to_s
|
20
22
|
end
|
21
23
|
end
|
22
24
|
else
|
@@ -34,28 +36,19 @@ module Tramway::Core
|
|
34
36
|
if params
|
35
37
|
if validate params
|
36
38
|
begin
|
37
|
-
save
|
38
|
-
# self.class.remove_validations_from_model!
|
39
|
-
end
|
39
|
+
save
|
40
40
|
rescue StandardError => e
|
41
|
-
# self.class.remove_validations_from_model!
|
42
41
|
error = Tramway::Error.new(plugin: :core, method: :submit, message: "Looks like you have method `#{e.name.to_s.gsub('=', '')}` in #{@@model_class}. You should rename it or rename property in #{self.class}")
|
43
42
|
raise error.message
|
44
43
|
end
|
45
44
|
else
|
46
|
-
association_error = false
|
47
45
|
@@associations.each do |association|
|
48
46
|
if errors.details[association] == [{ error: :blank }]
|
49
47
|
model.send("#{association}=", send(association))
|
50
|
-
association_error = true
|
51
48
|
end
|
52
49
|
end
|
53
|
-
(association_error && save).tap do
|
54
|
-
# self.class.remove_validations_from_model!
|
55
|
-
end
|
56
50
|
end
|
57
51
|
else
|
58
|
-
# self.class.remove_validations_from_model!
|
59
52
|
error = Tramway::Error.new(plugin: :core, method: :submit, message: 'ApplicationForm::Params should not be nil')
|
60
53
|
raise error.message
|
61
54
|
end
|
@@ -65,6 +58,10 @@ module Tramway::Core
|
|
65
58
|
@@model_class.model_name
|
66
59
|
end
|
67
60
|
|
61
|
+
def associations
|
62
|
+
@@associations
|
63
|
+
end
|
64
|
+
|
68
65
|
def form_properties(**args)
|
69
66
|
@form_properties = args
|
70
67
|
end
|
@@ -176,25 +173,7 @@ module Tramway::Core
|
|
176
173
|
raise error.message
|
177
174
|
end
|
178
175
|
@@model_class.validates attribute, **options
|
179
|
-
# @@validations ||= {}
|
180
|
-
# @@validations.deep_merge! attribute => options
|
181
176
|
end
|
182
|
-
|
183
|
-
# FIXME: Removes all validations in a field. We must implement own validations
|
184
|
-
|
185
|
-
# def remove_validations_from_model!
|
186
|
-
# return unless defined? @@validations
|
187
|
-
# @@validations&.each do |validation|
|
188
|
-
# @@model_class.class_eval do
|
189
|
-
# _validators.except validation[0]
|
190
|
-
#
|
191
|
-
# binding.pry
|
192
|
-
# _validate_callbacks.each do |callback|
|
193
|
-
# callback.raw_filter.attributes.delete validation[0]
|
194
|
-
# end
|
195
|
-
# end
|
196
|
-
# end
|
197
|
-
# end
|
198
177
|
end
|
199
178
|
end
|
200
179
|
end
|
@@ -19,7 +19,7 @@ class Tramway::Core::ExtendableForm
|
|
19
19
|
model.values = extended_params.permit!.to_h.reduce(model.values) do |hash, pair|
|
20
20
|
hash.merge! pair[0] => pair[1]
|
21
21
|
end
|
22
|
-
super
|
22
|
+
super(params) && model.errors.empty?
|
23
23
|
end
|
24
24
|
|
25
25
|
define_method 'properties' do
|
@@ -51,10 +51,19 @@ class Tramway::Core::ExtendableForm
|
|
51
51
|
|
52
52
|
define_method "#{property[0]}=" do |value|
|
53
53
|
property[1][:validates].each do |pair|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
case pair[0].to_s
|
55
|
+
when 'presence'
|
56
|
+
validator_object = "#{pair[0].to_s.camelize}Validator".constantize.new(attributes: :not_blank)
|
57
|
+
if pair[1] == 'true' && !validator_object.send(:valid?, value)
|
58
|
+
model.errors.add property[0],
|
59
|
+
I18n.t("activerecord.errors.models.#{model.class.name.underscore}.attributes.default.#{pair[0]}", value: value)
|
60
|
+
end
|
61
|
+
when 'inclusion'
|
62
|
+
in_array = pair[1][:in]
|
63
|
+
unless value.in? in_array
|
64
|
+
model.errors.add property[0],
|
65
|
+
I18n.t("activerecord.errors.models.#{model.class.name.underscore}.attributes.default.#{pair[0]}", value: value)
|
66
|
+
end
|
58
67
|
end
|
59
68
|
end
|
60
69
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tramway
|
2
4
|
module Core
|
3
5
|
module CopyToClipboardHelper
|
4
6
|
def copy_to_clipboard(id)
|
5
7
|
button_tag class: 'btn btn-info clipboard-btn',
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
data: { clipboard_action: 'copy', clipboard_target: "##{id}" },
|
9
|
+
style: 'margin-left: 15px' do
|
10
|
+
fa_icon 'copy'
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
@@ -12,7 +12,7 @@ class PhotoUploader < ApplicationUploader
|
|
12
12
|
file.file.match(%r{/system/uploads/.*}).to_s
|
13
13
|
else
|
14
14
|
default_url = '/assets/tramway/core/mona_lisa_from_prado_square.jpg'
|
15
|
-
File.
|
15
|
+
File.exist?(default_url) ? default_url : ''
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -1 +1 @@
|
|
1
|
-
= f.input field.title.to_sym, as: :boolean, input_html: { class: class_name, id: "#{class_name}_#{field.title.to_sym}", name: "#{class_name}[#{field.title}]" }, checked_value:
|
1
|
+
= f.input field.title.to_sym, as: :boolean, input_html: { class: class_name, id: "#{class_name}_#{field.title.to_sym}", name: "#{class_name}[#{field.title}]" }, checked_value: :true, unchecked_value: :false, required: field.required
|
data/lib/tramway/core/version.rb
CHANGED
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
|
+
version: 1.17.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: audited
|
@@ -118,22 +118,22 @@ dependencies:
|
|
118
118
|
name: haml-rails
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 1.0.0
|
124
121
|
- - "~>"
|
125
122
|
- !ruby/object:Gem::Version
|
126
123
|
version: '1.0'
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 1.0.0
|
127
127
|
type: :runtime
|
128
128
|
prerelease: false
|
129
129
|
version_requirements: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- - ">="
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: 1.0.0
|
134
131
|
- - "~>"
|
135
132
|
- !ruby/object:Gem::Version
|
136
133
|
version: '1.0'
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: 1.0.0
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: kaminari
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,22 +166,22 @@ dependencies:
|
|
166
166
|
name: mini_magick
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- - ">="
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
version: 4.8.0
|
172
169
|
- - "~>"
|
173
170
|
- !ruby/object:Gem::Version
|
174
171
|
version: '4.8'
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 4.8.0
|
175
175
|
type: :runtime
|
176
176
|
prerelease: false
|
177
177
|
version_requirements: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- - ">="
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: 4.8.0
|
182
179
|
- - "~>"
|
183
180
|
- !ruby/object:Gem::Version
|
184
181
|
version: '4.8'
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: 4.8.0
|
185
185
|
- !ruby/object:Gem::Dependency
|
186
186
|
name: pg_search
|
187
187
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,22 +228,22 @@ dependencies:
|
|
228
228
|
name: rmagick
|
229
229
|
requirement: !ruby/object:Gem::Requirement
|
230
230
|
requirements:
|
231
|
-
- - ">="
|
232
|
-
- !ruby/object:Gem::Version
|
233
|
-
version: 2.16.0
|
234
231
|
- - "~>"
|
235
232
|
- !ruby/object:Gem::Version
|
236
233
|
version: '2.16'
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 2.16.0
|
237
237
|
type: :runtime
|
238
238
|
prerelease: false
|
239
239
|
version_requirements: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
|
-
- - ">="
|
242
|
-
- !ruby/object:Gem::Version
|
243
|
-
version: 2.16.0
|
244
241
|
- - "~>"
|
245
242
|
- !ruby/object:Gem::Version
|
246
243
|
version: '2.16'
|
244
|
+
- - ">="
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: 2.16.0
|
247
247
|
- !ruby/object:Gem::Dependency
|
248
248
|
name: sass-rails
|
249
249
|
requirement: !ruby/object:Gem::Requirement
|
@@ -349,13 +349,16 @@ files:
|
|
349
349
|
- app/assets/images/tramway/core/mona_lisa_from_prado_square.jpg
|
350
350
|
- app/assets/javascripts/bootstrap-datepicker-1.8.0.js
|
351
351
|
- app/assets/javascripts/bootstrap-datepicker-1.8.0.ru.min.js
|
352
|
-
- app/assets/javascripts/tramway/core/application.js
|
352
|
+
- app/assets/javascripts/tramway/core/application.js
|
353
353
|
- app/assets/stylesheets/bootstrap-datepicker-1.8.0.css
|
354
354
|
- app/assets/stylesheets/tramway/core/application.sass
|
355
355
|
- app/controllers/tramway/core/application_controller.rb
|
356
356
|
- app/decorators/tramway/core/application_decorated_collection.rb
|
357
357
|
- app/decorators/tramway/core/application_decorator.rb
|
358
|
+
- app/decorators/tramway/core/associations/class_helper.rb
|
359
|
+
- app/decorators/tramway/core/associations/object_helper.rb
|
358
360
|
- app/decorators/tramway/core/concerns/attributes_decorator_helper.rb
|
361
|
+
- app/decorators/tramway/core/delegating/class_helper.rb
|
359
362
|
- app/forms/tramway/core/application_form.rb
|
360
363
|
- app/forms/tramway/core/extendable_form.rb
|
361
364
|
- app/forms/tramway/core/extended_application_form.rb
|
@@ -424,7 +427,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
424
427
|
- !ruby/object:Gem::Version
|
425
428
|
version: '0'
|
426
429
|
requirements: []
|
427
|
-
rubygems_version: 3.
|
430
|
+
rubygems_version: 3.1.2
|
428
431
|
signing_key:
|
429
432
|
specification_version: 4
|
430
433
|
summary: Core for all Tramway Rails Engines
|
@@ -1,35 +0,0 @@
|
|
1
|
-
#= require jquery
|
2
|
-
#= require jquery_ujs
|
3
|
-
#= require jquery3
|
4
|
-
#= require popper
|
5
|
-
#= require bootstrap
|
6
|
-
#= require bootstrap-datepicker-1.8.0
|
7
|
-
#= require bootstrap-datepicker-1.8.0.ru.min
|
8
|
-
#= require font_awesome5
|
9
|
-
#= require clipboard
|
10
|
-
#= require_tree .
|
11
|
-
|
12
|
-
window.i18n_locale = (locale) ->
|
13
|
-
switch locale
|
14
|
-
when 'en' then { date_format: 'yyyy-mm-dd', locale: locale }
|
15
|
-
when 'ru' then { date_format: 'dd.mm.yyyy', locale: locale }
|
16
|
-
|
17
|
-
$(document).ready ->
|
18
|
-
unless window.current_locale
|
19
|
-
console.log 'You should set `window.current_locale` before all Javascript code'
|
20
|
-
unless $('.date_picker').length == 0
|
21
|
-
$('.date_picker').datepicker({
|
22
|
-
format: window.current_locale.date_format,
|
23
|
-
language: window.current_locale.locale
|
24
|
-
})
|
25
|
-
|
26
|
-
$('.link').click ->
|
27
|
-
href = $(this).data('href')
|
28
|
-
if href
|
29
|
-
location.href = href
|
30
|
-
else
|
31
|
-
anchor = $(this).data('anchor')
|
32
|
-
unless $(anchor).offset() == undefined
|
33
|
-
$(window).scrollTop $(anchor).offset().top
|
34
|
-
|
35
|
-
clipboard = new Clipboard '.clipboard-btn'
|