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 +4 -4
- data/Rakefile +3 -5
- data/app/controllers/tramway/partner/application_controller.rb +2 -0
- data/app/decorators/tramway/partner/organization_decorator.rb +5 -1
- data/app/decorators/tramway/partner/organization_feature_decorator.rb +2 -0
- data/app/decorators/tramway/partner/partnership_decorator.rb +4 -2
- data/app/forms/{tramway → admin/tramway}/partner/organization_form.rb +3 -1
- data/app/forms/{tramway → admin/tramway}/partner/partnership_form.rb +3 -1
- data/app/helpers/tramway/partner/application_helper.rb +2 -0
- data/app/jobs/tramway/partner/application_job.rb +2 -0
- data/app/mailers/tramway/partner/application_mailer.rb +2 -0
- data/app/models/tramway/partner/application_record.rb +2 -0
- data/app/models/tramway/partner/organization.rb +2 -0
- data/app/models/tramway/partner/partnership.rb +4 -2
- data/config/initializers/tramway.rb +4 -1
- data/config/locales/enumerize.yml +3 -3
- data/config/routes.rb +2 -0
- data/lib/tasks/tramway/partner_tasks.rake +2 -0
- data/lib/tramway/partner.rb +4 -1
- data/lib/tramway/partner/engine.rb +2 -0
- data/lib/tramway/partner/generators/install_generator.rb +7 -6
- data/lib/tramway/partner/generators/templates/create_tramway_partner_organizations.rb +2 -0
- data/lib/tramway/partner/generators/templates/create_tramway_partner_partnerships.rb +2 -0
- data/lib/tramway/partner/scopes.rb +19 -0
- data/lib/tramway/partner/version.rb +3 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cae4fe7f8f73470a959bab93e595de2bd590c77421d4b271a8a23c61712f6d49
|
4
|
+
data.tar.gz: 8239f5ef84fd1990e1140a664ae93c1f6850c5a3876f1cfa9bd712e17962bbcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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,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
|
-
[
|
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,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
|
-
[
|
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
|
-
|
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,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: [
|
6
|
-
enumerize :partner_type, in: [
|
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
|
@@ -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: Информационные партнёры
|
data/config/routes.rb
CHANGED
data/lib/tramway/partner.rb
CHANGED
@@ -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('
|
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
|
-
|
20
|
-
|
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"
|
@@ -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
|
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.
|
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:
|
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
|
-
|
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
|