tramway-partner 0.1.0 → 1.0

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: 7b819637828eac714335ff735b7a6a15f50af749b819bf057fe75967cb346527
4
- data.tar.gz: e828c8fb17df52db114b2f88e1475d5bfc884d6cf178d1040680d34dec93fa9c
3
+ metadata.gz: 39d722a850910a7ddcc2f5a7b32bac7cd0b0ac3c55f870d36fdf3455d9c6f92d
4
+ data.tar.gz: 5def838467324f34b9e567f09aed2cbf16386afefd69ee784910c5b9a323e501
5
5
  SHA512:
6
- metadata.gz: 58bf72d5525bb9dea06a85772a929971a2da29504276d9f3ae618b3274797b61ef652982207d710d821856e419cc64f1744fbf1b64cd5794e5847bc2ab9ba9d4
7
- data.tar.gz: 9795bad803b0cf88eac3984172359961ccc925a8857ccc13099a8fd1ae8e9e2974184bb3ba86c4e83cf2455974ff63861a0d2fe1ea78d697d9f8f1b769322585
6
+ metadata.gz: e1b19e54f1ae7a899b79498aac5d99eb3facababf8962ab8ce4445ff41083edaaa0effc6185bc02f95c0172e6d0bef05ac1fad6e5b144c9ead307d161af3860e
7
+ data.tar.gz: 0e50ef534c5eb1301b464ec287cfe46f4d3a44539d8d817f83c09b1417bdcaf769ef13878f59dc55d3dfdefb334e4acfbf8a62955fba97ebfca993a9036d1167
@@ -4,4 +4,6 @@ class Tramway::Partner::OrganizationDecorator < ::Tramway::Core::ApplicationDeco
4
4
  [ :all ]
5
5
  end
6
6
  end
7
+
8
+ decorate_association :partnerships
7
9
  end
@@ -0,0 +1,15 @@
1
+ class Tramway::Partner::OrganizationFeatureDecorator < ::Tramway::Landing::BlockTypes::FeaturesDecorator
2
+ delegate :title, to: :object
3
+
4
+ def text
5
+ object.title
6
+ end
7
+
8
+ def image
9
+ object.logo.mini.url
10
+ end
11
+
12
+ def external_link
13
+ object.url
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ class Tramway::Partner::PartnershipDecorator < ::Tramway::Core::ApplicationDecorator
2
+ class << self
3
+ def collections
4
+ [ :all ]
5
+ end
6
+ end
7
+
8
+ def title
9
+ "#{object.organization.title} #{I18n.t("enumerize.tramway/partner/partnership.partnership_type.#{object.partnership_type}")} #{object.partner.title}"
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class Tramway::Partner::PartnershipForm < ::Tramway::Core::ApplicationForm
2
+ properties :partner_id, :organization_id, :partnership_type, :partner_type
3
+
4
+ associations :partner, :organization
5
+
6
+ def initialize(object)
7
+ form_object = super object
8
+ form_properties partner: :polymorphic_association,
9
+ organization: :association,
10
+ partnership_type: :default
11
+ form_object
12
+ end
13
+ end
@@ -1,6 +1,9 @@
1
1
  module Tramway
2
2
  module Partner
3
3
  class Organization < ::Tramway::Partner::ApplicationRecord
4
+ has_many :partnerships, class_name: 'Tramway::Partner::Partnership'
5
+
6
+ mount_uploader :logo, PhotoUploader
4
7
  end
5
8
  end
6
9
  end
@@ -0,0 +1,7 @@
1
+ class Tramway::Partner::Partnership < ::Tramway::Core::ApplicationRecord
2
+ belongs_to :organization, class_name: 'Tramway::Partner::Organization'
3
+ belongs_to :partner, polymorphic: true
4
+
5
+ enumerize :partnership_type, in: [ :organizator, :program, :support, :info ], default: :organizator
6
+ enumerize :partner_type, in: [ 'Tramway::Event::Event', 'Tramway::Conference::Unity' ]
7
+ end
@@ -1 +1,4 @@
1
- ::Tramway::Admin.set_available_models(::Tramway::Partner::Organization, project: :partner)
1
+ ::Tramway::Admin.set_available_models(
2
+ ::Tramway::Partner::Organization,
3
+ ::Tramway::Partner::Partnership,
4
+ project: :partner)
@@ -0,0 +1,8 @@
1
+ ru:
2
+ enumerize:
3
+ tramway/partner/partnership:
4
+ partnership_type:
5
+ organizator: Организатор
6
+ program: Программный партнёр
7
+ support: При поддержке
8
+ info: Информационный партнёр
@@ -2,12 +2,21 @@ ru:
2
2
  activerecord:
3
3
  models:
4
4
  tramway/partner/organization: Партнёр
5
+ tramway/partner/partnership: Партнёрство
5
6
  attributes:
6
7
  tramway/partner/organization:
7
8
  title: Название
8
9
  logo: Логотип
9
10
  url: Ссылка на сайт
11
+ tramway/partner/partnership:
12
+ partner: Сущность, для которой добавляем партнёра
13
+ partner_type: Тип сущности
14
+ organization: Партнёрская организация
15
+ partnership_type: Тип партнёрства
10
16
  cases:
11
17
  tramway/partner/organization:
12
18
  plural: партнёры
13
19
  genitive: партнёра
20
+ tramway/partner/partnership:
21
+ plural: партнёрства
22
+ genitive: партнёрство
@@ -16,7 +16,8 @@ module Tramway::Partner::Generators
16
16
 
17
17
  def copy_migrations
18
18
  migrations = [
19
- :create_tramway_partner_organizations
19
+ :create_tramway_partner_organizations,
20
+ :create_tramway_partner_partnerships
20
21
  ]
21
22
  migrations.each do |migration|
22
23
  migration_template "#{migration}.rb", "db/migrate/#{migration}.rb"
@@ -0,0 +1,13 @@
1
+ class CreateTramwayPartnerPartnerships < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :tramway_partner_partnerships do |t|
4
+ t.integer :organization_id
5
+ t.integer :partner_id
6
+ t.text :partner_type
7
+ t.text :partnership_type
8
+ t.text :state, default: :active
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Partner
3
- VERSION = '0.1.0'
3
+ VERSION = '1.0'
4
4
  end
5
5
  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: 0.1.0
4
+ version: '1.0'
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-20 00:00:00.000000000 Z
11
+ date: 2018-12-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for partners
14
14
  email:
@@ -25,14 +25,18 @@ files:
25
25
  - app/assets/stylesheets/tramway/partner/application.css
26
26
  - app/controllers/tramway/partner/application_controller.rb
27
27
  - app/decorators/tramway/partner/organization_decorator.rb
28
+ - app/decorators/tramway/partner/organization_feature_decorator.rb
29
+ - app/decorators/tramway/partner/partnership_decorator.rb
28
30
  - app/forms/tramway/partner/organization_form.rb
31
+ - app/forms/tramway/partner/partnership_form.rb
29
32
  - app/helpers/tramway/partner/application_helper.rb
30
33
  - app/jobs/tramway/partner/application_job.rb
31
34
  - app/mailers/tramway/partner/application_mailer.rb
32
35
  - app/models/tramway/partner/application_record.rb
33
36
  - app/models/tramway/partner/organization.rb
34
- - app/views/layouts/tramway/partner/application.html.erb
37
+ - app/models/tramway/partner/partnership.rb
35
38
  - config/initializers/tramway.rb
39
+ - config/locales/enumerize.yml
36
40
  - config/locales/models.yml
37
41
  - config/routes.rb
38
42
  - lib/tasks/tramway/partner_tasks.rake
@@ -40,6 +44,7 @@ files:
40
44
  - lib/tramway/partner/engine.rb
41
45
  - lib/tramway/partner/generators/install_generator.rb
42
46
  - lib/tramway/partner/generators/templates/create_tramway_partner_organizations.rb
47
+ - lib/tramway/partner/generators/templates/create_tramway_partner_partnerships.rb
43
48
  - lib/tramway/partner/version.rb
44
49
  homepage: https://github.com/ulmic/tramway-partner
45
50
  licenses:
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Tramway partner</title>
5
- <%= stylesheet_link_tag "tramway/partner/application", media: "all" %>
6
- <%= javascript_include_tag "tramway/partner/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>