tramway-core 0.2 → 1.0

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: f1fdd99b3bcf9ff2140b9cb18f1312eaf6ec59148a3ae8041d6ec5645be035a4
4
- data.tar.gz: f7646bb17b0dc8ddfcbbadc4e7f5b15f6b2b0bfd26cb2946e4787ed5ad8bc29b
3
+ metadata.gz: bfd6033a88454598b04b674d5533289b18d128c4f4011b47f312dfedbdcc49e0
4
+ data.tar.gz: c850087d3845cf990ac1ef8da5c874f53f2dfd7c2d5bb94fa17a663976a31098
5
5
  SHA512:
6
- metadata.gz: f9cddd8d4a8765d39ca37c2498f5a4b41db1ad455ea7153968077460a1e6db3c8659aa32e98cc1b17b2bb6e2578e12f313d895c84c4254d86daea1fa26bf9550
7
- data.tar.gz: 6d23dd21b4b146b15fe7ff2654321e3262899e91646b88e84739a27f615a80fad5ff8232ac367dc0cfc217f703a8e2578a0ba78b922e54f662618b15f0d7425c
6
+ metadata.gz: f7cb2c5f6daeac2cf88b66725956a24e8386400d8a0e764c7c3c61a367ecfac2bdc000b015e35f157eb7998f08e3b9c5f2e53b0651c0baf1ea625e9fbfbbecf1
7
+ data.tar.gz: 6ff73a44b73b9e1b9b38ae8f3ade5a0a38992f8dc24885be6b813036c17d4c75553e7059cab82598bad6ec535d224d41d1ca645673a618bd72d6c8e4ee243c5a
data/README.md CHANGED
@@ -1,26 +1,35 @@
1
1
  # Tramway::Core
2
- Short description and motivation.
3
2
 
4
- ## Usage
5
- How to use my plugin.
3
+ *If you need translation of this Readme, please message us kalashnikov@ulmic.ru. We'll translate for you and post to this page*
6
4
 
7
- ## Installation
8
- Add this line to your application's Gemfile:
5
+ tramway-core - это ядро проекта [tramway](https://github.com/ulmic/tramway)
9
6
 
10
- ```ruby
11
- gem 'tramway-core'
12
- ```
7
+ Этот гем предоставляет базовые классы и реализации для других шаблонов Tramway. Как правило, каждый шаблон Tramway должен иметь в зависимостях последнюю версию гема `tramway-core`.
13
8
 
14
- And then execute:
15
- ```bash
16
- $ bundle
17
- ```
9
+ # Installation
18
10
 
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install tramway-core
11
+ ```shell
12
+ gem install tramway-core
13
+ rails g tramway:core:install
22
14
  ```
23
15
 
16
+ # Базовые классы
17
+
18
+ * ApplicationDecorator - Базовый класс декоратора. В него по умолчанию включены `ActionView::Helpers` и `ActionView::Context` и `FontAwesome`. `FontAwesome` считается в `Tramway` основным шрифтом для иконок.
19
+ * ApplicationForm - наследованный от Reform::Form класс форм.
20
+ * ApplicationRecord - базовый класс для AR моделей
21
+ * ApplicationUploader - базовый класс для Carrierwave аплоадеров.
22
+ * FileUploader - базовый класс для загрузки файлов
23
+ * PhotoUploader - базовый класс для загрузки фотографий
24
+ * Вьюха `_messages` - предоставляет отображение ошибок в форме. Совместима с AR и Reform
25
+
26
+ # Локализация
27
+
28
+ * dates - правила локализации даты
29
+ * helpers - часто используемые в формах слова
30
+ * models - часто используемые в моделях слова
31
+ * state_machines - локализация состояний
32
+
24
33
  ## Contributing
25
34
  Contribution directions go here.
26
35
 
@@ -6,7 +6,7 @@ class PhotoUploader < ApplicationUploader
6
6
  end
7
7
 
8
8
  def url
9
- if File.exist? file.file
9
+ if file.present? && File.exist?(file.file)
10
10
  file.file.match(/\/system\/uploads\/.*/).to_s
11
11
  else
12
12
  "/assets/tramway/core/mona_lisa_from_prado_square.jpg"
@@ -21,6 +21,16 @@ class PhotoUploader < ApplicationUploader
21
21
  process :resize_to_fill => [100, 100]
22
22
  end
23
23
 
24
+ # FIXME move to tramway-landing uploader
25
+ version :card do
26
+ process resize_to_fill: [400, 400, 'North']
27
+ end
28
+
29
+ # FIXME move to tramway-landing uploader
30
+ version :horizontal do
31
+ process resize_to_fill: [800, 350, 'North']
32
+ end
33
+
24
34
  attr_reader :width, :height
25
35
 
26
36
  before :cache, :capture_size
@@ -0,0 +1,3 @@
1
+ class Tramway::Core::Application
2
+ attr_accessor :name, :url, :model_class
3
+ end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Core
3
- VERSION = '0.2'
3
+ VERSION = '1.0'
4
4
  end
5
5
  end
data/lib/tramway/core.rb CHANGED
@@ -1,7 +1,20 @@
1
1
  require "tramway/core/engine"
2
2
  require 'tramway/core/generators/install_generator'
3
+ require 'tramway/core/application'
3
4
 
4
5
  module Tramway
5
6
  module Core
7
+ class << self
8
+ def initialize_application(**options)
9
+ @application ||= Tramway::Core::Application.new
10
+ options.each do |attr, value|
11
+ @application.send "#{attr}=", value
12
+ end
13
+ end
14
+
15
+ def application
16
+ @application
17
+ end
18
+ end
6
19
  end
7
20
  end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-core
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
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-02-01 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 5.1.4
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 5.1.4
27
- - !ruby/object:Gem::Dependency
28
- name: pg
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
+ dependencies: []
41
13
  description: Core for all Tramway Rails Engines
42
14
  email:
43
15
  - kalashnikovisme@gmail.com
@@ -54,21 +26,14 @@ files:
54
26
  - app/assets/javascripts/tramway/core/application.js.coffee
55
27
  - app/assets/javascripts/tramway/core/web/application.js
56
28
  - app/assets/stylesheets/tramway/core/application.css.sass
57
- - app/controllers/tramway/core/application_controller.rb
58
- - app/controllers/tramway/core/web/application_controller.rb
59
29
  - app/decorators/tramway/core/application_decorated_collection.rb
60
30
  - app/decorators/tramway/core/application_decorator.rb
61
31
  - app/forms/tramway/core/application_form.rb
62
- - app/helpers/tramway/core/application_helper.rb
63
- - app/helpers/tramway/core/web/application_helper.rb
64
- - app/jobs/tramway/core/application_job.rb
65
- - app/mailers/tramway/core/application_mailer.rb
66
32
  - app/models/tramway/core/application_record.rb
67
33
  - app/uploaders/application_uploader.rb
68
34
  - app/uploaders/file_uploader.rb
69
35
  - app/uploaders/image_defaults.rb
70
36
  - app/uploaders/photo_uploader.rb
71
- - app/views/layouts/tramway/core/application.html.erb
72
37
  - app/views/tramway/core/shared/_messages.html.haml
73
38
  - config/locales/ru/dates.yml
74
39
  - config/locales/ru/helpers.yml
@@ -77,6 +42,7 @@ files:
77
42
  - config/routes.rb
78
43
  - lib/tasks/tramway/core_tasks.rake
79
44
  - lib/tramway/core.rb
45
+ - lib/tramway/core/application.rb
80
46
  - lib/tramway/core/engine.rb
81
47
  - lib/tramway/core/generators/install_generator.rb
82
48
  - lib/tramway/core/generators/templates/initializers/simple_form.rb
@@ -1,7 +0,0 @@
1
- module Tramway
2
- module Core
3
- class ApplicationController < ActionController::Base
4
- protect_from_forgery with: :exception
5
- end
6
- end
7
- end
@@ -1,4 +0,0 @@
1
- require_dependency "tramway/core/application_controller"
2
-
3
- class Tramway::Core::Web::ApplicationController < ApplicationController
4
- end
@@ -1,6 +0,0 @@
1
- module Tramway
2
- module Core
3
- module ApplicationHelper
4
- end
5
- end
6
- end
@@ -1,4 +0,0 @@
1
- module Tramway::Core
2
- module Web::ApplicationHelper
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module Tramway
2
- module Core
3
- class ApplicationJob < ActiveJob::Base
4
- end
5
- end
6
- end
@@ -1,8 +0,0 @@
1
- module Tramway
2
- module Core
3
- class ApplicationMailer < ActionMailer::Base
4
- default from: 'from@example.com'
5
- layout 'mailer'
6
- end
7
- end
8
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Tramway core</title>
5
- <%= stylesheet_link_tag "tramway/core/application", media: "all" %>
6
- <%= javascript_include_tag "tramway/core/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>