tramway-profiles 1.3.1 → 1.3.2

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: 5f3b74760688d0849b636537611ea1c450b6dec27abe79e44a7331f3346f19a9
4
- data.tar.gz: 6a7d645787ca47ce93fdc5c366179d1c275c5b6aa445a694961859d494f43534
3
+ metadata.gz: ede1826e5c2cf01648e65c16ebfb1555403781b89be465d02dd1dcedbf66aca9
4
+ data.tar.gz: 53b966590451cb08c4bc9d7cb2c7c6b54bf3c24c1e27e525f0e0f90ee1827a1f
5
5
  SHA512:
6
- metadata.gz: ac74cc2b77a2c6d4315d7921dc41f26eb9da1946abbd87dff571e8bf5eb48faacc6bb0e88c0c946117fb7e91fad807ca241f583e6a984400a02390ff4e676010
7
- data.tar.gz: af9d3dc577c0d347ffaf10f8b11be25ab8adad08c481e1cbdaa4a58bcf8984b7b07bf644f8db701203699d4f8b78582da26d4da08ec5b38582cf56e1a3b94bad
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
- ## Usage
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
- Add this line to your application's Gemfile:
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("../test/dummy/Rakefile", __FILE__)
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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Profiles
3
5
  class ApplicationController < ActionController::Base
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ::Tramway::Profiles::SocialNetworkDecorator < ::Tramway::Core::ApplicationDecorator
2
4
  class << self
3
5
  def collections
4
- [ :all ]
6
+ [:all]
5
7
  end
6
8
  end
7
9
 
@@ -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
- form_object = super object
6
- form_properties title: :string,
7
- network_name: :default,
8
- record_id: :integer,
9
- record_type: :default,
10
- uid: :string
11
- form_object
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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Profiles
3
5
  class ApplicationJob < ActiveJob::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Profiles
3
5
  class ApplicationMailer < ActionMailer::Base
@@ -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: [ :vk, :facebook, :twitter, :instagram, :telegram, :patreon ]
5
- #enumerize :record_type, in: ::Tramway::Profiles.records
6
- #
7
- # HACK
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
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ::Tramway::Admin.set_available_models(::Tramway::Profiles::SocialNetwork, project: :profiles)
data/config/routes.rb CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Tramway::Profiles::Engine.routes.draw do
2
4
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # desc "Explaining what the task does"
2
4
  # task :tramway_profiles do
3
5
  # # Task goes here
@@ -1,16 +1,14 @@
1
- require "tramway/profiles/engine"
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
- def records=(models)
8
- @records = models
9
- end
9
+ attr_writer :records
10
10
 
11
- def records
12
- @records
13
- end
11
+ attr_reader :records
14
12
  end
15
13
  end
16
14
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Profiles
3
5
  class Engine < ::Rails::Engine
@@ -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('../templates', __FILE__)
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayProfilesSocialNetworks < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_profiles_social_networks do |t|
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Profiles
3
- VERSION = '1.3.1'
5
+ VERSION = '1.3.2'
4
6
  end
5
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.1
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: 2019-06-16 00:00:00.000000000 Z
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
- rubyforge_project:
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