adminos 1.0.0.pre.rc.2 → 1.0.0.pre.rc.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -4
- data/README.md +26 -0
- data/adminos.gemspec +4 -4
- data/app/inputs/cropp_input.rb +15 -3
- data/app/inputs/filter_inputs/boolean_input.rb +18 -0
- data/app/inputs/filter_inputs/date_range_input.rb +36 -0
- data/app/inputs/filter_inputs/numeric_input.rb +40 -0
- data/app/inputs/filter_inputs/string_input.rb +40 -0
- data/lib/adminos/configuration.rb +9 -0
- data/lib/adminos/controllers/filters.rb +20 -0
- data/lib/adminos/controllers/resource.rb +34 -14
- data/lib/adminos/extensions/simple_form.rb +12 -0
- data/lib/adminos/features/search/elastic.rb +46 -0
- data/lib/adminos/features/search/pg_search.rb +49 -0
- data/lib/adminos/filters/forms.rb +55 -0
- data/lib/adminos/form_builder.rb +11 -0
- data/lib/adminos/helpers/models/searchable.rb +9 -0
- data/lib/adminos/helpers/view.rb +35 -0
- data/lib/adminos.rb +23 -3
- data/lib/generators/adminos/adminos_generator.rb +10 -7
- data/lib/generators/adminos/feedback_generator.rb +39 -0
- data/lib/generators/adminos/i18n_generator.rb +16 -4
- data/lib/generators/adminos/install_generator.rb +22 -0
- data/lib/generators/adminos/profile_generator.rb +34 -0
- data/lib/generators/adminos/search_generator.rb +38 -0
- data/lib/generators/adminos/two_factor_auth_generator.rb +81 -0
- data/lib/generators/templates/adminos/fields.slim +1 -1
- data/lib/generators/templates/adminos/locales/locale_fields.slim +7 -4
- data/lib/generators/templates/adminos/locales/model.rb.erb +2 -3
- data/lib/generators/templates/ci/.gitlab-ci.yml +1 -1
- data/lib/generators/templates/feedback/auto/app/controllers/admin/feedbacks_controller.rb +17 -0
- data/lib/generators/templates/feedback/auto/app/controllers/feedbacks_controller.rb +11 -0
- data/lib/generators/templates/feedback/auto/app/models/feedback.rb +6 -0
- data/lib/generators/templates/feedback/auto/app/views/admin/feedbacks/_fields.slim +5 -0
- data/lib/generators/templates/feedback/auto/app/views/admin/feedbacks/index.slim +28 -0
- data/lib/generators/templates/feedback/feedbacks_migration.rb +13 -0
- data/lib/generators/templates/field/locales/locale_fields.slim +1 -1
- data/lib/generators/templates/field/locales/model.rb.erb +2 -3
- data/lib/generators/templates/i18n/Gemfile +6 -1
- data/lib/generators/templates/i18n/auto/app/validators/locale_validator.rb +5 -1
- data/lib/generators/templates/i18n/auto/app/views/admin/base/_pills.slim +1 -5
- data/lib/generators/templates/i18n/auto/app/views/admin/pages/_locale_fields.slim +5 -5
- data/lib/generators/templates/i18n/auto/config/initializers/mobility.rb +92 -0
- data/lib/generators/templates/i18n/devise/devise.ru.yml +15 -3
- data/lib/generators/templates/i18n/devise/views/mailer/confirmation_instructions.slim +3 -4
- data/lib/generators/templates/i18n/devise/views/mailer/reset_password_instructions.slim +5 -5
- data/lib/generators/templates/i18n/devise/views/mailer/unlock_instructions.slim +4 -4
- data/lib/generators/templates/i18n/page.rb +2 -2
- data/lib/generators/templates/install/Gemfile +4 -6
- data/lib/generators/templates/install/README.md +22 -0
- data/lib/generators/templates/install/admin_panel/versions/views/admin_versions/index.slim +1 -1
- data/lib/generators/templates/install/admin_panel/versions/views/admin_versions/show.slim +3 -3
- data/lib/generators/templates/install/auto/Capfile +12 -2
- data/lib/generators/templates/install/auto/app/controllers/admin/settings_controller.rb +1 -1
- data/lib/generators/templates/install/auto/app/helpers/versions_helper.rb +3 -3
- data/lib/generators/templates/install/auto/app/inputs/carrierwave_input.rb +2 -2
- data/lib/generators/templates/install/auto/app/inputs/checkbox_input.rb +1 -1
- data/lib/generators/templates/install/auto/app/services/export_xlsx.rb +6 -6
- data/lib/generators/templates/install/auto/app/views/admin/base/_form.slim +3 -3
- data/lib/generators/templates/install/auto/app/views/admin/helps/index.slim +9 -9
- data/lib/generators/templates/install/auto/app/views/admin/settings/edit.slim +2 -2
- data/lib/generators/templates/install/auto/app/views/shared/admin/_back_button.slim +1 -1
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_collection_header.slim +2 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_new.slim +1 -1
- data/lib/generators/templates/install/auto/config/deploy/staging.rb +15 -10
- data/lib/generators/templates/install/auto/config/deploy/{shared → templates}/database.yml.erb +1 -1
- data/lib/generators/templates/install/auto/config/deploy/templates/nginx_conf.erb +96 -0
- data/lib/generators/templates/install/auto/config/deploy/templates/puma.rb.erb +52 -0
- data/lib/generators/templates/install/auto/config/environments/staging.rb +1 -1
- data/lib/generators/templates/install/auto/config/initializers/adminos.rb +3 -0
- data/lib/generators/templates/install/auto/config/locales/adminos.en.yml +30 -0
- data/lib/generators/templates/install/auto/config/locales/adminos.ru.yml +49 -2
- data/lib/generators/templates/install/auto/config/schedule.rb +0 -0
- data/lib/generators/templates/install/auto/config/systemd/puma.service.erb +19 -0
- data/lib/generators/templates/install/auto/config/systemd/sidekiq.service.erb +21 -0
- data/lib/generators/templates/install/auto/lib/capistrano/{template.rb → smart_templates.rb} +17 -3
- data/lib/generators/templates/install/auto/lib/capistrano/tasks/setup_config.cap +27 -20
- data/lib/generators/templates/install/deploy.rb.erb +13 -12
- data/lib/generators/templates/install/prepare_settings.rb +1 -1
- data/lib/generators/templates/profile/auto/app/controllers/admin/profiles_controller.rb +26 -0
- data/lib/generators/templates/profile/auto/app/views/admin/profiles/edit.slim +17 -0
- data/lib/generators/templates/two_facto_auth/Gemfile +1 -0
- data/lib/generators/templates/two_facto_auth/auto/app/controllers/concerns/authenticates_with_two_factor.rb +36 -0
- data/lib/generators/templates/two_facto_auth/auto/app/controllers/users/sessions_controller.rb +5 -0
- data/lib/generators/templates/two_facto_auth/auto/app/views/admin/profiles/_2fa.slim +24 -0
- data/lib/generators/templates/two_facto_auth/auto/app/views/devise/sessions/two_factor.slim +15 -0
- data/spec/lib/generators/adminos/feedback_generator_rspec.rb +50 -0
- data/spec/lib/generators/adminos/install_generator_rspec.rb +6 -7
- data/spec/lib/generators/adminos/profile_generator_rspec.rb +33 -0
- data/spec/lib/generators/adminos/search_generator.rb +20 -0
- data/spec/lib/generators/adminos/two_factor_auth_generator_rspec.rb +61 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/support/shared/generator.rb +1 -1
- metadata +59 -26
- data/bin/rspec +0 -29
- data/lib/adminos/extensions/globalize_actiontext.rb +0 -28
- data/lib/adminos/extensions/globalize_fields.rb +0 -19
- data/lib/generators/templates/adminos/locales/migration.rb.erb +0 -18
- data/lib/generators/templates/field/locales/migration.rb.erb +0 -13
- data/lib/generators/templates/i18n/add_translation_table_to_page.rb +0 -15
- data/lib/generators/templates/i18n/auto/config/initializers/globalize_fields.rb +0 -1
- data/lib/generators/templates/install/auto/config/deploy/shared/nginx.conf.erb +0 -28
- data/lib/generators/templates/install/auto/config/deploy/shared/unicorn.rb.erb +0 -35
- data/lib/generators/templates/install/auto/lib/capistrano/substitute_strings.rb +0 -12
- data/package-lock.json +0 -3
@@ -0,0 +1,92 @@
|
|
1
|
+
Mobility.configure do |config|
|
2
|
+
# Sets the default backend to use in models. This can be overridden in models
|
3
|
+
# by passing +backend: ...+ to +translates+.
|
4
|
+
config.default_backend = :jsonb
|
5
|
+
|
6
|
+
# By default, Mobility uses the +translates+ class method in models to
|
7
|
+
# describe translated attributes, but you can configure this method to be
|
8
|
+
# whatever you like. This may be useful if using Mobility alongside another
|
9
|
+
# translation gem which uses the same method name.
|
10
|
+
config.accessor_method = :translates
|
11
|
+
|
12
|
+
# To query on translated attributes, you need to append a scope to your
|
13
|
+
# model. The name of this scope is +i18n+ by default, but this can be changed
|
14
|
+
# to something else.
|
15
|
+
config.query_method = :i18n
|
16
|
+
|
17
|
+
# Uncomment and remove (or add) items to (from) this list to completely
|
18
|
+
# disable/enable plugins globally (so they cannot be used and are never even
|
19
|
+
# loaded). Note that if you remove an item from the list, you will not be
|
20
|
+
# able to use the plugin at all, and any options for the plugin will be
|
21
|
+
# ignored by models. (In most cases, you probably don't want to change this.)
|
22
|
+
#
|
23
|
+
# config.plugins = %i[
|
24
|
+
# query
|
25
|
+
# cache
|
26
|
+
# dirty
|
27
|
+
# fallbacks
|
28
|
+
# presence
|
29
|
+
# default
|
30
|
+
# attribute_methods
|
31
|
+
# fallthrough_accessors
|
32
|
+
# locale_accessors
|
33
|
+
# ]
|
34
|
+
|
35
|
+
config.plugins += [:ransack]
|
36
|
+
|
37
|
+
# The translation cache is on by default, but you can turn it off by
|
38
|
+
# uncommenting this line. (This may be helpful in debugging.)
|
39
|
+
#
|
40
|
+
# config.default_options[:cache] = false
|
41
|
+
|
42
|
+
# Dirty tracking is disabled by default. Uncomment this line to enable it.
|
43
|
+
# If you enable this, you should also enable +locale_accessors+ by default
|
44
|
+
# (see below).
|
45
|
+
#
|
46
|
+
# config.default_options[:dirty] = true
|
47
|
+
|
48
|
+
# No fallbacks are used by default. To define default fallbacks, uncomment
|
49
|
+
# and set the default fallback option value here. A "true" value will use
|
50
|
+
# whatever is defined by +I18n.fallbacks+ (if defined), or alternatively will
|
51
|
+
# fallback to your +I18n.default_locale+.
|
52
|
+
#
|
53
|
+
# config.default_options[:fallbacks] = true
|
54
|
+
|
55
|
+
# The Presence plugin converts empty strings to nil when fetching and setting
|
56
|
+
# translations. By default it is on, uncomment this line to turn it off.
|
57
|
+
#
|
58
|
+
# config.default_options[:presence] = false
|
59
|
+
|
60
|
+
# Set a default value to use if the translation is nil. By default this is
|
61
|
+
# off, uncomment and set a default to use it across all models (you probably
|
62
|
+
# don't want to do that).
|
63
|
+
#
|
64
|
+
# config.default_options[:default] = ...
|
65
|
+
|
66
|
+
# Uncomment to enable locale_accessors by default on models. A true value
|
67
|
+
# will use the locales defined either in
|
68
|
+
# Rails.application.config.i18n.available_locales or I18n.available_locales.
|
69
|
+
# If you want something else, pass an array of locales instead.
|
70
|
+
#
|
71
|
+
# config.default_options[:locale_accessors] = true
|
72
|
+
|
73
|
+
# Uncomment to enable fallthrough accessors by default on models. This will
|
74
|
+
# allow you to call any method with a suffix like _en or _pt_br, and Mobility
|
75
|
+
# will catch the suffix and convert it into a locale in +method_missing+. If
|
76
|
+
# you don't need this kind of open-ended fallthrough behavior, it's better
|
77
|
+
# to use locale_accessors instead (which define methods) since method_missing
|
78
|
+
# is very slow. (You can use both fallthrough and locale accessor plugins
|
79
|
+
# together without conflict.)
|
80
|
+
#
|
81
|
+
# Note: The dirty plugin enables fallthrough_accessors by default.
|
82
|
+
#
|
83
|
+
# config.default_options[:fallthrough_accessors] = true
|
84
|
+
|
85
|
+
# You can also include backend-specific default options. For example, if you
|
86
|
+
# want to default to using the text-type translation table with the KeyValue
|
87
|
+
# backend, you can set that as a default by uncommenting this line, or change
|
88
|
+
# it to :string to default to the string-type translation table instead. (For
|
89
|
+
# other backends, this option is ignored.)
|
90
|
+
#
|
91
|
+
# config.default_options[:type] = :text
|
92
|
+
end
|
@@ -53,8 +53,20 @@ ru:
|
|
53
53
|
failure: "Вы не можете войти в систему с учётной записью из %{kind}, т.к. \"%{reason}\"."
|
54
54
|
mailer:
|
55
55
|
confirmation_instructions:
|
56
|
-
|
56
|
+
action: Активировать
|
57
|
+
greeting: Здравствуйте, %{recipient} !
|
58
|
+
instruction: 'Вы можете активировать свою учетную запись, нажав ссылку снизу:'
|
59
|
+
subject: Инструкции по подтверждению учетной записи
|
57
60
|
reset_password_instructions:
|
58
|
-
|
61
|
+
action: Изменить пароль
|
62
|
+
greeting: Здравствуйте, %{recipient}!
|
63
|
+
instruction: 'Вы (или кто-то еще) запросили изменение пароля. Для изменения пароля нажмите ссылку ниже:'
|
64
|
+
instruction_2: Если вы не запрашивали изменение пароля - проигнорируйте это сообщение
|
65
|
+
instruction_3: Ваш пароль не изменится пока вы не нажмете на ссылку и не введете новый.
|
66
|
+
subject: Инструкции по восстановлению пароля
|
59
67
|
unlock_instructions:
|
60
|
-
|
68
|
+
action: Разблокировать учетную запись
|
69
|
+
greeting: Здравствуйте, %{recipient}!
|
70
|
+
instruction: 'Нажмите ссылку для активации учетной записи:'
|
71
|
+
message: Ваша учетная запись была заблокирована в связи с превышением лимита неудачных попыток входа.
|
72
|
+
subject: Инструкции по разблокировке учетной записи
|
@@ -1,4 +1,3 @@
|
|
1
|
-
p
|
2
|
-
p
|
3
|
-
p= link_to '
|
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 '
|
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
|
2
|
-
p
|
3
|
-
p
|
4
|
-
p= link_to '
|
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)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
1
|
+
extend Mobility
|
2
2
|
|
3
|
-
|
3
|
+
translates :name, :nav_name, :body, :meta_description, :meta_title, locale_accessors: true, ransack: true
|
4
4
|
|
5
5
|
validates_with LocaleValidator
|
@@ -7,20 +7,17 @@ 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
|
-
group :production, :staging do
|
14
|
-
gem 'unicorn'
|
15
|
-
end
|
16
|
-
|
17
13
|
group :development do
|
18
14
|
# gem 'spring'
|
19
15
|
gem 'capistrano', require: false
|
20
16
|
gem 'capistrano-bundler', require: false
|
21
17
|
gem 'capistrano-rails', require: false
|
22
18
|
gem 'capistrano-rvm', require: false
|
23
|
-
gem 'capistrano3-
|
19
|
+
gem 'capistrano3-puma'
|
20
|
+
gem 'capistrano-systemd-multiservice', '~> 0.1.0.beta6', require: false
|
24
21
|
|
25
22
|
gem 'guard'
|
26
23
|
gem 'guard-livereload', '~> 2.5', require: false
|
@@ -47,6 +44,7 @@ gem 'paper_trail'
|
|
47
44
|
gem 'postal-rails', '~> 1.0'
|
48
45
|
|
49
46
|
gem 'scoped_search'
|
47
|
+
gem 'pg_search'
|
50
48
|
|
51
49
|
gem 'omniauth'
|
52
50
|
gem 'omniauth-facebook'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
## Deployment
|
3
|
+
|
4
|
+
For painless deployment, you should configure several sudo commands for specified deploy user
|
5
|
+
to be executed without asking for password via `sudo visudo` command,
|
6
|
+
as described in https://capistranorb.com/documentation/getting-started/authentication-and-authorisation/#authorisation
|
7
|
+
|
8
|
+
Full list of sudo command could be obtained by running commands mentioned below with `--dry-run` option
|
9
|
+
(e. g. `bin/cap --dry-run {stage_name} deploy:setup`
|
10
|
+
|
11
|
+
1. Set up new deployment in `config/stages/{stage_name}.rb` file
|
12
|
+
1. Set up new deployment (upload configurations):
|
13
|
+
|
14
|
+
`bin/cap {stage_name} deploy:setup`
|
15
|
+
|
16
|
+
1. Deploy new version to `{stage_name}`:
|
17
|
+
|
18
|
+
`bin/cap {stage_name} deploy`
|
19
|
+
|
20
|
+
2. On new deployment (or when systemd templates updated), update & enable systemd services for Puma & Sidekiq:
|
21
|
+
|
22
|
+
`bin/cap {stage_name} deploy:setup_systemd`
|
@@ -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
|
@@ -3,12 +3,22 @@ require 'capistrano/setup'
|
|
3
3
|
|
4
4
|
# Include default deployment tasks
|
5
5
|
require 'capistrano/deploy'
|
6
|
+
require 'capistrano/scm/git'
|
6
7
|
require 'capistrano/rvm'
|
7
8
|
require 'capistrano/bundler'
|
8
9
|
require 'capistrano/rails'
|
9
|
-
require '
|
10
|
+
require 'capistrano/puma'
|
10
11
|
require 'capistrano-db-tasks'
|
12
|
+
require 'whenever/capistrano'
|
13
|
+
require 'capistrano/systemd/multiservice'
|
11
14
|
|
15
|
+
install_plugin Capistrano::SCM::Git
|
16
|
+
install_plugin Capistrano::Puma
|
17
|
+
install_plugin Capistrano::Puma::Nginx
|
18
|
+
install_plugin Capistrano::Systemd::MultiService.new_service('puma')
|
19
|
+
# install_plugin Capistrano::Systemd::MultiService.new_service('sidekiq')
|
20
|
+
|
21
|
+
lib_dir = File.join(__dir__, 'lib')
|
22
|
+
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
|
12
23
|
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
|
13
24
|
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
|
14
|
-
Dir.glob('lib/capistrano/**/*.rb').each { |r| import r }
|
@@ -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.
|
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"
|
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"
|
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"
|
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|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
= resource_header
|
9
9
|
|
10
|
-
=
|
10
|
+
= adminos_form_for resource_form_object, wrapper: :admin do |f|
|
11
11
|
.f
|
12
12
|
.f__wrapper
|
13
13
|
/ Родительский элемент
|
@@ -21,10 +21,10 @@
|
|
21
21
|
|
22
22
|
.f-submit.f-submit--fixed
|
23
23
|
.wrapper
|
24
|
-
= f.button :submit, '
|
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, '
|
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
|
4
|
+
h4= t('admin.helps.title_html')
|
5
5
|
ul
|
6
|
-
li
|
7
|
-
li
|
8
|
-
li
|
9
|
-
li
|
10
|
-
li
|
11
|
-
li
|
12
|
-
li
|
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
|
data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_new.slim
CHANGED
@@ -1 +1 @@
|
|
1
|
-
= link_to :new, polymorphic_path( [:admin, object.class], action: :new, parent_id: object.id )
|
1
|
+
= link_to :new, polymorphic_path( [:admin, object.class], action: :new, parent_id: object.id ), class: 'icon icon--diff -diff', title: t('labels.admin.add_child')
|
@@ -1,12 +1,17 @@
|
|
1
|
-
server "#{fetch(:application)}.staging.molinos.ru", user: '
|
2
|
-
|
3
|
-
set :
|
4
|
-
set :app_name, fetch(:application)
|
5
|
-
set :user_home_dir, "/home/#{fetch(:deploy_user)}"
|
6
|
-
# set :god_port, PLACEHOLDER
|
1
|
+
server "#{fetch(:application)}.staging.molinos.ru", user: 'app', roles: %w(web app db), primary: true
|
2
|
+
|
3
|
+
set :domain, "#{fetch(:application)}.staging.molinos.ru"
|
7
4
|
set :keep_releases, 5
|
8
5
|
set :rails_env, 'staging'
|
9
|
-
set :
|
10
|
-
|
11
|
-
set :
|
12
|
-
set :deploy_to, "
|
6
|
+
set :branch, :develop
|
7
|
+
|
8
|
+
set :user, :app
|
9
|
+
set :deploy_to, "/home/#{fetch(:user)}/#{fetch(:application)}"
|
10
|
+
|
11
|
+
# CentOS
|
12
|
+
set :nginx_sites_available_path, "#{fetch(:deploy_to)}/shared"
|
13
|
+
set :nginx_sites_enabled_path, '/etc/nginx/conf.d'
|
14
|
+
|
15
|
+
# Ubuntu
|
16
|
+
# set :nginx_sites_available_path, "/etc/nginx/sites-available"
|
17
|
+
# set :nginx_sites_enabled_path, "/etc/nginx/sites-enabled"
|
@@ -0,0 +1,96 @@
|
|
1
|
+
upstream puma_<%= fetch(:nginx_upstream_name) %> { <%
|
2
|
+
@backends = [fetch(:puma_bind)].flatten.map do |m|
|
3
|
+
etype, address = /(tcp|unix|ssl):\/{1,2}(.+)/.match(m).captures
|
4
|
+
if etype == 'unix'
|
5
|
+
"server #{etype}:#{address} #{fetch(:nginx_socket_flags)};"
|
6
|
+
else
|
7
|
+
"server #{address.gsub(/0\.0\.0\.0(.+)/, "127.0.0.1\\1")} #{fetch(:nginx_http_flags)};"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
%><% @backends.each do |server| %>
|
11
|
+
<%= server %><% end %>
|
12
|
+
}
|
13
|
+
<% if fetch(:nginx_use_ssl) -%>
|
14
|
+
server {
|
15
|
+
listen 80;
|
16
|
+
server_name <%= fetch(:nginx_server_name) %>;
|
17
|
+
return 301 https://$host$1$request_uri;
|
18
|
+
}
|
19
|
+
<% end -%>
|
20
|
+
|
21
|
+
server {
|
22
|
+
<% if fetch(:nginx_use_ssl) -%>
|
23
|
+
listen 443;
|
24
|
+
ssl on;
|
25
|
+
<% if fetch(:nginx_ssl_certificate) -%>
|
26
|
+
ssl_certificate <%= fetch(:nginx_ssl_certificate) %>;
|
27
|
+
<% else -%>
|
28
|
+
ssl_certificate /etc/letsencrypt/live/<%= fetch(:domain) %>/fullchain.pem;
|
29
|
+
<% end -%>
|
30
|
+
<% if fetch(:nginx_ssl_certificate_key) -%>
|
31
|
+
ssl_certificate_key <%= fetch(:nginx_ssl_certificate_key) %>;
|
32
|
+
<% else -%>
|
33
|
+
ssl_certificate_key /etc/letsencrypt/live/<%= fetch(:domain) %>/privkey.pem;
|
34
|
+
<% end -%>
|
35
|
+
include /etc/letsencrypt/options-ssl-nginx.conf;
|
36
|
+
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
37
|
+
<% else -%>
|
38
|
+
listen 80;
|
39
|
+
<% end -%>
|
40
|
+
server_name <%= fetch(:nginx_server_name) %>;
|
41
|
+
root <%= current_path %>/public;
|
42
|
+
try_files $uri/index.html $uri @puma_<%= fetch(:nginx_upstream_name) %>;
|
43
|
+
|
44
|
+
client_max_body_size 4G;
|
45
|
+
keepalive_timeout 10;
|
46
|
+
|
47
|
+
error_page 500 502 504 /500.html;
|
48
|
+
error_page 503 @503;
|
49
|
+
|
50
|
+
location @puma_<%= fetch(:nginx_upstream_name) %> {
|
51
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
52
|
+
proxy_set_header Host $host;
|
53
|
+
proxy_redirect off;
|
54
|
+
proxy_set_header Upgrade $http_upgrade;
|
55
|
+
proxy_set_header Connection "Upgrade";
|
56
|
+
<% if fetch(:nginx_use_ssl) -%>
|
57
|
+
proxy_set_header X-Forwarded-Proto https;
|
58
|
+
<% else -%>
|
59
|
+
proxy_set_header X-Forwarded-Proto http;
|
60
|
+
<% end -%>
|
61
|
+
proxy_pass http://puma_<%= fetch(:nginx_upstream_name) %>;
|
62
|
+
# limit_req zone=one;
|
63
|
+
access_log <%= shared_path %>/log/nginx.access.log;
|
64
|
+
error_log <%= shared_path %>/log/nginx.error.log;
|
65
|
+
}
|
66
|
+
|
67
|
+
location ^~ /assets/ {
|
68
|
+
gzip_static on;
|
69
|
+
expires max;
|
70
|
+
add_header Cache-Control public;
|
71
|
+
}
|
72
|
+
|
73
|
+
location = /50x.html {
|
74
|
+
root html;
|
75
|
+
}
|
76
|
+
|
77
|
+
location = /404.html {
|
78
|
+
root html;
|
79
|
+
}
|
80
|
+
|
81
|
+
location @503 {
|
82
|
+
error_page 405 = /system/maintenance.html;
|
83
|
+
if (-f $document_root/system/maintenance.html) {
|
84
|
+
rewrite ^(.*)$ /system/maintenance.html break;
|
85
|
+
}
|
86
|
+
rewrite ^(.*)$ /503.html break;
|
87
|
+
}
|
88
|
+
|
89
|
+
if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
|
90
|
+
return 405;
|
91
|
+
}
|
92
|
+
|
93
|
+
if (-f $document_root/system/maintenance.html) {
|
94
|
+
return 503;
|
95
|
+
}
|
96
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env puma
|
2
|
+
|
3
|
+
directory '<%= current_path %>'
|
4
|
+
rackup "<%=fetch(:puma_rackup)%>"
|
5
|
+
environment '<%= fetch(:puma_env) %>'
|
6
|
+
<% if fetch(:puma_tag) %>
|
7
|
+
tag '<%= fetch(:puma_tag)%>'
|
8
|
+
<% end %>
|
9
|
+
pidfile "<%=fetch(:puma_pid)%>"
|
10
|
+
state_path "<%=fetch(:puma_state)%>"
|
11
|
+
stdout_redirect '<%=fetch(:puma_access_log)%>', '<%=fetch(:puma_error_log)%>', true
|
12
|
+
|
13
|
+
|
14
|
+
threads <%=fetch(:puma_threads).join(',')%>
|
15
|
+
|
16
|
+
<%= puma_plugins %>
|
17
|
+
|
18
|
+
<%= puma_bind %>
|
19
|
+
<% if fetch(:puma_control_app) %>
|
20
|
+
activate_control_app "<%= fetch(:puma_default_control_app) %>"
|
21
|
+
<% end %>
|
22
|
+
workers <%= puma_workers %>
|
23
|
+
<% if fetch(:puma_worker_timeout) %>
|
24
|
+
worker_timeout <%= fetch(:puma_worker_timeout).to_i %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<% if puma_daemonize? %>
|
28
|
+
daemonize
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<% if puma_preload_app? %>
|
32
|
+
preload_app!
|
33
|
+
<% else %>
|
34
|
+
prune_bundler
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
on_restart do
|
38
|
+
puts 'Refreshing Gemfile'
|
39
|
+
ENV["BUNDLE_GEMFILE"] = "<%= fetch(:bundle_gemfile, "#{current_path}/Gemfile") %>"
|
40
|
+
end
|
41
|
+
|
42
|
+
<% if puma_preload_app? and fetch(:puma_init_active_record) %>
|
43
|
+
before_fork do
|
44
|
+
ActiveRecord::Base.connection_pool.disconnect!
|
45
|
+
end
|
46
|
+
|
47
|
+
on_worker_boot do
|
48
|
+
ActiveSupport.on_load(:active_record) do
|
49
|
+
ActiveRecord::Base.establish_connection
|
50
|
+
end
|
51
|
+
end
|
52
|
+
<% end %>
|
@@ -25,7 +25,7 @@ Rails.application.configure do
|
|
25
25
|
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
26
|
|
27
27
|
# Compress JavaScripts and CSS.
|
28
|
-
config.assets.js_compressor = :
|
28
|
+
config.assets.js_compressor = config.assets.js_compressor = Uglifier.new(harmony: true)
|
29
29
|
# config.assets.css_compressor = :sass
|
30
30
|
|
31
31
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|