tramway-core 1.17.3.1 → 1.17.6

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: 48e1c947dad194f06baa925068b67088cf7f62847b0e8f675431c8a9f927f8f2
4
- data.tar.gz: fada3528a9b191eb8ddbf0a524f5d117caf694b3b280e6b7d8fd753c778386a8
3
+ metadata.gz: ff3312136cc5e939cc9948d495df56951db7f9263eb15350627c9b04e8cb6407
4
+ data.tar.gz: 76b5da26c35481745798638acc2d9733098ae72336372ee6617a448122db71f9
5
5
  SHA512:
6
- metadata.gz: 230d46ff585f5dfd4773621d2d26b294b7c51eae32611fce795ab17051647f7a88057615f78e9dbd4361935589c7ce145923db47b3c8ee83384696c3bc579d3b
7
- data.tar.gz: 4d35f00d6faae4717b297d3b65ef085e7875df33efa052da1e62e7d96d880be8e3517bbacd5bec4df14292408184c4cb42e4febbcdf6bb64474bfcaefaac5f62
6
+ metadata.gz: de88772c33ebe611368ba67a004bd86d9cf74601b91a1b7688ba8ce9d2669b5305169da3fcecdcc40b268b579cd406b877ce59d832bdc0635809cb6e7a65f045
7
+ data.tar.gz: f70ca13587e303220071f3b57a89ce6c4642fedf31a2ddbf869a05392825daa60c48bb66d6bfd4f03253ec03901da00f4504bf5cbacdd71ecb54a77a9d56a362
data/README.md CHANGED
@@ -132,7 +132,7 @@ end
132
132
 
133
133
  ### CopyToClipboardHelper
134
134
 
135
- [app/helpers/tramway/core/copy_to_clipboard_helper.rb](https://github.com/ulmic/tramway-dev/blob/develop/tramway-core/app/helpers/tramway/core/copy_to_clipboard_helper.rb)
135
+ [app/helpers/tramway/core/copy_to_clipboard_helper.rb] (https://github.com/ulmic/tramway-dev/blob/develop/tramway-core/app/helpers/tramway/core/copy_to_clipboard_helper.rb)
136
136
 
137
137
  #### Install
138
138
 
@@ -96,7 +96,7 @@ class Tramway::Core::ApplicationForm < ::Reform::Form
96
96
  @@model_class = model_class_name.constantize
97
97
  rescue StandardError
98
98
  Tramway::Error.raise_error :tramway, :core, :application_form, :model_class, :there_is_not_model_class,
99
- name: name, model_class_name: model_class_name
99
+ name: name, model_class_name: model_class_name
100
100
  end
101
101
  end
102
102
  end
@@ -123,8 +123,10 @@ class Tramway::Core::ApplicationForm < ::Reform::Form
123
123
 
124
124
  def save
125
125
  super
126
+ rescue ArgumentError => e
127
+ Tramway::Error.raise_error :tramway, :core, :application_form, :save, :argument_error, message: e.message
126
128
  rescue StandardError => e
127
- Tramway::Error.raise_error :tramway, :core, :application_form, :submit, :looks_like_you_have_method,
128
- method_name: e.name.to_s.gsub('=', ''), model_class: @@model_class, class_name: self.class
129
+ Tramway::Error.raise_error :tramway, :core, :application_form, :save, :looks_like_you_have_method,
130
+ method_name: e.name.to_s.gsub('=', ''), model_class: @@model_class, class_name: self.class
129
131
  end
130
132
  end
@@ -6,6 +6,7 @@ module Tramway::Core::ApplicationForms::AssociationObjectHelpers
6
6
  define_polymorphic_association association, class_name
7
7
  else
8
8
  self.class.send(:define_method, "#{association}=") do |value|
9
+ model.send "#{association}_id=", value
9
10
  super class_name.find value
10
11
  end
11
12
  end
@@ -17,7 +18,7 @@ module Tramway::Core::ApplicationForms::AssociationObjectHelpers
17
18
  association_class = association_class.constantize if association_class.is_a? String
18
19
  if association_class.nil?
19
20
  Tramway::Error.raise_error :tramway, :core, :application_form, :initialize, :polymorphic_class_is_nil,
20
- association_name: association
21
+ association_name: association
21
22
  else
22
23
  super association_class.find value.split('_')[-1]
23
24
  send "#{association}_type=", association_class.to_s
@@ -18,7 +18,7 @@ module Tramway::Core::InputsHelper
18
18
  value: (form_object.send(property) || form_object.model.send("#{property}_id") || value)
19
19
  },
20
20
  selected: (form_object.model.send("#{property}_id") || value),
21
- collection: full_class_name_association.active.map do |obj|
21
+ collection: full_class_name_association.active.send("#{current_user.role}_scope", current_user.id).map do |obj|
22
22
  decorator_class(full_class_name_association).decorate obj
23
23
  end.sort_by(&:name)
24
24
  }.merge options
@@ -27,7 +27,7 @@ module Tramway::Core::InputsHelper
27
27
  def polymorphic_association_params(object:, form_object:, property:, value:, options: {})
28
28
  full_class_names = form_object.model.class.send("#{property}_type").values.map &:constantize
29
29
  collection = full_class_names.map do |class_name|
30
- class_name.active.map do |obj|
30
+ class_name.active.send("#{current_user.role}_scope", current_user.id).map do |obj|
31
31
  decorator_class(class_name).decorate obj
32
32
  end
33
33
  end.flatten.sort_by { |obj| obj.name.to_s }
@@ -16,6 +16,10 @@ class PhotoUploader < ApplicationUploader
16
16
  end
17
17
  end
18
18
 
19
+ def present?
20
+ super && width.present? && height.present?
21
+ end
22
+
19
23
  version :medium do
20
24
  process resize_to_fill: [400, 400]
21
25
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Tramway::Core::Application
4
- attr_accessor :name, :url, :model_class, :title, :tagline, :found_date, :phone, :email
4
+ attr_accessor :name, :url, :model_class, :title, :tagline, :found_date, :phone, :email, :main_image, :favicon
5
5
 
6
6
  def public_name
7
7
  name.to_s.gsub('_', ' ').camelize
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Core
5
- VERSION = '1.17.3.1'
5
+ VERSION = '1.17.6'
6
6
  end
7
7
  end
@@ -13,8 +13,10 @@ tramway:
13
13
  validates:
14
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
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
16
  params_should_not_be_nil: "ApplicationForm::Params should not be nil"
17
+ save:
18
+ 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}"
19
+ argument_error: "We have ArgumentError with message: %{message}"
18
20
  model_class:
19
21
  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
22
  concerns:
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.3.1
4
+ version: 1.17.6
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-26 00:00:00.000000000 Z
12
+ date: 2020-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: audited