tramway-profiles 1.3.1 → 1.3.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 +28 -4
- data/Rakefile +3 -5
- data/app/controllers/tramway/profiles/application_controller.rb +2 -0
- data/app/decorators/tramway/profiles/social_network_decorator.rb +3 -1
- data/app/forms/tramway/profiles/social_network_form.rb +9 -7
- data/app/helpers/tramway/profiles/links_helper.rb +3 -1
- data/app/jobs/tramway/profiles/application_job.rb +2 -0
- data/app/mailers/tramway/profiles/application_mailer.rb +2 -0
- data/app/models/tramway/profiles/social_network.rb +7 -6
- data/config/initializers/tramway.rb +2 -0
- data/config/routes.rb +2 -0
- data/lib/tasks/tramway/profiles_tasks.rake +2 -0
- data/lib/tramway/profiles.rb +5 -7
- data/lib/tramway/profiles/engine.rb +2 -0
- data/lib/tramway/profiles/generates/install_generator.rb +4 -3
- data/lib/tramway/profiles/generates/templates/create_tramway_profiles_social_networks.rb +2 -0
- data/lib/tramway/profiles/version.rb +3 -1
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ede1826e5c2cf01648e65c16ebfb1555403781b89be465d02dd1dcedbf66aca9
|
|
4
|
+
data.tar.gz: 53b966590451cb08c4bc9d7cb2c7c6b54bf3c24c1e27e525f0e0f90ee1827a1f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8648cc5a099979150a47bbbc004df4f47649d96fecc1ee7cc1f373383435f4417cf2df5b42910e0d64935fef87e0990408c24caef40406bbbb30f7ae820354b5
|
|
7
|
+
data.tar.gz: 04ed8c1b00ffff2a59e9a5b8b4a6e1c7526a9e23ec06e4909bdeb514c6a046fa835f2233a014040df23251b5112c06b66d09a7ce4dcabfcf573c69922260276c
|
data/README.md
CHANGED
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
# Tramway::Profiles
|
|
2
|
-
Short description and motivation.
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
How to use my plugin.
|
|
3
|
+
This gem provides easy way to add info about social profiles of your organization
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
#### 1. Add this line to your application's Gemfile:
|
|
9
8
|
|
|
10
9
|
```ruby
|
|
11
10
|
gem 'tramway-profiles'
|
|
12
11
|
```
|
|
13
12
|
|
|
13
|
+
#### 2. Generations
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
rails g tramway:profiles:install
|
|
17
|
+
rails db:migrate
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
#### 3. Install tramway-admin gem. [How-to](https://github.com/ulmic/tramway-dev/tree/develop/tramway-admin)
|
|
21
|
+
|
|
22
|
+
#### 4. Add social network to the admin panel
|
|
23
|
+
|
|
24
|
+
*app/initializers/tramway.rb*
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
::Tramway::Admin.set_available_models(::Tramway::Profiles::SocialNetwork, project: :your_project_name)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage. English
|
|
31
|
+
|
|
32
|
+
...coming soon
|
|
33
|
+
|
|
34
|
+
## Использование
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
14
38
|
And then execute:
|
|
15
39
|
```bash
|
|
16
40
|
$ bundle
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
begin
|
|
2
4
|
require 'bundler/setup'
|
|
3
5
|
rescue LoadError
|
|
@@ -14,14 +16,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
|
14
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
17
|
end
|
|
16
18
|
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
|
19
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
|
18
20
|
load 'rails/tasks/engine.rake'
|
|
19
21
|
|
|
20
|
-
|
|
21
22
|
load 'rails/tasks/statistics.rake'
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
24
|
require 'bundler/gem_tasks'
|
|
26
25
|
|
|
27
26
|
require 'rake/testtask'
|
|
@@ -32,5 +31,4 @@ Rake::TestTask.new(:test) do |t|
|
|
|
32
31
|
t.verbose = false
|
|
33
32
|
end
|
|
34
33
|
|
|
35
|
-
|
|
36
34
|
task default: :test
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class Tramway::Profiles::SocialNetworkForm < ::Tramway::Core::ApplicationForm
|
|
2
4
|
properties :title, :network_name, :record_id, :record_type, :uid
|
|
3
5
|
|
|
4
6
|
def initialize(object)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
super(object).tap do
|
|
8
|
+
form_properties title: :string,
|
|
9
|
+
network_name: :default,
|
|
10
|
+
uid: :string,
|
|
11
|
+
record_type: :default,
|
|
12
|
+
record_id: :integer
|
|
13
|
+
end
|
|
12
14
|
end
|
|
13
15
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Tramway::Profiles::LinksHelper
|
|
2
4
|
def profile_link(profile)
|
|
3
5
|
send profile.network_name, profile.uid, profile.title
|
|
@@ -33,7 +35,7 @@ module Tramway::Profiles::LinksHelper
|
|
|
33
35
|
link_to link, target: '_blank' do
|
|
34
36
|
concat fab_icon icon
|
|
35
37
|
concat ' '
|
|
36
|
-
concat title
|
|
38
|
+
concat title
|
|
37
39
|
end
|
|
38
40
|
end
|
|
39
41
|
end
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class Tramway::Profiles::SocialNetwork < ::Tramway::Core::ApplicationRecord
|
|
2
|
-
belongs_to :record, polymorphic: true
|
|
4
|
+
belongs_to :record, polymorphic: true, required: false
|
|
3
5
|
|
|
4
|
-
enumerize :network_name, in: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
enumerize :record_type, in: [ 'Tramway::SportSchool::Institution', 'Tramway::Conference::Unity' ], default: 'Tramway::SportSchool::Institution'
|
|
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.model_class]).compact)
|
|
9
10
|
end
|
data/config/routes.rb
CHANGED
data/lib/tramway/profiles.rb
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'tramway/profiles/engine'
|
|
2
4
|
require 'tramway/profiles/generates/install_generator'
|
|
3
5
|
|
|
4
6
|
module Tramway
|
|
5
7
|
module Profiles
|
|
6
8
|
class << self
|
|
7
|
-
|
|
8
|
-
@records = models
|
|
9
|
-
end
|
|
9
|
+
attr_writer :records
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
@records
|
|
13
|
-
end
|
|
11
|
+
attr_reader :records
|
|
14
12
|
end
|
|
15
13
|
end
|
|
16
14
|
end
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rails/generators'
|
|
2
4
|
require 'tramway/core/generators/install_generator'
|
|
3
5
|
|
|
4
6
|
module Tramway::Profiles::Generators
|
|
5
7
|
class InstallGenerator < ::Tramway::Core::Generators::InstallGenerator
|
|
6
8
|
include Rails::Generators::Migration
|
|
7
|
-
source_root File.expand_path('
|
|
9
|
+
source_root File.expand_path('templates', __dir__)
|
|
8
10
|
|
|
9
|
-
def run_other_generators
|
|
10
|
-
end
|
|
11
|
+
def run_other_generators; end
|
|
11
12
|
|
|
12
13
|
def self.next_migration_number(path)
|
|
13
14
|
next_migration_number = current_migration_number(path) + 1
|
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.
|
|
4
|
+
version: 1.3.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:
|
|
11
|
+
date: 2020-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Rails engine for social networks profiles
|
|
14
14
|
email:
|
|
@@ -59,8 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
60
|
version: '0'
|
|
61
61
|
requirements: []
|
|
62
|
-
|
|
63
|
-
rubygems_version: 2.7.7
|
|
62
|
+
rubygems_version: 3.0.3
|
|
64
63
|
signing_key:
|
|
65
64
|
specification_version: 4
|
|
66
65
|
summary: Rails engine for social networks profiles
|