tramway-site 0.1.0.1 → 0.1.0.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: 2a844549777fcd0ac88430693d91d87cde2b05ca99d242d067310fc27819a03d
4
- data.tar.gz: 36375b6664626cfc5aa9f5516361060cc9df21bc031addf9511e5fb2364e4a96
3
+ metadata.gz: 53d3f3fff069b7fa3c5365952837a45bca75bade075974835e7e03f66bf87888
4
+ data.tar.gz: 0f0e1240d06fa7d89ea85a8b543c16d38cbfe7823392e1a9fd5d1b4d47c995d6
5
5
  SHA512:
6
- metadata.gz: 247e23a9d4e1b02b1a3a8be33fbb000bd1b649ee2b6a0fff4a74538024af24a42c45d370833689d389dfbd5b520b24ad1a96fd04df26f28ce026cd0d6359748d
7
- data.tar.gz: 30290038c01cd3c82a0d0b10576a11f2f7007baf36deb1549bc8d83096ed7bcb2207f4fd3f9de84d668d7572eb47b94c47079942737bd16a605c7e5b2f802ff2
6
+ metadata.gz: 8220798ef83ae8c8926ae92c1ee80b929e63d2feeeec069fc2145e70d4dbe8be58c32e33ff3aaf5d26bbe2920fce9774debf69eb490725dbc4e4054f04a3c962
7
+ data.tar.gz: 5b409a15bcfd6b5bf38969a83ed1e3d0f719e2f7aa3f3519e08bc13bbc2607b5383edbdc594ee03e0a5f006725e4b3c7faa49f7cca614e17ee26b186d61d4846
data/MIT-LICENSE ADDED
@@ -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.
data/README.md ADDED
@@ -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).
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Tramway::Site'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+ 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,13 @@
1
+ module Tramway
2
+ module Site
3
+ class ApplicationController < Tramway::Core::ApplicationController
4
+ layout 'tramway/landing/application'
5
+ protect_from_forgery with: :exception
6
+ before_action :application
7
+
8
+ def application
9
+ @application = ::Tramway::Core.application.model_class.first
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,2 @@
1
+ class Tramway::Site::Web::ApplicationController < Tramway::Site::ApplicationController
2
+ end
@@ -0,0 +1,5 @@
1
+ class Tramway::Site::Web::WelcomeController < Tramway::Site::Web::ApplicationController
2
+ def index
3
+ @blocks = ::Tramway::Landing::BlockDecorator.decorate ::Tramway::Landing::Block.on_main_page
4
+ end
5
+ end
@@ -0,0 +1,21 @@
1
+ class Tramway::Site::PersonDecorator < Tramway::Core::ApplicationDecorator
2
+ class << self
3
+ def show_attributes
4
+ [:full_name, :short_bio, :bio, :photo]
5
+ end
6
+ end
7
+
8
+ delegate :short_bio, to: :object
9
+
10
+ def full_name
11
+ object.names.join ' '
12
+ end
13
+
14
+ def bio
15
+ raw object.bio
16
+ end
17
+
18
+ def photo
19
+ image_view object.photo
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ class Tramway::Site::PersonForm < Tramway::Core::ExtendedApplicationForm
2
+ properties :full_name, :photo, :short_bio, :bio
3
+
4
+ def initialize(object)
5
+ super(object).tap do
6
+ form_properties full_name: :string,
7
+ photo: :file,
8
+ short_bio: :string,
9
+ bio: :ckeditor
10
+ end
11
+ end
12
+
13
+ def full_name=(value)
14
+ model.names = value.split ' '
15
+ end
16
+
17
+ def full_name
18
+ model.names.join ' '
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ module Tramway
2
+ module Site
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Tramway
2
+ module Site
3
+ class ApplicationJob < ActiveJob::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ module Tramway
2
+ module Site
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: 'from@example.com'
5
+ layout 'mailer'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Tramway
2
+ module Site
3
+ class ApplicationRecord < Tramway::Core::ApplicationRecord
4
+ self.abstract_class = true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class Tramway::Site::Person < Tramway::Site::ApplicationRecord
2
+ mount_uploader :photo, PhotoUploader
3
+
4
+ def title
5
+ names.join(' ')
6
+ end
7
+ end
@@ -0,0 +1,33 @@
1
+ = content_for :head_content do
2
+ = stylesheet_link_tag 'tramway/person/application', media: 'all'
3
+ = javascript_include_tag 'tramway/person/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,2 @@
1
+ ::Tramway::Admin.set_singleton_models ::Tramway::Site::Person, project: :site
2
+ ::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: Личный сайт
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ Tramway::Site::Engine.routes.draw do
2
+ mount Tramway::Auth::Engine, at: '/auth'
3
+ mount Tramway::Admin::Engine, at: '/admin'
4
+
5
+ root to: 'web/welcome#index'
6
+ end
@@ -0,0 +1,16 @@
1
+ require 'tramway/site/engine'
2
+ require 'tramway/site/generates/install_generator'
3
+
4
+ module Tramway
5
+ module Site
6
+ class << self
7
+ def dependencies
8
+ [ :landing, :profiles ]
9
+ end
10
+
11
+ def application
12
+ :person
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ module Tramway
2
+ module Site
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Tramway::Site
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,29 @@
1
+ require 'rails/generators'
2
+ require 'tramway/core/generators/install_generator'
3
+
4
+ module Tramway::Site::Generators
5
+ class InstallGenerator < ::Tramway::Core::Generators::InstallGenerator
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def run_other_generators
10
+ generate 'tramway:user:install'
11
+ generate 'tramway:landing:install'
12
+ generate 'tramway:profiles:install'
13
+ end
14
+
15
+ def self.next_migration_number(path)
16
+ next_migration_number = current_migration_number(path) + 1
17
+ ActiveRecord::Migration.next_migration_number next_migration_number
18
+ end
19
+
20
+ def copy_migrations
21
+ migrations = [
22
+ :create_tramway_site_people
23
+ ]
24
+ migrations.each do |migration_name|
25
+ migration_template "#{migration_name}.rb", "db/migrate/#{migration_name}.rb"
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ class CreateTramwaySitePeople < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :tramway_site_people do |t|
4
+ t.text :names, array: true
5
+ t.text :short_bio
6
+ t.text :bio
7
+ t.text :photo
8
+
9
+ t.text :state, default: :active
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module Tramway
2
+ module Site
3
+ VERSION = '0.1.0.2'
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-site
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.1
4
+ version: 0.1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
@@ -16,7 +16,33 @@ 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/create_tramway_site_people.rb
45
+ - lib/tramway/site/version.rb
20
46
  homepage: https://github.com/ulmic/tramway-dev
21
47
  licenses:
22
48
  - MIT