biovision 0.1.210414.0 → 0.3.210504.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -34
- data/app/assets/stylesheets/biovision/admin/components.scss +10 -0
- data/app/assets/stylesheets/biovision/admin/components/users.scss +4 -0
- data/app/assets/stylesheets/biovision/admin/layout.scss +0 -8
- data/app/assets/stylesheets/biovision/biovision.scss +8 -0
- data/app/assets/stylesheets/biovision/components.scss +1 -0
- data/app/assets/stylesheets/biovision/components/filters.scss +41 -0
- data/app/assets/stylesheets/biovision/components/forms.scss +16 -0
- data/app/assets/stylesheets/biovision/components/quick_search.scss +24 -0
- data/app/assets/stylesheets/biovision/default.scss +4 -4
- data/app/assets/stylesheets/biovision/themes/default_theme.scss +0 -1
- data/app/assets/stylesheets/biovision/themes/default_theme/layout.scss +6 -3
- data/app/assets/stylesheets/biovision/themes/default_theme/layout/footer.scss +3 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout/header.scss +2 -0
- data/app/assets/stylesheets/biovision/vars.scss +5 -0
- data/app/controllers/admin/components_controller.rb +25 -79
- data/app/controllers/admin/dynamic_pages_controller.rb +1 -1
- data/app/controllers/admin/index_controller.rb +8 -2
- data/app/controllers/admin/navigation_groups_controller.rb +31 -0
- data/app/controllers/admin/tokens_controller.rb +15 -0
- data/app/controllers/admin/users_controller.rb +33 -3
- data/app/controllers/admin_controller.rb +15 -2
- data/app/controllers/concerns/crud_entities.rb +13 -13
- data/app/controllers/contact_controller.rb +1 -1
- data/app/helpers/biovision_components_helper.rb +7 -3
- data/app/lib/biovision/components/base/component_parameters.rb +8 -0
- data/app/lib/biovision/components/base/component_privileges.rb +26 -17
- data/app/lib/biovision/components/base/component_settings.rb +8 -0
- data/app/lib/biovision/components/base_component.rb +20 -23
- data/app/lib/biovision/components/contact_component.rb +5 -1
- data/app/lib/biovision/components/content_component.rb +36 -10
- data/app/lib/biovision/components/track_component.rb +1 -1
- data/app/lib/biovision/components/users_component.rb +28 -2
- data/app/lib/biovision/helpers/data_helper.rb +43 -0
- data/app/lib/biovision/migrations/component_migration.rb +54 -0
- data/app/mailers/feedback_mailer.rb +14 -0
- data/app/models/biovision_component.rb +3 -0
- data/app/models/browser.rb +1 -1
- data/app/models/code.rb +2 -2
- data/app/models/concerns/tree_structure.rb +2 -1
- data/app/models/contact_method.rb +1 -1
- data/app/models/contact_type.rb +1 -1
- data/app/models/dynamic_block.rb +1 -1
- data/app/models/dynamic_page.rb +3 -1
- data/app/models/feedback_message.rb +7 -1
- data/app/models/feedback_response.rb +2 -2
- data/app/models/navigation_group.rb +11 -1
- data/app/models/role.rb +44 -6
- data/app/models/simple_image.rb +1 -1
- data/app/models/simple_image_tag.rb +1 -1
- data/app/models/token.rb +6 -2
- data/app/models/user.rb +25 -10
- data/app/uploaders/simple_file_uploader.rb +1 -1
- data/app/views/admin/components/_list.html.erb +1 -1
- data/app/views/admin/components/entity/_links.html.erb +31 -21
- data/app/views/admin/components/links/_base.html.erb +1 -0
- data/app/views/admin/components/settings.html.erb +2 -1
- data/app/views/admin/components/settings/_settings.html.erb +3 -3
- data/app/views/admin/dynamic_blocks/entity/_in_list.html.erb +6 -4
- data/app/views/admin/dynamic_blocks/index.html.erb +5 -3
- data/app/views/admin/dynamic_blocks/show.html.erb +6 -4
- data/app/views/admin/dynamic_pages/_dynamic_page.jbuilder +18 -0
- data/app/views/admin/dynamic_pages/entity/_in_list.html.erb +4 -2
- data/app/views/admin/dynamic_pages/entity/_in_search.html.erb +7 -0
- data/app/views/admin/dynamic_pages/index.html.erb +11 -4
- data/app/views/admin/dynamic_pages/search.jbuilder +4 -0
- data/app/views/admin/dynamic_pages/show.html.erb +1 -1
- data/app/views/admin/index/index.html.erb +7 -5
- data/app/views/admin/navigation_group_pages/entity/_in_list.html.erb +26 -0
- data/app/views/admin/navigation_groups/entity/_dynamic_pages.html.erb +38 -0
- data/app/views/admin/navigation_groups/entity/_in_list.html.erb +6 -4
- data/app/views/admin/navigation_groups/index.html.erb +11 -4
- data/app/views/admin/navigation_groups/show.html.erb +16 -3
- data/app/views/admin/tokens/_form.html.erb +31 -0
- data/app/views/admin/tokens/_nav_item.html.erb +6 -0
- data/app/views/admin/tokens/entity/_in_list.html.erb +27 -0
- data/app/views/admin/tokens/index.html.erb +16 -0
- data/app/views/admin/tokens/show.html.erb +26 -0
- data/app/views/admin/users/_user.jbuilder +18 -0
- data/app/views/admin/users/entity/_in_list.html.erb +3 -1
- data/app/views/admin/users/entity/_in_search.html.erb +18 -0
- data/app/views/admin/users/index.html.erb +13 -4
- data/app/views/admin/users/roles.html.erb +23 -0
- data/app/views/admin/users/roles/_component.html.erb +22 -0
- data/app/views/admin/users/search.jbuilder +4 -0
- data/app/views/admin/users/show.html.erb +14 -2
- data/app/views/admin/widgets/_filters.html.erb +15 -0
- data/app/views/admin/widgets/_quick_search.html.erb +13 -0
- data/app/views/admin/widgets/filters/_flag.html.erb +15 -0
- data/app/views/components/content/_dynamic_page.html.erb +6 -10
- data/app/views/components/content/_dynamic_page_content.html.erb +14 -0
- data/app/views/contact/_form.html.erb +1 -1
- data/app/views/feedback_mailer/new_feedback_request.html.erb +11 -0
- data/app/views/feedback_mailer/new_feedback_request.text.erb +6 -0
- data/app/views/index/index.html.erb +14 -0
- data/app/views/layouts/admin.html.erb +0 -1
- data/app/views/layouts/application/_footer.html.erb +1 -1
- data/app/views/my/index/index.html.erb +26 -0
- data/app/views/shared/entity/_time_field.html.erb +6 -0
- data/app/views/shared/entity/_track.html.erb +12 -0
- data/app/views/shared/entity/_tree_caches.html.erb +8 -1
- data/app/views/shared/entity/edit.html.erb +5 -3
- data/app/views/shared/forms/_simple_image.html.erb +12 -4
- data/config/locales/biovision-ru.yml +14 -1
- data/config/locales/components-ru.yml +4 -2
- data/config/locales/contact-ru.yml +4 -0
- data/config/locales/content-ru.yml +4 -0
- data/config/locales/users-ru.yml +27 -5
- data/config/routes.rb +14 -4
- data/db/migrate/20191228000000_create_biovision_components.rb +2 -0
- data/db/migrate/20200224000000_create_track_component.rb +8 -12
- data/db/migrate/20200224000010_create_users_component.rb +10 -40
- data/db/migrate/20210405000000_create_acl.rb +15 -0
- data/db/migrate/{20200529000000_create_content_component.rb → 20210421000000_create_content_component.rb} +3 -18
- data/db/migrate/{20210401000000_create_contact_component.rb → 20210421000010_create_contact_component.rb} +1 -22
- data/lib/biovision/version.rb +1 -1
- metadata +34 -13
- data/app/lib/biovision/components/base/privilege_handler.rb +0 -79
- data/app/views/admin/components/links/_content.html.erb +0 -9
- data/app/views/admin/components/links/_track.html.erb +0 -2
- data/app/views/admin/components/links/_users.html.erb +0 -4
- data/app/views/admin/components/links/extra/_content.html.erb +0 -0
- data/app/views/admin/components/privileges.html.erb +0 -20
- data/app/views/admin/components/privileges/_component_user.html.erb +0 -17
- data/app/views/admin/components/privileges/_links.html.erb +0 -17
- data/app/views/admin/components/privileges/_users.html.erb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a682ae1c69e46f123d36b657ad1ebc715b5dc5bce649cf60d84c59fcc3999655
|
4
|
+
data.tar.gz: 1b4414bb33c19ad803dd256fdcc7a60ca3c4d069400426648350664e3ace6345
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a4f2e672b7234fb8b7c928d5014feec672a5fdbfe534c010edad2e331d4f630d253b10f697429fff8b5454f63db1905e317ea3ca93f1bc9eaa7a02064f14c98
|
7
|
+
data.tar.gz: 674321c7eaa0df820c0df3b07b8adbc89e3391e81412845022757a6a8311670f1f2b10f0106d963c927b206df2409356719299c488b45e1cb3e5ba94a6f2c6ed
|
data/README.md
CHANGED
@@ -22,8 +22,8 @@
|
|
22
22
|
|
23
23
|
Ещё нужно поменять `example.com` на актуальное название.
|
24
24
|
|
25
|
-
Также стоит удалить `app/assets/application.css`, так как используется scss,
|
26
|
-
и локаль `config/locales/en.yml`, если не планируется использование английской
|
25
|
+
Также стоит удалить `app/assets/application.css`, так как используется scss,
|
26
|
+
и локаль `config/locales/en.yml`, если не планируется использование английской
|
27
27
|
локали.
|
28
28
|
|
29
29
|
## Добавления в `Gemfile`
|
@@ -49,15 +49,15 @@ end
|
|
49
49
|
|
50
50
|
## Изменения в `config/environments/production.rb`
|
51
51
|
|
52
|
-
Нужно раскомментировать строку `config.require_master_key = true` (на момент
|
52
|
+
Нужно раскомментировать строку `config.require_master_key = true` (на момент
|
53
53
|
написания это `21` строка).
|
54
54
|
|
55
|
-
Нужно выставить уровень сообщения об ошибках в `:warn`
|
55
|
+
Нужно выставить уровень сообщения об ошибках в `:warn`
|
56
56
|
(`config.log_level = :warn` в районе `53` строки).
|
57
57
|
|
58
58
|
## Изменения в `app/mailers/application_mailer.rb`
|
59
59
|
|
60
|
-
Нужно удалить строку с отправителем по умолчанию
|
60
|
+
Нужно удалить строку с отправителем по умолчанию
|
61
61
|
(`default from: 'from@example.com'`), иначе при отправке писем в бою будет
|
62
62
|
ошибка с неправильным отправителем, независимо от того, что написано
|
63
63
|
в конфигурации в `production.rb`.
|
@@ -75,7 +75,7 @@ default: &default
|
|
75
75
|
development:
|
76
76
|
<<: *default
|
77
77
|
database: example # Поменять на актуальное название
|
78
|
-
|
78
|
+
|
79
79
|
test:
|
80
80
|
<<: *default
|
81
81
|
database: example_test # Такое же, как в development, но с приставкой _test
|
@@ -94,7 +94,7 @@ production:
|
|
94
94
|
задан как UTC.
|
95
95
|
|
96
96
|
```ruby
|
97
|
-
|
97
|
+
config.time_zone = 'Moscow'
|
98
98
|
```
|
99
99
|
|
100
100
|
## Добавления в `config/application_controller.rb`
|
@@ -102,9 +102,10 @@ production:
|
|
102
102
|
Добавить это в начале класса.
|
103
103
|
|
104
104
|
```ruby
|
105
|
-
|
106
|
-
|
107
|
-
|
105
|
+
|
106
|
+
def default_url_options
|
107
|
+
params.key?(:locale) ? { locale: I18n.locale } : {}
|
108
|
+
end
|
108
109
|
```
|
109
110
|
|
110
111
|
## Добавления в `package.json` и `application.js`
|
@@ -112,42 +113,48 @@ production:
|
|
112
113
|
Нужно добавить `@biovivion/biovision`, чтобы работал JS на клиентской стороне
|
113
114
|
(`yarn add @biovision/biovision`).
|
114
115
|
|
115
|
-
В `pack/javascripts/application.js` нужно добавить
|
116
|
+
В `pack/javascripts/application.js` нужно добавить
|
116
117
|
`require("@biovision/biovision")`.
|
117
118
|
|
118
119
|
## Добавления в `config/routes.rb`
|
119
120
|
|
120
121
|
```ruby
|
121
|
-
concern :check do
|
122
|
-
post :check, on: :collection, defaults: { format: :json }
|
123
|
-
end
|
124
122
|
|
125
|
-
|
126
|
-
|
127
|
-
|
123
|
+
concern :check do
|
124
|
+
post :check, on: :collection, defaults: { format: :json }
|
125
|
+
end
|
128
126
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
127
|
+
concern :toggle do
|
128
|
+
post :toggle, on: :member, defaults: { format: :json }
|
129
|
+
end
|
130
|
+
|
131
|
+
concern :priority do
|
132
|
+
post :priority, on: :member, defaults: { format: :json }
|
133
|
+
end
|
134
|
+
|
135
|
+
concern :search do
|
136
|
+
get :search, on: :collection
|
137
|
+
end
|
138
|
+
|
139
|
+
root 'index#index'
|
134
140
|
```
|
135
141
|
|
136
142
|
## Дополнения в config/puma.rb
|
137
143
|
|
138
|
-
Нужно обязательно закомментировать строку с портом, так как используется сокет.
|
139
|
-
На момент написания документации это `12` строка:
|
144
|
+
Нужно обязательно закомментировать строку с портом, так как используется сокет.
|
145
|
+
На момент написания документации это `12` строка:
|
140
146
|
`port ENV.fetch("PORT") { 3000 }`
|
141
147
|
|
142
148
|
```ruby
|
149
|
+
|
143
150
|
if ENV['RAILS_ENV'] == 'production'
|
144
151
|
shared_path = '/var/www/example.com/shared'
|
145
|
-
logs_dir
|
152
|
+
logs_dir = "#{shared_path}/log"
|
146
153
|
|
147
154
|
state_path "#{shared_path}/tmp/puma/state"
|
148
155
|
bind "unix://#{shared_path}/tmp/puma.sock"
|
149
156
|
stdout_redirect "#{logs_dir}/stdout.log", "#{logs_dir}/stderr.log", true
|
150
|
-
|
157
|
+
|
151
158
|
activate_control_app
|
152
159
|
end
|
153
160
|
```
|
@@ -169,8 +176,8 @@ bundle binstubs bundler --force
|
|
169
176
|
bundle binstub puma
|
170
177
|
```
|
171
178
|
|
172
|
-
Также имеет смысл запустить `EDITOR=vim rails credentials:edit`, чтобы создать
|
173
|
-
зашированный файл с ключом шифрования сессии (чтобы выйти из vim с сохранением,
|
179
|
+
Также имеет смысл запустить `EDITOR=vim rails credentials:edit`, чтобы создать
|
180
|
+
зашированный файл с ключом шифрования сессии (чтобы выйти из vim с сохранением,
|
174
181
|
надо нажать `esc` и набрать `:wq`).
|
175
182
|
|
176
183
|
Чтобы проходила сборка на сервере, следует запустить эту команду:
|
@@ -189,7 +196,7 @@ sudo su postgres
|
|
189
196
|
createuser -d -P example
|
190
197
|
```
|
191
198
|
|
192
|
-
Для создания БД (заменить `example` на пользователя из `config/database.yml`
|
199
|
+
Для создания БД (заменить `example` на пользователя из `config/database.yml`
|
193
200
|
из раздела `production`):
|
194
201
|
|
195
202
|
```bash
|
@@ -202,11 +209,11 @@ create database example template template0 encoding='UTF8' LC_COLLATE='ru_RU.UTF
|
|
202
209
|
|
203
210
|
## Настройка отгрузки через mina
|
204
211
|
|
205
|
-
Для начала надо запустить в консоли `mina init`. После этого внести изменения
|
212
|
+
Для начала надо запустить в консоли `mina init`. После этого внести изменения
|
206
213
|
в `config/deploy.rb`.
|
207
214
|
|
208
215
|
В начале и середине файла раскомментировать то, что относится к `rbenv`.
|
209
|
-
Кроме того, следует проверить настройки соединения по SSH
|
216
|
+
Кроме того, следует проверить настройки соединения по SSH
|
210
217
|
(`set :user, 'developer`).
|
211
218
|
|
212
219
|
Для `shared_dirs` и `shared_files` задать примерно такой вид.
|
@@ -236,7 +243,7 @@ namespace :nvm do
|
|
236
243
|
end
|
237
244
|
```
|
238
245
|
|
239
|
-
На серверной стороне нужно создать папку для пумы и файла с ключом шифрования:
|
246
|
+
На серверной стороне нужно создать папку для пумы и файла с ключом шифрования:
|
240
247
|
|
241
248
|
```bash
|
242
249
|
mkdir -p /var/www/example.com/shared/tmp/puma
|
@@ -244,7 +251,7 @@ mkdir -p /var/www/example.com/shared/tmp/pids
|
|
244
251
|
mkdir -p /var/www/example.com/shared/config
|
245
252
|
```
|
246
253
|
|
247
|
-
После этого локально запустить `mina setup`. Для нормальной работы нужно
|
254
|
+
После этого локально запустить `mina setup`. Для нормальной работы нужно
|
248
255
|
не забыть скопировать на сервер `.env` и `config/master.key`.
|
249
256
|
|
250
257
|
```bash
|
@@ -253,4 +260,6 @@ scp config/master.key biovision:/var/www/example.com/shared/config
|
|
253
260
|
```
|
254
261
|
|
255
262
|
## License
|
256
|
-
|
263
|
+
|
264
|
+
The gem is available as open source under the terms of
|
265
|
+
the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -58,4 +58,14 @@
|
|
58
58
|
}
|
59
59
|
}
|
60
60
|
|
61
|
+
@import "biovision/components/forms";
|
62
|
+
@import "biovision/components/breadcrumbs";
|
63
|
+
@import "biovision/components/lists";
|
64
|
+
@import "biovision/components/buttons";
|
65
|
+
@import "biovision/components/messages";
|
66
|
+
@import "biovision/components/simple_image";
|
67
|
+
@import "biovision/components/toggleable";
|
68
|
+
@import "biovision/components/pagination";
|
69
|
+
@import "biovision/components/quick_search";
|
70
|
+
@import "biovision/components/filters";
|
61
71
|
@import "biovision/admin/components/users";
|
@@ -73,12 +73,4 @@ h2 {
|
|
73
73
|
padding: var(--spacer-xs);
|
74
74
|
}
|
75
75
|
|
76
|
-
@import "biovision/components/forms";
|
77
|
-
@import "biovision/components/breadcrumbs";
|
78
|
-
@import "biovision/components/lists";
|
79
|
-
@import "biovision/components/buttons";
|
80
|
-
@import "biovision/components/messages";
|
81
|
-
@import "biovision/components/simple_image";
|
82
|
-
@import "biovision/components/toggleable";
|
83
|
-
@import "biovision/components/pagination";
|
84
76
|
@import "biovision/admin/components";
|
@@ -167,6 +167,14 @@ textarea {
|
|
167
167
|
width: 2.4rem;
|
168
168
|
}
|
169
169
|
|
170
|
+
.destroy {
|
171
|
+
background: image_url('biovision/icons/destroy.svg') no-repeat center / 1.6rem auto;
|
172
|
+
border: none;
|
173
|
+
border-radius: .4rem;
|
174
|
+
box-shadow: 0 0 .2rem hsla(0, 75%, 75%, .75);
|
175
|
+
cursor: pointer;
|
176
|
+
}
|
177
|
+
|
170
178
|
img {
|
171
179
|
height: 100%;
|
172
180
|
object-fit: contain;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
.widgets__filters {
|
2
|
+
fieldset {
|
3
|
+
box-shadow: var(--block-shadow);
|
4
|
+
}
|
5
|
+
|
6
|
+
.list {
|
7
|
+
align-items: center;
|
8
|
+
display: flex;
|
9
|
+
flex-wrap: wrap;
|
10
|
+
gap: var(--spacer-s);
|
11
|
+
}
|
12
|
+
|
13
|
+
.flag {
|
14
|
+
align-items: center;
|
15
|
+
border: var(--border-secondary);
|
16
|
+
display: flex;
|
17
|
+
gap: var(--spacer-xs);
|
18
|
+
padding: var(--spacer-xs);
|
19
|
+
}
|
20
|
+
|
21
|
+
dfn {
|
22
|
+
font-style: normal;
|
23
|
+
font-weight: 500;
|
24
|
+
|
25
|
+
&::after {
|
26
|
+
content: ':';
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
label {
|
31
|
+
padding: 0 var(--spacer-xxs);
|
32
|
+
|
33
|
+
input:checked + span {
|
34
|
+
text-decoration: underline;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
.actions {
|
39
|
+
margin-top: var(--spacer-xs);
|
40
|
+
}
|
41
|
+
}
|
@@ -142,6 +142,11 @@ form {
|
|
142
142
|
textarea {
|
143
143
|
width: 100%;
|
144
144
|
}
|
145
|
+
|
146
|
+
.secondary-data {
|
147
|
+
color: var(--text-color-secondary);
|
148
|
+
font-size: var(--font-size-decreased);
|
149
|
+
}
|
145
150
|
}
|
146
151
|
|
147
152
|
.input-select,
|
@@ -244,3 +249,14 @@ form {
|
|
244
249
|
width: 100%;
|
245
250
|
}
|
246
251
|
}
|
252
|
+
|
253
|
+
.entity-links {
|
254
|
+
list-style: none;
|
255
|
+
margin: var(--spacer-s) 0;
|
256
|
+
padding: 0 0 0 var(--spacer-s);
|
257
|
+
|
258
|
+
> li {
|
259
|
+
margin: 0;
|
260
|
+
padding: 0;
|
261
|
+
}
|
262
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
.widgets__quick-search {
|
2
|
+
--row-background-even: hsl(250, 75%, 95%);
|
3
|
+
--row-background-odd: hsl(250, 75%, 98%);
|
4
|
+
|
5
|
+
background: hsl(250, 75%, 98%);
|
6
|
+
box-shadow: var(--block-shadow);
|
7
|
+
margin: var(--spacer-s) 0 var(--spacer-m);
|
8
|
+
padding: var(--spacer-s) var(--spacer-xxs);
|
9
|
+
position: relative;
|
10
|
+
|
11
|
+
h3 {
|
12
|
+
font-weight: 400;
|
13
|
+
}
|
14
|
+
|
15
|
+
.results {
|
16
|
+
background: hsla(250, 75%, 98%, .5);
|
17
|
+
box-shadow: var(--block-shadow);
|
18
|
+
margin-top: 0;
|
19
|
+
min-width: 28rem;
|
20
|
+
position: absolute;
|
21
|
+
top: 100%;
|
22
|
+
z-index: 3;
|
23
|
+
}
|
24
|
+
}
|
@@ -41,10 +41,10 @@ $border-color-secondary: rgb(230, 230, 230) !default;
|
|
41
41
|
$border-primary: .1rem solid $border-color-primary !default;
|
42
42
|
$border-secondary: .1rem solid $border-color-secondary !default;
|
43
43
|
|
44
|
-
$
|
45
|
-
$
|
46
|
-
$
|
47
|
-
$
|
44
|
+
$layout-bg-body: #f4f4f4 linear-gradient(to top, #f4f4f4, #dfdedc) no-repeat center / cover !default;
|
45
|
+
$layout-bg-header: #fff !default;
|
46
|
+
$layout-bg-main: #fff !default;
|
47
|
+
$layout-bg-footer: #fff !default;
|
48
48
|
|
49
49
|
$link-color: rgb(20, 127, 255) !default;
|
50
50
|
$link-color-visited: rgb(20, 77, 250) !default;
|
@@ -1,6 +1,3 @@
|
|
1
|
-
@import "biovision/themes/default_theme/components";
|
2
|
-
@import "biovision/themes/default_theme/layout/header";
|
3
|
-
|
4
1
|
//* { outline: solid pink 1px }
|
5
2
|
|
6
3
|
html {
|
@@ -8,12 +5,14 @@ html {
|
|
8
5
|
}
|
9
6
|
|
10
7
|
body {
|
8
|
+
background: var(--layout-bg-body);
|
11
9
|
display: flex;
|
12
10
|
flex-direction: column;
|
13
11
|
//height: 100%;
|
14
12
|
}
|
15
13
|
|
16
14
|
#main {
|
15
|
+
background: var(--layout-bg-main);
|
17
16
|
flex: 1;
|
18
17
|
}
|
19
18
|
|
@@ -28,3 +27,7 @@ body {
|
|
28
27
|
width: 100%;
|
29
28
|
z-index: 5;
|
30
29
|
}
|
30
|
+
|
31
|
+
@import "biovision/themes/default_theme/components";
|
32
|
+
@import "biovision/themes/default_theme/layout/header";
|
33
|
+
@import "biovision/themes/default_theme/layout/footer";
|
@@ -50,4 +50,9 @@
|
|
50
50
|
--input-border-focus: #{$input-border-focus};
|
51
51
|
--input-border-invalid: #{$input-border-invalid};
|
52
52
|
--input-border-invalid-focus: #{$input-border-invalid-focus};
|
53
|
+
|
54
|
+
--layout-bg-body: #{$layout-bg-body};
|
55
|
+
--layout-bg-footer: #{$layout-bg-footer};
|
56
|
+
--layout-bg-header: #{$layout-bg-header};
|
57
|
+
--layout-bg-main: #{$layout-bg-main};
|
53
58
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Handling components
|
4
4
|
class Admin::ComponentsController < AdminController
|
5
|
-
|
5
|
+
# skip_before_action :restrict_access, only: :index
|
6
6
|
skip_before_action :verify_authenticity_token, only: :ckeditor
|
7
7
|
|
8
8
|
# get /admin/components
|
@@ -18,99 +18,38 @@ class Admin::ComponentsController < AdminController
|
|
18
18
|
|
19
19
|
# get /admin/components/:slug/settings
|
20
20
|
def settings
|
21
|
-
error = 'Viewing settings is not allowed'
|
22
|
-
handle_http_401(error) unless @handler.permit?('settings.view')
|
23
21
|
end
|
24
22
|
|
25
23
|
# patch /admin/components/:slug/settings
|
26
24
|
def update_settings
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
redirect_to(admin_component_settings_path(slug: params[:slug]))
|
32
|
-
else
|
33
|
-
handle_http_401('Changing settings is not allowed')
|
34
|
-
end
|
25
|
+
new_settings = params.dig(:component, :settings).permit!
|
26
|
+
@handler.settings = new_settings.to_h
|
27
|
+
flash[:success] = t('.success')
|
28
|
+
redirect_to(admin_component_settings_path(slug: params[:slug]))
|
35
29
|
end
|
36
30
|
|
37
31
|
# patch /admin/components/:slug/parameters
|
38
32
|
def update_parameter
|
39
|
-
|
40
|
-
|
41
|
-
value = param_from_request(:key, :value)
|
33
|
+
slug = param_from_request(:key, :slug).downcase
|
34
|
+
value = param_from_request(:key, :value)
|
42
35
|
|
43
|
-
|
44
|
-
end
|
36
|
+
@handler[slug] = value
|
45
37
|
|
46
38
|
head :no_content
|
47
39
|
end
|
48
40
|
|
49
41
|
# delete /admin/components/:slug/parameters/:parameter_slug
|
50
42
|
def delete_parameter
|
51
|
-
|
52
|
-
|
53
|
-
@handler.component.save
|
54
|
-
end
|
55
|
-
|
56
|
-
head :no_content
|
57
|
-
end
|
58
|
-
|
59
|
-
# get /admin/components/:slug/privileges
|
60
|
-
def privileges
|
61
|
-
error = 'Viewing privileges is not allowed'
|
62
|
-
handle_http_401(error) unless @handler.administrator?
|
63
|
-
end
|
64
|
-
|
65
|
-
# patch /admin/components/:slug/privileges
|
66
|
-
def update_privileges
|
67
|
-
if @handler.administrator?
|
68
|
-
user = User.find_by(id: params[:user_id])
|
69
|
-
|
70
|
-
if user.nil?
|
71
|
-
handle_http_404('Cannot find user') if user.nil?
|
72
|
-
else
|
73
|
-
@entity = @handler.user_link!(true)
|
74
|
-
end
|
75
|
-
else
|
76
|
-
handle_http_401('Updating privileges is not allowed')
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
# put /admin/components/:slug/administrators/:user_id
|
81
|
-
def add_administrator
|
82
|
-
if @handler.administrator?
|
83
|
-
@handler.user = User.find_by(id: params[:user_id])
|
84
|
-
@handler.privilege_handler.administrator!
|
85
|
-
end
|
43
|
+
@handler.component.parameters.delete(params[:parameter_slug])
|
44
|
+
@handler.component.save
|
86
45
|
|
87
46
|
head :no_content
|
88
47
|
end
|
89
48
|
|
90
|
-
# put /admin/components/:slug/administrators/:user_id
|
91
|
-
def remove_administrator
|
92
|
-
if @handler.administrator?
|
93
|
-
@handler.user = User.find_by(id: params[:user_id])
|
94
|
-
@handler.privilege_handler.not_administrator!
|
95
|
-
end
|
96
|
-
|
97
|
-
head :no_content
|
98
|
-
end
|
99
|
-
|
100
|
-
# put /admin/components/:slug/users/:user_id/privileges/:privilege_slug
|
101
|
-
def add_privilege
|
102
|
-
head :no_content
|
103
|
-
end
|
104
|
-
|
105
|
-
# put /admin/components/:slug/users/:user_id/privileges/:privilege_slug
|
106
|
-
def remove_privilege
|
107
|
-
head :no_content
|
108
|
-
end
|
109
|
-
|
110
49
|
# get /admin/components/:slug/images
|
111
50
|
def images
|
112
51
|
list = SimpleImage.in_component(@handler.component).list_for_administration
|
113
|
-
@collection =
|
52
|
+
@collection = list.page(current_page)
|
114
53
|
end
|
115
54
|
|
116
55
|
def create_image
|
@@ -144,16 +83,14 @@ class Admin::ComponentsController < AdminController
|
|
144
83
|
|
145
84
|
private
|
146
85
|
|
147
|
-
def
|
86
|
+
def restrict_access
|
148
87
|
slug = params[:slug]
|
149
88
|
@handler = Biovision::Components::BaseComponent.handler(slug, current_user)
|
150
|
-
|
89
|
+
role = action_name == 'index' ? 'components.view' : role_end_from_action
|
90
|
+
role_name = "#{@handler.slug}.#{role}"
|
91
|
+
error = t('admin.errors.unauthorized.missing_role', role: role_name)
|
151
92
|
|
152
|
-
|
153
|
-
return if current_user&.super_user?
|
154
|
-
|
155
|
-
links_exist = BiovisionComponentUser.where(user: current_user).exists?
|
156
|
-
handle_http_401('User has no component privileges') unless links_exist
|
93
|
+
handle_http_401(error) unless @handler.permit?(role)
|
157
94
|
end
|
158
95
|
|
159
96
|
def image_parameters
|
@@ -161,4 +98,13 @@ class Admin::ComponentsController < AdminController
|
|
161
98
|
parameters = params.require(:simple_image).permit(permitted)
|
162
99
|
parameters.merge(owner_for_entity(true))
|
163
100
|
end
|
101
|
+
|
102
|
+
def action_to_role_map
|
103
|
+
super.merge(
|
104
|
+
%w[images] => 'simple_images.view',
|
105
|
+
%w[create_image ckeditor] => 'simple_images.create',
|
106
|
+
%w[settings] => 'settings.view',
|
107
|
+
%w[update_settings update_parameter delete_parameter] => 'settings.edit'
|
108
|
+
)
|
109
|
+
end
|
164
110
|
end
|