tramway-core 1.18.5.2 → 1.18.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6099966ec764bed33f2ff047144f9bde9057da2740626df9dd7070658ea54b8a
|
4
|
+
data.tar.gz: 95215f84be2eed817f5a6d4741aadb8d68d9a66de216be52c994e0eabca50cf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8259a4092c24557aeb828575a7966634ae8a707beac890737fdf5630735e534193c3820a0c14a27dec54d0daf1b2a210266f881ce12631364782fa8298e233dc
|
7
|
+
data.tar.gz: b41e199f893ec054da4d5d1e9716d841acea37e155d6019792b9eb4009c651ad84b33231eaccc8643975ec800e7eca6276744cc32a31c628b11c27a0b5de2dd9
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Tramway::Core ![Ruby](https://github.com/Purple-Magic/tramway-core/workflows/Tests/badge.svg) ![Ruby](https://github.com/Purple-Magic/tramway-core/workflows/Rubocop/badge.svg) [![Gem Version](https://badge.fury.io/rb/tramway-core.svg)](https://badge.fury.io/rb/tramway-core)
|
1
|
+
# ![tramway-ico](https://raw.githubusercontent.com/kalashnikovisme/kalashnikovisme/master/%D1%82%D1%80%D1%8D%D0%BC%D0%B2%D1%8D%D0%B9%D0%B1%D0%B5%D0%B7%D1%84%D0%BE%D0%BD%D0%B0-min.png) Tramway::Core ![Ruby](https://github.com/Purple-Magic/tramway-core/workflows/Tests/badge.svg) ![Ruby](https://github.com/Purple-Magic/tramway-core/workflows/Rubocop/badge.svg) [![Gem Version](https://badge.fury.io/rb/tramway-core.svg)](https://badge.fury.io/rb/tramway-core)
|
2
2
|
|
3
3
|
*If you need translation of this Readme, please message us kalashnikov@ulmic.ru. We'll translate for you and post to this page*
|
4
4
|
|
@@ -22,7 +22,7 @@ rails g tramway:core:install
|
|
22
22
|
*config/initializers/tramway.rb*
|
23
23
|
```ruby
|
24
24
|
# Initialize application with name
|
25
|
-
Tramway::Core.initialize_application name:
|
25
|
+
Tramway::Core.initialize_application name: :your_application_name
|
26
26
|
|
27
27
|
# Initialize application name with model_class. Model class must be a singlethon
|
28
28
|
Tramway::Core.initialize_application model_class: ::Tramway::Conference::Unity # example was taken from tramway-conference gem
|
@@ -32,6 +32,64 @@ Tramway::Core.initialize_application model_class: ::Tramway::Conference::Unity #
|
|
32
32
|
```ruby
|
33
33
|
Rails.application.config.assets.precompile += %w( *.jpg *.png *.js )
|
34
34
|
```
|
35
|
+
|
36
|
+
#### Every Tramway application need initialized @application object (or if you create Tramway plugin, it should be @application_engine object).
|
37
|
+
|
38
|
+
You don't need to initialize this object yourself, just configurate application with Tramway. You have **2** options of this:
|
39
|
+
|
40
|
+
## Option 1. If you want to change @application object just in the code base.
|
41
|
+
|
42
|
+
```shell
|
43
|
+
rails g tramway:core:install
|
44
|
+
```
|
45
|
+
|
46
|
+
*config/initializers/tramway.rb*
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
Tramway::Core.initialize_application name: :your_application_name
|
50
|
+
```
|
51
|
+
|
52
|
+
## Option 2. If you want to change @application object from admin panel. How to create model that will be an Application Model for the Tramway
|
53
|
+
|
54
|
+
#### 1. Generate model that you to use. We create Organization, for example
|
55
|
+
|
56
|
+
```shell
|
57
|
+
rails g tramway:core:application
|
58
|
+
rails db:migrate
|
59
|
+
```
|
60
|
+
|
61
|
+
#### 2. Add model_class to Initializer
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
Tramway::Core.initialize_application model_class: Organization
|
65
|
+
```
|
66
|
+
|
67
|
+
#### 3. Create 1 instance of Organization model
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
rails c
|
71
|
+
Organization.create! public_name: 'Tramway', name: :organization, tagline: 'Tramway is not buggy, LOL!', main_image: 'https://raw.githubusercontent.com/ulmic/tramway-dev/develop/logo.png'
|
72
|
+
```
|
73
|
+
|
74
|
+
#### 4. Add model to singleton to the `tramway-admin` admin panel to be able to change its data
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
Tramway::Admin.set_singleton_models Organization, project: :organization # now you should use organization.name here
|
78
|
+
```
|
79
|
+
|
80
|
+
#### 5. Then continue configuration of your model in admin panel with tramway-admin gem [instruction, starting from point 8](https://github.com/ulmic/tramway-dev/tree/develop/tramway-admin#8-configurate-navbar)
|
81
|
+
|
82
|
+
#### 6. Now you are able to change your application main info in admin panel
|
83
|
+
|
84
|
+
## How-to
|
85
|
+
|
86
|
+
### add favicon to your application
|
87
|
+
|
88
|
+
*config/initializers/tramway.rb*
|
89
|
+
```ruby
|
90
|
+
::Tramway::Core.initialize_application attribute1: value, another_attribute: another_value, favicon: `/icon.ico` # icon should be in public folder
|
91
|
+
```
|
92
|
+
|
35
93
|
# Usage
|
36
94
|
|
37
95
|
## Tramway::Core::ApplicationRecord
|
@@ -177,54 +235,6 @@ Something like this:
|
|
177
235
|
copy_to_clipboard "some_id" # some_id is HTML id of element. Content of this element will be copied to the clipboard after pressing the button
|
178
236
|
```
|
179
237
|
|
180
|
-
# Every Tramway application need initialized @application object (or if you create Tramway plugin, it should be @application_engine object).
|
181
|
-
|
182
|
-
You don't need to initialize this object yourself, just configurate application with Tramway. You have **2** options of this:
|
183
|
-
|
184
|
-
## Option 1. If you want to change @application object just in the code base.
|
185
|
-
|
186
|
-
```shell
|
187
|
-
rails g tramway:core:application
|
188
|
-
```
|
189
|
-
|
190
|
-
*config/initializers/tramway.rb*
|
191
|
-
|
192
|
-
```ruby
|
193
|
-
Tramway::Core.initialize_application name: :your_application_name
|
194
|
-
```
|
195
|
-
|
196
|
-
## Option 2. If you want to change @application object from admin panel. How to create model that will be an Application Model for the Tramway
|
197
|
-
|
198
|
-
#### 1. Generate model that you to use. We create Organization, for example
|
199
|
-
|
200
|
-
```shell
|
201
|
-
rails g tramway:core:application
|
202
|
-
rails db:migrate
|
203
|
-
```
|
204
|
-
|
205
|
-
#### 2. Add model_class to Initializer
|
206
|
-
|
207
|
-
```ruby
|
208
|
-
Tramway::Core.initialize_application model_class: Organization
|
209
|
-
```
|
210
|
-
|
211
|
-
#### 3. Create 1 instance of Organization model
|
212
|
-
|
213
|
-
```ruby
|
214
|
-
rails c
|
215
|
-
Organization.create! public_name: 'Tramway', name: :organization, tagline: 'Tramway is not buggy, LOL!', main_image: 'https://raw.githubusercontent.com/ulmic/tramway-dev/develop/logo.png'
|
216
|
-
```
|
217
|
-
|
218
|
-
#### 4. Add model to singleton to the `tramway-admin` admin panel to be able to change its data
|
219
|
-
|
220
|
-
```ruby
|
221
|
-
Tramway::Admin.set_singleton_models Organization, project: :organization # now you should use organization.name here
|
222
|
-
```
|
223
|
-
|
224
|
-
#### 5. Then continue configuration of your model in admin panel with tramway-admin gem [instruction, starting from point 8](https://github.com/ulmic/tramway-dev/tree/develop/tramway-admin#8-configurate-navbar)
|
225
|
-
|
226
|
-
#### 6. Now you are able to change your application main info in admin panel
|
227
|
-
|
228
238
|
## In Russian
|
229
239
|
|
230
240
|
# Базовые классы
|
@@ -251,7 +261,13 @@ Tramway::Admin.set_singleton_models Organization, project: :organization # now y
|
|
251
261
|
* [Pavel Kalashnikov](https://github.com/kalashnikovisme)
|
252
262
|
* [moshinaan](https://github.com/moshinaan)
|
253
263
|
|
254
|
-
###
|
264
|
+
### Run tests
|
265
|
+
|
266
|
+
```shell
|
267
|
+
make test
|
268
|
+
```
|
269
|
+
|
270
|
+
### Deployment workflow
|
255
271
|
|
256
272
|
#### If you don't have access to push gem to rubygems then
|
257
273
|
|
@@ -20,7 +20,7 @@ class Tramway::Core::ApplicationRecord < ActiveRecord::Base
|
|
20
20
|
scope :created_by_user, lambda { |user_id|
|
21
21
|
joins(:audits).where('audits.action = \'create\' AND audits.user_id = ?', user_id)
|
22
22
|
}
|
23
|
-
scope :admin_scope, ->(_arg) { all }
|
23
|
+
scope :admin_scope, -> (_arg) { all }
|
24
24
|
|
25
25
|
include ::PgSearch::Model
|
26
26
|
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: audited
|