biovision-base 0.7.170709 → 0.8.170916
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -13
- data/app/assets/javascripts/biovision/base/biovision.js +128 -45
- data/app/assets/stylesheets/biovision/base/admin.scss +64 -104
- data/app/assets/stylesheets/biovision/base/biovision.scss +2 -11
- data/app/assets/stylesheets/biovision/base/buttons.scss +156 -52
- data/app/assets/stylesheets/biovision/base/default.scss +2 -37
- data/app/assets/stylesheets/biovision/base/default_admin.scss +1 -0
- data/app/assets/stylesheets/biovision/base/default_application.scss +1 -0
- data/app/assets/stylesheets/biovision/base/layout.scss +64 -2
- data/app/assets/stylesheets/biovision/base/toggleable.scss +71 -0
- data/app/assets/stylesheets/biovision/base/users.scss +77 -13
- data/app/controllers/about_controller.rb +15 -0
- data/app/controllers/admin/stored_values_controller.rb +25 -0
- data/app/controllers/concerns/toggleable_entity.rb +17 -1
- data/app/controllers/index_controller.rb +1 -0
- data/app/controllers/my/profiles_controller.rb +6 -1
- data/app/controllers/stored_values_controller.rb +56 -0
- data/app/controllers/users_controller.rb +6 -0
- data/app/helpers/biovision_users_helper.rb +3 -3
- data/app/helpers/stored_values_helper.rb +6 -0
- data/app/models/central_region.rb +4 -0
- data/app/models/region.rb +5 -0
- data/app/models/stored_value.rb +28 -0
- data/app/models/user.rb +33 -13
- data/app/models/user_profile.rb +21 -0
- data/app/services/user_manager.rb +32 -0
- data/app/views/about/editable.html.erb +11 -0
- data/app/views/admin/index/index.html.erb +1 -0
- data/app/views/admin/login_attempts/entity/_in_list.html.erb +1 -1
- data/app/views/admin/stored_values/_nav_item.html.erb +6 -0
- data/app/views/admin/stored_values/entity/_in_list.html.erb +15 -0
- data/app/views/admin/stored_values/index.html.erb +14 -0
- data/app/views/admin/stored_values/show.html.erb +37 -0
- data/app/views/admin/users/_filter.html.erb +2 -0
- data/app/views/admin/users/codes.html.erb +1 -1
- data/app/views/admin/users/search.jbuilder +4 -2
- data/app/views/admin/users/show.html.erb +11 -11
- data/app/views/authentication/_form.html.erb +2 -2
- data/app/views/authentication/new.html.erb +1 -1
- data/app/views/editable_pages/_editable_page.html.erb +8 -0
- data/app/views/index/index.html.erb +7 -3
- data/app/views/layouts/application/_footer.html.erb +9 -0
- data/app/views/my/confirmations/show.html.erb +21 -15
- data/app/views/my/login_attempts/index.html.erb +1 -1
- data/app/views/my/profiles/edit/_form.html.erb +112 -65
- data/app/views/my/profiles/edit.html.erb +5 -4
- data/app/views/my/profiles/new/_form.html.erb +5 -5
- data/app/views/my/recoveries/show.html.erb +28 -17
- data/app/views/my/tokens/index.html.erb +1 -1
- data/app/views/profiles/_profile.html.erb +34 -40
- data/app/views/shared/admin/_list_with_priority.html.erb +11 -0
- data/app/views/stored_values/_form.html.erb +33 -0
- data/app/views/stored_values/edit.html.erb +17 -0
- data/app/views/stored_values/new.html.erb +15 -0
- data/app/views/users/_form.html.erb +42 -31
- data/app/views/users/new.html.erb +1 -1
- data/config/locales/common-ru.yml +10 -0
- data/config/locales/editable-pages-ru.yml +34 -2
- data/config/locales/users-ru.yml +19 -12
- data/config/routes.rb +7 -0
- data/db/migrate/20170302000001_create_users.rb +1 -5
- data/db/migrate/20170302000002_create_user_profiles.rb +21 -0
- data/db/migrate/{20170302000002_create_tokens.rb → 20170302000003_create_tokens.rb} +0 -0
- data/db/migrate/{20170302000003_create_code_types.rb → 20170302000004_create_code_types.rb} +0 -0
- data/db/migrate/{20170302000004_create_codes.rb → 20170302000005_create_codes.rb} +0 -0
- data/db/migrate/20170320000000_create_editable_pages.rb +4 -0
- data/db/migrate/20170823000001_create_stored_values.rb +19 -0
- data/lib/biovision/base/engine.rb +1 -0
- data/lib/biovision/base/version.rb +1 -1
- data/lib/tasks/regions.rake +37 -2
- metadata +32 -12
@@ -0,0 +1,56 @@
|
|
1
|
+
class StoredValuesController < AdminController
|
2
|
+
before_action :set_entity, only: [:edit, :update, :destroy]
|
3
|
+
|
4
|
+
# get /stored_values/new
|
5
|
+
def new
|
6
|
+
@entity = StoredValue.new
|
7
|
+
end
|
8
|
+
|
9
|
+
# post /stored_values
|
10
|
+
def create
|
11
|
+
@entity = StoredValue.new(entity_parameters)
|
12
|
+
if @entity.save
|
13
|
+
redirect_to admin_stored_value_path(@entity.id)
|
14
|
+
else
|
15
|
+
render :new, status: :bad_request
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# get /stored_values/:id/edit
|
20
|
+
def edit
|
21
|
+
end
|
22
|
+
|
23
|
+
# patch /stored_values/:id
|
24
|
+
def update
|
25
|
+
if @entity.update(entity_parameters)
|
26
|
+
redirect_to admin_stored_value_path(@entity.id), notice: t('stored_values.update.success')
|
27
|
+
else
|
28
|
+
render :edit, status: :bad_request
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# delete /stored_values/:id
|
33
|
+
def destroy
|
34
|
+
if @entity.destroy
|
35
|
+
flash[:notice] = t('stored_values.destroy.success')
|
36
|
+
end
|
37
|
+
redirect_to admin_stored_values_path
|
38
|
+
end
|
39
|
+
|
40
|
+
protected
|
41
|
+
|
42
|
+
def restrict_access
|
43
|
+
require_privilege :administrator
|
44
|
+
end
|
45
|
+
|
46
|
+
def set_entity
|
47
|
+
@entity = StoredValue.find_by(id: params[:id])
|
48
|
+
if @entity.nil?
|
49
|
+
handle_http_404('Cannot find stored_value')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def entity_parameters
|
54
|
+
params.require(:stored_value).permit(StoredValue.entity_parameters)
|
55
|
+
end
|
56
|
+
end
|
@@ -10,6 +10,7 @@ class UsersController < AdminController
|
|
10
10
|
def create
|
11
11
|
@entity = User.new(creation_parameters)
|
12
12
|
if @entity.save
|
13
|
+
@entity.user_profile.update(profile_parameters)
|
13
14
|
redirect_to admin_user_path(@entity.id), notice: t('users.create.success')
|
14
15
|
else
|
15
16
|
render :new, status: :bad_request
|
@@ -23,6 +24,7 @@ class UsersController < AdminController
|
|
23
24
|
# patch /users/:id
|
24
25
|
def update
|
25
26
|
if @entity.update(entity_parameters)
|
27
|
+
@entity.user_profile.update(profile_parameters)
|
26
28
|
redirect_to admin_user_path(@entity.id), notice: t('users.update.success')
|
27
29
|
else
|
28
30
|
render :edit, status: :bad_request
|
@@ -54,4 +56,8 @@ class UsersController < AdminController
|
|
54
56
|
def creation_parameters
|
55
57
|
params.require(:user).permit(User.entity_parameters).merge(tracking_for_entity)
|
56
58
|
end
|
59
|
+
|
60
|
+
def profile_parameters
|
61
|
+
params.require(:user_profile).permit(UserProfile.entity_parameters)
|
62
|
+
end
|
57
63
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module BiovisionUsersHelper
|
2
2
|
def genders_for_select
|
3
3
|
genders = [[t(:not_selected), '']]
|
4
|
-
prefix = 'activerecord.attributes.
|
5
|
-
genders +
|
4
|
+
prefix = 'activerecord.attributes.user_profile.genders.'
|
5
|
+
genders + UserProfile.genders.keys.to_a.map { |o| [I18n.t("#{prefix}#{o}"), o] }
|
6
6
|
end
|
7
7
|
|
8
8
|
# @param [User] entity
|
@@ -40,7 +40,7 @@ module BiovisionUsersHelper
|
|
40
40
|
return image_tag('biovision/base/placeholders/user.svg') if entity.image.blank?
|
41
41
|
|
42
42
|
versions = "#{entity.image.preview_2x.url} 2x"
|
43
|
-
image_tag(entity.image.preview.url, alt: entity.
|
43
|
+
image_tag(entity.image.preview.url, alt: entity.profile_name, srcset: versions)
|
44
44
|
end
|
45
45
|
|
46
46
|
# @param [ForeignSite] foreign_site
|
data/app/models/region.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
class StoredValue < ApplicationRecord
|
2
|
+
include RequiredUniqueSlug
|
3
|
+
|
4
|
+
SLUG_LIMIT = 50
|
5
|
+
NAME_LIMIT = 100
|
6
|
+
DESCRIPTION_LIMIT = 250
|
7
|
+
VALUE_LIMIT = 255
|
8
|
+
|
9
|
+
validates_length_of :slug, maximum: SLUG_LIMIT
|
10
|
+
validates_length_of :name, maximum: NAME_LIMIT
|
11
|
+
validates_length_of :description, maximum: DESCRIPTION_LIMIT
|
12
|
+
validates_length_of :value, maximum: VALUE_LIMIT
|
13
|
+
|
14
|
+
def self.page_for_administration
|
15
|
+
ordered_by_slug
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.entity_parameters
|
19
|
+
%i(slug name description value)
|
20
|
+
end
|
21
|
+
|
22
|
+
# @param [String] slug
|
23
|
+
# @param [String] default
|
24
|
+
def self.receive(slug, default = '')
|
25
|
+
entity = find_by(slug: slug)
|
26
|
+
entity&.value || default
|
27
|
+
end
|
28
|
+
end
|
data/app/models/user.rb
CHANGED
@@ -10,23 +10,19 @@ class User < ApplicationRecord
|
|
10
10
|
|
11
11
|
SLUG_LIMIT = 250
|
12
12
|
EMAIL_LIMIT = 250
|
13
|
-
NAME_LIMIT = 100
|
14
13
|
NOTICE_LIMIT = 255
|
15
14
|
PHONE_LIMIT = 50
|
16
15
|
|
17
16
|
toggleable %i(allow_login bot email_confirmed phone_confirmed allow_mail)
|
18
17
|
|
19
|
-
belongs_to :agent, optional: true
|
20
|
-
|
21
18
|
has_secure_password
|
22
19
|
|
23
20
|
mount_uploader :image, AvatarUploader
|
24
21
|
|
25
|
-
enum gender: [:female, :male]
|
26
|
-
|
27
22
|
belongs_to :agent, optional: true
|
28
23
|
belongs_to :inviter, class_name: User.to_s, optional: true
|
29
24
|
belongs_to :region, optional: true, counter_cache: true
|
25
|
+
has_one :user_profile, dependent: :destroy
|
30
26
|
has_many :invitees, class_name: User.to_s, foreign_key: :inviter_id, dependent: :nullify
|
31
27
|
has_many :tokens, dependent: :delete_all
|
32
28
|
has_many :codes, dependent: :delete_all
|
@@ -36,6 +32,8 @@ class User < ApplicationRecord
|
|
36
32
|
has_many :login_attempts, dependent: :delete_all
|
37
33
|
|
38
34
|
before_save :normalize_slug
|
35
|
+
before_save :prepare_search_string
|
36
|
+
after_create { UserProfile.create(user: self) }
|
39
37
|
|
40
38
|
validates_presence_of :screen_name, :email
|
41
39
|
validates_format_of :screen_name, with: /\A[a-z0-9_]{1,30}\z/i, if: :native_slug?
|
@@ -44,21 +42,17 @@ class User < ApplicationRecord
|
|
44
42
|
validates :email, uniqueness: { case_sensitive: false }
|
45
43
|
validates_length_of :slug, maximum: SLUG_LIMIT
|
46
44
|
validates_length_of :screen_name, maximum: SLUG_LIMIT
|
47
|
-
validates_length_of :name, maximum: NAME_LIMIT
|
48
|
-
validates_length_of :patronymic, maximum: NAME_LIMIT
|
49
|
-
validates_length_of :surname, maximum: NAME_LIMIT
|
50
45
|
validates_length_of :email, maximum: EMAIL_LIMIT
|
51
46
|
validates_length_of :phone, maximum: PHONE_LIMIT
|
52
47
|
validates_length_of :notice, maximum: NOTICE_LIMIT
|
53
48
|
|
54
49
|
scope :with_privilege, ->(privilege) { joins(:user_privileges).where(user_privileges: { privilege_id: privilege.branch_ids }) }
|
55
50
|
scope :bots, ->(flag) { where(bot: flag.to_i > 0) unless flag.blank? }
|
56
|
-
scope :name_like, ->(val) { where('name ilike ?', "%#{val}%") unless val.blank? }
|
57
51
|
scope :email_like, ->(val) { where('email ilike ?', "%#{val}%") unless val.blank? }
|
58
52
|
scope :with_email, ->(email) { where('lower(email) = lower(?)', email) }
|
59
53
|
scope :screen_name_like, ->(val) { where('screen_name ilike ?', "%#{val}%") unless val.blank? }
|
60
|
-
scope :search, ->(q) { where(
|
61
|
-
scope :filtered, ->(f) {
|
54
|
+
scope :search, ->(q) { where('search_string like ?', "%#{q.downcase}%") unless q.blank? }
|
55
|
+
scope :filtered, ->(f) { email_like(f[:email]).screen_name_like(f[:screen_name]) }
|
62
56
|
|
63
57
|
# @param [Integer] page
|
64
58
|
# @param [Hash] filter
|
@@ -67,7 +61,7 @@ class User < ApplicationRecord
|
|
67
61
|
end
|
68
62
|
|
69
63
|
def self.profile_parameters
|
70
|
-
%i(image
|
64
|
+
%i(image allow_mail)
|
71
65
|
end
|
72
66
|
|
73
67
|
def self.sensitive_parameters
|
@@ -92,12 +86,30 @@ class User < ApplicationRecord
|
|
92
86
|
(min..max)
|
93
87
|
end
|
94
88
|
|
89
|
+
def profile
|
90
|
+
user_profile
|
91
|
+
end
|
92
|
+
|
93
|
+
# Name to be shown as profile
|
94
|
+
#
|
95
|
+
# This can be redefined for cases when something other than screen name should
|
96
|
+
# be used.
|
97
|
+
#
|
98
|
+
# @return [String]
|
95
99
|
def profile_name
|
96
100
|
screen_name
|
97
101
|
end
|
98
102
|
|
99
103
|
def name_for_letter
|
100
|
-
name.blank? ? profile_name : name
|
104
|
+
user_profile&.name.blank? ? profile_name : user_profile.name
|
105
|
+
end
|
106
|
+
|
107
|
+
# @param [Boolean] include_patronymic
|
108
|
+
def full_name(include_patronymic = false)
|
109
|
+
result = [name_for_letter]
|
110
|
+
result << user_profile&.patronymic.to_s.strip if include_patronymic
|
111
|
+
result << user_profile&.surname.to_s.strip
|
112
|
+
result.compact.join(' ')
|
101
113
|
end
|
102
114
|
|
103
115
|
def can_receive_letters?
|
@@ -117,4 +129,12 @@ class User < ApplicationRecord
|
|
117
129
|
self.slug = slug.downcase
|
118
130
|
end
|
119
131
|
end
|
132
|
+
|
133
|
+
def prepare_search_string
|
134
|
+
new_string = "#{slug} #{email}"
|
135
|
+
unless user_profile.nil?
|
136
|
+
new_string << " #{user_profile.search_string}"
|
137
|
+
end
|
138
|
+
self.search_string = new_string.downcase
|
139
|
+
end
|
120
140
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class UserProfile < ApplicationRecord
|
2
|
+
NAME_LIMIT = 100
|
3
|
+
|
4
|
+
enum gender: [:female, :male]
|
5
|
+
|
6
|
+
belongs_to :user
|
7
|
+
|
8
|
+
validates_length_of :name, maximum: NAME_LIMIT
|
9
|
+
validates_length_of :patronymic, maximum: NAME_LIMIT
|
10
|
+
validates_length_of :surname, maximum: NAME_LIMIT
|
11
|
+
validates_uniqueness_of :user_id
|
12
|
+
|
13
|
+
def self.entity_parameters
|
14
|
+
excluded = %w(id user_id created_at updated_at)
|
15
|
+
column_names.reject { |c| excluded.include? c }
|
16
|
+
end
|
17
|
+
|
18
|
+
def search_string
|
19
|
+
"#{name} #{surname}"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class UserManager
|
2
|
+
attr_accessor :user
|
3
|
+
|
4
|
+
# @param [User] user
|
5
|
+
def initialize(user = nil)
|
6
|
+
@user = user
|
7
|
+
end
|
8
|
+
|
9
|
+
# @param [Hash] user_parameters
|
10
|
+
# @param [Hash] profile_parameters
|
11
|
+
def self.create(user_parameters, profile_parameters)
|
12
|
+
user = User.new(user_parameters)
|
13
|
+
if user.save
|
14
|
+
profile = user.user_profile.new(profile_parameters)
|
15
|
+
profile.save
|
16
|
+
else
|
17
|
+
profile = nil
|
18
|
+
end
|
19
|
+
{ user: user, profile: profile }
|
20
|
+
end
|
21
|
+
|
22
|
+
# @param [Hash] user_parameters
|
23
|
+
# @param [Hash] profile_parameters
|
24
|
+
def update(user_parameters, profile_parameters)
|
25
|
+
raise 'User is not set' if @user.nil?
|
26
|
+
@user.update(user_parameters)
|
27
|
+
profile = @user.user_profile || @user.user_profile.create
|
28
|
+
profile.update(profile_parameters)
|
29
|
+
|
30
|
+
{ user: @user, profile: profile }
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% if @editable_page.nil? %>
|
2
|
+
<% content_for :meta_title, t('.title') %>
|
3
|
+
|
4
|
+
<article>
|
5
|
+
<h1><%= t('.heading') %></h1>
|
6
|
+
|
7
|
+
<div class="message-box-warning"><%= t('.message') %></div>
|
8
|
+
</article>
|
9
|
+
<% else %>
|
10
|
+
<%= render partial: 'editable_pages/editable_page', locals: { entity: @editable_page } %>
|
11
|
+
<% end %>
|
@@ -13,6 +13,7 @@
|
|
13
13
|
<li><%= render 'admin/codes/nav_item' %></li>
|
14
14
|
<li><%= render 'admin/privileges/nav_item' %></li>
|
15
15
|
<li><%= render 'admin/privilege_groups/nav_item' %></li>
|
16
|
+
<li><%= render 'admin/stored_values/nav_item' %></li>
|
16
17
|
<% end %>
|
17
18
|
<% if current_user_in_group?(:region_managers) %>
|
18
19
|
<li><%= render 'admin/regions/nav_item' %></li>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<div><%= admin_user_link(entity.user) %></div>
|
6
6
|
<div class="info"><%= time_tag(entity.created_at) %></div>
|
7
7
|
<div class="secondary info">
|
8
|
-
|
8
|
+
<!-- <%= entity.password %> -->
|
9
9
|
<% unless entity.ip.nil? %>
|
10
10
|
<div><%= entity.ip %></div>
|
11
11
|
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="data">
|
2
|
+
<div><%= admin_stored_value_link(entity) %></div>
|
3
|
+
<div class="info">
|
4
|
+
<%= entity.name %>: <q><%= entity.value %></q>
|
5
|
+
</div>
|
6
|
+
<% unless entity.description.blank? %>
|
7
|
+
<div class="secondary info">
|
8
|
+
<%= entity.description %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<ul class="actions">
|
13
|
+
<li><%= edit_icon(edit_stored_value_path(entity.id)) %></li>
|
14
|
+
</ul>
|
15
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<span><%= t('admin.stored_values.nav_item.text') %></span>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<article class="entity-page">
|
7
|
+
<h1><%= t('.heading') %></h1>
|
8
|
+
<ul class="actions">
|
9
|
+
<li><%= back_icon(admin_path) %></li>
|
10
|
+
<li><%= create_icon(new_stored_value_path) %></li>
|
11
|
+
</ul>
|
12
|
+
|
13
|
+
<%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
|
14
|
+
</article>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', slug: @entity.slug) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.stored_values.nav_item.text'), admin_stored_values_path) %>
|
4
|
+
<span><%= @entity.slug %></span>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<article>
|
8
|
+
<h1><%= @entity.slug %></h1>
|
9
|
+
|
10
|
+
<ul class="actions">
|
11
|
+
<li><%= back_icon(admin_stored_values_path) %></li>
|
12
|
+
<li><%= edit_icon(edit_stored_value_path(@entity.id)) %></li>
|
13
|
+
</ul>
|
14
|
+
|
15
|
+
<dl>
|
16
|
+
<dt><%= t(:created_at) %></dt>
|
17
|
+
<dd><%= time_tag(@entity.created_at) %></dd>
|
18
|
+
|
19
|
+
<dt><%= t(:updated_at) %></dt>
|
20
|
+
<dd><%= time_tag(@entity.updated_at) %></dd>
|
21
|
+
|
22
|
+
<dt><%= t('activerecord.attributes.stored_value.slug') %></dt>
|
23
|
+
<dd><%= @entity.slug %></dd>
|
24
|
+
|
25
|
+
<dt><%= t('activerecord.attributes.stored_value.value') %></dt>
|
26
|
+
<dd><%= @entity.value %></dd>
|
27
|
+
|
28
|
+
<% unless @entity.name.blank? %>
|
29
|
+
<dt><%= t('activerecord.attributes.stored_value.name') %></dt>
|
30
|
+
<dd><%= @entity.name %></dd>
|
31
|
+
<% end %>
|
32
|
+
<% unless @entity.description.blank? %>
|
33
|
+
<dt><%= t('activerecord.attributes.stored_value.description') %></dt>
|
34
|
+
<dd><%= @entity.description %></dd>
|
35
|
+
<% end %>
|
36
|
+
</dl>
|
37
|
+
</article>
|
@@ -7,10 +7,12 @@
|
|
7
7
|
<div><%= search_field_tag 'filter[screen_name]', filter[:screen_name], size: 30, results: 5, autosave: 'screen_name' %></div>
|
8
8
|
</div>
|
9
9
|
|
10
|
+
<!--
|
10
11
|
<div>
|
11
12
|
<div><%= label_tag 'filter_name', t('activerecord.attributes.user.name') %></div>
|
12
13
|
<div><%= search_field_tag 'filter[name]', filter[:name], size: 30, results: 5, autosave: 'name' %></div>
|
13
14
|
</div>
|
15
|
+
-->
|
14
16
|
|
15
17
|
<div>
|
16
18
|
<div><%= label_tag 'filter_email', t('activerecord.attributes.user.email') %></div>
|
@@ -1,10 +1,12 @@
|
|
1
1
|
json.data do
|
2
2
|
if @collection.any?
|
3
3
|
json.users @collection do |user|
|
4
|
-
json.(user, :id, :slug, :email
|
4
|
+
json.(user, :id, :slug, :email)
|
5
|
+
json.surname user.user_profile&.surname
|
6
|
+
json.name user.user_profile&.name
|
5
7
|
end
|
6
8
|
else
|
7
9
|
json.users []
|
8
10
|
end
|
9
11
|
json.html render(partial: 'admin/users/search/results', formats: [:html], locals: { collection: @collection })
|
10
|
-
end
|
12
|
+
end
|
@@ -43,19 +43,19 @@
|
|
43
43
|
<dt><%= t('activerecord.attributes.user.screen_name') %></dt>
|
44
44
|
<dd><%= user_link @entity %></dd>
|
45
45
|
|
46
|
-
<% unless @entity.name.blank? %>
|
47
|
-
<dt><%= t('activerecord.attributes.
|
48
|
-
<dd><%= @entity.name %></dd>
|
46
|
+
<% unless @entity.user_profile.name.blank? %>
|
47
|
+
<dt><%= t('activerecord.attributes.user_profile.name') %></dt>
|
48
|
+
<dd><%= @entity.user_profile.name %></dd>
|
49
49
|
<% end %>
|
50
50
|
|
51
|
-
<% unless @entity.patronymic.blank? %>
|
52
|
-
<dt><%= t('activerecord.attributes.
|
53
|
-
<dd><%= @entity.patronymic %></dd>
|
51
|
+
<% unless @entity.user_profile.patronymic.blank? %>
|
52
|
+
<dt><%= t('activerecord.attributes.user_profile.patronymic') %></dt>
|
53
|
+
<dd><%= @entity.user_profile.patronymic %></dd>
|
54
54
|
<% end %>
|
55
55
|
|
56
|
-
<% unless @entity.surname.blank? %>
|
57
|
-
<dt><%= t('activerecord.attributes.
|
58
|
-
<dd><%= @entity.surname %></dd>
|
56
|
+
<% unless @entity.user_profile.surname.blank? %>
|
57
|
+
<dt><%= t('activerecord.attributes.user_profile.surname') %></dt>
|
58
|
+
<dd><%= @entity.user_profile.surname %></dd>
|
59
59
|
<% end %>
|
60
60
|
|
61
61
|
<% unless @entity.email.blank? %>
|
@@ -68,8 +68,8 @@
|
|
68
68
|
<dd><%= link_to @entity.phone, "tel:#{@entity.phone}" %></dd>
|
69
69
|
<% end %>
|
70
70
|
|
71
|
-
<dt><%= t('activerecord.attributes.
|
72
|
-
<dd><%= @entity.gender.blank? ? t(:not_selected) : t("activerecord.attributes.
|
71
|
+
<dt><%= t('activerecord.attributes.user_profile.gender') %></dt>
|
72
|
+
<dd><%= @entity.user_profile.gender.blank? ? t(:not_selected) : t("activerecord.attributes.user_profile.genders.#{@entity.user_profile.gender}") %></dd>
|
73
73
|
|
74
74
|
<% unless @entity.ip.blank? %>
|
75
75
|
<dt><%= t('activerecord.attributes.user.ip') %></dt>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
</div>
|
11
11
|
</div>
|
12
12
|
<div class="actions">
|
13
|
-
<%= button_tag t('
|
14
|
-
<%= link_to t('my.profiles.new.title'), new_my_profile_path, class: 'nav
|
13
|
+
<%= button_tag t('.log_in'), type: 'submit' %>
|
14
|
+
<%= link_to t('my.profiles.new.title'), new_my_profile_path, class: 'button-nav' %>
|
15
15
|
</div>
|
16
16
|
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% content_for(:meta_title, entity.title) unless entity.title.blank? %>
|
2
|
+
<% content_for(:meta_keywords, entity.keywords) unless entity.keywords.blank? %>
|
3
|
+
<% content_for(:meta_description, entity.description) unless entity.description.blank? %>
|
4
|
+
<% content_for(:meta_image, request.protocol + request.host_with_port + entity.image.medium.url) unless entity.image.blank? %>
|
5
|
+
<% content_for :meta_twitter do %>
|
6
|
+
<meta name="twitter:card" content="summary_large_image" />
|
7
|
+
<meta name="twitter:description" content="<%= entity.description %>" />
|
8
|
+
<% end %>
|
@@ -1,5 +1,9 @@
|
|
1
|
-
<%
|
1
|
+
<% if @editable_page.nil? %>
|
2
|
+
<% content_for :meta_title, t('.title') %>
|
2
3
|
|
3
|
-
<article>
|
4
|
+
<article>
|
4
5
|
|
5
|
-
</article>
|
6
|
+
</article>
|
7
|
+
<% else %>
|
8
|
+
<%= render partial: 'editable_pages/editable_page', locals: { entity: @editable_page } %>
|
9
|
+
<% end %>
|
@@ -1,5 +1,14 @@
|
|
1
1
|
<footer>
|
2
2
|
<div>
|
3
3
|
<div class="copyright">© <%= t(:copyright) %></div>
|
4
|
+
<nav>
|
5
|
+
<ul>
|
6
|
+
<li><%= link_to(t('about.index.nav_text'), about_path) %></li>
|
7
|
+
<li><%= link_to(t('about.tos.nav_text'), tos_path) %></li>
|
8
|
+
<% if UserPrivilege.user_has_any_privilege?(current_user) %>
|
9
|
+
<li><%= link_to(t('admin.index.index.heading'), admin_path) %></li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
</nav>
|
4
13
|
</div>
|
5
14
|
</footer>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% content_for :meta_title, t('.title') %>
|
2
2
|
|
3
|
-
<article>
|
3
|
+
<article class="my-confirmation">
|
4
4
|
<h1><%= t('.title') %></h1>
|
5
5
|
<% if current_user&.email_confirmed? %>
|
6
6
|
<div class="message-box-notice"><%= t('activerecord.attributes.user.email_confirmed') %></div>
|
@@ -8,10 +8,14 @@
|
|
8
8
|
<section id="confirmation-container">
|
9
9
|
<h2><%= t('.got_code') %></h2>
|
10
10
|
<%= form_tag my_confirmation_path, method: :patch do %>
|
11
|
-
<
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
<dl>
|
12
|
+
<dt>
|
13
|
+
<%= label_tag :code, t('activerecord.attributes.code.body') %>
|
14
|
+
</dt>
|
15
|
+
<dd>
|
16
|
+
<%= text_field_tag :code, param_from_request(:code), required: true %>
|
17
|
+
</dd>
|
18
|
+
</dl>
|
15
19
|
<div>
|
16
20
|
<%= button_tag t('.confirm'), type: :submit %>
|
17
21
|
</div>
|
@@ -22,19 +26,21 @@
|
|
22
26
|
<script>
|
23
27
|
'use strict';
|
24
28
|
|
25
|
-
|
26
|
-
|
29
|
+
document.addEventListener('DOMContentLoaded', function () {
|
30
|
+
document.querySelector('#confirmation-container form').submit();
|
27
31
|
});
|
28
32
|
</script>
|
29
33
|
<% end %>
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
<% unless current_user.nil? %>
|
36
|
+
<section>
|
37
|
+
<h2><%= t('.no_code') %></h2>
|
38
|
+
<%= form_tag my_confirmation_path, method: :post do %>
|
39
|
+
<div>
|
40
|
+
<%= button_tag t('.send_code'), type: :submit %>
|
41
|
+
</div>
|
42
|
+
<% end %>
|
43
|
+
</section>
|
44
|
+
<% end %>
|
39
45
|
<% end %>
|
40
46
|
</article>
|