biovision-base 0.8.170916 → 0.8.171029
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/biovision/base/placeholders/image.svg +3 -18
- data/app/assets/javascripts/biovision/base/biovision.js +228 -124
- data/app/assets/stylesheets/biovision/base/admin.scss +8 -7
- data/app/assets/stylesheets/biovision/base/biovision.scss +1 -1
- data/app/assets/stylesheets/biovision/base/default.scss +6 -3
- data/app/assets/stylesheets/biovision/base/default_admin.scss +30 -0
- data/app/assets/stylesheets/biovision/base/layout.scss +22 -14
- data/app/assets/stylesheets/biovision/base/message-box.scss +8 -1
- data/app/controllers/admin/regions_controller.rb +0 -9
- data/app/controllers/admin/users_controller.rb +2 -2
- data/app/controllers/authentication_controller.rb +4 -1
- data/app/controllers/concerns/toggleable_entity.rb +12 -3
- data/app/controllers/regions_controller.rb +1 -1
- data/app/helpers/biovision_users_helper.rb +18 -8
- data/app/models/region.rb +6 -1
- data/app/models/user.rb +3 -3
- data/app/models/user_profile.rb +8 -0
- data/app/services/canonizer.rb +9 -8
- data/app/views/admin/metrics/show.html.erb +20 -12
- data/app/views/admin/privileges/entity/_groups.html.erb +12 -10
- data/app/views/admin/regions/entity/_in_list.html.erb +1 -1
- data/app/views/admin/regions/show.html.erb +1 -1
- data/app/views/admin/users/_filter.html.erb +2 -14
- data/app/views/admin/users/index.html.erb +1 -1
- data/app/views/admin/users/privileges.html.erb +53 -38
- data/app/views/agents/_filter.html.erb +28 -28
- data/app/views/authentication/new.jbuilder +6 -0
- data/app/views/editable_pages/_editable_page.html.erb +6 -0
- data/app/views/editable_pages/form/_ckeditor.html.erb +3 -3
- data/app/views/layouts/admin.html.erb +1 -1
- data/app/views/my/recoveries/show.html.erb +1 -1
- data/app/views/shared/_breadcrumbs.html.erb +6 -0
- data/app/views/shared/_list_of_errors.html.erb +5 -9
- data/config/locales/common-ru.yml +22 -22
- data/config/locales/users-ru.yml +9 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20170301000001_create_metrics.rb +1 -1
- data/db/migrate/20170301000002_create_metric_values.rb +1 -1
- data/db/migrate/20170301000101_create_browsers.rb +1 -1
- data/db/migrate/20170301000102_create_agents.rb +1 -1
- data/db/migrate/20170301000201_create_regions.rb +4 -1
- data/db/migrate/20170302000001_create_users.rb +2 -1
- data/db/migrate/20170302000003_create_tokens.rb +1 -1
- data/db/migrate/20170302000005_create_codes.rb +1 -1
- data/db/migrate/20170302000101_create_privileges.rb +1 -1
- data/db/migrate/20170302000102_create_user_privileges.rb +1 -1
- data/db/migrate/20170302000103_create_privilege_groups.rb +1 -1
- data/db/migrate/20170302000104_create_privilege_group_privileges.rb +1 -1
- data/db/migrate/20170320000000_create_editable_pages.rb +4 -1
- data/db/migrate/20170425000001_create_foreign_sites.rb +1 -1
- data/db/migrate/20170425000002_create_foreign_users.rb +1 -1
- data/db/migrate/20171025222222_add_new_fields_171026.rb +29 -0
- data/lib/biovision/base/engine.rb +5 -0
- data/lib/biovision/base/version.rb +1 -1
- metadata +8 -4
@@ -17,22 +17,28 @@
|
|
17
17
|
<canvas id="metric-chart" width="640" height="480" data-source="<%= data_admin_metric_path(@entity.id) %>"></canvas>
|
18
18
|
</article>
|
19
19
|
|
20
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.
|
20
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.bundle.min.js"></script>
|
21
21
|
<script>
|
22
22
|
'use strict';
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
|
24
|
+
document.addEventListener('DOMContentLoaded', function () {
|
25
|
+
const canvas = document.getElementById('metric-chart');
|
26
|
+
const url = canvas.getAttribute('data-source');
|
27
|
+
const request = Biovision.new_ajax_request('GET', url, function () {
|
28
|
+
const response = JSON.parse(this.responseText);
|
29
|
+
|
26
30
|
if (response.hasOwnProperty('data')) {
|
27
|
-
|
28
|
-
|
29
|
-
|
31
|
+
const metric = response.data;
|
32
|
+
const labels = Object.keys(metric.graph_data);
|
33
|
+
const myChart = new Chart(canvas, {
|
30
34
|
type: 'line',
|
31
35
|
data: {
|
32
36
|
labels: labels,
|
33
37
|
datasets: [{
|
34
|
-
label: metric
|
35
|
-
data: labels.map(function(k) {
|
38
|
+
label: metric.name,
|
39
|
+
data: labels.map(function (k) {
|
40
|
+
return metric.graph_data.k;
|
41
|
+
}),
|
36
42
|
borderWidth: 1
|
37
43
|
}]
|
38
44
|
},
|
@@ -40,13 +46,15 @@
|
|
40
46
|
scales: {
|
41
47
|
yAxes: [{
|
42
48
|
ticks: {
|
43
|
-
beginAtZero: metric
|
49
|
+
beginAtZero: metric.start_with_zero
|
44
50
|
}
|
45
51
|
}]
|
46
52
|
}
|
47
53
|
}
|
48
54
|
});
|
49
55
|
}
|
50
|
-
})
|
56
|
+
});
|
57
|
+
|
58
|
+
request.send();
|
51
59
|
});
|
52
|
-
</script>
|
60
|
+
</script>
|
@@ -14,17 +14,19 @@
|
|
14
14
|
|
15
15
|
<script>
|
16
16
|
'use strict';
|
17
|
-
$(function () {
|
18
|
-
$('ul.privilege-groups input[type=checkbox]').on('click', function () {
|
19
|
-
var url = $(this).closest('li').data('url');
|
20
|
-
var method = $(this).is(':checked') ? 'put' : 'delete';
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
document.addEventListener('DOMContentLoaded', function () {
|
19
|
+
document.querySelectorAll('ul.privilege-groups input[type=checkbox]').forEach(function(element) {
|
20
|
+
element.addEventListener('click', function () {
|
21
|
+
const url = this.closest('li').getAttribute('data-url');
|
22
|
+
const method = this.checked ? 'put' : 'delete';
|
23
|
+
const request = Biovision.new_ajax_request(method, url, function() {
|
24
|
+
console.log(JSON.parse(this.responseText));
|
25
|
+
});
|
26
|
+
|
27
|
+
request.send();
|
28
|
+
});
|
29
|
+
|
28
30
|
});
|
29
31
|
});
|
30
32
|
</script>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<%= render partial: 'admin/regions/toggleable', locals: { entity: entity } %>
|
25
25
|
|
26
26
|
<ul class="actions">
|
27
|
-
<li class="lockable <%= entity.editable_by?(current_user) ? '' : 'hidden' %>">
|
27
|
+
<li class="lockable <%= (entity.editable_by?(current_user) && !entity.locked?) ? '' : 'hidden' %>">
|
28
28
|
<%= edit_icon edit_region_path(entity) %>
|
29
29
|
</li>
|
30
30
|
<%= render partial: 'shared/actions/locks', locals: { entity: entity, path: lock_admin_region_path(entity) } %>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
<ul class="actions">
|
14
14
|
<li><%= back_icon(admin_regions_path) %></li>
|
15
|
-
<% if @entity.editable_by?(current_user) %>
|
15
|
+
<% if @entity.editable_by?(current_user) && !@entity.locked? %>
|
16
16
|
<li><%= edit_icon edit_region_path(@entity.id) %></li>
|
17
17
|
<% end %>
|
18
18
|
</ul>
|
@@ -3,20 +3,8 @@
|
|
3
3
|
<legend><%= t(:filter) %></legend>
|
4
4
|
|
5
5
|
<div>
|
6
|
-
<div><%= label_tag '
|
7
|
-
<div><%= search_field_tag '
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<!--
|
11
|
-
<div>
|
12
|
-
<div><%= label_tag 'filter_name', t('activerecord.attributes.user.name') %></div>
|
13
|
-
<div><%= search_field_tag 'filter[name]', filter[:name], size: 30, results: 5, autosave: 'name' %></div>
|
14
|
-
</div>
|
15
|
-
-->
|
16
|
-
|
17
|
-
<div>
|
18
|
-
<div><%= label_tag 'filter_email', t('activerecord.attributes.user.email') %></div>
|
19
|
-
<div><%= search_field_tag 'filter[email]', filter[:email], size: 30, results: 5, autosave: 'email' %></div>
|
6
|
+
<div><%= label_tag 'q', t('.search') %></div>
|
7
|
+
<div><%= search_field_tag 'q', param_from_request(:q), size: 30, results: 5, autosave: 'user_search' %></div>
|
20
8
|
</div>
|
21
9
|
|
22
10
|
<div class="button"><%= button_tag t(:submit), type: :submit, name: '' %></div>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<li><%= create_icon(new_user_path) %></li>
|
12
12
|
</ul>
|
13
13
|
|
14
|
-
<%= render partial: 'filter'
|
14
|
+
<%= render partial: 'filter' %>
|
15
15
|
|
16
16
|
<%= paginate @collection %>
|
17
17
|
<%= render partial: 'list', locals: { collection: @collection } %>
|
@@ -22,49 +22,64 @@
|
|
22
22
|
<script>
|
23
23
|
'use strict';
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
method: method,
|
35
|
-
data: data,
|
36
|
-
}).fail(handle_ajax_failure);
|
37
|
-
}
|
38
|
-
});
|
25
|
+
document.addEventListener('DOMContentLoaded', function () {
|
26
|
+
document.querySelectorAll('ul.privileges input[type=checkbox]').forEach(function (element) {
|
27
|
+
element.addEventListener('click', function () {
|
28
|
+
if (this.offsetParent !== null) {
|
29
|
+
const url = this.closest('div.entity').getAttribute('data-url');
|
30
|
+
const method = this.checked ? 'put' : 'delete';
|
31
|
+
const region_id = this.getAttribute('data-region-id');
|
32
|
+
const data = region_id > 0 ? {region_id: region_id} : {};
|
33
|
+
const request = Biovision.new_ajax_request(method, url);
|
39
34
|
|
40
|
-
|
41
|
-
|
42
|
-
let $container = $(this).closest('ul');
|
43
|
-
|
44
|
-
$.get($container.data('url'), function (response) {
|
45
|
-
if (response.hasOwnProperty('data')) {
|
46
|
-
$(response['data']).each(function(i, data) {
|
47
|
-
if (data.hasOwnProperty('meta')) {
|
48
|
-
$container.append('<li>' + data['meta']['html_chunk'] + '</li>');
|
49
|
-
}
|
50
|
-
});
|
35
|
+
request.setRequestHeader("Content-Type", "application/json");
|
36
|
+
request.send(JSON.stringify(data));
|
51
37
|
}
|
52
|
-
|
53
|
-
}).fail(handle_ajax_failure);
|
38
|
+
});
|
54
39
|
});
|
55
40
|
|
56
|
-
|
57
|
-
|
58
|
-
let $li = $(this).closest('li');
|
59
|
-
let data = {region_id: $(this).val()};
|
41
|
+
document.addEventListener('click', function (event) {
|
42
|
+
const element = event.target;
|
60
43
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
44
|
+
if (element.matches('button.add_regions')) {
|
45
|
+
const container = element.closest('ul');
|
46
|
+
const url = container.getAttribute('data-url');
|
47
|
+
const request = Biovision.new_ajax_request('GET', url, function () {
|
48
|
+
const response = JSON.parse(this.responseText);
|
49
|
+
const li = element.closest('li');
|
50
|
+
|
51
|
+
if (response.hasOwnProperty('data')) {
|
52
|
+
response.data.forEach(function (data) {
|
53
|
+
if (data.hasOwnProperty('meta')) {
|
54
|
+
const item = document.createElement('li');
|
55
|
+
|
56
|
+
item.innerHTML = data.meta.html_chunk;
|
57
|
+
|
58
|
+
container.appendChild(item);
|
59
|
+
}
|
60
|
+
});
|
61
|
+
}
|
62
|
+
li.parentNode.removeChild(li);
|
63
|
+
});
|
64
|
+
|
65
|
+
request.send();
|
66
|
+
}
|
67
|
+
|
68
|
+
if (element.matches('input[type=checkbox].privilege-adder')) {
|
69
|
+
const url = element.closest('div.entity').getAttribute('data-url');
|
70
|
+
const li = element.closest('li');
|
71
|
+
const data = {region_id: element.value};
|
72
|
+
const list = li.querySelector('ul.regions');
|
73
|
+
|
74
|
+
const request = Biovision.new_ajax_request('put', url, function() {
|
75
|
+
if (list) {
|
76
|
+
list.parentNode.removeChild(list);
|
77
|
+
}
|
78
|
+
});
|
79
|
+
|
80
|
+
request.setRequestHeader("Content-Type", "application/json");
|
81
|
+
request.send(JSON.stringify(data));
|
82
|
+
}
|
68
83
|
});
|
69
84
|
});
|
70
85
|
</script>
|
@@ -23,31 +23,31 @@
|
|
23
23
|
</fieldset>
|
24
24
|
<% end %>
|
25
25
|
|
26
|
-
<script
|
27
|
-
"use strict";
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
});
|
53
|
-
|
26
|
+
<script>
|
27
|
+
"use strict";
|
28
|
+
|
29
|
+
document.addEventListener('DOMContentLoaded', function () {
|
30
|
+
const pagination = document.querySelector('#agents-filter div.pages');
|
31
|
+
const field = document.getElementById('agent-filter-page');
|
32
|
+
|
33
|
+
function change_page(delta) {
|
34
|
+
let value = parseInt(field.value);
|
35
|
+
|
36
|
+
value += delta;
|
37
|
+
if (value < 1) {
|
38
|
+
value = 1;
|
39
|
+
}
|
40
|
+
|
41
|
+
field.value = value;
|
42
|
+
field.closest('form').submit();
|
43
|
+
}
|
44
|
+
|
45
|
+
pagination.querySelector('.previous-page').addEventListener('click', function () {
|
46
|
+
change_page(-1);
|
47
|
+
});
|
48
|
+
|
49
|
+
pagination.querySelector('.next-page').addEventListener('click', function () {
|
50
|
+
change_page(1);
|
51
|
+
});
|
52
|
+
});
|
53
|
+
</script>
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<script src="//cdn.ckeditor.com/4.7.
|
1
|
+
<script src="//cdn.ckeditor.com/4.7.3/standard/ckeditor.js"></script>
|
2
2
|
<script>
|
3
|
-
|
4
|
-
|
3
|
+
document.addEventListener('DOMContentLoaded', function () {
|
4
|
+
const editor = document.getElementById('editable_page_body');
|
5
5
|
|
6
6
|
CKEDITOR.replace(editor, {
|
7
7
|
// filebrowserUploadUrl: '/illustrations',
|
@@ -1,11 +1,7 @@
|
|
1
1
|
<% if entity.errors.any? %>
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<li><%= message %></li>
|
8
|
-
<% end %>
|
9
|
-
</ol>
|
10
|
-
</section>
|
2
|
+
<ol class="errors">
|
3
|
+
<% entity.errors.full_messages.each do |message| %>
|
4
|
+
<li><%= message %></li>
|
5
|
+
<% end %>
|
6
|
+
</ol>
|
11
7
|
<% end %>
|
@@ -25,36 +25,37 @@ ru:
|
|
25
25
|
- "декабрь"
|
26
26
|
archive_year: " за %{year} год"
|
27
27
|
archive_month: " за %{month} %{year} года"
|
28
|
-
|
28
|
+
are_you_sure: "Вы уверены?"
|
29
|
+
back: "Назад"
|
30
|
+
copyright: "2017"
|
29
31
|
create: "Создать"
|
30
|
-
|
31
|
-
|
32
|
-
edit: "Редактировать"
|
33
|
-
update: "Обновить"
|
32
|
+
created_at: "Время создания"
|
33
|
+
current_image: "Текущая картинка"
|
34
34
|
delete: "Удалить"
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
deleted_entity: "Удалённый объект"
|
36
|
+
edit: "Редактировать"
|
37
|
+
filter: "Фильтр"
|
38
38
|
find: "Найти"
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
flags: "Флаги"
|
40
|
+
hide: "Скрыть"
|
41
|
+
home: "Главная"
|
42
|
+
list: "К списку"
|
43
|
+
locked: "Редактирование зарещено"
|
44
|
+
"no": "Нет"
|
42
45
|
not_selected: "Не выбрано"
|
43
46
|
not_set: "Не задано"
|
44
|
-
|
45
|
-
"yes": "Да"
|
46
|
-
"no": "Нет"
|
47
|
+
nothing_found: "Ничего не нашлось"
|
47
48
|
page: "Страница"
|
48
|
-
|
49
|
-
|
50
|
-
locked: "Редактирование зарещено"
|
49
|
+
save: "Сохранить"
|
50
|
+
submit: "Отправить"
|
51
51
|
unlocked: "Редактирование разрешено"
|
52
|
-
home: "Главная"
|
53
52
|
untitled: "Без названия"
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
update: "Обновить"
|
54
|
+
updated_at: "Время обновления"
|
55
|
+
view: "В просмотр"
|
57
56
|
view_as_administrator: "Посмотреть в админке"
|
57
|
+
view_as_visitor: "Посмотреть на странице"
|
58
|
+
"yes": "Да"
|
58
59
|
views:
|
59
60
|
pagination:
|
60
61
|
first: "⇤"
|
@@ -108,4 +109,3 @@ ru:
|
|
108
109
|
title: "Раздел в разработке"
|
109
110
|
heading: "Раздел наполняется"
|
110
111
|
message: "Информация ещё не готова, зайдите позже"
|
111
|
-
flags: "Флаги"
|