tramway-core 1.17.2.2 → 1.17.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c612a0122da3218a86e61b973beff51f378e14352fd424489130039694f82f8
4
- data.tar.gz: 07d47a9b6e995469f7b500e34b21f705cc24ce1e4aede1e946ace36f5ddebb28
3
+ metadata.gz: 48e1c947dad194f06baa925068b67088cf7f62847b0e8f675431c8a9f927f8f2
4
+ data.tar.gz: fada3528a9b191eb8ddbf0a524f5d117caf694b3b280e6b7d8fd753c778386a8
5
5
  SHA512:
6
- metadata.gz: 8b275c112e32864152637a34c283677de289fc2fb5e79123fd15f149656e0d3741c1b7768e06d441004927e4fe5db0f4af2a744a55e6fdc58fe210227e1b7ce7
7
- data.tar.gz: 350ace536d11005778f241370a3179f5f51f9078d8822ca4e80955aeb0ffb93edbafc64e55d9635d0cba4e4cc4ef8b3fd6f3aa205a7171542b25e6500c82d281
6
+ metadata.gz: 230d46ff585f5dfd4773621d2d26b294b7c51eae32611fce795ab17051647f7a88057615f78e9dbd4361935589c7ce145923db47b3c8ee83384696c3bc579d3b
7
+ data.tar.gz: 4d35f00d6faae4717b297d3b65ef085e7875df33efa052da1e62e7d96d880be8e3517bbacd5bec4df14292408184c4cb42e4febbcdf6bb64474bfcaefaac5f62
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Tramway
4
- module Core
5
- class ApplicationController < ActionController::Base
6
- before_action :application
7
- before_action :load_extensions
3
+ class Tramway::Core::ApplicationController < ActionController::Base
4
+ before_action :application
5
+ before_action :load_extensions
8
6
 
9
- def application
10
- @application = ::Tramway::Core.application_object
11
- end
7
+ def application
8
+ @application = ::Tramway::Core.application_object
9
+ end
10
+
11
+ def load_extensions
12
+ ::Tramway::Extensions.load if defined? ::Tramway::Extensions
13
+ end
12
14
 
13
- def load_extensions
14
- ::Tramway::Extensions.load if defined? ::Tramway::Extensions
15
- end
16
- end
15
+ def model_class
16
+ params[:model].constantize
17
17
  end
18
18
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'tramway/error'
4
+ require 'tramway/helpers/class_name_helpers'
4
5
 
5
6
  class Tramway::Core::ApplicationDecorator
6
7
  include ActionView::Helpers
@@ -8,6 +9,8 @@ class Tramway::Core::ApplicationDecorator
8
9
  include ::FontAwesome5::Rails::IconHelper
9
10
  include ::Tramway::Core::CopyToClipboardHelper
10
11
  include ::Tramway::Core::Associations::ObjectHelper
12
+ include ::Tramway::Core::Attributes::ViewHelper
13
+ include ::Tramway::ClassNameHelpers
11
14
 
12
15
  def initialize(object)
13
16
  @object = object
@@ -18,8 +21,10 @@ class Tramway::Core::ApplicationDecorator
18
21
  end
19
22
 
20
23
  def title
21
- error = Tramway::Error.new(plugin: :core, method: :title, message: "Please, implement `title` method in a #{self.class} or #{object.class}")
22
- raise error.message
24
+ Tramway::Error.raise_error(
25
+ :tramway, :core, :application_decorator, :title, :please_implement_title,
26
+ class_name: self.class, object_class: object.class
27
+ )
23
28
  end
24
29
 
25
30
  delegate :id, to: :object
@@ -69,12 +74,7 @@ class Tramway::Core::ApplicationDecorator
69
74
  if object.try :file
70
75
  object.file.url
71
76
  else
72
- error = Tramway::Error.new(
73
- plugin: :core,
74
- method: :link,
75
- message: "Method `link` uses `file` attribute of the decorated object. If decorated object doesn't contain `file`, you shouldn't use `link` method."
76
- )
77
- raise error.message
77
+ Tramway::Error.raise_error :tramway, :core, :application_decorator, :link, :method_link_uses_file_attribute
78
78
  end
79
79
  end
80
80
 
@@ -97,25 +97,12 @@ class Tramway::Core::ApplicationDecorator
97
97
  def attributes
98
98
  object.attributes.reduce({}) do |hash, attribute|
99
99
  if attribute[0].in? RESERVED_WORDS
100
- error = Tramway::Error.new(
101
- plugin: :core,
102
- method: :attributes,
103
- message: "Method `#{attribute[0]}` is reserved word. Please, create or delegate method in #{self.class.name} with another name."
100
+ Tramway::Error.raise_error(
101
+ :tramway, :core, :application_decorator, :attributes, :method_is_reserved_word,
102
+ attribute_name: attribute[0], class_name: self.class.name
104
103
  )
105
- raise error.message
106
- end
107
- value = try(attribute[0]) ? send(attribute[0]) : object.send(attribute[0])
108
- if attribute[0].to_s.in? object.class.state_machines.keys.map(&:to_s)
109
- hash.merge! attribute[0] => state_machine_view(object, attribute[0])
110
- elsif value.class.in? [ActiveSupport::TimeWithZone, DateTime, Time]
111
- hash.merge! attribute[0] => datetime_view(attribute[1])
112
- elsif value.class.superclass == ApplicationUploader
113
- hash.merge! attribute[0] => image_view(object.send(attribute[0]))
114
- elsif value.is_a? Enumerize::Value
115
- hash.merge! attribute[0] => enumerize_view(value)
116
- else
117
- hash.merge! attribute[0] => value
118
104
  end
105
+ hash.merge! attribute[0] => build_viewable_value(object, attribute)
119
106
  end
120
107
  end
121
108
 
@@ -16,7 +16,7 @@ module Tramway::Core::Associations::ClassHelper
16
16
  end
17
17
 
18
18
  define_method "add_#{association_name}_form" do
19
- "Admin::#{object.class.to_s.pluralize}::Add#{association_name.to_s.camelize.singularize}Form".constantize.new object
19
+ add_association_form_class_name(object, association_name).new object
20
20
  end
21
21
  end
22
22
 
@@ -29,19 +29,12 @@ module Tramway::Core::Associations::ClassHelper
29
29
  def define_main_association_method(association_name, decorator)
30
30
  define_method association_name do
31
31
  association = object.class.reflect_on_association(association_name)
32
- if association.nil?
33
- error = Tramway::Error.new(plugin: :core, method: :decorate_association, message: "Model #{object.class} does not have association named `#{association_name}`")
34
- raise error.message
35
- end
36
- decorator_class_name = decorator || "#{class_name(association).to_s.singularize}Decorator".constantize
37
- if association.class.in? [ActiveRecord::Reflection::HasManyReflection, ActiveRecord::Reflection::HasAndBelongsToManyReflection]
38
- return object.send(association_name).active.map do |association_object|
39
- decorator_class_name.decorate association_object
40
- end
41
- end
42
- if association.class == ActiveRecord::Reflection::BelongsToReflection
43
- return decorator_class_name.decorate object.send association_name
32
+ check_association object, association_name, association
33
+ decorator_class_name = decorator || decorator_class_name(class_name(association))
34
+ if association_type(association).in? %i[has_many has_and_belongs_to_many]
35
+ return associations_collection(object, association_name, decorator_class_name)
44
36
  end
37
+ return decorator_class_name.decorate object.send association_name if association_type(association) == :belongs_to
45
38
  end
46
39
  end
47
40
  end
@@ -6,10 +6,36 @@ module Tramway::Core::Associations::ObjectHelper
6
6
  object.send(association.name).class
7
7
  else
8
8
  unless association.options[:class_name]
9
- 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}'`")
10
- raise error.message
9
+ Tramway::Error.raise_error(
10
+ :tramway, :core, :associations, :object_helper, :please_specify_association_name,
11
+ association_name: association.name, object_class: object.class,
12
+ association_class_name: association.name.to_s.singularize.camelize
13
+ )
11
14
  end
12
15
  association.options[:class_name]
13
16
  end
14
17
  end
18
+
19
+ def check_association(object, association_name, association)
20
+ return unless association.nil?
21
+
22
+ Tramway::Error.raise_error(
23
+ :tramway, :core, :associations, :class_helper, :model_does_not_have_association,
24
+ object_class: object.class, association_name: association_name
25
+ )
26
+ end
27
+
28
+ def association_type(association)
29
+ association.class.to_s.split('::').last.sub(/Reflection$/, '').underscore.to_sym
30
+ end
31
+
32
+ def associations_collection(object, association_name, decorator_class_name)
33
+ object.send(association_name).active.map do |association_object|
34
+ decorator_class_name.decorate association_object
35
+ end
36
+ end
37
+
38
+ def add_association_form_class_name(object, association_name)
39
+ "Admin::#{object.class.to_s.pluralize}::Add#{association_name.to_s.camelize.singularize}Form".constantize
40
+ end
15
41
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway::Core::Attributes::ViewHelper
4
+ def build_viewable_value(object, attribute)
5
+ value = try(attribute[0]) ? send(attribute[0]) : object.send(attribute[0])
6
+ return state_machine_view(object, attribute[0]) if state_machine? object, attribute[0]
7
+
8
+ view_by_value object, value, attribute
9
+ end
10
+
11
+ def state_machine?(object, attribute_name)
12
+ attribute_name.to_s.in? object.class.state_machines.keys.map(&:to_s)
13
+ end
14
+
15
+ def view_by_value(object, value, attribute)
16
+ if value.class.in? [ActiveSupport::TimeWithZone, DateTime, Time]
17
+ datetime_view(attribute[1])
18
+ elsif value.class.superclass == ApplicationUploader
19
+ image_view(object.send(attribute[0]))
20
+ elsif value.is_a? Enumerize::Value
21
+ enumerize_view(value)
22
+ else
23
+ value
24
+ end
25
+ end
26
+ end
@@ -13,37 +13,58 @@ module Tramway::Core::Concerns::AttributesDecoratorHelper
13
13
  object.send "human_#{attribute_name}_name"
14
14
  end
15
15
 
16
+ BASE64_REGEXP = %r{^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|
17
+ (?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$}x.freeze
18
+
16
19
  def image_view(original, thumb: nil, filename: nil)
17
- if original.present?
18
- thumb ||= original.is_a?(CarrierWave::Uploader::Base) ? original.small : nil
19
- filename ||= original.is_a?(CarrierWave::Uploader::Base) ? original.path&.split('/')&.last : nil
20
- src_thumb = if thumb&.is_a?(CarrierWave::Uploader::Base)
21
- thumb.url
22
- elsif thumb&.match(%r{^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$})
23
- "data:image/jpeg;base64,#{thumb}"
24
- else
25
- thumb
26
- end
27
- src_original = if original.is_a?(CarrierWave::Uploader::Base)
28
- original.url
29
- elsif original.match(%r{^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$})
30
- "data:image/jpeg;base64,#{original}"
31
- else
32
- original
33
- end
34
- content_tag(:div) do
35
- begin
36
- concat image_tag src_thumb || src_original
37
- rescue NoMethodError => e
38
- error = Tramway::Error.new plugin: :core, method: :image_view, message: "You should mount PhotoUploader to your model. Just add `mount_uploader \#{attribute_name}, PhotoUploader` to your model. #{e.message}"
39
- raise error.message
40
- end
41
- concat link_to(fa_icon(:download), src_original, class: 'btn btn-success', download: filename) if filename
42
- end
20
+ return unless original.present?
21
+
22
+ filename ||= build_filename(original)
23
+ content_tag(:div) do
24
+ build_div_content src_original(original), src_thumb(original, thumb), filename || build_filename(original)
43
25
  end
44
26
  end
45
27
 
46
28
  def enumerize_view(value)
47
29
  value.text
48
30
  end
31
+
32
+ private
33
+
34
+ def src_thumb(original, thumb)
35
+ thumb ||= original.is_a?(CarrierWave::Uploader::Base) ? original.small : nil
36
+ if thumb&.is_a?(CarrierWave::Uploader::Base)
37
+ thumb.url
38
+ elsif thumb&.match(BASE64_REGEXP)
39
+ "data:image/jpeg;base64,#{thumb}"
40
+ else
41
+ thumb
42
+ end
43
+ end
44
+
45
+ def src_original(original)
46
+ if original.is_a?(CarrierWave::Uploader::Base)
47
+ original.url
48
+ elsif original.match(BASE64_REGEXP)
49
+ "data:image/jpeg;base64,#{original}"
50
+ else
51
+ original
52
+ end
53
+ end
54
+
55
+ def build_filename(original)
56
+ original.is_a?(CarrierWave::Uploader::Base) ? original.path&.split('/')&.last : nil
57
+ end
58
+
59
+ def build_div_content(original, thumb, filename)
60
+ begin
61
+ concat image_tag src_thumb(original, thumb) || src_original(original)
62
+ rescue NoMethodError => e
63
+ Tramway::Error.raise_error(
64
+ :tramway, :core, :concerns, :attributes_decorator_helper, :you_should_mount_photo_uploader,
65
+ message: e.message, attribute_name: attribute_name
66
+ )
67
+ end
68
+ concat link_to(fa_icon(:download), src_original(original), class: 'btn btn-success', download: filename) if filename
69
+ end
49
70
  end
@@ -5,6 +5,8 @@ class Tramway::Core::ApplicationForm < ::Reform::Form
5
5
  include Tramway::Core::ApplicationForms::ConstantObjectActions
6
6
  include Tramway::Core::ApplicationForms::PropertiesObjectHelper
7
7
 
8
+ attr_accessor :submit_message
9
+
8
10
  def initialize(object = nil)
9
11
  object ||= self.class.model_class.new
10
12
  super(object).tap do
@@ -32,6 +34,18 @@ class Tramway::Core::ApplicationForm < ::Reform::Form
32
34
  @@model_class.model_name
33
35
  end
34
36
 
37
+ def associations
38
+ @@associations
39
+ end
40
+
41
+ def to_model
42
+ self
43
+ end
44
+
45
+ def persisted?
46
+ model.id.nil?
47
+ end
48
+
35
49
  class << self
36
50
  include Tramway::Core::ApplicationForms::ConstantClassActions
37
51
 
@@ -54,7 +68,7 @@ class Tramway::Core::ApplicationForm < ::Reform::Form
54
68
 
55
69
  if options&.dig(:polymorphic)
56
70
  hash.merge! association => @@model_class.send("#{association}_type").values
57
- elsif options.present?
71
+ elsif options
58
72
  hash.merge!(association => (options[:class_name] || association.to_s.camelize).constantize)
59
73
  end
60
74
  hash
@@ -1,10 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway::Core::ApplicationForms::AssociationObjectHelpers
4
- def associations
5
- @@associations
6
- end
7
-
8
4
  def define_association_method(association, class_name)
9
5
  if class_name.is_a? Array
10
6
  define_polymorphic_association association, class_name
@@ -8,6 +8,13 @@ module Tramway::Core::ApplicationForms::ConstantObjectActions
8
8
  def build_errors; end
9
9
 
10
10
  def attributes
11
- properties.reduce({}) { |hash, property| hash.merge! property.first => model.values[property.first.to_s] }
11
+ properties.reduce({}) do |hash, property|
12
+ value = if model.respond_to? :values
13
+ model.values[property.first.to_s]
14
+ else
15
+ model.send(property.first.to_s)
16
+ end
17
+ hash.merge! property.first => value
18
+ end
12
19
  end
13
20
  end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway::Core::ApplicationHelper
4
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway::Core::InputsHelper
4
+ def association_params(form_object:, property:, value:, object:, options: {})
5
+ full_class_name_association = form_object.class.full_class_name_association(property)
6
+ unless full_class_name_association
7
+ raise "It seems you've defined association attributes with `property` method. Please, use `association` method. `association :#{property}`"
8
+ end
9
+ if full_class_name_association.is_a? Array
10
+ raise "It seems you've used `association` input type in the Form. Please, use `polymorphic_association` type. `#{property}: :polymorphic_association`"
11
+ end
12
+
13
+ {
14
+ label: false,
15
+ input_html: {
16
+ name: "#{object}[#{property}]",
17
+ id: "#{object}_#{property}",
18
+ value: (form_object.send(property) || form_object.model.send("#{property}_id") || value)
19
+ },
20
+ selected: (form_object.model.send("#{property}_id") || value),
21
+ collection: full_class_name_association.active.map do |obj|
22
+ decorator_class(full_class_name_association).decorate obj
23
+ end.sort_by(&:name)
24
+ }.merge options
25
+ end
26
+
27
+ def polymorphic_association_params(object:, form_object:, property:, value:, options: {})
28
+ full_class_names = form_object.model.class.send("#{property}_type").values.map &:constantize
29
+ collection = full_class_names.map do |class_name|
30
+ class_name.active.map do |obj|
31
+ decorator_class(class_name).decorate obj
32
+ end
33
+ end.flatten.sort_by { |obj| obj.name.to_s }
34
+ builded_value = if form_object.send(property).present?
35
+ "#{form_object.send(property).class.to_s.underscore}_#{form_object.send(property).id}"
36
+ else
37
+ "#{value[:type]&.underscore}_#{value[:id]}"
38
+ end
39
+ {
40
+ as: :select,
41
+ label: false,
42
+ input_html: {
43
+ name: "#{object}[#{property}]",
44
+ id: "#{object}_#{property}",
45
+ value: builded_value
46
+ },
47
+ selected: builded_value,
48
+ collection: collection,
49
+ label_method: lambda do |obj|
50
+ "#{obj.class.model_name.human} | #{obj.name}"
51
+ end,
52
+ value_method: lambda do |obj|
53
+ "#{obj.class.to_s.underscore.sub(/_decorator$/, '')}_#{obj.id}"
54
+ end
55
+ }.merge options
56
+ end
57
+
58
+ def value_from_params(model_class:, property:, type:)
59
+ case type
60
+ when :polymorphic_association, 'polymorphic_association'
61
+ {
62
+ id: params.dig(model_class.to_s.underscore, property.to_s),
63
+ type: params.dig(model_class.to_s.underscore, "#{property}_type")
64
+ }
65
+ else
66
+ params.dig(model_class.to_s.underscore, property.to_s)
67
+ end
68
+ end
69
+
70
+ def default_params(property:, object:, form_object:, value:, options: {})
71
+ {
72
+ label: false,
73
+ input_html: {
74
+ name: "#{object}[#{property}]",
75
+ id: "#{object}_#{property}",
76
+ value: (form_object.send(property) || form_object.model.send(property) || value)
77
+ },
78
+ selected: (form_object.model.send(property) || value)
79
+ }.merge options
80
+ end
81
+
82
+ def else_params(property:, object:, type:, form_object:, value:, options: {})
83
+ {
84
+ as: type,
85
+ label: false,
86
+ input_html: {
87
+ name: "#{object}[#{property}]",
88
+ id: "#{object}_#{property}",
89
+ value: (form_object.send(property) || form_object.model.send(property) || value)
90
+ }
91
+ }.merge options
92
+ end
93
+ end
@@ -0,0 +1,25 @@
1
+ - model_class = defined?(record) ? record.model : model_class
2
+ - form_object = defined?(record) ? record : instance_variable_get("@#{object}_form")
3
+ - input_params = { property: property, object: object, form_object: form_object, value: value }
4
+ - if !type.class.in?([ Symbol, String ]) && type[:input_options]
5
+ - input_params.merge!(options: type[:input_options])
6
+ - type = type[:type]
7
+ - if type.class.in?([ Symbol, String ]) || type&.dig(:input_options)
8
+ - type = type.to_sym
9
+ = form.label form_object.model.class.human_attribute_name property
10
+ - case type
11
+ - when :default
12
+ = form.input property, **default_params(**input_params)
13
+ - when :association
14
+ = form.association property, **association_params(**input_params)
15
+ - when :polymorphic_association
16
+ = form.input property, **polymorphic_association_params(**input_params.merge(value: value))
17
+ - else
18
+ = form.input property, **else_params(**input_params.merge(type: type))
19
+ - else
20
+ - property_value = form_object.model.values.present? && form_object.model.values[property.to_s]
21
+ = render 'tramway/core/shared/input_extended', field: type[:extended_form_property], class_name: :record, value: property_value, f: form
22
+
23
+ - if params[:errors].present? && params[:errors][property]&.first
24
+ .alert.alert-danger
25
+ = params[:errors][property]&.first
@@ -30,6 +30,10 @@ module Tramway::Core
30
30
  end
31
31
  end
32
32
 
33
+ def root
34
+ File.dirname __dir__
35
+ end
36
+
33
37
  attr_reader :application
34
38
  end
35
39
  end
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Tramway::Core::Generators
3
+ module Tramway::Core
4
+ module Generators
5
+ end
4
6
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Core
5
- VERSION = '1.17.2.2'
5
+ VERSION = '1.17.3.1'
6
6
  end
7
7
  end
@@ -19,10 +19,10 @@ class Tramway::Error < RuntimeError
19
19
 
20
20
  class << self
21
21
  def raise_error(*coordinates, **options)
22
- @errors ||= YAML.load_file('..', '..', 'yaml', 'errors.yml').with_indifferent_access
22
+ @errors ||= YAML.load_file("#{Tramway::Core.root}/yaml/errors.yml").with_indifferent_access
23
23
  error = @errors.dig(*coordinates)
24
24
  options.each do |pair|
25
- error.gsub!("%{#{pair[0]}}", pair[1])
25
+ error.gsub!("%{#{pair[0]}}", pair[1].to_s)
26
26
  end
27
27
  raise error
28
28
  end
@@ -0,0 +1,35 @@
1
+ tramway:
2
+ collections:
3
+ helper:
4
+ collection_list_by:
5
+ there_no_such_collection: "There no such collection named %{name_camelize}. Please create class with self method `list` and extended of `Tramway::Collection`. You should reload your server after creating this collection."
6
+ core:
7
+ title_helper:
8
+ title:
9
+ you_should_set_tramway_core_application: "You should set Tramway::Core::Application class using `::Tramway::Core.initialize_application model_class: #{model_class_name}` in config/initializers/tramway.rb OR maybe you don't have any records of application model"
10
+ application_form:
11
+ initialize:
12
+ polymorphic_class_is_nil: "Polymorphic association class is nil. Maybe, you should write `assocation #{association_name}` after `properties #{association_name}_id, #{association_name}_type`"
13
+ validates:
14
+ you_need_to_set_model_class: 'You need to set `model_class` name while using validations. Just write `self.model_class = YOUR_MODEL_NAME` in the class area.'
15
+ submit:
16
+ looks_like_you_have_method: "Looks like you have method `%{method_name}` in %{model_class}. You should rename it or rename property in %{class_name}"
17
+ params_should_not_be_nil: "ApplicationForm::Params should not be nil"
18
+ model_class:
19
+ there_is_not_model_class: "There is not model class name for %{name}. Should be %{model_class_name} or you can use another class to initialize form object or just initialize form with object."
20
+ concerns:
21
+ attribute_decorator_helper:
22
+ you_should_mount_photo_uploader: "You should mount PhotoUploader to your model. Just add `mount_uploader %{attribute_name}, PhotoUploader` to your model. %{message}"
23
+ associations:
24
+ object_helper:
25
+ please_specify_association_name: "Please, specify `%{association_name}` association class_name in %{object_class} model. For example: `has_many :%{association_name}, class_name: '%{association_class_name}'`"
26
+ class_helper:
27
+ model_does_not_have_association: "Model %{object_class} does not have association named `%{association_name}`"
28
+ application_decorator:
29
+ attributes:
30
+ method_is_reserved_word: "Method `%{attribute_name}` is reserved word. Please, create or delegate method in %{class_name} with another name."
31
+ title:
32
+ please_implement_title: "Please, implement `title` method in a %{class_name} or %{object_class}"
33
+ link:
34
+ method_link_uses_file_attribute: "Method `link` uses `file` attribute of the decorated object. If decorated object doesn't contain `file`, you shouldn't use `link` method."
35
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.2.2
4
+ version: 1.17.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-19 00:00:00.000000000 Z
12
+ date: 2020-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: audited
@@ -358,6 +358,7 @@ files:
358
358
  - app/decorators/tramway/core/application_decorator.rb
359
359
  - app/decorators/tramway/core/associations/class_helper.rb
360
360
  - app/decorators/tramway/core/associations/object_helper.rb
361
+ - app/decorators/tramway/core/attributes/view_helper.rb
361
362
  - app/decorators/tramway/core/concerns/attributes_decorator_helper.rb
362
363
  - app/decorators/tramway/core/delegating/class_helper.rb
363
364
  - app/forms/tramway/core/application_form.rb
@@ -375,7 +376,9 @@ files:
375
376
  - app/forms/tramway/core/extendable_forms_helpers/validators.rb
376
377
  - app/forms/tramway/core/extended_application_form.rb
377
378
  - app/forms/tramway/core/form_creator.rb
379
+ - app/helpers/tramway/core/application_helper.rb
378
380
  - app/helpers/tramway/core/copy_to_clipboard_helper.rb
381
+ - app/helpers/tramway/core/inputs_helper.rb
379
382
  - app/helpers/tramway/core/title_helper.rb
380
383
  - app/inputs/date_picker_input.rb
381
384
  - app/models/tramway/core/application_record.rb
@@ -384,6 +387,7 @@ files:
384
387
  - app/uploaders/image_defaults.rb
385
388
  - app/uploaders/photo_uploader.rb
386
389
  - app/views/tramway/core/404.haml
390
+ - app/views/tramway/core/shared/_input.html.haml
387
391
  - app/views/tramway/core/shared/_input_extended.html.haml
388
392
  - app/views/tramway/core/shared/_messages.html.haml
389
393
  - app/views/tramway/core/shared/input_extended_types/_checkbox.html.haml
@@ -422,6 +426,7 @@ files:
422
426
  - lib/tramway/error.rb
423
427
  - lib/tramway/helpers/class_name_helpers.rb
424
428
  - lib/validators/presence_validator.rb
429
+ - lib/yaml/errors.yml
425
430
  homepage: https://github.com/purple-magic/tramway-core
426
431
  licenses:
427
432
  - MIT