tramway-profiles 1.3.2.4 → 1.4

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: 3c2c9a31e67a0ed087ead13b299e3a08e18da3d971572c9cb7ac56fb67b43328
4
- data.tar.gz: 913df40cf233e9a1a55dd4d430b8686c10cd331e676167c80098192bc2bff95c
3
+ metadata.gz: 4abc89d7e1d959a2d620f9eb4e2e63f3c78d78d07ec5f683f09d102fbb60d1de
4
+ data.tar.gz: cb64a595639fdc3283b247eb7f62e3d9378d31029168b3a8089546c477961f94
5
5
  SHA512:
6
- metadata.gz: 9b5a313048bb8ca03de2f68571fb278f16336de4c58c4c85f4bc503310a1b86bf6677a39410bded0a2dad1edb0f010330771391dfe95112213335f724cb367c0
7
- data.tar.gz: 7ee200be2d8d15d25d89c95398f83c2618f1b5bbc96fe27f5cc7f764a4c760e8c919a6445617e80c60668d8a8cd2cd840aadeee175e177a6e08a4a780c40d8c9
6
+ metadata.gz: f1c0649aa8e3da815ab87c4cbffa8730aff7455a4b56cfaa54c1374edbdf0d224626de1646ae59517905851cc714f53f6ae1fe2d17e4d6e7e7886af3e8548dc9
7
+ data.tar.gz: f8c9e89541ae6617b022a9a44daaea72860368433f7e37f204a999b9585c80470b43851dca947dfd9a3fe53c95f3cda81fcd758b7288e577fbb7a0bc4fae61ea
data/README.md CHANGED
@@ -27,6 +27,8 @@ rails db:migrate
27
27
  ::Tramway::Admin.set_available_models(::Tramway::Profiles::SocialNetwork, project: :your_project_name)
28
28
  ```
29
29
 
30
+ #### 5. Now you have SocialNetwork objects in your project, that associated with [Tramway::Core.application](https://github.com/ulmic/tramway-dev/tree/develop/tramway-core#how-to-create-model-that-will-be-an-application-model-for-the-tramway) by default
31
+
30
32
  ## Usage. English
31
33
 
32
34
  ...coming soon
@@ -8,4 +8,8 @@ class ::Tramway::Profiles::SocialNetworkDecorator < ::Tramway::Core::Application
8
8
  end
9
9
 
10
10
  delegate :title, to: :object
11
+
12
+ def name
13
+ "#{object.network_name} | #{object.title}"
14
+ end
11
15
  end
@@ -1,15 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Admin::Tramway::Profiles::SocialNetworkForm < ::Tramway::Core::ApplicationForm
4
- properties :title, :network_name, :record_id, :record_type, :uid
4
+ properties :title, :network_name, :uid, :record_id, :record_type
5
+
6
+ association :record
5
7
 
6
8
  def initialize(object)
7
9
  super(object).tap do
8
10
  form_properties title: :string,
9
11
  network_name: :default,
10
12
  uid: :string,
11
- record_type: :default,
12
- record_id: :integer
13
+ record: :polymorphic_association
13
14
  end
14
15
  end
15
16
  end
@@ -4,7 +4,5 @@ class Tramway::Profiles::SocialNetwork < ::Tramway::Core::ApplicationRecord
4
4
  belongs_to :record, polymorphic: true, required: false
5
5
 
6
6
  enumerize :network_name, in: %i[vk facebook twitter instagram telegram patreon]
7
- enumerize :record_type, in: (['Tramway::SportSchool::Institution', 'Tramway::Conference::Unity'].map do |type|
8
- type if const_defined?(type)
9
- end + [Tramway::Core.application_object.try(:model_class) || Tramway::Core.application_object]).compact
7
+ enumerize :record_type, in: Tramway::Profiles.records
10
8
  end
File without changes
@@ -6,9 +6,16 @@ require 'tramway/profiles/generates/install_generator'
6
6
  module Tramway
7
7
  module Profiles
8
8
  class << self
9
- attr_writer :records
9
+ def records=(*models)
10
+ @@records ||= []
11
+ @@records += (models.map do |model|
12
+ model.to_s.sub(/^\:\:/, '')
13
+ end)
14
+ end
10
15
 
11
- attr_reader :records
16
+ def records
17
+ defined?(@@records) ? @@records.uniq : []
18
+ end
12
19
  end
13
20
  end
14
21
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Profiles
5
- VERSION = '1.3.2.4'
5
+ VERSION = '1.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-profiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2.4
4
+ version: '1.4'
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-02-11 00:00:00.000000000 Z
11
+ date: 2020-03-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for social networks profiles
14
14
  email:
@@ -32,7 +32,7 @@ files:
32
32
  - app/models/tramway/profiles/social_network.rb
33
33
  - app/views/layouts/tramway/profiles/application.html.erb
34
34
  - config/initializers/tramway.rb
35
- - config/locales/models.yml
35
+ - config/locales/profiles_models.yml
36
36
  - config/routes.rb
37
37
  - lib/tasks/tramway/profiles_tasks.rake
38
38
  - lib/tramway/profiles.rb
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  requirements: []
62
- rubygems_version: 3.0.3
62
+ rubygems_version: 3.1.2
63
63
  signing_key:
64
64
  specification_version: 4
65
65
  summary: Rails engine for social networks profiles