ditty 0.8.0 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.test +2 -0
- data/.gitignore +3 -0
- data/.pryrc +2 -0
- data/.rubocop.yml +23 -4
- data/.travis.yml +4 -8
- data/CNAME +1 -0
- data/Dockerfile +18 -0
- data/Gemfile.ci +0 -17
- data/Rakefile +2 -2
- data/_config.yml +1 -0
- data/config.ru +4 -4
- data/ditty.gemspec +28 -18
- data/docs/CNAME +1 -0
- data/docs/_config.yml +1 -0
- data/docs/index.md +34 -0
- data/exe/ditty +2 -0
- data/lib/ditty/cli.rb +41 -5
- data/lib/ditty/components/{app.rb → ditty.rb} +18 -16
- data/lib/ditty/controllers/{application.rb → application_controller.rb} +63 -34
- data/lib/ditty/controllers/{audit_logs.rb → audit_logs_controller.rb} +4 -2
- data/lib/ditty/controllers/{auth.rb → auth_controller.rb} +22 -18
- data/lib/ditty/controllers/{component.rb → component_controller.rb} +23 -20
- data/lib/ditty/controllers/{main.rb → main_controller.rb} +6 -2
- data/lib/ditty/controllers/roles_controller.rb +23 -0
- data/lib/ditty/controllers/user_login_traits_controller.rb +46 -0
- data/lib/ditty/controllers/{users.rb → users_controller.rb} +13 -11
- data/lib/ditty/db.rb +7 -5
- data/lib/ditty/emails/base.rb +37 -32
- data/lib/ditty/generators/crud_generator.rb +114 -0
- data/lib/ditty/generators/migration_generator.rb +26 -0
- data/lib/ditty/generators/project_generator.rb +52 -0
- data/lib/ditty/helpers/component.rb +2 -1
- data/lib/ditty/helpers/pundit.rb +24 -8
- data/lib/ditty/helpers/response.rb +15 -13
- data/lib/ditty/helpers/views.rb +28 -6
- data/lib/ditty/listener.rb +6 -4
- data/lib/ditty/memcached.rb +8 -0
- data/lib/ditty/middleware/accept_extension.rb +2 -2
- data/lib/ditty/middleware/error_catchall.rb +2 -2
- data/lib/ditty/models/base.rb +9 -0
- data/lib/ditty/models/identity.rb +11 -7
- data/lib/ditty/models/role.rb +1 -0
- data/lib/ditty/models/user.rb +23 -2
- data/lib/ditty/policies/role_policy.rb +1 -1
- data/lib/ditty/policies/user_login_trait_policy.rb +1 -1
- data/lib/ditty/policies/user_policy.rb +1 -1
- data/lib/ditty/services/authentication.rb +27 -16
- data/lib/ditty/services/email.rb +19 -15
- data/lib/ditty/services/logger.rb +26 -20
- data/lib/ditty/services/pagination_wrapper.rb +7 -5
- data/lib/ditty/services/settings.rb +7 -6
- data/lib/ditty/tasks/ditty.rake +19 -1
- data/lib/ditty/tasks/omniauth-ldap.rake +2 -2
- data/lib/ditty/templates/.gitignore +5 -0
- data/lib/ditty/templates/.rspec +2 -0
- data/lib/ditty/templates/.rubocop.yml +7 -0
- data/lib/ditty/templates/Rakefile +12 -0
- data/lib/ditty/templates/application.rb +12 -0
- data/lib/ditty/templates/config.ru +37 -0
- data/lib/ditty/templates/controller.rb.erb +64 -0
- data/lib/ditty/templates/env.example +4 -0
- data/lib/ditty/templates/lib/project.rb.erb +5 -0
- data/lib/ditty/templates/logs/.empty_directory +0 -0
- data/lib/ditty/templates/migration.rb.erb +7 -0
- data/lib/ditty/templates/model.rb.erb +26 -0
- data/lib/ditty/templates/pids/.empty_directory +0 -0
- data/lib/ditty/templates/policy.rb.erb +48 -0
- data/{public → lib/ditty/templates/public}/browserconfig.xml +0 -0
- data/lib/ditty/templates/public/css/sb-admin-2.min.css +10 -0
- data/lib/ditty/templates/public/css/styles.css +13 -0
- data/lib/ditty/templates/public/favicon.ico +0 -0
- data/{public → lib/ditty/templates/public}/images/apple-icon.png +0 -0
- data/{public → lib/ditty/templates/public}/images/favicon-16x16.png +0 -0
- data/{public → lib/ditty/templates/public}/images/favicon-32x32.png +0 -0
- data/{public → lib/ditty/templates/public}/images/launcher-icon-1x.png +0 -0
- data/{public → lib/ditty/templates/public}/images/launcher-icon-2x.png +0 -0
- data/{public → lib/ditty/templates/public}/images/launcher-icon-4x.png +0 -0
- data/{public → lib/ditty/templates/public}/images/mstile-150x150.png +0 -0
- data/{public → lib/ditty/templates/public}/images/safari-pinned-tab.svg +0 -0
- data/lib/ditty/templates/public/js/sb-admin-2.min.js +7 -0
- data/lib/ditty/templates/public/js/scripts.js +1 -0
- data/{public/manifest.json → lib/ditty/templates/public/manifest.json.erb} +2 -2
- data/lib/ditty/templates/settings.yml.erb +29 -0
- data/lib/ditty/templates/sidekiq.rb +18 -0
- data/lib/ditty/templates/sidekiq.yml +9 -0
- data/lib/ditty/templates/spec_helper.rb +43 -0
- data/lib/ditty/templates/type.rb.erb +21 -0
- data/lib/ditty/templates/views/display.haml.tt +20 -0
- data/lib/ditty/templates/views/edit.haml.tt +10 -0
- data/lib/ditty/templates/views/form.haml.tt +11 -0
- data/lib/ditty/templates/views/index.haml.tt +29 -0
- data/lib/ditty/templates/views/new.haml.tt +10 -0
- data/lib/ditty/version.rb +1 -1
- data/lib/ditty.rb +6 -4
- data/lib/rubocop/cop/ditty/call_services_directly.rb +2 -2
- data/migrate/20181209_add_user_login_traits.rb +4 -4
- data/migrate/20190220_add_parent_id_to_roles.rb +9 -0
- data/spec/ditty/api_spec.rb +51 -0
- data/spec/ditty/controllers/roles_spec.rb +67 -0
- data/spec/ditty/controllers/user_login_traits_spec.rb +72 -0
- data/spec/ditty/controllers/users_spec.rb +72 -0
- data/spec/ditty/emails/base_spec.rb +76 -0
- data/spec/ditty/emails/forgot_password_spec.rb +20 -0
- data/spec/ditty/helpers/component_spec.rb +85 -0
- data/spec/ditty/models/user_spec.rb +36 -0
- data/spec/ditty/services/email_spec.rb +36 -0
- data/spec/ditty/services/logger_spec.rb +68 -0
- data/spec/ditty/services/settings_spec.rb +63 -0
- data/spec/ditty_spec.rb +9 -0
- data/spec/factories.rb +46 -0
- data/spec/fixtures/logger.yml +17 -0
- data/spec/fixtures/section.yml +3 -0
- data/spec/fixtures/settings.yml +8 -0
- data/spec/spec_helper.rb +51 -0
- data/spec/support/api_shared_examples.rb +250 -0
- data/spec/support/crud_shared_examples.rb +145 -0
- data/views/403.haml +1 -1
- data/views/404.haml +2 -4
- data/views/500.haml +11 -0
- data/views/audit_logs/index.haml +32 -33
- data/views/auth/forgot_password.haml +32 -16
- data/views/auth/identity.haml +14 -13
- data/views/auth/ldap.haml +2 -2
- data/views/auth/login.haml +23 -17
- data/views/auth/register.haml +20 -18
- data/views/auth/register_identity.haml +27 -12
- data/views/auth/reset_password.haml +36 -19
- data/views/blank.haml +43 -0
- data/views/embedded.haml +17 -11
- data/views/index.haml +1 -1
- data/views/layout.haml +45 -30
- data/views/partials/actions.haml +15 -14
- data/views/partials/content_tag.haml +0 -0
- data/views/partials/delete_form.haml +1 -1
- data/views/partials/filter_control.haml +2 -2
- data/views/partials/footer.haml +6 -5
- data/views/partials/form_control.haml +19 -12
- data/views/partials/form_tag.haml +1 -1
- data/views/partials/navitems.haml +42 -0
- data/views/partials/notifications.haml +12 -8
- data/views/partials/pager.haml +44 -25
- data/views/partials/search.haml +15 -11
- data/views/partials/sidebar.haml +15 -37
- data/views/partials/sort_ui.haml +2 -0
- data/views/partials/topbar.haml +53 -0
- data/views/partials/user_associations.haml +32 -0
- data/views/quick_start.haml +23 -0
- data/views/roles/display.haml +27 -6
- data/views/roles/edit.haml +3 -3
- data/views/roles/form.haml +1 -0
- data/views/roles/index.haml +23 -16
- data/views/roles/new.haml +2 -2
- data/views/user_login_traits/display.haml +4 -4
- data/views/user_login_traits/edit.haml +3 -3
- data/views/user_login_traits/index.haml +23 -25
- data/views/user_login_traits/new.haml +2 -2
- data/views/users/display.haml +14 -15
- data/views/users/edit.haml +3 -3
- data/views/users/form.haml +0 -0
- data/views/users/index.haml +31 -24
- data/views/users/login_traits.haml +6 -8
- data/views/users/new.haml +2 -2
- data/views/users/profile.haml +15 -15
- data/views/users/user.haml +1 -1
- metadata +271 -63
- data/lib/ditty/controllers/roles.rb +0 -13
- data/lib/ditty/controllers/user_login_traits.rb +0 -18
- data/views/partials/navbar.haml +0 -22
@@ -0,0 +1,23 @@
|
|
1
|
+
%link{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.20.0/themes/prism-okaidia.min.css' }
|
2
|
+
|
3
|
+
.row.mb-4
|
4
|
+
.col-2
|
5
|
+
.col-8
|
6
|
+
.card.card-default.border-left-dark.shadow.h-100
|
7
|
+
%h4.card-header Run on a folder
|
8
|
+
.card-body
|
9
|
+
%pre
|
10
|
+
%code.lang-shell
|
11
|
+
:preserve
|
12
|
+
docker run -d -e ELASTICSEARCH_HOSTS=192.168.1.200:9200 \
|
13
|
+
--volume=/var/log/nginx/:/usr/share/incoming/ \
|
14
|
+
hackerplanet/requestd-filebeat:latest
|
15
|
+
.card.card-default.border-left-dark.shadow.h-100
|
16
|
+
%h4.card-header Run on a single file
|
17
|
+
.card-body
|
18
|
+
%pre
|
19
|
+
%code.lang-shell
|
20
|
+
:preserve
|
21
|
+
docker run -d -e ELASTICSEARCH_HOSTS=elastic.hackerpla.net:9200 \
|
22
|
+
--volume=/var/log/nginx/access.log:/usr/share/incoming/access.log \
|
23
|
+
hackerplanet/requestd-filebeat:latest
|
data/views/roles/display.haml
CHANGED
@@ -1,17 +1,38 @@
|
|
1
|
-
.row
|
1
|
+
.row.mb-4
|
2
2
|
.col-md-2
|
3
3
|
.col-md-8
|
4
|
-
.
|
5
|
-
.
|
4
|
+
.card.card-default.shadow
|
5
|
+
.card-body
|
6
6
|
%p.description
|
7
7
|
%label Name:
|
8
|
-
= entity.name
|
8
|
+
= entity.name.titlecase
|
9
|
+
%p.description
|
10
|
+
%label Parent:
|
11
|
+
%a{ href: "#{base_path}/#{entity.parent_id}" }= entity.parent&.name&.titlecase || '(None)'
|
9
12
|
|
10
13
|
.row
|
11
14
|
.col-md-6
|
12
|
-
%a.btn.btn-
|
15
|
+
%a.btn.btn-secondary{ href: "#{base_path}/#{entity.display_id}/edit" } Edit
|
13
16
|
.col-md-6.text-right
|
14
17
|
- if policy(entity).delete?
|
15
|
-
= delete_form_tag("#{base_path}/#{entity.
|
18
|
+
= delete_form_tag("#{base_path}/#{entity.display_id}") do
|
16
19
|
%button.btn.btn-warning{ type: 'submit' } Delete
|
17
20
|
.col-md-2
|
21
|
+
|
22
|
+
.row
|
23
|
+
.col-md-2
|
24
|
+
.col-md-8
|
25
|
+
.card.card-default.shadow
|
26
|
+
.card-body
|
27
|
+
%h4.card-title Included Roles
|
28
|
+
%table.table.table-striped.mb-0
|
29
|
+
%tbody
|
30
|
+
- if entity.descendants.count > 0
|
31
|
+
- entity.descendants.each do |role|
|
32
|
+
%tr
|
33
|
+
%td
|
34
|
+
%a.btn-block{ href: "#{settings.map_path}/role/#{role.id}" }
|
35
|
+
= role.name.titlecase
|
36
|
+
- else
|
37
|
+
%tr
|
38
|
+
%td.text-center No records
|
data/views/roles/edit.haml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
.row
|
2
2
|
.col-md-2
|
3
3
|
.col-md-8
|
4
|
-
.
|
5
|
-
.
|
6
|
-
= edit_form_tag "#{base_path}/#{entity.
|
4
|
+
.card.card-default.shadow
|
5
|
+
.card-body
|
6
|
+
= edit_form_tag "#{base_path}/#{entity.display_id}" do
|
7
7
|
= haml :'roles/form', locals: { entity: entity }
|
8
8
|
%button.btn.btn-primary{ type: 'submit' }
|
9
9
|
Update Role
|
data/views/roles/form.haml
CHANGED
data/views/roles/index.haml
CHANGED
@@ -1,20 +1,27 @@
|
|
1
1
|
.row
|
2
2
|
.col-md-12
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
%
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
%tr
|
14
|
-
%td
|
15
|
-
%a{ href: "#{base_path}/#{entity.id}" }= entity.name
|
16
|
-
- else
|
3
|
+
= haml :'partials/search'
|
4
|
+
%table.table.table-striped.table-bordered.table-hover
|
5
|
+
%thead.thead-dark
|
6
|
+
%tr
|
7
|
+
%th= "Name#{sort_ui(:name)}"
|
8
|
+
%th Parent
|
9
|
+
%th
|
10
|
+
%tbody
|
11
|
+
- if list.count > 0
|
12
|
+
- list.all.each do |entity|
|
17
13
|
%tr
|
18
|
-
%td
|
14
|
+
%td
|
15
|
+
%a{ href: "#{base_path}/#{entity.display_id}" }= entity.name
|
16
|
+
%td
|
17
|
+
%a{ href: "#{base_path}/#{entity.parent_id}" }= entity.parent&.name || '(None)'
|
18
|
+
%td
|
19
|
+
- if policy(entity).update?
|
20
|
+
%a{ href: "#{base_path}/#{entity.display_id}/edit", title: 'Edit' }
|
21
|
+
%i.fa.fa-edit
|
22
|
+
- else
|
23
|
+
%tr
|
24
|
+
%td.text-center{ colspan: 3 } No Roles
|
19
25
|
|
20
|
-
|
26
|
+
- if list.count > 0
|
27
|
+
= pagination(list, base_path)
|
data/views/roles/new.haml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
.row
|
2
2
|
.col-md-2
|
3
3
|
.col-md-8
|
4
|
-
.
|
5
|
-
.
|
4
|
+
.card.card-default.shadow
|
5
|
+
.card-body
|
6
6
|
%p.description
|
7
7
|
%label User:
|
8
8
|
= entity.user&.email || 'Unknown'
|
@@ -24,9 +24,9 @@
|
|
24
24
|
|
25
25
|
.row
|
26
26
|
.col-md-6
|
27
|
-
%a.btn.btn-
|
27
|
+
%a.btn.btn-secondary{ href: "#{base_path}/#{entity.display_id}/edit" } Edit
|
28
28
|
.col-md-6.text-right
|
29
29
|
- if policy(entity).delete?
|
30
|
-
= delete_form_tag("#{base_path}/#{entity.
|
30
|
+
= delete_form_tag("#{base_path}/#{entity.display_id}") do
|
31
31
|
%button.btn.btn-warning{ type: 'submit' } Delete
|
32
32
|
.col-md-2
|
@@ -1,9 +1,9 @@
|
|
1
1
|
.row
|
2
2
|
.col-md-2
|
3
3
|
.col-md-8
|
4
|
-
.
|
5
|
-
.
|
6
|
-
= edit_form_tag "#{base_path}/#{entity.
|
4
|
+
.card.card-default.shadow
|
5
|
+
.card-body
|
6
|
+
= edit_form_tag "#{base_path}/#{entity.display_id}" do
|
7
7
|
= haml :'user_login_traits/form', locals: { entity: entity }
|
8
8
|
%button.btn.btn-primary{ type: 'submit' }
|
9
9
|
Update Login Trait
|
@@ -1,30 +1,28 @@
|
|
1
1
|
.row
|
2
2
|
.col-md-12
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
%
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
- if list.count.positive?
|
17
|
-
- list.all.each do |entity|
|
18
|
-
%tr
|
19
|
-
%td= entity.user&.email || 'Unknown'
|
20
|
-
%td
|
21
|
-
%a{ href: "#{base_path}/#{entity.id}" }= entity.ip_address || 'Unknown'
|
22
|
-
%td= entity.device || 'Unknown'
|
23
|
-
%td= entity.platform || 'Unknown'
|
24
|
-
%td= entity.browser || 'Unknown'
|
25
|
-
%td= entity.updated_at
|
26
|
-
- else
|
3
|
+
= haml :'partials/search'
|
4
|
+
%table.table.table-striped.table-bordered.table-hover
|
5
|
+
%thead.thead-dark
|
6
|
+
%tr
|
7
|
+
%th= "User #{sort_ui(:user_id)}"
|
8
|
+
%th= "IP Address #{sort_ui(:ip_address)}"
|
9
|
+
%th= "Device #{sort_ui(:device)}"
|
10
|
+
%th= "Platform #{sort_ui(:platform)}"
|
11
|
+
%th= "Browser #{sort_ui(:browser)}"
|
12
|
+
%th= "Last Seen #{sort_ui(:updated_at)}"
|
13
|
+
%tbody
|
14
|
+
- if list.count.positive?
|
15
|
+
- list.all.each do |entity|
|
27
16
|
%tr
|
28
|
-
%td.
|
17
|
+
%td= entity.user&.email || 'Unknown'
|
18
|
+
%td
|
19
|
+
%a{ href: "#{base_path}/#{entity.display_id}" }= entity.ip_address || 'Unknown'
|
20
|
+
%td= entity.device || 'Unknown'
|
21
|
+
%td= entity.platform || 'Unknown'
|
22
|
+
%td= entity.browser || 'Unknown'
|
23
|
+
%td= entity.updated_at
|
24
|
+
- else
|
25
|
+
%tr
|
26
|
+
%td.text-center{ colspan: 6 } No records
|
29
27
|
|
30
28
|
=pagination(list, base_path)
|
data/views/users/display.haml
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
.row
|
1
|
+
.row.mb-4
|
2
2
|
.col-md-2
|
3
3
|
.col-md-8
|
4
|
-
.
|
5
|
-
.
|
4
|
+
.card.card-default.shadow
|
5
|
+
.card-body
|
6
6
|
.author
|
7
|
-
%img.
|
8
|
-
%h4= entity.
|
7
|
+
%img.float-right.img-thumbnail{ src: entity.gravatar }
|
8
|
+
%h4= entity.display_name
|
9
9
|
|
10
10
|
%hr
|
11
11
|
%p.description
|
12
12
|
%label Name:
|
13
|
-
= entity.name
|
13
|
+
= entity.name || '(None)'
|
14
14
|
%p.description
|
15
15
|
%label Surname:
|
16
|
-
= entity.surname
|
16
|
+
= entity.surname || '(None)'
|
17
17
|
%p.description
|
18
18
|
%label Roles:
|
19
19
|
= entity.roles_dataset.map(:name).map(&:titlecase).join(', ')
|
@@ -24,22 +24,21 @@
|
|
24
24
|
.row
|
25
25
|
.col-md-6
|
26
26
|
- if policy(entity).update?
|
27
|
-
%a.btn.btn-
|
27
|
+
%a.btn.btn-secondary{ href: "#{base_path}/#{entity.display_id}/edit" } Edit
|
28
28
|
.col-md-6.text-right
|
29
29
|
- if policy(entity).delete?
|
30
|
-
= delete_form_tag("#{base_path}/#{entity.
|
30
|
+
= delete_form_tag("#{base_path}/#{entity.display_id}") do
|
31
31
|
%button.btn.btn-warning{ type: 'submit' } Delete
|
32
32
|
.col-md-2
|
33
33
|
|
34
34
|
- if entity.identity.first
|
35
|
-
.row
|
35
|
+
.row.mb-4
|
36
36
|
.col-md-2
|
37
37
|
.col-md-8
|
38
|
-
.
|
39
|
-
.
|
40
|
-
%h4 Change Password
|
41
|
-
|
42
|
-
= edit_form_tag("#{base_path}/#{entity.id}/identity") do
|
38
|
+
.card.card-default.shadow
|
39
|
+
.card-body
|
40
|
+
%h4.card-title Change Password
|
41
|
+
= edit_form_tag("#{base_path}/#{entity.display_id}/identity") do
|
43
42
|
= form_control(:password, entity.identity.first, type: 'password', placeholder: 'Your password', group: 'identity')
|
44
43
|
= form_control(:password_confirmation, entity.identity.first, type: 'password', label: 'Confirm Password', placeholder: 'Confirm your password', group: 'identity')
|
45
44
|
%button.btn.btn-primary{ type: 'submit' }
|
data/views/users/edit.haml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
.row
|
2
2
|
.col-md-2
|
3
3
|
.col-md-8
|
4
|
-
.
|
5
|
-
.
|
6
|
-
= edit_form_tag "#{base_path}/#{entity.
|
4
|
+
.card.card-default.shadow
|
5
|
+
.card-body
|
6
|
+
= edit_form_tag "#{base_path}/#{entity.display_id}" do
|
7
7
|
= haml :'users/user', locals: { user: entity }
|
8
8
|
%button.btn.btn-primary{ type: 'submit' }
|
9
9
|
Update User
|
File without changes
|
data/views/users/index.haml
CHANGED
@@ -1,28 +1,35 @@
|
|
1
1
|
.row
|
2
2
|
.col-md-12
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
%
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
-
|
16
|
-
- list.all.each do |entity|
|
17
|
-
%tr
|
18
|
-
%td
|
19
|
-
%a{ href: "#{base_path}/#{entity.id}" }= entity.email
|
20
|
-
%td= entity.name
|
21
|
-
%td= entity.surname
|
22
|
-
%td= entity.roles_dataset.map(:name).map(&:titlecase).join(', ')
|
23
|
-
%td= entity.created_at.strftime('%Y-%m-%d')
|
24
|
-
- else
|
3
|
+
= haml :'partials/search'
|
4
|
+
%table.table.table-striped.table-bordered.table-hover
|
5
|
+
%thead.thead-dark
|
6
|
+
%tr
|
7
|
+
%th= "Email #{sort_ui(:email)}"
|
8
|
+
%th= "Name #{sort_ui(:name)}"
|
9
|
+
%th= "Surname #{sort_ui(:surname)}"
|
10
|
+
%th Roles
|
11
|
+
%th= "Signed Up #{sort_ui(:created_at)}"
|
12
|
+
%th
|
13
|
+
%tbody
|
14
|
+
- if list.count > 0
|
15
|
+
- list.all.each do |entity|
|
25
16
|
%tr
|
26
|
-
%td
|
17
|
+
%td
|
18
|
+
- if policy(entity).read?
|
19
|
+
%a{ href: "#{base_path}/#{entity.display_id}" }= entity.email
|
20
|
+
- else
|
21
|
+
= entity.email
|
22
|
+
%td= entity.name
|
23
|
+
%td= entity.surname
|
24
|
+
%td= entity.all_roles.map(&:name).map(&:titlecase).join(', ')
|
25
|
+
%td= entity.created_at.strftime('%Y-%m-%d')
|
26
|
+
%td
|
27
|
+
- if policy(entity).update?
|
28
|
+
%a{ href: "#{base_path}/#{entity.display_id}/edit", title: 'Edit' }
|
29
|
+
%i.fa.fa-edit
|
30
|
+
- else
|
31
|
+
%tr
|
32
|
+
%td.text-center{ colspan: 6 } No records
|
27
33
|
|
28
|
-
|
34
|
+
- if list.count > 0
|
35
|
+
= pagination(list, base_path)
|
@@ -1,11 +1,10 @@
|
|
1
1
|
.row
|
2
|
-
.col-md-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
%thead
|
2
|
+
.col-md-12
|
3
|
+
.card.card-default.shadow
|
4
|
+
.card-body
|
5
|
+
%h4.card-title Logins
|
6
|
+
%table.table.table-striped.mb-0
|
7
|
+
%thead.thead-dark
|
9
8
|
%tr
|
10
9
|
%th IP Address
|
11
10
|
%th Device
|
@@ -24,4 +23,3 @@
|
|
24
23
|
- else
|
25
24
|
%tr
|
26
25
|
%td.text-center{ colspan: 5 } No Records
|
27
|
-
.col-md-2
|
data/views/users/new.haml
CHANGED
data/views/users/profile.haml
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
.row
|
1
|
+
.row.mb-4
|
2
2
|
.col-md-2
|
3
3
|
.col-md-8
|
4
|
-
.
|
5
|
-
.
|
4
|
+
.card.card-default.shadow
|
5
|
+
.card-body
|
6
6
|
.author
|
7
|
-
%img.
|
7
|
+
%img.float-right.img-thumbnail{ src: entity.gravatar }
|
8
8
|
%h4= entity.email
|
9
9
|
|
10
10
|
%hr
|
11
11
|
%p.description
|
12
12
|
%label Name:
|
13
|
-
= entity.name
|
13
|
+
= entity.name || '(None)'
|
14
14
|
%p.description
|
15
15
|
%label Surname:
|
16
|
-
= entity.surname
|
16
|
+
= entity.surname || '(None)'
|
17
17
|
%p.description
|
18
18
|
%label Roles:
|
19
19
|
= entity.roles_dataset.map(:name).map(&:titlecase).join(', ')
|
@@ -23,22 +23,22 @@
|
|
23
23
|
.row
|
24
24
|
.col-md-6
|
25
25
|
- if policy(entity).update?
|
26
|
-
%a.btn.btn-
|
26
|
+
%a.btn.btn-secondary{ href: "#{base_path}/#{entity.display_id}/edit" } Edit
|
27
27
|
.col-md-6.text-right
|
28
28
|
- if policy(entity).delete?
|
29
|
-
= delete_form_tag("#{base_path}/#{entity.
|
29
|
+
= delete_form_tag("#{base_path}/#{entity.display_id}") do
|
30
30
|
%button.btn.btn-warning{ type: 'submit' } Delete
|
31
31
|
.col-md-2
|
32
32
|
|
33
|
-
.row
|
33
|
+
.row.mb-4
|
34
34
|
.col-md-2
|
35
35
|
.col-md-8
|
36
|
-
.
|
37
|
-
.
|
38
|
-
%h4 Change Password
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
.card.card-default.shadow
|
37
|
+
.card-body
|
38
|
+
%h4.card-title Change Password
|
39
|
+
= edit_form_tag("#{base_path}/#{entity.display_id}/identity") do
|
40
|
+
- if current_user.super_admin? == false
|
41
|
+
= form_control(:old_password, identity, type: 'password', placeholder: 'Your current password', value: '')
|
42
42
|
= form_control(:password, identity, type: 'password', placeholder: 'Your new password')
|
43
43
|
= form_control(:password_confirmation, identity, type: 'password', label: 'Confirm Password', placeholder: 'Confirm your password')
|
44
44
|
%button.btn.btn-primary{ type: 'submit' }
|