adminos 1.0.0.pre.rc.3 → 1.0.0.pre.rc.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/adminos.gemspec +4 -4
  4. data/app/inputs/cropp_input.rb +4 -4
  5. data/lib/adminos/controllers/resource.rb +17 -4
  6. data/lib/adminos/helpers/plugin.rb +5 -0
  7. data/lib/adminos/plugins/base.rb +10 -0
  8. data/lib/adminos.rb +1 -0
  9. data/lib/generators/adminos/search_generator.rb +2 -2
  10. data/lib/generators/templates/adminos/locales/model.rb.erb +1 -1
  11. data/lib/generators/templates/i18n/devise/devise.ru.yml +15 -3
  12. data/lib/generators/templates/i18n/devise/views/mailer/confirmation_instructions.slim +3 -4
  13. data/lib/generators/templates/i18n/devise/views/mailer/reset_password_instructions.slim +5 -5
  14. data/lib/generators/templates/i18n/devise/views/mailer/unlock_instructions.slim +4 -4
  15. data/lib/generators/templates/install/Gemfile +2 -2
  16. data/lib/generators/templates/install/admin_panel/versions/views/admin_versions/index.slim +1 -1
  17. data/lib/generators/templates/install/admin_panel/versions/views/admin_versions/show.slim +3 -3
  18. data/lib/generators/templates/install/auto/app/controllers/admin/settings_controller.rb +1 -1
  19. data/lib/generators/templates/install/auto/app/helpers/versions_helper.rb +3 -3
  20. data/lib/generators/templates/install/auto/app/inputs/carrierwave_input.rb +2 -2
  21. data/lib/generators/templates/install/auto/app/inputs/checkbox_input.rb +1 -1
  22. data/lib/generators/templates/install/auto/app/services/export_xlsx.rb +6 -6
  23. data/lib/generators/templates/install/auto/app/views/admin/base/_form.slim +2 -2
  24. data/lib/generators/templates/install/auto/app/views/admin/helps/index.slim +9 -9
  25. data/lib/generators/templates/install/auto/app/views/admin/settings/edit.slim +2 -2
  26. data/lib/generators/templates/install/auto/app/views/shared/admin/_back_button.slim +1 -1
  27. data/lib/generators/templates/install/auto/config/locales/adminos.en.yml +30 -0
  28. data/lib/generators/templates/install/auto/config/locales/adminos.ru.yml +31 -2
  29. data/lib/generators/templates/install/deploy.rb.erb +1 -1
  30. data/lib/generators/templates/install/prepare_settings.rb +1 -1
  31. data/lib/generators/templates/two_facto_auth/auto/app/views/admin/profiles/_2fa.slim +4 -4
  32. data/lib/generators/templates/two_facto_auth/auto/app/views/devise/sessions/two_factor.slim +2 -2
  33. data/spec/lib/adminos/helpers/plugin_spec.rb +21 -0
  34. metadata +18 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b5e4c3f3ca3f62630cea3a1f944cdbfc825974f295b1e056ad9e27fc571b59f
4
- data.tar.gz: 58829a898a9194f9d3836e5743716f581e0be4cd61c7425da5942b3ffa94d461
3
+ metadata.gz: dc9440754eb7cf2a6a53a63b317e92dcaaf687658eab4c79a598a8962ce47ff6
4
+ data.tar.gz: 4c58c89f2f73ec2dae058312b558162c6f0f67c9b879cd269f3488acfaf4b402
5
5
  SHA512:
6
- metadata.gz: c2fbcdb16cc34d96aa89f42e1b8bc8d15bebacfcbdbd88821560317f6682f694baa360597f3b1f3858b277d2e5b2c59415aa33722fc9e6218ff7dce3d10fc728
7
- data.tar.gz: c7b3733876ea14ee809f01b64d94781c8f239830f4261ea3cc83d096f5e0ca7eefd84ca6ea1a43fd04eeb9ff4d4d60fa039141954cd44141ad8d3cfb148a6a17
6
+ metadata.gz: 493649ce1767af16101e2b3b82466640a1427c484f2e96e8f609cae860210a0f04c6976cafbd810c37f35d1960089d09145c8868a7f984aa8071189cb4bccf64
7
+ data.tar.gz: deca48dd013e389fe98ea87135ad6500ffa134bcaab898c4d35234336072efb53780ea39bfed172b7947053c3dc347b06f43cea2ffe5b85f259ba3b4c47a00e1
data/Gemfile CHANGED
@@ -19,6 +19,6 @@ end
19
19
 
20
20
  gem 'guard-minitest', '~> 2.4'
21
21
  gem 'friendly_id'
22
- gem 'activerecord-nulldb-adapter', git: 'git://github.com/nulldb/nulldb.git'
23
- gem 'sqlite3', '~> 1.3.6'
22
+ gem 'activerecord-nulldb-adapter'
23
+ gem 'sqlite3', '~> 1.4'
24
24
  gem 'database_cleaner'
data/adminos.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'adminos'
3
- gem.version = '1.0.0-rc.3'
3
+ gem.version = '1.0.0-rc.5'
4
4
  gem.authors = ['RavWar', 'milushov', 'abuhtoyarov', 'SiebenSieben']
5
5
  gem.email = ['studio@molinos.ru']
6
6
  gem.homepage = 'https://gitlab.molinos.ru/global/adminos'
@@ -15,9 +15,9 @@ Gem::Specification.new do |gem|
15
15
 
16
16
  gem.add_dependency 'path'
17
17
  gem.add_dependency 'jquery-fileupload-rails'
18
- gem.add_dependency 'railties', '~> 5.1'
18
+ gem.add_dependency 'railties', '>= 5.1'
19
19
  gem.add_dependency 'dotenv-rails'
20
- gem.add_dependency 'slim-rails'
20
+ gem.add_dependency 'slim-rails', '~> 3.6.0'
21
21
  gem.add_dependency 'friendly_id'
22
22
  gem.add_dependency 'babosa'
23
23
  gem.add_dependency 'simple_form'
@@ -28,7 +28,7 @@ Gem::Specification.new do |gem|
28
28
  gem.add_dependency 'awesome_nested_set'
29
29
  gem.add_dependency 'ransack'
30
30
 
31
- gem.add_development_dependency 'bundler', '~> 1.3'
31
+ gem.add_development_dependency 'bundler', '~> 2.2'
32
32
  gem.add_development_dependency 'm'
33
33
  gem.add_development_dependency 'rails'
34
34
  gem.add_development_dependency 'rake'
@@ -6,7 +6,7 @@ class CroppInput < SimpleForm::Inputs::Base
6
6
  out = []
7
7
  out << %{<div class="f-file">}
8
8
  out << %{ <label class="f-file__selection js-file">}
9
- out << %{ <span class="f-file__button">Выбрать</span>}
9
+ out << %{ <span class="f-file__button">#{I18n.t('labels.admin.choose')}</span>}
10
10
  out << @builder.file_field(attribute_name, input_html_options)
11
11
  out << @builder.hidden_field(@coord_attribute)
12
12
  out << %{ <span class="f-file__selected"></span>}
@@ -32,12 +32,12 @@ class CroppInput < SimpleForm::Inputs::Base
32
32
  out << %{</div></div><div class="col-md-4">}
33
33
  out << %{<div class="cropper-dimensions">}
34
34
  out << %{<div class="field">}
35
- out << template.label_tag(:width, 'Ширина', class: 'control-label')
35
+ out << template.label_tag(:width, I18n.t('labels.admin.image.width'), class: 'control-label')
36
36
  out << template.number_field_tag(:width, nil, class: 'form-control')
37
37
  out << %{</div>}
38
38
  out << %{<div class="field">}
39
39
 
40
- out << template.label_tag(:height, 'Высота', class: 'control-label')
40
+ out << template.label_tag(:height, I18n.t('labels.admin.image.height'), class: 'control-label')
41
41
  out << template.number_field_tag(:height, nil, class: 'form-control')
42
42
  out << %{</div>}
43
43
 
@@ -58,7 +58,7 @@ class CroppInput < SimpleForm::Inputs::Base
58
58
 
59
59
  out << template.image_tag(object.send("#{@version}_#{attribute_name}_cropped"))
60
60
 
61
- out << %{<figcaption class="figure-caption text-center">Cropped image</figcaption></figure></div>}
61
+ out << %{<figcaption class="figure-caption text-center">#{I18n.t('labels.admin.image.width.cropped')}</figcaption></figure></div>}
62
62
  out.join
63
63
  end
64
64
  end
@@ -31,7 +31,7 @@ module Adminos::Controllers::Resource
31
31
  end
32
32
 
33
33
  define_method :update do
34
- resource.update_attributes(parameters)
34
+ resource.update(parameters)
35
35
  respond_with(resource, location: self.instance_eval(&location))
36
36
  end
37
37
 
@@ -130,10 +130,23 @@ module Adminos::Controllers::Resource
130
130
  reflect_has_one = resource_class.reflect_on_all_associations(:has_one)
131
131
  rich_text_attributes = reflect_has_one.map(&:name).map { |name| name.to_s.gsub('rich_text_', '') }.compact
132
132
 
133
- _attribute_names = self.resource_class_scope.attribute_names + ids_attributes + rich_text_attributes
133
+ attachment_names = reflect_has_one.
134
+ map { |reflection| reflection.name.to_s }.
135
+ select { |name| name.match?(/_attachment/) }.
136
+ map { |name| name.chomp('_attachment').to_sym }
134
137
 
135
- if resource_class.respond_to?(:translated_attribute_names)
136
- _attribute_names += resource_class.translated_attribute_names.map do |attr|
138
+ attachments_names = resource_class.
139
+ reflect_on_all_associations(:has_many).
140
+ map { |reflection| reflection.name.to_s }.
141
+ select { |name| name.match?(/_attachments/) }.
142
+ map { |name| { name.chomp('_attachments').to_sym => [] } }
143
+
144
+ _attribute_names = self.resource_class_scope.attribute_names +
145
+ attachment_names + ids_attributes +
146
+ rich_text_attributes + attachments_names
147
+
148
+ if resource_class.respond_to?(:mobility_attributes)
149
+ _attribute_names += resource_class.mobility_attributes.map do |attr|
137
150
  I18n.available_locales.map { |locale| "#{attr}_#{Mobility.normalize_locale(locale)}" }
138
151
  end.flatten
139
152
  end
@@ -0,0 +1,5 @@
1
+ module Adminos::Helpers::Plugin
2
+ def plugin_names
3
+ Adminos::Plugins::Base.descendants.map(&:name)
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ module Adminos
2
+ module Plugins
3
+ class Base
4
+ def self.name
5
+ raise NotImplementedError.new('method name is not defined')
6
+ end
7
+ end
8
+ end
9
+ end
10
+
data/lib/adminos.rb CHANGED
@@ -42,6 +42,7 @@ module Adminos
42
42
  ActionView::Base.send :include, Helpers::View
43
43
  ActionView::Base.send :include, Helpers::Admin
44
44
  ActionView::Base.send :include, Helpers::Bootstrap
45
+ ActionView::Base.send :include, Helpers::Plugin
45
46
  end
46
47
 
47
48
  initializer 'adminos.controller_helpers' do
@@ -24,11 +24,11 @@ module Adminos::Generators
24
24
  private
25
25
 
26
26
  def model_path
27
- "app/models/#{model}.rb"
27
+ "app/models/#{model.underscore}.rb"
28
28
  end
29
29
 
30
30
  def partial_path
31
- "app/views/admin/#{model.pluralize}/index.slim"
31
+ "app/views/admin/#{model.underscore.pluralize}/index.slim"
32
32
  end
33
33
 
34
34
  def model
@@ -1,5 +1,5 @@
1
1
  extend Mobility
2
2
 
3
- translates :name, <%= attributes.map{|a| ":#{a.name}, " if a.locale }.compact.join %><%= ':nav_name, ' if options.type == 'section' %>:meta_description, :meta_title, locale_accessors: true, ransack: true
3
+ translates :name, <%= attributes.map{|a| ":#{a.name}, " if a.locale }.compact.join %><%= ':nav_name, ' if options.type == 'section' %><%= ':meta_description, :meta_title, ' if options.seo? %>locale_accessors: true, ransack: true
4
4
 
5
5
  validates_with LocaleValidator
@@ -53,8 +53,20 @@ ru:
53
53
  failure: "Вы не можете войти в систему с учётной записью из %{kind}, т.к. \"%{reason}\"."
54
54
  mailer:
55
55
  confirmation_instructions:
56
- subject: "Инструкции по подтверждению учётной записи"
56
+ action: Активировать
57
+ greeting: Здравствуйте, %{recipient} !
58
+ instruction: 'Вы можете активировать свою учетную запись, нажав ссылку снизу:'
59
+ subject: Инструкции по подтверждению учетной записи
57
60
  reset_password_instructions:
58
- subject: "Инструкции по восстановлению пароля"
61
+ action: Изменить пароль
62
+ greeting: Здравствуйте, %{recipient}!
63
+ instruction: 'Вы (или кто-то еще) запросили изменение пароля. Для изменения пароля нажмите ссылку ниже:'
64
+ instruction_2: Если вы не запрашивали изменение пароля - проигнорируйте это сообщение
65
+ instruction_3: Ваш пароль не изменится пока вы не нажмете на ссылку и не введете новый.
66
+ subject: Инструкции по восстановлению пароля
59
67
  unlock_instructions:
60
- subject: "Инструкции по разблокировке учётной записи"
68
+ action: Разблокировать учетную запись
69
+ greeting: Здравствуйте, %{recipient}!
70
+ instruction: 'Нажмите ссылку для активации учетной записи:'
71
+ message: Ваша учетная запись была заблокирована в связи с превышением лимита неудачных попыток входа.
72
+ subject: Инструкции по разблокировке учетной записи
@@ -1,4 +1,3 @@
1
- p Здравствуйте!
2
- p Вы можете подтвердить данный почтовый ящик своего аккаунта по следующей ссылке:
3
- p= link_to 'Активировать мой аккаунт', confirmation_url(@resource, confirmation_token: @resource.confirmation_token)
4
- p Если вы не регистрировались на сайте или не запрашивали повторных инструкций по активации, просто проигнорируйте это сообщение.
1
+ p= t('devise.mailer.confirmation_instructions.greeting')
2
+ p= t('devise.mailer.confirmation_instructions.instruction')
3
+ p= link_to t('devise.mailer.confirmation_instructions.action'), confirmation_url(@resource, confirmation_token: @resource.confirmation_token)
@@ -1,5 +1,5 @@
1
- p Здравствуйте!
2
- p Мы получили запрос по смене пароля вашего аккаунта, вы можете сделать это по следующей ссылке:
3
- p= link_to 'Изменить пароль', edit_password_url(@resource, reset_password_token: @resource.reset_password_token)
4
- p Если вы не запрашивали данной операции, пожалуйста, проигнорируйте это письмо.
5
- p Ваш пароль не изменится до перехода по полученной ссылке выше.
1
+ p= t('devise.mailer.reset_password_instructions.greeting')
2
+ p= t('devise.mailer.reset_password_instructions.instruction')
3
+ p= link_to t('devise.mailer.reset_password_instructions.action'), edit_password_url(@resource, reset_password_token: @resource.reset_password_token)
4
+ p= t('devise.mailer.reset_password_instructions.instruction2')
5
+ p= t('devise.mailer.reset_password_instructions.instruction3')
@@ -1,4 +1,4 @@
1
- p Hello #{@resource.email}!
2
- p Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
3
- p Click the link below to unlock your account:
4
- p= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @resource.unlock_token)
1
+ p= t('devise.mailer.unlock_instructions.greeting')
2
+ p= t('devise.mailer.unlock_instructions.message')
3
+ p= t('devise.mailer.unlock_instructions.instruction')
4
+ p= link_to t('devise.mailer.unlock_instructions.action'), unlock_url(@resource, unlock_token: @resource.unlock_token)
@@ -7,7 +7,7 @@ gem 'puma', '~> 3.7'
7
7
  gem 'jbuilder', '~> 2.5'
8
8
  gem 'role_model'
9
9
  gem 'webpacker', '~> 3.5'
10
- gem "actiontext", github: "rails/actiontext", require: "action_text", ref: "cfe4674d3637c746cdb3c2b5131e2de498775529"
10
+ # gem "actiontext", github: "rails/actiontext", require: "action_text", ref: "cfe4674d3637c746cdb3c2b5131e2de498775529"
11
11
  gem "image_processing", "~> 1.2" # for Active Storage variants
12
12
 
13
13
  group :development do
@@ -51,5 +51,5 @@ gem 'omniauth-facebook'
51
51
  gem 'omniauth-twitter'
52
52
  gem 'omniauth-vkontakte'
53
53
 
54
- gem 'axlsx', git: 'https://github.com/randym/axlsx.git'
54
+ gem 'axlsx'
55
55
  gem 'spreadsheet_architect'
@@ -41,7 +41,7 @@
41
41
  = list
42
42
 
43
43
  p
44
- = link_to 'Сохранить таблицу',
44
+ = link_to t('admin.paper_trail/versions.labels.actions.save_table'),
45
45
  admin_versions_path(format: :xlsx),
46
46
  target: '_blank',
47
47
  class: 'btn btn-primary btn-small'
@@ -7,9 +7,9 @@
7
7
  table.table.table-hover.table-sm
8
8
  thead
9
9
  tr
10
- th Поле
11
- th Старое значение
12
- th Новое значение
10
+ th= I18n.t('admin.paper_trail/versions.labels.field')
11
+ th= I18n.t('admin.paper_trail/versions.labels.old_value')
12
+ th= I18n.t('admin.paper_trail/versions.labels.new_value')
13
13
  tbody
14
14
  - resource.changeset.each do |field, change|
15
15
  tr
@@ -2,7 +2,7 @@ class Admin::SettingsController < Admin::BaseController
2
2
  load_and_authorize_resource param_method: :strong_params, class: 'Settings'
3
3
 
4
4
  def update
5
- if resource.update_attributes strong_params
5
+ if resource.update strong_params
6
6
  flash[:notice] = t 'flash.actions.update.notice'
7
7
  redirect_to action: :edit
8
8
  else
@@ -2,7 +2,7 @@ module VersionsHelper
2
2
  def version_item(object)
3
3
  case object.item_type
4
4
  when 'Settings'
5
- name = 'Настройки'
5
+ name = t('admin.settings.actions.index.header')
6
6
  link = :settings
7
7
  when 'User'
8
8
  name = object.item.email
@@ -14,9 +14,9 @@ module VersionsHelper
14
14
 
15
15
  def version_event(object)
16
16
  if version_login? object
17
- 'Логин'
17
+ t('labels.admin.login')
18
18
  elsif version_registration? object
19
- 'Регистрация'
19
+ t('labels.admin.sign_up')
20
20
  else
21
21
  t "admin.actions.#{object.event}"
22
22
  end
@@ -7,7 +7,7 @@ class CarrierwaveInput < SimpleForm::Inputs::Base
7
7
  out << %{<div class="f-file">}
8
8
  out << @builder.hidden_field("#{attribute_name}_cache")
9
9
  out << %{ <label class="f-file__selection js-file">}
10
- out << %{ <span class="f-file__button">Выбрать</span>}
10
+ out << %{ <span class="f-file__button">#{I18n.t('labels.admin.choose')}</span>}
11
11
  out << @builder.file_field(attribute_name, input_html_options)
12
12
  out << %{ <span class="f-file__selected"></span>}
13
13
  out << %{ </label>}
@@ -25,7 +25,7 @@ class CarrierwaveInput < SimpleForm::Inputs::Base
25
25
  out << @builder.input_field("remove_#{attribute_name}", as: :boolean)
26
26
  out << %{ <label class="f-check">}
27
27
  out << %{ <span class="f-check__box"></span>}
28
- out << %{ <span class="f-check__label">Удалить</span>}
28
+ out << %{ <span class="f-check__label">#{I18n.t('labels.admin.destroy')}</span>}
29
29
  out << %{ </label>}
30
30
  out << %{</div>}
31
31
  out.join
@@ -5,7 +5,7 @@ class CheckboxInput < SimpleForm::Inputs::BooleanInput
5
5
  out << %{ <label class="f-check" for="#{object_name}_#{attribute_name}">}
6
6
  out << @builder.input_field("#{attribute_name}", as: :boolean)
7
7
  out << %{ <span class="f-check__box"></span>}
8
- out << %{ <span class="f-check__label">Опубликовано</span>}
8
+ out << %{ <span class="f-check__label">#{I18n.t('labels.admin.published')}</span>}
9
9
  out << %{ </label>}
10
10
  out << %{</div>}
11
11
  out.join.html_safe
@@ -13,12 +13,12 @@ class ExportXlsx
13
13
 
14
14
  def generate_xlsx
15
15
  headers = [
16
- 'Объект',
17
- 'Тип',
18
- 'Событие',
19
- 'Пользователь',
20
- 'Дата',
21
- 'Изменения'
16
+ I18n.t('activerecord.attributes.paper_trail/version.item'),
17
+ I18n.t('activerecord.attributes.paper_trail/version.item_type'),
18
+ I18n.t('activerecord.attributes.paper_trail/version.event'),
19
+ I18n.t('activerecord.attributes.paper_trail/version.whodunnit'),
20
+ I18n.t('attributes.created_at'),
21
+ I18n.t('admin.paper_trail/version.labels.changes')
22
22
  ]
23
23
 
24
24
  data = @versions.map do |x|
@@ -21,10 +21,10 @@
21
21
 
22
22
  .f-submit.f-submit--fixed
23
23
  .wrapper
24
- = f.button :submit, 'Сохранить', class: 'btn btn-primary btn--done'
24
+ = f.button :submit, t('labels.admin.save'), class: 'btn btn-primary btn--done'
25
25
  /resource_button_value_main
26
26
  /= f.button :submit, 'Применить', type: 'button', name: 'stay_in_place', class: 'btn btn-secondary js-save-form'
27
- = f.button :submit, 'Применить', name: 'stay_in_place', class: 'btn btn-secondary'
27
+ = f.button :submit, t('labels.admin.apply'), name: 'stay_in_place', class: 'btn btn-secondary'
28
28
  /resource_button_value_stay
29
29
  /= link_to resource_button_value_cancel,
30
30
  polymorphic_path([:admin, resource.class.name.underscore.pluralize]),
@@ -1,16 +1,16 @@
1
1
  - title I18n.t('admin.helps.actions.index.title')
2
2
 
3
3
  = admin_page_header I18n.t('admin.helps.actions.index.header')
4
- h4 Общие замечания по&nbsp;добавлению и&nbsp;редактированию информации:
4
+ h4= t('admin.helps.title_html')
5
5
  ul
6
- li Везде, где можно добавить ту&nbsp;или иную сущность (например, страницу), <b>в правой верхней части страницы есть кнопка «добавить»</b>.
7
- li Некоторые типы записей могут быть <b>опубликованы</b> (и&nbsp;будут отображаться на&nbsp;сайте) и&nbsp;<b>заархивированы</b> (сохранятся в&nbsp;базе, их&nbsp;можно редактировать, но&nbsp;они не&nbsp;будут опубликованы на&nbsp;сайте). <b>Состояние опубликованной записи обозначается пиктограммой <i class="icon-eye-open"></i> в&nbsp;правой части списка</b> (отсутствие пиктограммы обозначает&nbsp;то, что запись заархивирована).
8
- li В&nbsp; некоторых списках есть возможность <b>ручной сортировки записей</b> (порядок отображения на&nbsp;сайте и&nbsp;в&nbsp;списках). Иногда требуется вывести какую-то запись раньше предыдущей. Это справедливо, например, для списка страниц. <b>Чтобы переместить запись выше или ниже, достаточно просто перетащить её&nbsp;в&nbsp;нужное место указателем мыши</b> (предварительно нажав левую кнопку мыши, когда указатель находится над пиктограммой <i class="icon-move"></i>).
9
- li В&nbsp; некоторых списках предусмотрены <b>групповые операции</b>&nbsp;— публикация, архивирование и&nbsp;удаление. Чтобы выполнить групповую операцию, необходимо выбрать записи, с&nbsp;которыми будет осуществляться операция&nbsp;— это можно сделать, отметив эти записи галочками в&nbsp;чекбоксах,&nbsp;— а&nbsp;затем выбрать операцию из&nbsp;списка внизу страницы (нажать на&nbsp;соответствующую кнопку). Эти операции можно выполнять также и&nbsp;с&nbsp;отдельными объектами (то&nbsp;есть по&nbsp;одному), чтобы не&nbsp;заходить на&nbsp;страницу редактирования записи.
10
- li Если <b>редактирование записей</b> доступно, то&nbsp;в&nbsp;списке присутствует пиктограмма <i class="icon-edit"></i>. Щелчок по&nbsp;этой пиктограмме открывает страницу редактирования соответствующей записи.
11
- li Все <b>специфичные настройки страниц</b> вынесены в раздел «#{link_to I18n.t('admin.settings.actions.index.header'), edit_admin_settings_path}».
12
- li В&nbsp;случаях, где это предусмотрено оформлением страниц, текстовые поля оснащены <b>WYSIWYG-редактором</b>. Редактор имеет возможность размещения изображений и&nbsp;вставки кода для видео (embedded video) с&nbsp;сервиса YouTube.
13
- h4 Значение пиктограмм:
6
+ li=t('admin.helps.hint1_html')
7
+ li=t('admin.helps.hint2_html')
8
+ li=t('admin.helps.hint3_html')
9
+ li=t('admin.helps.hint4_html')
10
+ li=t('admin.helps.hint5_html')
11
+ li=t('admin.helps.hint6_html')
12
+ li=t('admin.helps.hint7_html')
13
+ h4 =t('admin.helps.icons_meaning')
14
14
  ul.legend
15
15
  li
16
16
  <i class="icon-edit"></i>
@@ -1,5 +1,5 @@
1
- - title 'Настройки'
2
- = resource_header 'Настройки'
1
+ - title t('admin.settings.actions.index.header')
2
+ = resource_header t('admin.settings.actions.index.header')
3
3
 
4
4
  = simple_form_for [:admin, resource], url: admin_settings_path, wrapper: :admin, html: { method: :put } do |f|
5
5
  /.pill-content
@@ -1,3 +1,3 @@
1
1
  - content_for :topbar_button do
2
2
  .actions__item
3
- = link_to 'Назад', admin_index_path(resource.class), class: 'actions__link actions__link--back'
3
+ = link_to t('labels.admin.back'), admin_index_path(resource.class), class: 'actions__link actions__link--back'
@@ -51,6 +51,17 @@ en:
51
51
  file: Photo
52
52
 
53
53
  admin:
54
+ welcome: Entrance to admin dashboard
55
+ helps:
56
+ title_html: General notes on adding and editing information
57
+ hint1_html: "Everywhere, where it is possible to add this or that entity (for example, a page), <b>in the right upper part of the page there is a 'Add' button</b>."
58
+ hint2_html: "Some types of records can be <b>published</b> (and will be displayed on the site) and <b>archived</b> (saved in the database, they can be edited, but they will not be published on the site). <b>The status of a published entry is indicated by <i class="icon-eye-open"></i> icon on the right side of the list</b> (the absence of an icon indicates that the entry has been archived)."
59
+ hint3_html: "Some lists have the ability to <b>manually sort the records</b> (the order of display on the site and in the lists). Sometimes you want to bring some record before the previous one. This is true, for example, for a list of pages. <b>To move a record up or down, simply drag it to the desired place with the mouse pointer</b> (by pressing the left mouse button first, when the pointer is above <i class="icon-move"></i> icon)."
60
+ hint4_html: "Some lists include <b>group operations</b> — publish, archive, and delete. To perform a group operation, you need to select the records with which the operation will be carried out - this can be done with checkboxes, and then selecting an operation from the list at the bottom of the page (click on the appropriate button). These operations can also be performed with individual objects in order not to enter the record editing page."
61
+ hint5_html: "If <b>editing records</b> is available, <i class="icon-edit"></i> icon appears in the list. Clicking this icon opens the edit page for the corresponding entry."
62
+ hint6_html: "All <b>specific page settings</b> are in '#{link_to I18n.t('admin.settings.actions.index.header'), edit_admin_settings_path}' section."
63
+ hint7_html: "In cases where this is provided for page layout, the text fields are equipped with a <b>WYSIWYG editor</b>. The editor has the ability to post images and insert video code (embedded video) from the YouTube service."
64
+ icons_meaning: Icons meaning
54
65
  actions:
55
66
  create: Create
56
67
  update: Update
@@ -100,6 +111,11 @@ en:
100
111
  labels:
101
112
  actions:
102
113
  show: Show modifications
114
+ save_table: Save table
115
+ changes: Changes
116
+ field: Field
117
+ old_value: Old value
118
+ new_value: New value
103
119
  settings:
104
120
  actions:
105
121
  index:
@@ -136,6 +152,11 @@ en:
136
152
  cancel: Cancel
137
153
  destroy: Delete
138
154
  edit: Edit
155
+ apply: Apply
156
+ save: Save
157
+ choose: Choose
158
+ login: Login
159
+ sign_up: Sign up
139
160
  show: Show modifications
140
161
  go_to_root: Home
141
162
  info: Information
@@ -155,6 +176,10 @@ en:
155
176
  set_nav_published_on: Add to navigation
156
177
  set_published_off: Remove from publication
157
178
  set_published_on: Publish
179
+ image:
180
+ width: Width
181
+ height: Height
182
+ cropped: Кадрированное изображение
158
183
 
159
184
  sites:
160
185
  holding: Holding
@@ -162,3 +187,8 @@ en:
162
187
 
163
188
  unauthorized:
164
189
  default: You must login or register.
190
+ authentication:
191
+ two_factor: Two-factor authentication
192
+ key: Key
193
+ switch_on_2fa: Switch on 2FA
194
+ switch_off_2fa: Switch off 2FA
@@ -164,6 +164,11 @@ ru:
164
164
  cancel: Отменить
165
165
  destroy: Удалить
166
166
  edit: Редактировать
167
+ apply: Применить
168
+ save: Сохранить
169
+ choose: Выбрать
170
+ login: Логин
171
+ sign_up: Регистрация
167
172
  show: Просмотр изменений
168
173
  go_to_root: Перейти на сайт
169
174
  info: Справка
@@ -174,16 +179,20 @@ ru:
174
179
  seo: SEO
175
180
  logout: Выйти
176
181
  nav_published: В навигации
177
- published: Опубликована
182
+ published: Опубликовано
178
183
  locked: Закреплена
179
184
  server_restart: Перезагрузить сервер
180
- unpublished: Не опубликована
185
+ unpublished: Не опубликовано
181
186
  batch_actions:
182
187
  destroy: Удалить
183
188
  set_nav_published_off: Убрать из навигации
184
189
  set_nav_published_on: Опубликовать в навигации
185
190
  set_published_off: Снять с публикации
186
191
  set_published_on: Опубликовать
192
+ image:
193
+ width: Ширина
194
+ height: Высота
195
+ cropped: Кадрированное изображение
187
196
 
188
197
  confirmations:
189
198
  destroy:
@@ -199,11 +208,21 @@ ru:
199
208
  title: &layouts_admin_title Панель управления
200
209
 
201
210
  admin:
211
+ welcome: Вход в систему администрирования
202
212
  actions:
203
213
  create: Создание
204
214
  update: Обновление
205
215
  destroy: Удаление
206
216
  helps:
217
+ title_html: "Общие замечания по&nbsp;добавлению и&nbsp;редактированию информации:"
218
+ hint1_html: "Везде, где можно добавить ту&nbsp;или иную сущность (например, страницу), <b>в правой верхней части страницы есть кнопка «добавить»</b>."
219
+ hint2_html: "Некоторые типы записей могут быть <b>опубликованы</b> (и&nbsp;будут отображаться на&nbsp;сайте) и&nbsp;<b>заархивированы</b> (сохранятся в&nbsp;базе, их&nbsp;можно редактировать, но&nbsp;они не&nbsp;будут опубликованы на&nbsp;сайте). <b>Состояние опубликованной записи обозначается пиктограммой <i class="icon-eye-open"></i> в&nbsp;правой части списка</b> (отсутствие пиктограммы обозначает&nbsp;то, что запись заархивирована)."
220
+ hint3_html: "В&nbsp; некоторых списках есть возможность <b>ручной сортировки записей</b> (порядок отображения на&nbsp;сайте и&nbsp;в&nbsp;списках). Иногда требуется вывести какую-то запись раньше предыдущей. Это справедливо, например, для списка страниц. <b>Чтобы переместить запись выше или ниже, достаточно просто перетащить её&nbsp;в&nbsp;нужное место указателем мыши</b> (предварительно нажав левую кнопку мыши, когда указатель находится над пиктограммой <i class="icon-move"></i>)."
221
+ hint4_html: "В&nbsp; некоторых списках предусмотрены <b>групповые операции</b>&nbsp;— публикация, архивирование и&nbsp;удаление. Чтобы выполнить групповую операцию, необходимо выбрать записи, с&nbsp;которыми будет осуществляться операция&nbsp;— это можно сделать, отметив эти записи галочками в&nbsp;чекбоксах,&nbsp;— а&nbsp;затем выбрать операцию из&nbsp;списка внизу страницы (нажать на&nbsp;соответствующую кнопку). Эти операции можно выполнять также и&nbsp;с&nbsp;отдельными объектами (то&nbsp;есть по&nbsp;одному), чтобы не&nbsp;заходить на&nbsp;страницу редактирования записи."
222
+ hint5_html: "Если <b>редактирование записей</b> доступно, то&nbsp;в&nbsp;списке присутствует пиктограмма <i class="icon-edit"></i>. Щелчок по&nbsp;этой пиктограмме открывает страницу редактирования соответствующей записи."
223
+ hint6_html: "Все <b>специфичные настройки страниц</b> вынесены в раздел «#{link_to I18n.t('admin.settings.actions.index.header'), edit_admin_settings_path}»."
224
+ hint7_html: "В&nbsp;случаях, где это предусмотрено оформлением страниц, текстовые поля оснащены <b>WYSIWYG-редактором</b>. Редактор имеет возможность размещения изображений и&nbsp;вставки кода для видео (встроенное видео) с&nbsp;сервиса YouTube."
225
+ icons_meaning: Значение пиктограмм
207
226
  actions:
208
227
  index:
209
228
  header: Панель управления
@@ -248,6 +267,11 @@ ru:
248
267
  labels:
249
268
  actions:
250
269
  show: Просмотр изменений
270
+ save_table: Сохранить таблицу
271
+ changes: Изменения
272
+ field: Поле
273
+ old_value: Старое значение
274
+ new_value: Новое значение
251
275
  feedbacks:
252
276
  actions:
253
277
  index:
@@ -308,3 +332,8 @@ ru:
308
332
 
309
333
  unauthorized:
310
334
  default: Необходимо войти или зарегистрироваться.
335
+ authentication:
336
+ two_factor: Двухфакторная аутентификация
337
+ key: Ключ
338
+ switch_on_2fa: Включить 2FA
339
+ switch_off_2fa: Выключить 2FA
@@ -4,7 +4,7 @@ set :repo_url, "git@gitlab.molinos.ru:studio/#{fetch(:application)}.git"
4
4
  set :config_files, %w[config/database.yml .env]
5
5
  append :linked_files, 'config/database.yml', '.env', 'config/master.key'
6
6
  append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets',
7
- 'vendor/bundle', 'public/system', 'public/uploads'
7
+ 'vendor/bundle', 'public/system', 'public/uploads', 'storage'
8
8
 
9
9
  set :rvm_ruby_version, Pathname(__dir__).join('../.ruby-version').read.chomp
10
10
 
@@ -1,3 +1,3 @@
1
1
 
2
2
 
3
- Settings.first_or_initialize.update_attributes email: 'studio@molinos.ru', email_header_from: 'studio@molinos.ru', company_name: 'Molinos'
3
+ Settings.first_or_initialize.update email: 'studio@molinos.ru', email_header_from: 'studio@molinos.ru', company_name: 'Molinos'
@@ -1,11 +1,11 @@
1
1
  .f__fieldset
2
- .f__legend Двухфакторная аутентификация
2
+ .f__legend=t('authentication.two_factor')
3
3
  - if resource.otp_required_for_login
4
4
  .f
5
5
  .f__wrapper
6
6
  .f-field
7
7
  .f-field__label
8
- label.f-label Ключ
8
+ label.f-label=t('authentication.key')
9
9
  .f-field__container
10
10
  .f-field__text =resource.otp.secret
11
11
  .f-field
@@ -15,10 +15,10 @@
15
15
  = google_authenticator_qrcode(resource)
16
16
  .f-field
17
17
  .f-field__container
18
- = link_to "Отключить 2FA", toggle_two_factor_admin_profile_path, method: :post, class: 'btn btn btn-primary'
18
+ = link_to t('authentication.switch_off_2fa'), toggle_two_factor_admin_profile_path, method: :post, class: 'btn btn btn-primary'
19
19
  - else
20
20
  .f
21
21
  .f__wrapper
22
22
  .f-field
23
23
  .f-field__container
24
- = link_to "Включить 2FA", toggle_two_factor_admin_profile_path, method: :post, class: 'btn btn btn-primary'
24
+ = link_to t('authentication.switch_on_2fa'), toggle_two_factor_admin_profile_path, method: :post, class: 'btn btn btn-primary'
@@ -2,13 +2,13 @@
2
2
 
3
3
  .auth
4
4
  .auth__title Adminos
5
- .auth__welcome Вход в систему администрирования
5
+ .auth__welcome= t('admin.welcome')
6
6
 
7
7
  = simple_form_for resource, as: resource_name, url: session_path(resource_name), wrapper: :auth, html: { class: 'form auth__form' } do |f|
8
8
  = f.input :otp_attempt, placeholder: '2FA'
9
9
 
10
10
  .form__submit.centered
11
- = f.submit 'Войти', class: 'button button--rounded'
11
+ = f.submit t('admin.users.labels.form.login'), class: 'button button--rounded'
12
12
 
13
13
  - if flash.present?
14
14
  .auth__message
@@ -0,0 +1,21 @@
1
+ RSpec.describe Adminos::Helpers::Plugin, type: :helper do
2
+ describe '#plugin_names' do
3
+ let(:plugin_names_list) { helper.plugin_names }
4
+
5
+ before do
6
+ class SomePlugin < Adminos::Plugins::Base
7
+ def self.name
8
+ 'some name'
9
+ end
10
+ end
11
+ end
12
+
13
+ it 'list of plugin names is not empty' do
14
+ expect(plugin_names_list).not_to be_empty
15
+ end
16
+
17
+ it 'return list of plugin names' do
18
+ expect(plugin_names_list).to include(SomePlugin.name)
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adminos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.rc.3
4
+ version: 1.0.0.pre.rc.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - RavWar
8
8
  - milushov
9
9
  - abuhtoyarov
10
10
  - SiebenSieben
11
- autorequire:
11
+ autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2019-03-18 00:00:00.000000000 Z
14
+ date: 2024-04-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: path
@@ -45,14 +45,14 @@ dependencies:
45
45
  name: railties
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - "~>"
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '5.1'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - "~>"
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '5.1'
58
58
  - !ruby/object:Gem::Dependency
@@ -73,16 +73,16 @@ dependencies:
73
73
  name: slim-rails
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ">="
76
+ - - "~>"
77
77
  - !ruby/object:Gem::Version
78
- version: '0'
78
+ version: 3.6.0
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ">="
83
+ - - "~>"
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 3.6.0
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: friendly_id
88
88
  requirement: !ruby/object:Gem::Requirement
@@ -215,14 +215,14 @@ dependencies:
215
215
  requirements:
216
216
  - - "~>"
217
217
  - !ruby/object:Gem::Version
218
- version: '1.3'
218
+ version: '2.2'
219
219
  type: :development
220
220
  prerelease: false
221
221
  version_requirements: !ruby/object:Gem::Requirement
222
222
  requirements:
223
223
  - - "~>"
224
224
  - !ruby/object:Gem::Version
225
- version: '1.3'
225
+ version: '2.2'
226
226
  - !ruby/object:Gem::Dependency
227
227
  name: m
228
228
  requirement: !ruby/object:Gem::Requirement
@@ -362,10 +362,12 @@ files:
362
362
  - lib/adminos/helpers/models/slugged.rb
363
363
  - lib/adminos/helpers/models/soft_destroy.rb
364
364
  - lib/adminos/helpers/models/wysiwyg.rb
365
+ - lib/adminos/helpers/plugin.rb
365
366
  - lib/adminos/helpers/view.rb
366
367
  - lib/adminos/operations/check_environment.rb
367
368
  - lib/adminos/operations/extract_environment.rb
368
369
  - lib/adminos/operations/load_environment.rb
370
+ - lib/adminos/plugins/base.rb
369
371
  - lib/adminos/stateful_link/action_any_of.rb
370
372
  - lib/adminos/stateful_link/helper.rb
371
373
  - lib/adminos_template.rb
@@ -602,6 +604,7 @@ files:
602
604
  - spec/lib/adminos/helpers/models/if_blank_set_to_nil_params_spec.rb
603
605
  - spec/lib/adminos/helpers/models/recognizable_spec.rb
604
606
  - spec/lib/adminos/helpers/models/slugged.rb
607
+ - spec/lib/adminos/helpers/plugin_spec.rb
605
608
  - spec/lib/generators/adminos/adminos_generator_spec.rb
606
609
  - spec/lib/generators/adminos/ci_generator_spec.rb
607
610
  - spec/lib/generators/adminos/feedback_generator_rspec.rb
@@ -619,7 +622,7 @@ files:
619
622
  homepage: https://gitlab.molinos.ru/global/adminos
620
623
  licenses: []
621
624
  metadata: {}
622
- post_install_message:
625
+ post_install_message:
623
626
  rdoc_options: []
624
627
  require_paths:
625
628
  - lib
@@ -634,8 +637,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
634
637
  - !ruby/object:Gem::Version
635
638
  version: 1.3.1
636
639
  requirements: []
637
- rubygems_version: 3.0.2
638
- signing_key:
640
+ rubygems_version: 3.3.7
641
+ signing_key:
639
642
  specification_version: 4
640
643
  summary: Adminos
641
644
  test_files:
@@ -648,6 +651,7 @@ test_files:
648
651
  - spec/lib/adminos/helpers/models/if_blank_set_to_nil_params_spec.rb
649
652
  - spec/lib/adminos/helpers/models/recognizable_spec.rb
650
653
  - spec/lib/adminos/helpers/models/slugged.rb
654
+ - spec/lib/adminos/helpers/plugin_spec.rb
651
655
  - spec/lib/generators/adminos/adminos_generator_spec.rb
652
656
  - spec/lib/generators/adminos/ci_generator_spec.rb
653
657
  - spec/lib/generators/adminos/feedback_generator_rspec.rb