tramway-site 0.1.0 → 0.1.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 912cbe534ee85391957c6597f381a58274ef9c14b68e9292f419b1cd406248fd
4
- data.tar.gz: 31bfb71fbe0e1543a652c39ac0fac989f65f2c07b59917f566d9d8b9899766e6
3
+ metadata.gz: 6bf2097c6d4a77b3da1941bed8176d1c3724dde7bbe12430e2c748fd035ae735
4
+ data.tar.gz: fb0bcbe038d3c49f67d223359cbd8054c45d6a49398c22d3cf0f52a4acdf8a26
5
5
  SHA512:
6
- metadata.gz: f4743d3b5ba28db983d1ca56e9625a28521e4369c5d487e38ca4a204115a3c75498552f83eba37c97ba02f69cfae8dced66d2b7efbd5094c87747f48f2f69f5e
7
- data.tar.gz: 1cadbbee3db79722caa437e71d805cb9976e5fc39ec755ae84fd78a6f6a9f801560068f1f2fa521dc0e11893324e3ffcdce6d0379901cc500a32d780a8929743
6
+ metadata.gz: daa3f892acc54a220b59285dc630cb51245797b7f74fbe0dfc5a30d5b68f6881000a51b94aa6c098c0670dba014418f6afe4d04bd36231feff3bab79edef21cc
7
+ data.tar.gz: 24933cc8f4209bf4b5e6e173302bced1871a0ebff60755ff448927dd5138d9c41688248a6665720fc8f0fd0ba63785c3a6eec33fb1eb742458cd912c41698526
@@ -0,0 +1,20 @@
1
+ Copyright 2019 Pavel Kalashnikov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # Tramway::Site
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'tramway-site'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install tramway-site
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ require 'rdoc/task'
10
+
11
+ RDoc::Task.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = 'rdoc'
13
+ rdoc.title = 'Tramway::Site'
14
+ rdoc.options << '--line-numbers'
15
+ rdoc.rdoc_files.include('README.md')
16
+ rdoc.rdoc_files.include('lib/**/*.rb')
17
+ end
18
+
19
+ APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
20
+ load 'rails/tasks/engine.rake'
21
+
22
+ load 'rails/tasks/statistics.rake'
23
+
24
+ require 'bundler/gem_tasks'
25
+
26
+ require 'rake/testtask'
27
+
28
+ Rake::TestTask.new(:test) do |t|
29
+ t.libs << 'test'
30
+ t.pattern = 'test/**/*_test.rb'
31
+ t.verbose = false
32
+ end
33
+
34
+ task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/tramway/site .js
2
+ //= link_directory ../stylesheets/tramway/site .css
@@ -0,0 +1,2 @@
1
+ //= require rails-ujs
2
+ //= require_tree .
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require_tree .
3
+ *= require_self
4
+ */
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway
4
+ module Site
5
+ class ApplicationController < Tramway::Core::ApplicationController
6
+ layout 'tramway/landing/application'
7
+ protect_from_forgery with: :exception
8
+ before_action :application
9
+
10
+ def application
11
+ @application = ::Tramway::Core.application.model_class.first
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Tramway::Site::Web::ApplicationController < Tramway::Site::ApplicationController
4
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Tramway::Site::Web::WelcomeController < Tramway::Site::Web::ApplicationController
4
+ def index
5
+ @blocks = ::Tramway::Landing::BlockDecorator.decorate ::Tramway::Landing::Block.on_main_page
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Tramway::Site::PersonDecorator < Tramway::Core::ApplicationDecorator
4
+ class << self
5
+ def show_attributes
6
+ %i[full_name short_bio bio photo]
7
+ end
8
+ end
9
+
10
+ delegate :short_bio, to: :object
11
+
12
+ def full_name
13
+ object.names.join ' '
14
+ end
15
+
16
+ def bio
17
+ raw object.bio
18
+ end
19
+
20
+ def photo
21
+ image_view object.photo
22
+ end
23
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Tramway::Site::PersonForm < Tramway::Core::ExtendedApplicationForm
4
+ properties :full_name, :photo, :short_bio, :bio
5
+
6
+ def initialize(object)
7
+ super(object).tap do
8
+ form_properties full_name: :string,
9
+ photo: :file,
10
+ short_bio: :string,
11
+ bio: :ckeditor
12
+ end
13
+ end
14
+
15
+ def full_name=(value)
16
+ model.names = value.split ' '
17
+ end
18
+
19
+ def full_name
20
+ model.names.join ' '
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway
4
+ module Site
5
+ module ApplicationHelper
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway
4
+ module Site
5
+ class ApplicationJob < ActiveJob::Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway
4
+ module Site
5
+ class ApplicationMailer < ActionMailer::Base
6
+ default from: 'from@example.com'
7
+ layout 'mailer'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway
4
+ module Site
5
+ class ApplicationRecord < Tramway::Core::ApplicationRecord
6
+ self.abstract_class = true
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Tramway::Site::Person < Tramway::Site::ApplicationRecord
4
+ mount_uploader :photo, PhotoUploader
5
+
6
+ def title
7
+ names.join(' ')
8
+ end
9
+
10
+ alias name title
11
+ alias public_name title
12
+ end
@@ -0,0 +1,33 @@
1
+ = content_for :head_content do
2
+ = stylesheet_link_tag 'tramway/site/application', media: 'all'
3
+ = javascript_include_tag 'tramway/site/application'
4
+
5
+ = content_for :application_name do
6
+ = @application&.title || t('application.name')
7
+
8
+ = content_for :title do
9
+ = @application&.title || t('application.name')
10
+
11
+ = content_for :application_tagline do
12
+ = @application&.tagline || t('application.tagline')
13
+
14
+ = content_for :address do
15
+ = @unity&.address
16
+
17
+ = content_for :phone do
18
+ = @unity&.phone
19
+
20
+ = content_for :footer_links do
21
+ = nil
22
+
23
+ = content_for :footer_logos do
24
+ = nil
25
+
26
+ = content_for :latitude do
27
+ = @unity&.latitude
28
+
29
+ = content_for :longtitude do
30
+ = @unity&.longtitude
31
+
32
+ - content_for :main_image do
33
+ = request.protocol + request.host_with_port + @blocks.select { |block| block.model.block_type.header? }.first.background.url
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::Tramway::Admin.set_singleton_models ::Tramway::Site::Person, project: :site
4
+ ::Tramway::Core.initialize_application model_class: ::Tramway::Site::Person
@@ -0,0 +1,13 @@
1
+ ru:
2
+ activerecord:
3
+ models:
4
+ tramway/site/person: Персона
5
+ attributes:
6
+ tramway/site/person:
7
+ short_bio: Коротко о себе
8
+ full_name: Полное имя
9
+ bio: О себе
10
+ photo: Фото
11
+ cases:
12
+ tramway/site/person:
13
+ genitive: персону
@@ -0,0 +1,3 @@
1
+ ru:
2
+ application:
3
+ name: Личный сайт
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ Tramway::Site::Engine.routes.draw do
4
+ mount Tramway::Auth::Engine, at: '/auth'
5
+ mount Tramway::Admin::Engine, at: '/admin'
6
+
7
+ root to: 'web/welcome#index'
8
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tramway/site/engine'
4
+ require 'tramway/site/generates/install_generator'
5
+
6
+ module Tramway
7
+ module Site
8
+ class << self
9
+ def dependencies
10
+ %i[landing profiles]
11
+ end
12
+
13
+ def application
14
+ :person
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway
4
+ module Site
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace Tramway::Site
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+ require 'tramway/core/generators/install_generator'
5
+
6
+ module Tramway::Site::Generators
7
+ class InstallGenerator < ::Tramway::Core::Generators::InstallGenerator
8
+ include Rails::Generators::Migration
9
+ source_root File.expand_path('templates', __dir__)
10
+
11
+ def run_other_generators
12
+ generate 'tramway:user:install'
13
+ generate 'tramway:landing:install'
14
+ generate 'tramway:profiles:install'
15
+ end
16
+
17
+ def self.next_migration_number(path)
18
+ next_migration_number = current_migration_number(path) + 1
19
+ ActiveRecord::Migration.next_migration_number next_migration_number
20
+ end
21
+
22
+ def copy_migrations
23
+ migrations = [
24
+ :create_tramway_site_people,
25
+ :add_main_image_tramway_site_people
26
+ ]
27
+ migrations.each do |migration_name|
28
+ migration_template "#{migration_name}.rb", "db/migrate/#{migration_name}.rb"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddMainImageTramwaySitePeople < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :tramway_site_people, :main_image, :text
6
+ add_column :tramway_site_people, :favicon, :text
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateTramwaySitePeople < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :tramway_site_people do |t|
6
+ t.text :names, array: true
7
+ t.text :short_bio
8
+ t.text :bio
9
+ t.text :photo
10
+
11
+ t.text :state, default: :active
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tramway
4
+ module Site
5
+ VERSION = '0.1.0.5'
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-site
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.0.5
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-07-07 00:00:00.000000000 Z
11
+ date: 2020-11-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for person site
14
14
  email:
@@ -16,7 +16,34 @@ email:
16
16
  executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
- files: []
19
+ files:
20
+ - MIT-LICENSE
21
+ - README.md
22
+ - Rakefile
23
+ - app/assets/config/tramway_site_manifest.js
24
+ - app/assets/javascripts/tramway/site/application.js
25
+ - app/assets/stylesheets/tramway/site/application.css
26
+ - app/controllers/tramway/site/application_controller.rb
27
+ - app/controllers/tramway/site/web/application_controller.rb
28
+ - app/controllers/tramway/site/web/welcome_controller.rb
29
+ - app/decorators/tramway/site/person_decorator.rb
30
+ - app/forms/tramway/site/person_form.rb
31
+ - app/helpers/tramway/site/application_helper.rb
32
+ - app/jobs/tramway/site/application_job.rb
33
+ - app/mailers/tramway/site/application_mailer.rb
34
+ - app/models/tramway/site/application_record.rb
35
+ - app/models/tramway/site/person.rb
36
+ - app/views/tramway/site/web/welcome/index.html.haml
37
+ - config/initializers/tramway.rb
38
+ - config/locales/models.yml
39
+ - config/locales/ru.yml
40
+ - config/routes.rb
41
+ - lib/tramway/site.rb
42
+ - lib/tramway/site/engine.rb
43
+ - lib/tramway/site/generates/install_generator.rb
44
+ - lib/tramway/site/generates/templates/add_main_image_tramway_site_people.rb
45
+ - lib/tramway/site/generates/templates/create_tramway_site_people.rb
46
+ - lib/tramway/site/version.rb
20
47
  homepage: https://github.com/ulmic/tramway-dev
21
48
  licenses:
22
49
  - MIT
@@ -36,8 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
63
  - !ruby/object:Gem::Version
37
64
  version: '0'
38
65
  requirements: []
39
- rubyforge_project:
40
- rubygems_version: 2.7.6
66
+ rubygems_version: 3.1.2
41
67
  signing_key:
42
68
  specification_version: 4
43
69
  summary: Rails engine for person site