tramway-partner 1.0.1 → 1.0.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: a46b5733234cc568d3a9a957b36c798f772f8cc9c9a948937baf7466ac4489a7
4
- data.tar.gz: e25840a2a8c245de465095f676c4c1eed68243d2f24944dc9f13cab103c2bcc4
3
+ metadata.gz: cae4fe7f8f73470a959bab93e595de2bd590c77421d4b271a8a23c61712f6d49
4
+ data.tar.gz: 8239f5ef84fd1990e1140a664ae93c1f6850c5a3876f1cfa9bd712e17962bbcc
5
5
  SHA512:
6
- metadata.gz: 6ac0d60208eee1f895a9b981ff45e505117afd5ad47be27051e9cf9b3e9fd83fe2df59b774b4d440a4e6096980a7cb4fb862135bc0112226cdf14c84abcfa9f6
7
- data.tar.gz: 88729dd148f37ddceaed62675ab164f4eba3ad24e346a46ee71afb73bc1e2cde2e58fbb6cdd6fab99807e00fe887d3c301d62a46138fceeea8e2921c6d28f681
6
+ metadata.gz: a8675bb2d1ee70fb5a7844e038368243de8d10e9a468863e320b4b51677ea66e22117e5695df8cebd188ce86139d6783e345fd283e62287ef7c4dbfd729d1844
7
+ data.tar.gz: 7e8450d4d53bf69a0fbf86be51a7df3c843025266d12f2873c8ee701c94b478782c67e8273aff2d5b009f5d08a2a57ea36ef26ca2f33ed5700855a255cd67dc7
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 Partner
3
5
  class ApplicationController < ActionController::Base
@@ -1,9 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Partner::OrganizationDecorator < ::Tramway::Core::ApplicationDecorator
2
4
  class << self
3
5
  def collections
4
- [ :all ]
6
+ [:all]
5
7
  end
6
8
  end
7
9
 
8
10
  decorate_association :partnerships
11
+
12
+ delegate :title, to: :object
9
13
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Partner::OrganizationFeatureDecorator < ::Tramway::Landing::BlockTypes::FeaturesDecorator
2
4
  def image
3
5
  object.logo.mini.url
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Partner::PartnershipDecorator < ::Tramway::Core::ApplicationDecorator
2
4
  class << self
3
5
  def collections
4
- [ :all ]
6
+ [:all]
5
7
  end
6
8
  end
7
-
9
+
8
10
  def title
9
11
  "#{object.organization.title} #{I18n.t("enumerize.tramway/partner/partnership.partnership_type.#{object.partnership_type}")} #{object.partner.title}"
10
12
  end
@@ -1,4 +1,6 @@
1
- class Tramway::Partner::OrganizationForm < ::Tramway::Core::ApplicationForm
1
+ # frozen_string_literal: true
2
+
3
+ class Admin::Tramway::Partner::OrganizationForm < ::Tramway::Core::ApplicationForm
2
4
  properties :title, :logo, :url
3
5
 
4
6
  def initialize(object)
@@ -1,4 +1,6 @@
1
- class Tramway::Partner::PartnershipForm < ::Tramway::Core::ApplicationForm
1
+ # frozen_string_literal: true
2
+
3
+ class Admin::Tramway::Partner::PartnershipForm < ::Tramway::Core::ApplicationForm
2
4
  properties :partner_id, :organization_id, :partnership_type, :partner_type
3
5
 
4
6
  associations :partner, :organization
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Partner
3
5
  module ApplicationHelper
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Partner
3
5
  class ApplicationJob < ActiveJob::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Partner
3
5
  class ApplicationMailer < ActionMailer::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Partner
3
5
  class ApplicationRecord < ::Tramway::Core::ApplicationRecord
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Partner
3
5
  class Organization < ::Tramway::Partner::ApplicationRecord
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Partner::Partnership < ::Tramway::Core::ApplicationRecord
2
4
  belongs_to :organization, class_name: 'Tramway::Partner::Organization'
3
5
  belongs_to :partner, polymorphic: true
4
6
 
5
- enumerize :partnership_type, in: [ :organizator, :program, :support, :info ], default: :organizator
6
- enumerize :partner_type, in: [ 'Tramway::Event::Event', 'Tramway::Conference::Unity' ]
7
+ enumerize :partnership_type, in: %i[organizator program support info customer], default: :organizator
8
+ enumerize :partner_type, in: ['Tramway::Event::Event', 'Tramway::Conference::Unity']
7
9
  end
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ::Tramway::Admin.set_available_models(
2
4
  ::Tramway::Partner::Organization,
3
5
  ::Tramway::Partner::Partnership,
4
- project: :partner)
6
+ project: :partner
7
+ )
@@ -2,7 +2,7 @@ ru:
2
2
  enumerize:
3
3
  tramway/partner/partnership:
4
4
  partnership_type:
5
- organizator: Организатор
6
- program: Программный партнёр
5
+ organizator: Организаторы
6
+ program: Программные партнёры
7
7
  support: При поддержке
8
- info: Информационный партнёр
8
+ info: Информационные партнёры
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Tramway::Partner::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_partner do
3
5
  # # Task goes here
@@ -1,5 +1,8 @@
1
- require "tramway/partner/engine"
1
+ # frozen_string_literal: true
2
+
3
+ require 'tramway/partner/engine'
2
4
  require 'tramway/partner/generators/install_generator'
5
+ require 'tramway/partner/scopes'
3
6
 
4
7
  module Tramway
5
8
  module Partner
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Partner
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::Partner::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
@@ -15,9 +16,9 @@ module Tramway::Partner::Generators
15
16
  end
16
17
 
17
18
  def copy_migrations
18
- migrations = [
19
- :create_tramway_partner_organizations,
20
- :create_tramway_partner_partnerships
19
+ migrations = %i[
20
+ create_tramway_partner_organizations
21
+ create_tramway_partner_partnerships
21
22
  ]
22
23
  migrations.each do |migration|
23
24
  migration_template "#{migration}.rb", "db/migrate/#{migration}.rb"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayPartnerOrganizations < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_partner_organizations do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayPartnerPartnerships < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_partner_partnerships do |t|
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway::Partner::Scopes
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ ::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type|
8
+ define_method partnership_type.pluralize.to_sym do
9
+ query = <<-SQL
10
+ tramway_partner_partnerships.partnership_type = '#{partnership_type}'
11
+ AND tramway_partner_partnerships.partner_id = '#{id}'
12
+ AND tramway_partner_partnerships.state = 'active'
13
+ AND tramway_partner_partnerships.partner_type = '#{self.class.name}'
14
+ SQL
15
+ Tramway::Partner::Organization.joins(:partnerships).where(query)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Partner
3
- VERSION = '1.0.1'
5
+ VERSION = '1.0.4'
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-partner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.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: 2018-12-24 00:00:00.000000000 Z
11
+ date: 2020-12-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for partners
14
14
  email:
@@ -27,8 +27,8 @@ files:
27
27
  - app/decorators/tramway/partner/organization_decorator.rb
28
28
  - app/decorators/tramway/partner/organization_feature_decorator.rb
29
29
  - app/decorators/tramway/partner/partnership_decorator.rb
30
- - app/forms/tramway/partner/organization_form.rb
31
- - app/forms/tramway/partner/partnership_form.rb
30
+ - app/forms/admin/tramway/partner/organization_form.rb
31
+ - app/forms/admin/tramway/partner/partnership_form.rb
32
32
  - app/helpers/tramway/partner/application_helper.rb
33
33
  - app/jobs/tramway/partner/application_job.rb
34
34
  - app/mailers/tramway/partner/application_mailer.rb
@@ -45,6 +45,7 @@ files:
45
45
  - lib/tramway/partner/generators/install_generator.rb
46
46
  - lib/tramway/partner/generators/templates/create_tramway_partner_organizations.rb
47
47
  - lib/tramway/partner/generators/templates/create_tramway_partner_partnerships.rb
48
+ - lib/tramway/partner/scopes.rb
48
49
  - lib/tramway/partner/version.rb
49
50
  homepage: https://github.com/ulmic/tramway-partner
50
51
  licenses:
@@ -65,8 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
66
  - !ruby/object:Gem::Version
66
67
  version: '0'
67
68
  requirements: []
68
- rubyforge_project:
69
- rubygems_version: 2.7.6
69
+ rubygems_version: 3.1.2
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: Rails engine for partners