lotus_admin 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +63 -0
  4. data/Rakefile +20 -0
  5. data/app/assets/config/lotus_admin_manifest.js +2 -0
  6. data/app/assets/images/lotus_admin/profile-menu.png +0 -0
  7. data/app/assets/javascripts/lotus_admin/application.js +5 -0
  8. data/app/assets/stylesheets/lotus_admin/application.css.scss +9 -0
  9. data/app/assets/stylesheets/lotus_admin/components/_alerts.scss +5 -0
  10. data/app/assets/stylesheets/lotus_admin/components/_all.scss +4 -0
  11. data/app/assets/stylesheets/lotus_admin/components/_devise.scss +3 -0
  12. data/app/assets/stylesheets/lotus_admin/components/_forms.scss +7 -0
  13. data/app/assets/stylesheets/lotus_admin/components/_tables.scss +27 -0
  14. data/app/controllers/concerns/lotus_admin/devise_controllers.rb +7 -0
  15. data/app/controllers/concerns/lotus_admin/exposure.rb +27 -0
  16. data/app/controllers/concerns/lotus_admin/permitted_params.rb +18 -0
  17. data/app/controllers/lotus_admin/application_controller.rb +20 -0
  18. data/app/controllers/lotus_admin/authenticated_controller.rb +20 -0
  19. data/app/controllers/lotus_admin/confirmations_controller.rb +3 -0
  20. data/app/controllers/lotus_admin/dashboard_controller.rb +5 -0
  21. data/app/controllers/lotus_admin/passwords_controller.rb +3 -0
  22. data/app/controllers/lotus_admin/profiles_controller.rb +20 -0
  23. data/app/controllers/lotus_admin/sessions_controller.rb +3 -0
  24. data/app/controllers/lotus_admin/users_controller.rb +45 -0
  25. data/app/helpers/lotus_admin/application_helper.rb +18 -0
  26. data/app/helpers/lotus_admin/form_helpers.rb +25 -0
  27. data/app/helpers/lotus_admin/link_helpers.rb +27 -0
  28. data/app/helpers/lotus_admin/pagination_helpers.rb +7 -0
  29. data/app/helpers/lotus_admin/panel_helpers.rb +24 -0
  30. data/app/helpers/lotus_admin/sidebar_helpers.rb +25 -0
  31. data/app/jobs/lotus_admin/application_job.rb +4 -0
  32. data/app/mailers/lotus_admin/application_mailer.rb +6 -0
  33. data/app/mailers/lotus_admin/user_mailer.rb +10 -0
  34. data/app/models/lotus_admin/application_record.rb +5 -0
  35. data/app/models/lotus_admin/user.rb +17 -0
  36. data/app/views/administrators/_links.html.haml +20 -0
  37. data/app/views/administrators/confirmations/new.html.haml +13 -0
  38. data/app/views/administrators/passwords/edit.html.haml +15 -0
  39. data/app/views/administrators/passwords/new.html.haml +11 -0
  40. data/app/views/administrators/sessions/new.html.haml +11 -0
  41. data/app/views/kaminari/lotus_admin/_first_page.html.haml +2 -0
  42. data/app/views/kaminari/lotus_admin/_gap.html.haml +1 -0
  43. data/app/views/kaminari/lotus_admin/_last_page.html.haml +2 -0
  44. data/app/views/kaminari/lotus_admin/_next_page.html.haml +2 -0
  45. data/app/views/kaminari/lotus_admin/_page.html.haml +2 -0
  46. data/app/views/kaminari/lotus_admin/_paginator.html.haml +12 -0
  47. data/app/views/kaminari/lotus_admin/_prev_page.html.haml +2 -0
  48. data/app/views/layouts/lotus_admin/_devise_footer.html.haml +0 -0
  49. data/app/views/layouts/lotus_admin/_favicons.html.haml +0 -0
  50. data/app/views/layouts/lotus_admin/_footer.html.haml +2 -0
  51. data/app/views/layouts/lotus_admin/_footer_scripts.html.haml +2 -0
  52. data/app/views/layouts/lotus_admin/_header.html.haml +31 -0
  53. data/app/views/layouts/lotus_admin/_header_dropdown_items.html.haml +0 -0
  54. data/app/views/layouts/lotus_admin/_html_head.html.haml +9 -0
  55. data/app/views/layouts/lotus_admin/_javascripts.html.haml +1 -0
  56. data/app/views/layouts/lotus_admin/_sidebar.html.haml +22 -0
  57. data/app/views/layouts/lotus_admin/_sidebar_items.html.haml +9 -0
  58. data/app/views/layouts/lotus_admin/_stylesheets.html.haml +5 -0
  59. data/app/views/layouts/lotus_admin/application.html.haml +22 -0
  60. data/app/views/layouts/lotus_admin/devise.html.haml +19 -0
  61. data/app/views/layouts/lotus_admin/mailer.html.haml +10 -0
  62. data/app/views/layouts/lotus_admin/mailer.text.erb +4 -0
  63. data/app/views/lotus_admin/dashboard/show.html.haml +1 -0
  64. data/app/views/lotus_admin/profiles/edit.html.haml +26 -0
  65. data/app/views/lotus_admin/shared/_collection_pagination.html.haml +7 -0
  66. data/app/views/lotus_admin/user_mailer/invited.html.haml +8 -0
  67. data/app/views/lotus_admin/user_mailer/invited.text.erb +5 -0
  68. data/app/views/lotus_admin/users/_form.html.haml +10 -0
  69. data/app/views/lotus_admin/users/edit.html.haml +12 -0
  70. data/app/views/lotus_admin/users/index.html.haml +30 -0
  71. data/app/views/lotus_admin/users/new.html.haml +9 -0
  72. data/app/views/lotus_admin/users/show.html.haml +24 -0
  73. data/config/initializers/devise.rb +280 -0
  74. data/config/initializers/simple_form.rb +170 -0
  75. data/config/initializers/simple_form_bootstrap.rb +155 -0
  76. data/config/initializers/simple_form_material.rb +35 -0
  77. data/config/locales/dates.en.yml +11 -0
  78. data/config/locales/devise.en.yml +64 -0
  79. data/config/locales/mailers.en.yml +5 -0
  80. data/config/locales/page_titles.en.yml +30 -0
  81. data/config/locales/simple_form.en.yml +31 -0
  82. data/config/locales/users.en.yml +29 -0
  83. data/config/routes.rb +8 -0
  84. data/db/migrate/20180228124526_devise_create_lotus_admin_users.rb +46 -0
  85. data/db/migrate/20180228210938_add_timezone_to_users.rb +5 -0
  86. data/lib/lotus_admin.rb +17 -0
  87. data/lib/lotus_admin/engine.rb +19 -0
  88. data/lib/lotus_admin/version.rb +3 -0
  89. data/lib/tasks/lotus_admin_tasks.rake +6 -0
  90. data/lib/templates/erb/scaffold/_form.html.erb +14 -0
  91. metadata +371 -0
@@ -0,0 +1,7 @@
1
+ module LotusAdmin
2
+ module PaginationHelpers
3
+ def pagination(collection)
4
+ render partial: 'lotus_admin/shared/collection_pagination', locals: { collection: collection }
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ module LotusAdmin
2
+ module PanelHelpers
3
+ def panel_attribute(resource, attribute, &block)
4
+ content_tag(:div, class: 'list-group-item') do
5
+ content_tag(:div, class: 'lgi-heading m-b-5') do
6
+ resource.class.human_attribute_name(attribute)
7
+ end +
8
+ content_tag(:div, class: 'lgi-text') do
9
+ if block_given?
10
+ capture_haml(&block)
11
+ else
12
+ resource.public_send(attribute)
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ def boolean_tag(bool)
19
+ return content_tag(:span, 'Yes', class: 'label label-success') if bool
20
+
21
+ content_tag(:span, 'No', class: 'label label-danger')
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ module LotusAdmin
2
+ module SidebarHelpers
3
+ def sidebar_item(identifier, &block)
4
+ content_tag(:li, class: class_for_menu(identifier), &block)
5
+ end
6
+
7
+ def sidebar_parent_item(identifier, icon, name, &block)
8
+ content_tag(:li, class: class_for_parent_menu_item(identifier)) do
9
+ link_to('#', data: { ma_action: 'submenu-toggle' }) do
10
+ content_tag(:i, nil, class: "zmdi zmdi-#{ icon }") + name
11
+ end + capture_haml(&block)
12
+ end
13
+ end
14
+
15
+ def class_for_menu(identifier)
16
+ return 'active' if menu_identifier == identifier
17
+ end
18
+
19
+ def class_for_parent_menu_item(identifier)
20
+ return 'sub-menu active toggled' if parent_menu_identifier == identifier
21
+
22
+ 'sub-menu'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,4 @@
1
+ module LotusAdmin
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module LotusAdmin
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: Rails.application.secrets.action_mailer_default_sender_address
4
+ layout 'lotus_admin/mailer'
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ module LotusAdmin
2
+ class UserMailer < LotusAdmin::ApplicationMailer
3
+ def invited(user, token)
4
+ @resource = user
5
+ @token = token
6
+
7
+ mail to: user.email, subject: default_i18n_subject(app: I18n.t('app.name'))
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ module LotusAdmin
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ module LotusAdmin
2
+ class User < ApplicationRecord
3
+ devise :database_authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :validatable
4
+
5
+ validates :first_name, :last_name, presence: true
6
+
7
+ def name
8
+ [ first_name, last_name ].join(' ')
9
+ end
10
+
11
+ def send_invited_email_notification
12
+ token = set_reset_password_token
13
+
14
+ LotusAdmin::UserMailer.invited(self, token).deliver_later
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ .devise-shared-links-container
2
+ - if controller_name != 'sessions'
3
+ = link_to "Log in", new_session_path(resource_name)
4
+ %br/
5
+ - if devise_mapping.registerable? && controller_name != 'registrations'
6
+ = link_to "Sign up", new_registration_path(resource_name)
7
+ %br/
8
+ - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
9
+ = link_to "Forgot your password?", new_password_path(resource_name)
10
+ %br/
11
+ - if devise_mapping.confirmable? && controller_name != 'confirmations'
12
+ = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
13
+ %br/
14
+ - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
15
+ = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
16
+ %br/
17
+ - if devise_mapping.omniauthable?
18
+ - resource_class.omniauth_providers.each do |provider|
19
+ = link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider)
20
+ %br/
@@ -0,0 +1,13 @@
1
+ = material_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
2
+ = f.error_notification
3
+
4
+ = f.full_error :confirmation_token
5
+
6
+ .form-inputs
7
+ = f.input :email, required: true, autofocus: true
8
+
9
+ .form-actions
10
+ = button_tag class: 'btn btn-success btn-login' do
11
+ %i.zmdi.zmdi-arrow-forward
12
+
13
+ = render "administrators/links"
@@ -0,0 +1,15 @@
1
+ = material_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
2
+ = f.error_notification
3
+
4
+ = f.input :reset_password_token, as: :hidden
5
+ = f.full_error :reset_password_token
6
+
7
+ .form-inputs
8
+ = f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length)
9
+ = f.input :password_confirmation, label: "Confirm your new password", required: true
10
+
11
+ .form-actions
12
+ = button_tag class: 'btn btn-success btn-login' do
13
+ %i.zmdi.zmdi-arrow-forward
14
+
15
+ = render "administrators/links"
@@ -0,0 +1,11 @@
1
+ = material_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
2
+ = f.error_notification
3
+
4
+ .form-inputs
5
+ = f.input :email, required: true, autofocus: true
6
+
7
+ .form-actions
8
+ = button_tag class: 'btn btn-success btn-login' do
9
+ %i.zmdi.zmdi-arrow-forward
10
+
11
+ = render "administrators/links"
@@ -0,0 +1,11 @@
1
+ = material_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
2
+ .form-inputs
3
+ = f.input :email, required: false, autofocus: true
4
+ = f.input :password, required: false
5
+ = f.input :remember_me, as: :hidden, input_html: { value: true } if devise_mapping.rememberable?
6
+
7
+ .form-actions
8
+ = button_tag class: 'btn btn-success btn-login' do
9
+ %i.zmdi.zmdi-arrow-forward
10
+
11
+ = render 'administrators/links'
@@ -0,0 +1,2 @@
1
+ %li.first
2
+ = link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote
@@ -0,0 +1 @@
1
+ %li.page.gap= t('views.pagination.truncate').html_safe
@@ -0,0 +1,2 @@
1
+ %li.last
2
+ = link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, remote: remote
@@ -0,0 +1,2 @@
1
+ %li.next
2
+ = link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, rel: 'next', remote: remote
@@ -0,0 +1,2 @@
1
+ %li{:class => "page#{' active' if page.current?}"}
2
+ = link_to page, url, { class: 'active', remote: remote, rel: page.rel }
@@ -0,0 +1,12 @@
1
+ = paginator.render do
2
+ %nav.pagination
3
+ = first_page_tag unless current_page.first?
4
+ = prev_page_tag unless current_page.first?
5
+ - each_page do |page|
6
+ - if page.display_tag?
7
+ = page_tag page
8
+ - elsif !page.was_truncated?
9
+ = gap_tag
10
+ - unless current_page.out_of_range?
11
+ = next_page_tag unless current_page.last?
12
+ = last_page_tag unless current_page.last?
@@ -0,0 +1,2 @@
1
+ %li.prev
2
+ = link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, rel: 'prev', remote: remote
File without changes
@@ -0,0 +1,2 @@
1
+ %footer#footer
2
+ = link_to 'Powered by Lotus Admin', 'http://www.madebylotus.com/?ref=lotus-admin', target: :blank
@@ -0,0 +1,2 @@
1
+ = javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/node-waves/0.7.5/waves.min.js'
2
+ = javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.js'
@@ -0,0 +1,31 @@
1
+ %header#header.clearfix{"data-ma-theme" => "blue"}
2
+ %ul.h-inner
3
+ %li.hi-trigger.ma-trigger{"data-ma-action" => "sidebar-open", "data-ma-target" => "#sidebar"}
4
+ .line-wrap
5
+ .line.top
6
+ .line.center
7
+ .line.bottom
8
+ %li.hi-logo.hidden-xs
9
+ = link_to page_title, lotus_admin.root_path
10
+
11
+ %li.pull-right
12
+ %ul.hi-menu
13
+
14
+ %li.hide{"data-ma-action" => "search-open"}
15
+ = link_to '#' do
16
+ %i.him-icon.zmdi.zmdi-search
17
+
18
+ %li.dropdown
19
+ = link_to '#', data: { toggle: :dropdown } do
20
+ %i.him-icon.zmdi.zmdi-more-vert
21
+
22
+ %ul.dropdown-menu.pull-right
23
+ %li.hidden-xs
24
+ = link_to 'Toggle Fullscreen', '#', data: { ma_action: :fullscreen }
25
+
26
+ = render 'layouts/lotus_admin/header_dropdown_items'
27
+
28
+ .h-search-wrap
29
+ .hsw-inner
30
+ %i.hsw-close.zmdi.zmdi-arrow-left{"data-ma-action" => "search-close"}
31
+ %input{:type => "text"}
@@ -0,0 +1,9 @@
1
+ %meta{ content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type" }
2
+ %meta{ name: "viewport", content: "width=device-width, initial-scale=1" }
3
+ %meta{ :"http-equiv" => "http-equiv", content: "IE=edge" }
4
+ %title= page_title
5
+ = csrf_meta_tags
6
+
7
+ = render 'layouts/lotus_admin/stylesheets'
8
+ = render 'layouts/lotus_admin/javascripts'
9
+ = render 'layouts/lotus_admin/favicons'
@@ -0,0 +1 @@
1
+ = javascript_include_tag 'lotus_admin/application', 'data-turbolinks-track': 'reload'
@@ -0,0 +1,22 @@
1
+ %aside#sidebar.sidebar.c-overflow
2
+ .s-profile
3
+ %a{"data-ma-action" => "profile-menu-toggle", :href => ""}
4
+ .sp-pic
5
+
6
+ .sp-info
7
+ = current_administrator.name
8
+ %i.zmdi.zmdi-caret-down
9
+
10
+ %ul.main-menu
11
+ %li
12
+ = link_to lotus_admin.edit_profile_path do
13
+ %i.zmdi.zmdi-account-box
14
+ Edit My Profile
15
+
16
+ %li
17
+ = link_to destroy_administrator_session_path, data: { method: :delete } do
18
+ %i.zmdi.zmdi-time-restore
19
+ Logout
20
+
21
+ %ul.main-menu
22
+ = render 'layouts/lotus_admin/sidebar_items'
@@ -0,0 +1,9 @@
1
+ = sidebar_item(:dashboard_show) do
2
+ = link_to lotus_admin.root_path do
3
+ %i.zmdi.zmdi-home
4
+ Dashboard
5
+
6
+ = sidebar_item(:users_index) do
7
+ = link_to lotus_admin.polymorphic_path([ LotusAdmin::User ]) do
8
+ %i.zmdi.zmdi-accounts
9
+ = LotusAdmin::User.model_name.human(count: 2)
@@ -0,0 +1,5 @@
1
+ = stylesheet_link_tag 'https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css'
2
+ = stylesheet_link_tag 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700'
3
+ = stylesheet_link_tag 'https://cdnjs.cloudflare.com/ajax/libs/node-waves/0.7.5/waves.min.css'
4
+ = stylesheet_link_tag 'https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css'
5
+ = stylesheet_link_tag 'lotus_admin/application', media: 'all', 'data-turbolinks-track': 'reload'
@@ -0,0 +1,22 @@
1
+ !!! 5
2
+ <!--[if IE 9 ]><html class="ie9"><![endif]-->
3
+ %html
4
+ %head
5
+ = render 'layouts/lotus_admin/html_head'
6
+
7
+ %body{class: body_class}
8
+ = render 'layouts/lotus_admin/header'
9
+
10
+ %section#main
11
+ = render 'layouts/lotus_admin/sidebar'
12
+
13
+ %section#content
14
+ .container
15
+ - flash.each do |type, message|
16
+ = flash_message(message, type)
17
+
18
+ = yield
19
+
20
+ = render 'layouts/lotus_admin/footer'
21
+
22
+ = render 'layouts/lotus_admin/footer_scripts'
@@ -0,0 +1,19 @@
1
+ !!! 5
2
+ <!--[if IE 9 ]><html class="ie9"><![endif]-->
3
+ %html
4
+ %head
5
+ = render 'layouts/lotus_admin/html_head'
6
+
7
+ %body{class: body_class}
8
+ .login-content
9
+ #l-login.lc-block.toggled
10
+ %h2= page_title_from_translation(nil)
11
+
12
+ .lcb-form
13
+ - flash.each do |type, message|
14
+ = flash_message(message, type)
15
+
16
+ = yield
17
+
18
+ = render 'layouts/lotus_admin/devise_footer'
19
+ = render 'layouts/lotus_admin/footer_scripts'
@@ -0,0 +1,10 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
5
+ :css
6
+ /* Email styles need to be inline */
7
+ %body
8
+ = yield
9
+ %p Sincerely,
10
+ %p= I18n.t('app.name')
@@ -0,0 +1,4 @@
1
+ <%= yield %>
2
+
3
+ Sincerely,
4
+ <%= I18n.t('app.name') %>
@@ -0,0 +1 @@
1
+ %h1 Dashboard#show
@@ -0,0 +1,26 @@
1
+ .block-header
2
+ %h2= page_title!("Edit My Profile")
3
+
4
+ .card
5
+ .card-header
6
+ = t('.help')
7
+
8
+ .card-body.card-padding
9
+ = material_form_for current_administrator, url: lotus_admin.profile_path do |f|
10
+ .form-inputs
11
+ .row
12
+ .col-sm-6= f.input :first_name
13
+ .col-sm-6= f.input :last_name
14
+
15
+ .row
16
+ .col-sm-6= f.input :email
17
+ .col-sm-6= f.input :time_zone, priority: /US/
18
+
19
+ .form-inputs
20
+ .row
21
+ .col-sm-6= f.input :password
22
+ .col-sm-6= f.input :password_confirmation
23
+
24
+ .form-actions
25
+ = material_form_submit(current_administrator)
26
+ = material_form_cancel(lotus_admin.root_path)
@@ -0,0 +1,7 @@
1
+ .row
2
+ .col-sm-6
3
+ = paginate(collection, theme: 'lotus_admin')
4
+
5
+ .col-sm-6
6
+ .pagination-info
7
+ %small= page_entries_info(collection)