ditty 0.8.0 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/.env.test +2 -0
  3. data/.gitignore +3 -0
  4. data/.pryrc +2 -0
  5. data/.rubocop.yml +23 -4
  6. data/.travis.yml +4 -8
  7. data/CNAME +1 -0
  8. data/Dockerfile +18 -0
  9. data/Gemfile.ci +0 -17
  10. data/Rakefile +2 -2
  11. data/_config.yml +1 -0
  12. data/config.ru +4 -4
  13. data/ditty.gemspec +28 -18
  14. data/docs/CNAME +1 -0
  15. data/docs/_config.yml +1 -0
  16. data/docs/index.md +34 -0
  17. data/exe/ditty +2 -0
  18. data/lib/ditty/cli.rb +41 -5
  19. data/lib/ditty/components/{app.rb → ditty.rb} +18 -16
  20. data/lib/ditty/controllers/{application.rb → application_controller.rb} +63 -34
  21. data/lib/ditty/controllers/{audit_logs.rb → audit_logs_controller.rb} +4 -2
  22. data/lib/ditty/controllers/{auth.rb → auth_controller.rb} +22 -18
  23. data/lib/ditty/controllers/{component.rb → component_controller.rb} +23 -20
  24. data/lib/ditty/controllers/{main.rb → main_controller.rb} +6 -2
  25. data/lib/ditty/controllers/roles_controller.rb +23 -0
  26. data/lib/ditty/controllers/user_login_traits_controller.rb +46 -0
  27. data/lib/ditty/controllers/{users.rb → users_controller.rb} +13 -11
  28. data/lib/ditty/db.rb +7 -5
  29. data/lib/ditty/emails/base.rb +37 -32
  30. data/lib/ditty/generators/crud_generator.rb +114 -0
  31. data/lib/ditty/generators/migration_generator.rb +26 -0
  32. data/lib/ditty/generators/project_generator.rb +52 -0
  33. data/lib/ditty/helpers/component.rb +2 -1
  34. data/lib/ditty/helpers/pundit.rb +24 -8
  35. data/lib/ditty/helpers/response.rb +15 -13
  36. data/lib/ditty/helpers/views.rb +28 -6
  37. data/lib/ditty/listener.rb +6 -4
  38. data/lib/ditty/memcached.rb +8 -0
  39. data/lib/ditty/middleware/accept_extension.rb +2 -2
  40. data/lib/ditty/middleware/error_catchall.rb +2 -2
  41. data/lib/ditty/models/base.rb +9 -0
  42. data/lib/ditty/models/identity.rb +11 -7
  43. data/lib/ditty/models/role.rb +1 -0
  44. data/lib/ditty/models/user.rb +23 -2
  45. data/lib/ditty/policies/role_policy.rb +1 -1
  46. data/lib/ditty/policies/user_login_trait_policy.rb +1 -1
  47. data/lib/ditty/policies/user_policy.rb +1 -1
  48. data/lib/ditty/services/authentication.rb +27 -16
  49. data/lib/ditty/services/email.rb +19 -15
  50. data/lib/ditty/services/logger.rb +26 -20
  51. data/lib/ditty/services/pagination_wrapper.rb +7 -5
  52. data/lib/ditty/services/settings.rb +7 -6
  53. data/lib/ditty/tasks/ditty.rake +19 -1
  54. data/lib/ditty/tasks/omniauth-ldap.rake +2 -2
  55. data/lib/ditty/templates/.gitignore +5 -0
  56. data/lib/ditty/templates/.rspec +2 -0
  57. data/lib/ditty/templates/.rubocop.yml +7 -0
  58. data/lib/ditty/templates/Rakefile +12 -0
  59. data/lib/ditty/templates/application.rb +12 -0
  60. data/lib/ditty/templates/config.ru +37 -0
  61. data/lib/ditty/templates/controller.rb.erb +64 -0
  62. data/lib/ditty/templates/env.example +4 -0
  63. data/lib/ditty/templates/lib/project.rb.erb +5 -0
  64. data/lib/ditty/templates/logs/.empty_directory +0 -0
  65. data/lib/ditty/templates/migration.rb.erb +7 -0
  66. data/lib/ditty/templates/model.rb.erb +26 -0
  67. data/lib/ditty/templates/pids/.empty_directory +0 -0
  68. data/lib/ditty/templates/policy.rb.erb +48 -0
  69. data/{public → lib/ditty/templates/public}/browserconfig.xml +0 -0
  70. data/lib/ditty/templates/public/css/sb-admin-2.min.css +10 -0
  71. data/lib/ditty/templates/public/css/styles.css +13 -0
  72. data/lib/ditty/templates/public/favicon.ico +0 -0
  73. data/{public → lib/ditty/templates/public}/images/apple-icon.png +0 -0
  74. data/{public → lib/ditty/templates/public}/images/favicon-16x16.png +0 -0
  75. data/{public → lib/ditty/templates/public}/images/favicon-32x32.png +0 -0
  76. data/{public → lib/ditty/templates/public}/images/launcher-icon-1x.png +0 -0
  77. data/{public → lib/ditty/templates/public}/images/launcher-icon-2x.png +0 -0
  78. data/{public → lib/ditty/templates/public}/images/launcher-icon-4x.png +0 -0
  79. data/{public → lib/ditty/templates/public}/images/mstile-150x150.png +0 -0
  80. data/{public → lib/ditty/templates/public}/images/safari-pinned-tab.svg +0 -0
  81. data/lib/ditty/templates/public/js/sb-admin-2.min.js +7 -0
  82. data/lib/ditty/templates/public/js/scripts.js +1 -0
  83. data/{public/manifest.json → lib/ditty/templates/public/manifest.json.erb} +2 -2
  84. data/lib/ditty/templates/settings.yml.erb +29 -0
  85. data/lib/ditty/templates/sidekiq.rb +18 -0
  86. data/lib/ditty/templates/sidekiq.yml +9 -0
  87. data/lib/ditty/templates/spec_helper.rb +43 -0
  88. data/lib/ditty/templates/type.rb.erb +21 -0
  89. data/lib/ditty/templates/views/display.haml.tt +20 -0
  90. data/lib/ditty/templates/views/edit.haml.tt +10 -0
  91. data/lib/ditty/templates/views/form.haml.tt +11 -0
  92. data/lib/ditty/templates/views/index.haml.tt +29 -0
  93. data/lib/ditty/templates/views/new.haml.tt +10 -0
  94. data/lib/ditty/version.rb +1 -1
  95. data/lib/ditty.rb +6 -4
  96. data/lib/rubocop/cop/ditty/call_services_directly.rb +2 -2
  97. data/migrate/20181209_add_user_login_traits.rb +4 -4
  98. data/migrate/20190220_add_parent_id_to_roles.rb +9 -0
  99. data/spec/ditty/api_spec.rb +51 -0
  100. data/spec/ditty/controllers/roles_spec.rb +67 -0
  101. data/spec/ditty/controllers/user_login_traits_spec.rb +72 -0
  102. data/spec/ditty/controllers/users_spec.rb +72 -0
  103. data/spec/ditty/emails/base_spec.rb +76 -0
  104. data/spec/ditty/emails/forgot_password_spec.rb +20 -0
  105. data/spec/ditty/helpers/component_spec.rb +85 -0
  106. data/spec/ditty/models/user_spec.rb +36 -0
  107. data/spec/ditty/services/email_spec.rb +36 -0
  108. data/spec/ditty/services/logger_spec.rb +68 -0
  109. data/spec/ditty/services/settings_spec.rb +63 -0
  110. data/spec/ditty_spec.rb +9 -0
  111. data/spec/factories.rb +46 -0
  112. data/spec/fixtures/logger.yml +17 -0
  113. data/spec/fixtures/section.yml +3 -0
  114. data/spec/fixtures/settings.yml +8 -0
  115. data/spec/spec_helper.rb +51 -0
  116. data/spec/support/api_shared_examples.rb +250 -0
  117. data/spec/support/crud_shared_examples.rb +145 -0
  118. data/views/403.haml +1 -1
  119. data/views/404.haml +2 -4
  120. data/views/500.haml +11 -0
  121. data/views/audit_logs/index.haml +32 -33
  122. data/views/auth/forgot_password.haml +32 -16
  123. data/views/auth/identity.haml +14 -13
  124. data/views/auth/ldap.haml +2 -2
  125. data/views/auth/login.haml +23 -17
  126. data/views/auth/register.haml +20 -18
  127. data/views/auth/register_identity.haml +27 -12
  128. data/views/auth/reset_password.haml +36 -19
  129. data/views/blank.haml +43 -0
  130. data/views/embedded.haml +17 -11
  131. data/views/index.haml +1 -1
  132. data/views/layout.haml +45 -30
  133. data/views/partials/actions.haml +15 -14
  134. data/views/partials/content_tag.haml +0 -0
  135. data/views/partials/delete_form.haml +1 -1
  136. data/views/partials/filter_control.haml +2 -2
  137. data/views/partials/footer.haml +6 -5
  138. data/views/partials/form_control.haml +19 -12
  139. data/views/partials/form_tag.haml +1 -1
  140. data/views/partials/navitems.haml +42 -0
  141. data/views/partials/notifications.haml +12 -8
  142. data/views/partials/pager.haml +44 -25
  143. data/views/partials/search.haml +15 -11
  144. data/views/partials/sidebar.haml +15 -37
  145. data/views/partials/sort_ui.haml +2 -0
  146. data/views/partials/topbar.haml +53 -0
  147. data/views/partials/user_associations.haml +32 -0
  148. data/views/quick_start.haml +23 -0
  149. data/views/roles/display.haml +27 -6
  150. data/views/roles/edit.haml +3 -3
  151. data/views/roles/form.haml +1 -0
  152. data/views/roles/index.haml +23 -16
  153. data/views/roles/new.haml +2 -2
  154. data/views/user_login_traits/display.haml +4 -4
  155. data/views/user_login_traits/edit.haml +3 -3
  156. data/views/user_login_traits/index.haml +23 -25
  157. data/views/user_login_traits/new.haml +2 -2
  158. data/views/users/display.haml +14 -15
  159. data/views/users/edit.haml +3 -3
  160. data/views/users/form.haml +0 -0
  161. data/views/users/index.haml +31 -24
  162. data/views/users/login_traits.haml +6 -8
  163. data/views/users/new.haml +2 -2
  164. data/views/users/profile.haml +15 -15
  165. data/views/users/user.haml +1 -1
  166. metadata +271 -63
  167. data/lib/ditty/controllers/roles.rb +0 -13
  168. data/lib/ditty/controllers/user_login_traits.rb +0 -18
  169. 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
@@ -1,17 +1,38 @@
1
- .row
1
+ .row.mb-4
2
2
  .col-md-2
3
3
  .col-md-8
4
- .panel.panel-default
5
- .panel-body
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-default{ href: "#{base_path}/#{entity.id}/edit" } Edit
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.id}") do
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
@@ -1,9 +1,9 @@
1
1
  .row
2
2
  .col-md-2
3
3
  .col-md-8
4
- .panel.panel-default
5
- .panel-body
6
- = edit_form_tag "#{base_path}/#{entity.id}" do
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
@@ -1 +1,2 @@
1
+ = form_control(:parent_id, entity, type: 'select', options: parent_options(entity).as_hash(:id, :name))
1
2
  = form_control(:name, entity)
@@ -1,20 +1,27 @@
1
1
  .row
2
2
  .col-md-12
3
- .panel.panel-default
4
- .panel-body
5
- = haml :'partials/search'
6
- %table.table.table-striped
7
- %thead
8
- %tr
9
- %th Name
10
- %tbody
11
- - if list.count > 0
12
- - list.all.each do |entity|
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.text-center{ colspan: 1 } No records
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
- =pagination(list, base_path)
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
- .panel.panel-default
5
- .panel-body
4
+ .card.card-default.shadow
5
+ .card-body
6
6
  = new_form_tag base_path do
7
7
  = haml :'roles/form', locals: { entity: entity }
8
8
  %button.btn.btn-primary{ type: 'submit' }
@@ -1,8 +1,8 @@
1
1
  .row
2
2
  .col-md-2
3
3
  .col-md-8
4
- .panel.panel-default
5
- .panel-body
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-default{ href: "#{base_path}/#{entity.id}/edit" } Edit
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.id}") do
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
- .panel.panel-default
5
- .panel-body
6
- = edit_form_tag "#{base_path}/#{entity.id}" do
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
- .panel.panel-default
4
- .panel-body
5
- = haml :'partials/search'
6
- %table.table.table-striped
7
- %thead
8
- %tr
9
- %th User
10
- %th IP Address
11
- %th Device
12
- %th Platform
13
- %th Browser
14
- %th Last Seen
15
- %tbody
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.text-center{ colspan: 6 } No records
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)
@@ -1,8 +1,8 @@
1
1
  .row
2
2
  .col-md-2
3
3
  .col-md-8
4
- .panel.panel-default
5
- .panel-body
4
+ .card.card-default.shadow
5
+ .card-body
6
6
  = new_form_tag base_path do
7
7
  = haml :'user_login_traits/form', locals: { entity: entity }
8
8
  %button.btn.btn-primary{ type: 'submit' }
@@ -1,19 +1,19 @@
1
- .row
1
+ .row.mb-4
2
2
  .col-md-2
3
3
  .col-md-8
4
- .panel.panel-default
5
- .panel-body
4
+ .card.card-default.shadow
5
+ .card-body
6
6
  .author
7
- %img.pull-right.thumbnail{ src: entity.gravatar }
8
- %h4= entity.email
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-default{ href: "#{base_path}/#{entity.id}/edit" } Edit
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.id}") do
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
- .panel.panel-default
39
- .panel-heading
40
- %h4 Change Password
41
- .panel-body
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' }
@@ -1,9 +1,9 @@
1
1
  .row
2
2
  .col-md-2
3
3
  .col-md-8
4
- .panel.panel-default
5
- .panel-body
6
- = edit_form_tag "#{base_path}/#{entity.id}" do
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
@@ -1,28 +1,35 @@
1
1
  .row
2
2
  .col-md-12
3
- .panel.panel-default
4
- .panel-body
5
- = haml :'partials/search'
6
- %table.table.table-striped
7
- %thead
8
- %tr
9
- %th Email
10
- %th Name
11
- %th Surname
12
- %th Roles
13
- %th Signed Up
14
- %tbody
15
- - if list.count > 0
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.text-center{ colspan: 5 } No records
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
- =pagination(list, base_path)
34
+ - if list.count > 0
35
+ = pagination(list, base_path)
@@ -1,11 +1,10 @@
1
1
  .row
2
- .col-md-2
3
- .col-md-8
4
- .panel.panel-default
5
- .panel-heading
6
- %h4 Logins
7
- %table.table
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
@@ -1,8 +1,8 @@
1
1
  .row
2
2
  .col-md-2
3
3
  .col-md-8
4
- .panel.panel-default
5
- .panel-body
4
+ .card.card-default.shadow
5
+ .card-body
6
6
  = new_form_tag base_path do
7
7
  = haml :'users/identity', locals: { identity: identity }
8
8
  = haml :'users/user', locals: { user: entity }
@@ -1,19 +1,19 @@
1
- .row
1
+ .row.mb-4
2
2
  .col-md-2
3
3
  .col-md-8
4
- .panel.panel-default
5
- .panel-body
4
+ .card.card-default.shadow
5
+ .card-body
6
6
  .author
7
- %img.pull-right.thumbnail{ src: entity.gravatar }
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-default{ href: "#{base_path}/#{entity.id}/edit" } Edit
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.id}") do
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
- .panel.panel-default
37
- .panel-heading
38
- %h4 Change Password
39
- .panel-body
40
- = edit_form_tag("#{base_path}/#{entity.id}/identity") do
41
- = form_control(:old_password, identity, type: 'password', placeholder: 'Your current password')
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' }