ditty 0.7.1 → 0.10.1
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 +24 -8
- data/.travis.yml +4 -8
- data/CNAME +1 -0
- data/Dockerfile +18 -0
- data/Gemfile.ci +0 -15
- data/Rakefile +5 -4
- data/Readme.md +24 -2
- data/_config.yml +1 -0
- data/config.ru +4 -4
- data/ditty.gemspec +31 -20
- 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.rb +30 -4
- data/lib/ditty/cli.rb +38 -5
- data/lib/ditty/components/ditty.rb +82 -0
- data/lib/ditty/controllers/application_controller.rb +267 -0
- data/lib/ditty/controllers/{audit_logs.rb → audit_logs_controller.rb} +5 -7
- data/lib/ditty/controllers/{auth.rb → auth_controller.rb} +56 -32
- data/lib/ditty/controllers/{component.rb → component_controller.rb} +35 -24
- data/lib/ditty/controllers/{main.rb → main_controller.rb} +7 -7
- 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} +17 -20
- data/lib/ditty/db.rb +9 -5
- data/lib/ditty/emails/base.rb +48 -34
- 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/authentication.rb +6 -5
- data/lib/ditty/helpers/component.rb +11 -2
- data/lib/ditty/helpers/pundit.rb +24 -8
- data/lib/ditty/helpers/response.rb +38 -15
- data/lib/ditty/helpers/views.rb +48 -6
- data/lib/ditty/listener.rb +44 -14
- data/lib/ditty/memcached.rb +8 -0
- data/lib/ditty/middleware/accept_extension.rb +4 -2
- data/lib/ditty/middleware/error_catchall.rb +4 -2
- data/lib/ditty/models/audit_log.rb +1 -0
- data/lib/ditty/models/base.rb +13 -0
- data/lib/ditty/models/identity.rb +10 -7
- data/lib/ditty/models/role.rb +2 -0
- data/lib/ditty/models/user.rb +40 -3
- data/lib/ditty/models/user_login_trait.rb +17 -0
- data/lib/ditty/policies/audit_log_policy.rb +6 -6
- data/lib/ditty/policies/role_policy.rb +3 -3
- data/lib/ditty/policies/user_login_trait_policy.rb +45 -0
- data/lib/ditty/policies/user_policy.rb +3 -3
- data/lib/ditty/rubocop.rb +3 -0
- data/lib/ditty/seed.rb +2 -0
- data/lib/ditty/services/authentication.rb +31 -15
- data/lib/ditty/services/email.rb +22 -12
- data/lib/ditty/services/logger.rb +30 -13
- data/lib/ditty/services/pagination_wrapper.rb +9 -5
- data/lib/ditty/services/settings.rb +19 -7
- data/lib/ditty/tasks/ditty.rake +127 -0
- data/lib/ditty/tasks/omniauth-ldap.rake +43 -0
- 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/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 +19 -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/rubocop/cop/ditty/call_services_directly.rb +42 -0
- data/migrate/20181209_add_user_login_traits.rb +16 -0
- data/migrate/20181209_extend_audit_log.rb +12 -0
- 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 +2 -0
- data/views/404.haml +2 -4
- data/views/500.haml +11 -0
- data/views/audit_logs/index.haml +32 -28
- data/views/auth/forgot_password.haml +32 -16
- data/views/auth/identity.haml +14 -13
- data/views/auth/ldap.haml +17 -0
- 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/emails/forgot_password.haml +1 -1
- data/views/emails/layouts/action.haml +10 -6
- data/views/emails/layouts/alert.haml +2 -1
- data/views/emails/layouts/billing.haml +2 -1
- data/views/embedded.haml +17 -11
- data/views/error.haml +8 -3
- 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 +13 -5
- data/views/partials/form_control.haml +30 -19
- 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/timespan_selector.haml +64 -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 -14
- data/views/roles/new.haml +2 -2
- data/views/user_login_traits/display.haml +32 -0
- data/views/user_login_traits/edit.haml +10 -0
- data/views/user_login_traits/form.haml +5 -0
- data/views/user_login_traits/index.haml +28 -0
- data/views/user_login_traits/new.haml +10 -0
- data/views/users/display.haml +15 -16
- 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 +25 -0
- data/views/users/new.haml +2 -2
- data/views/users/profile.haml +17 -15
- data/views/users/user.haml +1 -1
- metadata +314 -76
- data/lib/ditty/components/app.rb +0 -77
- data/lib/ditty/controllers/application.rb +0 -175
- data/lib/ditty/controllers/roles.rb +0 -16
- data/lib/ditty/rake_tasks.rb +0 -102
- data/views/partials/navbar.haml +0 -23
@@ -1,19 +1,36 @@
|
|
1
|
-
.
|
2
|
-
|
3
|
-
.
|
4
|
-
.
|
5
|
-
.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
.container
|
2
|
+
/ Outer Row
|
3
|
+
.row.justify-content-center
|
4
|
+
.col-xl-10.col-lg-12.col-md-9
|
5
|
+
.card.card-default.o-hidden.border-0.shadow-lg.my-5
|
6
|
+
.card-body.p-0
|
7
|
+
/ Nested Row within Card Body
|
8
|
+
.row
|
9
|
+
.col-lg-6.d-none.d-lg-block.bg-password-image
|
10
|
+
.col-lg-6
|
11
|
+
.p-5
|
12
|
+
.text-center
|
13
|
+
%h1.h4.text-gray-900.mb-2
|
14
|
+
Reset your Password
|
15
|
+
= edit_form_tag("#{settings.map_path}/auth/reset-password") do
|
16
|
+
%input{ name: 'token', value: params[:token], type: 'hidden' }
|
17
|
+
- if identity.errors[:password] && identity.errors[:password].include?('is not strong enough')
|
18
|
+
.alert.alert-warning
|
19
|
+
%p Make sure your password is at least 8 characters long, and including the following
|
20
|
+
%ul
|
21
|
+
%li Upper- and lowercase letters
|
22
|
+
%li Numbers
|
23
|
+
%li Special Characters
|
24
|
+
= form_control(:password, identity, type: 'password', placeholder: 'Your password', group: 'identity')
|
25
|
+
= form_control(:password_confirmation, identity, type: 'password', label: 'Confirm Password', placeholder: 'Confirm your password', group: 'identity')
|
26
|
+
%button.btn.btn-primary{ type: 'submit' }
|
27
|
+
Reset Password
|
28
|
+
%hr
|
29
|
+
- if policy(::Ditty::User).register?
|
30
|
+
.text-center
|
31
|
+
%a.small{ href: "#{settings.map_path}/auth/register" } Create an Account!
|
32
|
+
.text-center
|
33
|
+
%a.small{ href: "#{settings.map_path}/auth/login" } Already have an account? Login!
|
34
|
+
|
35
|
+
.row.justify-content-center
|
36
|
+
.col-xl-10.col-lg-12.col-md-9
|
data/views/blank.haml
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html{ lang: 'en' }
|
3
|
+
%head
|
4
|
+
%meta{ charset: 'utf-8' }
|
5
|
+
%meta{ 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1' }
|
6
|
+
%meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
|
7
|
+
%meta{ name: 'theme-color', content: '#ffffff' }
|
8
|
+
= Rack::Csrf.csrf_metatag(env)
|
9
|
+
%link{ rel: 'manifest', href: '/manifest.json' }
|
10
|
+
%link{ rel: 'icon', type: 'image/png', sizes: '32x32', href: '/images/favicon-32x32.png' }
|
11
|
+
%link{ rel: 'icon', type: 'image/png', sizes: '16x16', href: '/images/favicon-16x16.png' }
|
12
|
+
%link{ rel: 'apple-touch-icon', sizes: '76x76', href: '/images/apple-icon.png' }
|
13
|
+
%link{ rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#5bbad5' }
|
14
|
+
|
15
|
+
%title
|
16
|
+
= config('ditty.title', 'Ditty')
|
17
|
+
- if defined? title
|
18
|
+
= "- #{title}"
|
19
|
+
|
20
|
+
%meta{ name: 'description', content: '' }
|
21
|
+
%meta{ name: 'author', content: '' }
|
22
|
+
|
23
|
+
/ Le styles
|
24
|
+
%link{ rel: 'stylesheet', href: '/css/sb-admin-2.min.css', media: 'screen' }
|
25
|
+
%link{ rel: 'stylesheet', href: '/css/styles.css', media: 'screen' }
|
26
|
+
%link{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css', media: 'screen' }
|
27
|
+
%body.bg-gradient-primary
|
28
|
+
= yield
|
29
|
+
|
30
|
+
/ Placed at the end of the document so the pages load faster
|
31
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js' }
|
32
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js' }
|
33
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js' }
|
34
|
+
/ %script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.production.min.js' }
|
35
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js' }
|
36
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js' }
|
37
|
+
%script{ type: 'text/javascript', src: '/js/sb-admin-2.min.js' }
|
38
|
+
%script{ type: 'text/javascript', src: '/js/scripts.js' }
|
39
|
+
:javascript
|
40
|
+
$(function() {
|
41
|
+
$('.select2').select2();
|
42
|
+
});
|
43
|
+
|
@@ -3,7 +3,8 @@
|
|
3
3
|
%head
|
4
4
|
%meta{:content => "width=device-width", :name => "viewport"}/
|
5
5
|
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
|
6
|
-
%title
|
6
|
+
%title
|
7
|
+
= subject
|
7
8
|
:css
|
8
9
|
img {
|
9
10
|
max-width: 100%;
|
@@ -59,10 +60,13 @@
|
|
59
60
|
%td.container{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto;", :valign => "top", :width => "600"}
|
60
61
|
.content{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;"}
|
61
62
|
= content
|
62
|
-
-
|
63
|
-
|
64
|
-
%
|
65
|
-
%
|
66
|
-
|
63
|
+
.footer{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;"}
|
64
|
+
%table{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;", :width => "100%"}
|
65
|
+
%tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"}
|
66
|
+
%td.aligncenter.content-block{:align => "center", :style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0; padding: 0 0 20px;", :valign => "top"}
|
67
|
+
- if defined? footer
|
67
68
|
= footer
|
69
|
+
- else
|
70
|
+
This email was sent to
|
71
|
+
= to
|
68
72
|
%td{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;", :valign => "top"}
|
data/views/embedded.haml
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
%meta{ 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1' }
|
6
6
|
%meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
|
7
7
|
%meta{ name: 'theme-color', content: '#ffffff' }
|
8
|
+
= Rack::Csrf.csrf_metatag(env)
|
8
9
|
%link{ rel: 'manifest', href: '/manifest.json' }
|
9
10
|
%link{ rel: 'icon', type: 'image/png', sizes: '32x32', href: '#{request.base_url}/images/favicon-32x32.png' }
|
10
11
|
%link{ rel: 'icon', type: 'image/png', sizes: '16x16', href: '#{request.base_url}/images/favicon-16x16.png' }
|
@@ -20,14 +21,9 @@
|
|
20
21
|
%meta{ name: 'author', content: '' }
|
21
22
|
|
22
23
|
/ Le styles
|
23
|
-
%link{ rel: 'stylesheet', href: '
|
24
|
-
%link{ rel: 'stylesheet', href: '
|
25
|
-
%link{ rel: 'stylesheet', href: 'https://
|
26
|
-
/[if lt IE 9] <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
|
27
|
-
/[if lt IE 9] <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
|
28
|
-
|
29
|
-
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js' }
|
30
|
-
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/startbootstrap-sb-admin-2/3.3.7+1/js/sb-admin-2.min.js' }
|
24
|
+
%link{ rel: 'stylesheet', href: '/css/sb-admin-2.min.css', media: 'screen' }
|
25
|
+
%link{ rel: 'stylesheet', href: '/css/styles.css', media: 'screen' }
|
26
|
+
%link{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css', media: 'screen' }
|
31
27
|
%body
|
32
28
|
.container-fluid
|
33
29
|
.row
|
@@ -37,6 +33,16 @@
|
|
37
33
|
= yield
|
38
34
|
|
39
35
|
/ Placed at the end of the document so the pages load faster
|
40
|
-
%script{ type: 'text/javascript', src: 'https://
|
41
|
-
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/
|
42
|
-
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/
|
36
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js' }
|
37
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js' }
|
38
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js' }
|
39
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js' }
|
40
|
+
/ %script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.production.min.js' }
|
41
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js' }
|
42
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js' }
|
43
|
+
%script{ type: 'text/javascript', src: '/js/sb-admin-2.min.js' }
|
44
|
+
%script{ type: 'text/javascript', src: '/js/scripts.js' }
|
45
|
+
:javascript
|
46
|
+
$(function() {
|
47
|
+
$('.select2').select2();
|
48
|
+
});
|
data/views/error.haml
CHANGED
data/views/index.haml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
%
|
1
|
+
%h1.h3.mb-4.text-gray-800 Home Page
|
data/views/layout.haml
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
%meta{ 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1' }
|
6
6
|
%meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
|
7
7
|
%meta{ name: 'theme-color', content: '#ffffff' }
|
8
|
+
= Rack::Csrf.csrf_metatag(env)
|
8
9
|
%link{ rel: 'manifest', href: '/manifest.json' }
|
9
10
|
%link{ rel: 'icon', type: 'image/png', sizes: '32x32', href: '/images/favicon-32x32.png' }
|
10
11
|
%link{ rel: 'icon', type: 'image/png', sizes: '16x16', href: '/images/favicon-16x16.png' }
|
@@ -12,7 +13,7 @@
|
|
12
13
|
%link{ rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#5bbad5' }
|
13
14
|
|
14
15
|
%title
|
15
|
-
Ditty
|
16
|
+
= config('ditty.title', 'Ditty')
|
16
17
|
- if defined? title
|
17
18
|
= "- #{title}"
|
18
19
|
|
@@ -20,43 +21,57 @@
|
|
20
21
|
%meta{ name: 'author', content: '' }
|
21
22
|
|
22
23
|
/ Le styles
|
23
|
-
%link{ rel: 'stylesheet', href: '
|
24
|
-
%link{ rel: 'stylesheet', href: '
|
25
|
-
%link{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/
|
26
|
-
|
27
|
-
/
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
%link{ rel: 'stylesheet', href: '/css/sb-admin-2.min.css', media: 'screen' }
|
25
|
+
%link{ rel: 'stylesheet', href: '/css/styles.css', media: 'screen' }
|
26
|
+
%link{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css', media: 'screen' }
|
27
|
+
%body#page-top
|
28
|
+
/ Logout Modal
|
29
|
+
#logoutModal.modal.fade{ tabindex: -1, role: 'dialog', 'aria-hidden': 'true' }
|
30
|
+
.modal-dialog{ role: 'document' }
|
31
|
+
.modal-content
|
32
|
+
.modal-header
|
33
|
+
%h5.modal-title Ready to Leave?
|
34
|
+
%button.close{ type: 'button', 'data-dismiss': 'modal', 'aria-label': 'Close' }
|
35
|
+
%span{ 'aria-hidden': 'true' } ×
|
36
|
+
.modal-body
|
37
|
+
Select "Logout" below if you are ready to end your current session.
|
38
|
+
.modal-footer
|
39
|
+
%button.btn.btn-secondary{ type: 'button', 'data-dismiss': 'modal' } Cancel
|
40
|
+
= delete_form_tag("#{settings.map_path}/auth") do
|
41
|
+
%button.btn.btn-primary{ type: 'submit' } Logout
|
42
|
+
/ Page Wrapper
|
34
43
|
#wrapper
|
35
|
-
= haml :'partials/
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
.row
|
46
|
-
.col-md-12
|
44
|
+
= haml :'partials/sidebar', locals: { title: (defined?(title) ? title : 'Ditty') }
|
45
|
+
|
46
|
+
#content-wrapper.d-flex.flex-column
|
47
|
+
#content
|
48
|
+
= haml :'partials/topbar'
|
49
|
+
.container-fluid
|
50
|
+
/ TODO
|
51
|
+
/ .row
|
52
|
+
/ .col-md-12
|
47
53
|
= haml :'partials/notifications'
|
48
54
|
|
49
|
-
|
55
|
+
= yield
|
56
|
+
|
50
57
|
= haml :'partials/footer'
|
51
58
|
|
59
|
+
/ Scroll to Top Button
|
60
|
+
%a.scroll-to-top.rounded{ href: '#page-top' }
|
61
|
+
%i.fas.fa-angle-up
|
62
|
+
|
52
63
|
/ Placed at the end of the document so the pages load faster
|
53
|
-
%script{ type: 'text/javascript', src: 'https://
|
54
|
-
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/
|
55
|
-
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/
|
56
|
-
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/
|
64
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js' }
|
65
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js' }
|
66
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js' }
|
67
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js' }
|
68
|
+
/ %script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.production.min.js' }
|
69
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js' }
|
70
|
+
%script{ type: 'text/javascript', src: 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js' }
|
71
|
+
%script{ type: 'text/javascript', src: '/js/sb-admin-2.min.js' }
|
72
|
+
%script{ type: 'text/javascript', src: '/js/scripts.js' }
|
57
73
|
:javascript
|
58
74
|
$(function() {
|
59
|
-
$('.sidebar-nav').metisMenu();
|
60
75
|
$('.select2').select2();
|
61
76
|
});
|
62
77
|
|
data/views/partials/actions.haml
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
- if actions
|
2
|
-
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
%
|
7
|
-
|
8
|
-
|
9
|
-
-
|
10
|
-
|
11
|
-
%
|
12
|
-
|
13
|
-
-actions.
|
14
|
-
|
1
|
+
- if defined?(actions)
|
2
|
+
- if actions.count > 1
|
3
|
+
- link, text = actions.shift
|
4
|
+
.btn-group.text-right
|
5
|
+
%a.btn.btn-primary{ href: link }= text
|
6
|
+
%button.btn.btn-primary.dropdown-toggle{ type: 'button', id: 'actions-toggle', data: { toggle: 'dropdown' } }
|
7
|
+
%span.caret
|
8
|
+
%span.sr-only Toggle Dropdown
|
9
|
+
%ul.dropdown-menu{ 'aria-labelledby': 'actions-toggle' }
|
10
|
+
-actions.each do |k, v|
|
11
|
+
%li
|
12
|
+
%a{ href: k }= v
|
13
|
+
- elsif actions.count > 0
|
14
|
+
-actions.each do |k, v|
|
15
|
+
%a.btn.btn-primary{ href: k }= v
|
File without changes
|
@@ -1,2 +1,2 @@
|
|
1
|
-
= delete_form_tag "#{base_path}/#{entity.
|
1
|
+
= delete_form_tag "#{base_path}/#{entity.display_id}" do
|
2
2
|
%button.btn.btn-danger{ type: 'submit' }= delete_label
|
@@ -1,6 +1,6 @@
|
|
1
|
-
.form-group
|
1
|
+
.form-group{ class: total_filters.to_i > 4 ? 'col-3' : 'col-md'}
|
2
2
|
%label{ for: "filter_#{name}" }= label
|
3
|
-
%select.form-control{ name: name, id: "filter_#{name}" }
|
3
|
+
%select.form-control.select2{ style: 'width: 100%', name: name, id: "filter_#{name}" }
|
4
4
|
%option{ value: '' } -- Select One --
|
5
5
|
- options.each do |k,v| k ||= v; v ||= k;
|
6
6
|
%option{ value: k, selected: (params[name].eql? k)}= v
|
data/views/partials/footer.haml
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
.
|
4
|
-
|
5
|
-
|
1
|
+
/ Footer
|
2
|
+
%footer.sticky-footer.bg-light
|
3
|
+
.container.my-auto
|
4
|
+
-if ENV['SKIP_BRANDING'].blank?
|
5
|
+
.copyright.text-center.my-auto.text-dark
|
6
|
+
%p
|
7
|
+
Copyright ©
|
8
|
+
%a{ href: 'https://hackerpla.net/requestd', target: '_blank' }
|
9
|
+
HackerPlanet
|
10
|
+
2020
|
11
|
+
%p.mb-0
|
12
|
+
%a{ href: 'https://hackerpla.net/requestd', target: '_blank' }
|
13
|
+
%img.rounded{ src: 'http://hackerpla.net/wp-content/uploads/2014/07/HP_1C_128x128.png', height: 60 }
|
@@ -1,20 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
- type = attributes.delete(:type)
|
2
|
+
- attributes[:value] ||= model.send(field) || default
|
3
|
+
- if help_text
|
4
|
+
- attributes[:'aria-describedby'] = "#{attributes[:id]}_helptext"
|
5
|
+
- if type == 'hidden'
|
6
|
+
%input{attributes, type: type, value: model.send(field) || default}
|
7
|
+
- else
|
8
|
+
.form-group
|
9
|
+
- if type != 'file'
|
10
|
+
%label{ for: attributes[:id] }= label
|
11
|
+
- if type == 'select'
|
12
|
+
- options = attributes.delete(:options)
|
13
|
+
- value = attributes.delete(:value)
|
8
14
|
- if attributes[:multiple]
|
9
|
-
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
- attributes[:name] = "#{attributes[:name]}[]" unless attributes[:name][-2..-1] == '[]'
|
16
|
+
%select{attributes}
|
17
|
+
- if attributes[:multiple]
|
18
|
+
- options.each do |k, v| k = v if k.nil?; v = k if v.nil?;
|
19
|
+
%option{ value: k.to_s, selected: value&.include?(k) }= v
|
20
|
+
- else
|
21
|
+
%option{ value: "" } -- Select One --
|
22
|
+
- options.each do |k, v| k = v if k.nil?; v = k if v.nil?;
|
23
|
+
%option{ value: k.to_s, selected: value == k }= v
|
24
|
+
- elsif type == 'textarea'
|
25
|
+
%textarea{attributes}= preserve(model.send(field) || default)
|
26
|
+
- else
|
27
|
+
%input{ attributes, type: type }
|
28
|
+
- if model.errors[field]
|
29
|
+
.invalid-feedback= model.errors[field].join(', ')
|
30
|
+
- if help_text
|
31
|
+
%small.form-text.text-muted{ id: "#{attributes[:id]}_helptext" }= help_text
|