dq_admin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +52 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +173 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +36 -0
- data/app/assets/config/dq_admin_manifest.js +2 -0
- data/app/assets/images/dq_admin/.keep +0 -0
- data/app/assets/javascripts/dq_admin/application.js +14 -0
- data/app/assets/javascripts/dq_admin/dashboard.js +2 -0
- data/app/assets/javascripts/dq_admin/fields.js +2 -0
- data/app/assets/javascripts/dq_admin/products.js +2 -0
- data/app/assets/javascripts/dq_admin/users.js +2 -0
- data/app/assets/stylesheets/dq_admin/application.css +48 -0
- data/app/assets/stylesheets/dq_admin/dashboard.css +4 -0
- data/app/assets/stylesheets/dq_admin/fields.css +4 -0
- data/app/assets/stylesheets/dq_admin/products.css +4 -0
- data/app/assets/stylesheets/dq_admin/users.css +4 -0
- data/app/controllers/dq_admin/application_controller.rb +19 -0
- data/app/controllers/dq_admin/dashboard_controller.rb +6 -0
- data/app/controllers/dq_admin/fields_controller.rb +6 -0
- data/app/controllers/dq_admin/products_controller.rb +31 -0
- data/app/controllers/dq_admin/users_controller.rb +58 -0
- data/app/helpers/dq_admin/application_helper.rb +12 -0
- data/app/helpers/dq_admin/dashboard_helper.rb +4 -0
- data/app/helpers/dq_admin/fields_helper.rb +4 -0
- data/app/helpers/dq_admin/products_helper.rb +4 -0
- data/app/helpers/dq_admin/users_helper.rb +4 -0
- data/app/jobs/dq_admin/application_job.rb +4 -0
- data/app/mailers/dq_admin/application_mailer.rb +6 -0
- data/app/models/dq_admin/application_record.rb +5 -0
- data/app/models/dq_admin/article.rb +4 -0
- data/app/models/dq_admin/field.rb +13 -0
- data/app/models/dq_admin/product.rb +4 -0
- data/app/models/dq_admin/setting.rb +9 -0
- data/app/models/dq_admin/slide.rb +4 -0
- data/app/models/dq_admin/user.rb +30 -0
- data/app/services/dq_admin/field_service.rb +50 -0
- data/app/views/devise/confirmations/new.html.erb +16 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/email_changed.html.erb +7 -0
- data/app/views/devise/mailer/password_change.html.erb +3 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +25 -0
- data/app/views/devise/passwords/new.html.erb +16 -0
- data/app/views/devise/registrations/edit.html.erb +43 -0
- data/app/views/devise/registrations/new.html.erb +29 -0
- data/app/views/devise/sessions/new.html.erb +35 -0
- data/app/views/devise/shared/_links.html.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +16 -0
- data/app/views/dq_admin/dashboard/index.html.erb +9 -0
- data/app/views/dq_admin/products/edit.html.erb +0 -0
- data/app/views/dq_admin/products/index.html.erb +54 -0
- data/app/views/dq_admin/products/new.html.erb +0 -0
- data/app/views/dq_admin/shared/_slidebar.html.erb +0 -0
- data/app/views/dq_admin/users/_form.html.erb +0 -0
- data/app/views/dq_admin/users/edit.html.erb +37 -0
- data/app/views/dq_admin/users/index.html.erb +53 -0
- data/app/views/dq_admin/users/new.html.erb +37 -0
- data/app/views/kaminari/_first_page.html.erb +3 -0
- data/app/views/kaminari/_gap.html.erb +3 -0
- data/app/views/kaminari/_last_page.html.erb +3 -0
- data/app/views/kaminari/_next_page.html.erb +3 -0
- data/app/views/kaminari/_page.html.erb +9 -0
- data/app/views/kaminari/_paginator.html.erb +15 -0
- data/app/views/kaminari/_prev_page.html.erb +3 -0
- data/app/views/layouts/dq_admin/application.html.erb +93 -0
- data/bin/rails +14 -0
- data/config/initializers/devise.rb +282 -0
- data/config/initializers/user.rb +1 -0
- data/config/locales/devise.en.yml +64 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20180312020826_devise_create_dq_admin_users.rb +44 -0
- data/db/migrate/20180313060828_create_dq_admin_fields.rb +14 -0
- data/db/migrate/20180313125449_rename_config_to_option.rb +5 -0
- data/db/migrate/20180314235103_create_dq_admin_settings.rb +9 -0
- data/db/migrate/20180318070651_create_dq_admin_products.rb +13 -0
- data/db/migrate/20180318070806_create_dq_admin_slides.rb +11 -0
- data/db/migrate/20180318071018_create_dq_admin_articles.rb +12 -0
- data/db/migrate/20180318071514_add_username_to_users.rb +5 -0
- data/dq_admin.gemspec +33 -0
- data/lib/dq_admin/engine.rb +5 -0
- data/lib/dq_admin/version.rb +3 -0
- data/lib/dq_admin.rb +7 -0
- data/lib/tasks/dq_admin_tasks.rake +6 -0
- data/test/controllers/dq_admin/dashboard_controller_test.rb +11 -0
- data/test/controllers/dq_admin/fields_controller_test.rb +11 -0
- data/test/controllers/dq_admin/products_controller_test.rb +11 -0
- data/test/controllers/dq_admin/users_controller_test.rb +11 -0
- data/test/dq_admin_test.rb +7 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +5 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/javascripts/cable.js +13 -0
- data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +38 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +18 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +91 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/fields.json +20 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +56 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +32 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/db/schema.rb +77 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/package.json +5 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/dq_admin/articles.yml +13 -0
- data/test/fixtures/dq_admin/fields.yml +17 -0
- data/test/fixtures/dq_admin/products.yml +15 -0
- data/test/fixtures/dq_admin/settings.yml +7 -0
- data/test/fixtures/dq_admin/slides.yml +11 -0
- data/test/fixtures/dq_admin/users.yml +11 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/models/dq_admin/article_test.rb +9 -0
- data/test/models/dq_admin/field_test.rb +9 -0
- data/test/models/dq_admin/product_test.rb +9 -0
- data/test/models/dq_admin/setting_test.rb +9 -0
- data/test/models/dq_admin/slide_test.rb +9 -0
- data/test/models/dq_admin/user_test.rb +9 -0
- data/test/test_helper.rb +17 -0
- metadata +410 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title></title>
|
5
|
+
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
|
8
|
+
<link href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
|
9
|
+
<link href="//cdn.bootcss.com/admin-lte/2.3.11/css/AdminLTE.min.css" rel="stylesheet">
|
10
|
+
<link href="//cdn.bootcss.com/admin-lte/2.3.11/css/alt/AdminLTE-bootstrap-social.min.css" rel="stylesheet">
|
11
|
+
<link href="//cdn.bootcss.com/admin-lte/2.3.11/css/alt/AdminLTE-fullcalendar.min.css" rel="stylesheet">
|
12
|
+
<link href="//cdn.bootcss.com/admin-lte/2.3.11/css/alt/AdminLTE-select2.min.css" rel="stylesheet">
|
13
|
+
<link href="//cdn.bootcss.com/admin-lte/2.3.11/css/skins/_all-skins.min.css" rel="stylesheet">
|
14
|
+
<link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
15
|
+
<link href="//cdn.bootcss.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet">
|
16
|
+
<link href="//cdn.bootcss.com/simditor/2.3.6/styles/simditor.min.css" rel="stylesheet">
|
17
|
+
|
18
|
+
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
19
|
+
<script src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
20
|
+
<script src="//cdn.bootcss.com/admin-lte/2.3.11/js/app.min.js"></script>
|
21
|
+
<script src="//cdn.bootcss.com/lodash.js/4.17.4/lodash.js"></script>
|
22
|
+
<script src="http://simditor.tower.im/assets/scripts/module.js"></script>
|
23
|
+
<script src="http://simditor.tower.im/assets/scripts/uploader.js"></script>
|
24
|
+
<script src="http://simditor.tower.im/assets/scripts/hotkeys.js"></script>
|
25
|
+
<script src="http://simditor.tower.im/assets/scripts/simditor.js"></script>
|
26
|
+
<%= stylesheet_link_tag "dq_admin/application", media: "all" %>
|
27
|
+
</head>
|
28
|
+
|
29
|
+
<% if is_devise_page? %>
|
30
|
+
<body class="hold-transition login-page">
|
31
|
+
<%= yield %>
|
32
|
+
</body>
|
33
|
+
<% else %>
|
34
|
+
<body class="skin-blue">
|
35
|
+
<div class="wrapper">
|
36
|
+
<header class="main-header">
|
37
|
+
<a href="/admin" class="logo">
|
38
|
+
<span class="logo-bg">Admin</span>
|
39
|
+
</a>
|
40
|
+
<nav class="navbar navbar-static-top">
|
41
|
+
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
42
|
+
<span class="sr-only">Toggle navigation</span>
|
43
|
+
</a>
|
44
|
+
|
45
|
+
<div class="navbar-custom-menu">
|
46
|
+
<ul class="nav navbar-nav">
|
47
|
+
<li class="user user-menu">
|
48
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
49
|
+
<span class="hidden-xs">Alexander Pierce</span>
|
50
|
+
</a>
|
51
|
+
</li>
|
52
|
+
<li>
|
53
|
+
<%= link_to "Sign out", destroy_user_session_path(current_user), data: { confirm: "Are you sure?" }, method: :delete %>
|
54
|
+
</li>
|
55
|
+
</ul>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
</nav>
|
59
|
+
</header>
|
60
|
+
<aside class="main-sidebar">
|
61
|
+
<section class="sidebar" style="height: auto;">
|
62
|
+
<ul class="sidebar-menu">
|
63
|
+
<li class="header">Application</li>
|
64
|
+
<li><a href="/">Dashboard</a></li>
|
65
|
+
<li><a href="/products">Products</a></li>
|
66
|
+
<li><a href="/articles">Articles</a></li>
|
67
|
+
<li><a href="/slides">Slides</a></li>
|
68
|
+
|
69
|
+
|
70
|
+
<li class="header">Admin</li>
|
71
|
+
<li><a href="/settings">Settings</a></li>
|
72
|
+
<li><a href="/users">Admins</a></li>
|
73
|
+
<li>
|
74
|
+
<a href="#" class="treeview">Fields</a>
|
75
|
+
<ul class="treeview-menu">
|
76
|
+
</ul>
|
77
|
+
</li>
|
78
|
+
</ul>
|
79
|
+
</section>
|
80
|
+
</aside>
|
81
|
+
|
82
|
+
<div class="content-wrapper" style="min-height: 916px;">
|
83
|
+
<%= yield %>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<%= javascript_include_tag "dq_admin/application" %>
|
88
|
+
</body>
|
89
|
+
<% end %>
|
90
|
+
|
91
|
+
</html>
|
92
|
+
|
93
|
+
|
data/bin/rails
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
6
|
+
ENGINE_PATH = File.expand_path('../../lib/dq_admin/engine', __FILE__)
|
7
|
+
APP_PATH = File.expand_path('../../test/dummy/config/application', __FILE__)
|
8
|
+
|
9
|
+
# Set up gems listed in the Gemfile.
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
11
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
12
|
+
|
13
|
+
require 'rails/all'
|
14
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,282 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
4
|
+
# Many of these configuration options can be set straight in your model.
|
5
|
+
Devise.setup do |config|
|
6
|
+
# The secret key used by Devise. Devise uses this key to generate
|
7
|
+
# random tokens. Changing this key will render invalid all existing
|
8
|
+
# confirmation, reset password and unlock tokens in the database.
|
9
|
+
# Devise will use the `secret_key_base` as its `secret_key`
|
10
|
+
# by default. You can change it below and use your own secret key.
|
11
|
+
# config.secret_key = 'e5b117351cca20e4c3dd5a8b8f8177fe952ef83df8fd195b7d53d09329eefda6e304ff302964231ae59f4d5cb4b30d3eecd973bc72c047f3a7b2050ec37abfed'
|
12
|
+
|
13
|
+
# ==> Mailer Configuration
|
14
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
15
|
+
# note that it will be overwritten if you use your own mailer class
|
16
|
+
# with default "from" parameter.
|
17
|
+
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
18
|
+
|
19
|
+
# Configure the class responsible to send e-mails.
|
20
|
+
# config.mailer = 'Devise::Mailer'
|
21
|
+
|
22
|
+
# Configure the parent class responsible to send e-mails.
|
23
|
+
# config.parent_mailer = 'ActionMailer::Base'
|
24
|
+
|
25
|
+
# ==> ORM configuration
|
26
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
27
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
28
|
+
# available as additional gems.
|
29
|
+
require 'devise/orm/active_record'
|
30
|
+
|
31
|
+
# ==> Configuration for any authentication mechanism
|
32
|
+
# Configure which keys are used when authenticating a user. The default is
|
33
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
34
|
+
# authenticating a user, both parameters are required. Remember that those
|
35
|
+
# parameters are used only when authenticating and not when retrieving from
|
36
|
+
# session. If you need permissions, you should implement that in a before filter.
|
37
|
+
# You can also supply a hash where the value is a boolean determining whether
|
38
|
+
# or not authentication should be aborted when the value is not present.
|
39
|
+
# config.authentication_keys = [:email]
|
40
|
+
|
41
|
+
# Configure parameters from the request object used for authentication. Each entry
|
42
|
+
# given should be a request method and it will automatically be passed to the
|
43
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
44
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
45
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
46
|
+
# config.request_keys = []
|
47
|
+
|
48
|
+
# Configure which authentication keys should be case-insensitive.
|
49
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
50
|
+
# to authenticate or find a user. Default is :email.
|
51
|
+
config.case_insensitive_keys = [:email]
|
52
|
+
|
53
|
+
# Configure which authentication keys should have whitespace stripped.
|
54
|
+
# These keys will have whitespace before and after removed upon creating or
|
55
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
56
|
+
config.strip_whitespace_keys = [:email]
|
57
|
+
|
58
|
+
# Tell if authentication through request.params is enabled. True by default.
|
59
|
+
# It can be set to an array that will enable params authentication only for the
|
60
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
61
|
+
# enable it only for database (email + password) authentication.
|
62
|
+
# config.params_authenticatable = true
|
63
|
+
|
64
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
65
|
+
# It can be set to an array that will enable http authentication only for the
|
66
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
67
|
+
# enable it only for database authentication. The supported strategies are:
|
68
|
+
# :database = Support basic authentication with authentication key + password
|
69
|
+
# config.http_authenticatable = false
|
70
|
+
|
71
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
72
|
+
# config.http_authenticatable_on_xhr = true
|
73
|
+
|
74
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
75
|
+
# config.http_authentication_realm = 'Application'
|
76
|
+
|
77
|
+
# It will change confirmation, password recovery and other workflows
|
78
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
79
|
+
# Does not affect registerable.
|
80
|
+
# config.paranoid = true
|
81
|
+
|
82
|
+
# By default Devise will store the user in session. You can skip storage for
|
83
|
+
# particular strategies by setting this option.
|
84
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
85
|
+
# may want to disable generating routes to Devise's sessions controller by
|
86
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
87
|
+
config.skip_session_storage = [:http_auth]
|
88
|
+
|
89
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
90
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
91
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
92
|
+
# from the server. You can disable this option at your own risk.
|
93
|
+
# config.clean_up_csrf_token_on_authentication = true
|
94
|
+
|
95
|
+
# When false, Devise will not attempt to reload routes on eager load.
|
96
|
+
# This can reduce the time taken to boot the app but if your application
|
97
|
+
# requires the Devise mappings to be loaded during boot time the application
|
98
|
+
# won't boot properly.
|
99
|
+
# config.reload_routes = true
|
100
|
+
|
101
|
+
# ==> Configuration for :database_authenticatable
|
102
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
|
103
|
+
# using other algorithms, it sets how many times you want the password to be hashed.
|
104
|
+
#
|
105
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
106
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
107
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
108
|
+
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
109
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
110
|
+
config.stretches = Rails.env.test? ? 1 : 11
|
111
|
+
|
112
|
+
# Set up a pepper to generate the hashed password.
|
113
|
+
# config.pepper = '91b7ea372b4890f86f350bcfdda910dd8f2411f3d4acc17fab4b5382378a876de7700a03ae569b8745a3a51e8fb56c413a6c7d8b674f0c9409a219cf54edfdfd'
|
114
|
+
|
115
|
+
# Send a notification to the original email when the user's email is changed.
|
116
|
+
# config.send_email_changed_notification = false
|
117
|
+
|
118
|
+
# Send a notification email when the user's password is changed.
|
119
|
+
# config.send_password_change_notification = false
|
120
|
+
|
121
|
+
# ==> Configuration for :confirmable
|
122
|
+
# A period that the user is allowed to access the website even without
|
123
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
124
|
+
# able to access the website for two days without confirming their account,
|
125
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
126
|
+
# the user cannot access the website without confirming their account.
|
127
|
+
# config.allow_unconfirmed_access_for = 2.days
|
128
|
+
|
129
|
+
# A period that the user is allowed to confirm their account before their
|
130
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
131
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
132
|
+
# their account can't be confirmed with the token any more.
|
133
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
134
|
+
# before confirming their account.
|
135
|
+
# config.confirm_within = 3.days
|
136
|
+
|
137
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
138
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
139
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
140
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
141
|
+
config.reconfirmable = true
|
142
|
+
|
143
|
+
# Defines which key will be used when confirming an account
|
144
|
+
# config.confirmation_keys = [:email]
|
145
|
+
|
146
|
+
# ==> Configuration for :rememberable
|
147
|
+
# The time the user will be remembered without asking for credentials again.
|
148
|
+
# config.remember_for = 2.weeks
|
149
|
+
|
150
|
+
# Invalidates all the remember me tokens when the user signs out.
|
151
|
+
config.expire_all_remember_me_on_sign_out = true
|
152
|
+
|
153
|
+
# If true, extends the user's remember period when remembered via cookie.
|
154
|
+
# config.extend_remember_period = false
|
155
|
+
|
156
|
+
# Options to be passed to the created cookie. For instance, you can set
|
157
|
+
# secure: true in order to force SSL only cookies.
|
158
|
+
# config.rememberable_options = {}
|
159
|
+
|
160
|
+
# ==> Configuration for :validatable
|
161
|
+
# Range for password length.
|
162
|
+
config.password_length = 6..128
|
163
|
+
|
164
|
+
# Email regex used to validate email formats. It simply asserts that
|
165
|
+
# one (and only one) @ exists in the given string. This is mainly
|
166
|
+
# to give user feedback and not to assert the e-mail validity.
|
167
|
+
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
168
|
+
|
169
|
+
# ==> Configuration for :timeoutable
|
170
|
+
# The time you want to timeout the user session without activity. After this
|
171
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
172
|
+
# config.timeout_in = 30.minutes
|
173
|
+
|
174
|
+
# ==> Configuration for :lockable
|
175
|
+
# Defines which strategy will be used to lock an account.
|
176
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
177
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
178
|
+
# config.lock_strategy = :failed_attempts
|
179
|
+
|
180
|
+
# Defines which key will be used when locking and unlocking an account
|
181
|
+
# config.unlock_keys = [:email]
|
182
|
+
|
183
|
+
# Defines which strategy will be used to unlock an account.
|
184
|
+
# :email = Sends an unlock link to the user email
|
185
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
186
|
+
# :both = Enables both strategies
|
187
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
188
|
+
# config.unlock_strategy = :both
|
189
|
+
|
190
|
+
# Number of authentication tries before locking an account if lock_strategy
|
191
|
+
# is failed attempts.
|
192
|
+
# config.maximum_attempts = 20
|
193
|
+
|
194
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
195
|
+
# config.unlock_in = 1.hour
|
196
|
+
|
197
|
+
# Warn on the last attempt before the account is locked.
|
198
|
+
# config.last_attempt_warning = true
|
199
|
+
|
200
|
+
# ==> Configuration for :recoverable
|
201
|
+
#
|
202
|
+
# Defines which key will be used when recovering the password for an account
|
203
|
+
# config.reset_password_keys = [:email]
|
204
|
+
|
205
|
+
# Time interval you can reset your password with a reset password key.
|
206
|
+
# Don't put a too small interval or your users won't have the time to
|
207
|
+
# change their passwords.
|
208
|
+
config.reset_password_within = 6.hours
|
209
|
+
|
210
|
+
# When set to false, does not sign a user in automatically after their password is
|
211
|
+
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
212
|
+
# config.sign_in_after_reset_password = true
|
213
|
+
|
214
|
+
# ==> Configuration for :encryptable
|
215
|
+
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
216
|
+
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
217
|
+
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
218
|
+
# for default behavior) and :restful_authentication_sha1 (then you should set
|
219
|
+
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
220
|
+
#
|
221
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
222
|
+
# config.encryptor = :sha512
|
223
|
+
|
224
|
+
# ==> Scopes configuration
|
225
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
226
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
227
|
+
# are using only default views.
|
228
|
+
# config.scoped_views = false
|
229
|
+
|
230
|
+
# Configure the default scope given to Warden. By default it's the first
|
231
|
+
# devise role declared in your routes (usually :user).
|
232
|
+
# config.default_scope = :user
|
233
|
+
|
234
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
235
|
+
# only the current scope. By default, Devise signs out all scopes.
|
236
|
+
# config.sign_out_all_scopes = true
|
237
|
+
|
238
|
+
# ==> Navigation configuration
|
239
|
+
# Lists the formats that should be treated as navigational. Formats like
|
240
|
+
# :html, should redirect to the sign in page when the user does not have
|
241
|
+
# access, but formats like :xml or :json, should return 401.
|
242
|
+
#
|
243
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
244
|
+
# should add them to the navigational formats lists.
|
245
|
+
#
|
246
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
247
|
+
# config.navigational_formats = ['*/*', :html]
|
248
|
+
|
249
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
250
|
+
config.sign_out_via = :delete
|
251
|
+
|
252
|
+
# ==> OmniAuth
|
253
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
254
|
+
# up on your models and hooks.
|
255
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
256
|
+
|
257
|
+
# ==> Warden configuration
|
258
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
259
|
+
# change the failure app, you can configure them inside the config.warden block.
|
260
|
+
#
|
261
|
+
# config.warden do |manager|
|
262
|
+
# manager.intercept_401 = false
|
263
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
264
|
+
# end
|
265
|
+
|
266
|
+
# ==> Mountable engine configurations
|
267
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
268
|
+
# is mountable, there are some extra configurations to be taken into account.
|
269
|
+
# The following options are available, assuming the engine is mounted as:
|
270
|
+
#
|
271
|
+
# mount MyEngine, at: '/my_engine'
|
272
|
+
#
|
273
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
274
|
+
config.router_name = :dq_admin
|
275
|
+
#
|
276
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
277
|
+
# so you need to do it manually. For the users scope, it would be:
|
278
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
279
|
+
|
280
|
+
|
281
|
+
config.parent_controller = 'DqAdmin::ApplicationController'
|
282
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
DqAdmin::User.populate
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
devise:
|
5
|
+
confirmations:
|
6
|
+
confirmed: "Your email address has been successfully confirmed."
|
7
|
+
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
8
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
9
|
+
failure:
|
10
|
+
already_authenticated: "You are already signed in."
|
11
|
+
inactive: "Your account is not activated yet."
|
12
|
+
invalid: "Invalid %{authentication_keys} or password."
|
13
|
+
locked: "Your account is locked."
|
14
|
+
last_attempt: "You have one more attempt before your account is locked."
|
15
|
+
not_found_in_database: "Invalid %{authentication_keys} or password."
|
16
|
+
timeout: "Your session expired. Please sign in again to continue."
|
17
|
+
unauthenticated: "You need to sign in or sign up before continuing."
|
18
|
+
unconfirmed: "You have to confirm your email address before continuing."
|
19
|
+
mailer:
|
20
|
+
confirmation_instructions:
|
21
|
+
subject: "Confirmation instructions"
|
22
|
+
reset_password_instructions:
|
23
|
+
subject: "Reset password instructions"
|
24
|
+
unlock_instructions:
|
25
|
+
subject: "Unlock instructions"
|
26
|
+
email_changed:
|
27
|
+
subject: "Email Changed"
|
28
|
+
password_change:
|
29
|
+
subject: "Password Changed"
|
30
|
+
omniauth_callbacks:
|
31
|
+
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
32
|
+
success: "Successfully authenticated from %{kind} account."
|
33
|
+
passwords:
|
34
|
+
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
35
|
+
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
36
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
37
|
+
updated: "Your password has been changed successfully. You are now signed in."
|
38
|
+
updated_not_active: "Your password has been changed successfully."
|
39
|
+
registrations:
|
40
|
+
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
41
|
+
signed_up: "Welcome! You have signed up successfully."
|
42
|
+
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
43
|
+
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
44
|
+
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
45
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
|
46
|
+
updated: "Your account has been updated successfully."
|
47
|
+
sessions:
|
48
|
+
signed_in: "Signed in successfully."
|
49
|
+
signed_out: "Signed out successfully."
|
50
|
+
already_signed_out: "Signed out successfully."
|
51
|
+
unlocks:
|
52
|
+
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
53
|
+
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
54
|
+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
55
|
+
errors:
|
56
|
+
messages:
|
57
|
+
already_confirmed: "was already confirmed, please try signing in"
|
58
|
+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
59
|
+
expired: "has expired, please request a new one"
|
60
|
+
not_found: "not found"
|
61
|
+
not_locked: "was not locked"
|
62
|
+
not_saved:
|
63
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
64
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
DqAdmin::Engine.routes.draw do
|
2
|
+
|
3
|
+
root 'dashboard#index'
|
4
|
+
|
5
|
+
devise_for :users, class_name: "DqAdmin::User", path: '', module: :devise
|
6
|
+
|
7
|
+
resources :fields
|
8
|
+
resources :settings
|
9
|
+
resources :users
|
10
|
+
resources :products
|
11
|
+
resources :slides
|
12
|
+
resources :articles
|
13
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DeviseCreateDqAdminUsers < ActiveRecord::Migration[5.1]
|
4
|
+
def change
|
5
|
+
create_table :dq_admin_users do |t|
|
6
|
+
## Database authenticatable
|
7
|
+
t.string :email, null: false, default: ""
|
8
|
+
t.string :encrypted_password, null: false, default: ""
|
9
|
+
|
10
|
+
## Recoverable
|
11
|
+
t.string :reset_password_token
|
12
|
+
t.datetime :reset_password_sent_at
|
13
|
+
|
14
|
+
## Rememberable
|
15
|
+
t.datetime :remember_created_at
|
16
|
+
|
17
|
+
## Trackable
|
18
|
+
t.integer :sign_in_count, default: 0, null: false
|
19
|
+
t.datetime :current_sign_in_at
|
20
|
+
t.datetime :last_sign_in_at
|
21
|
+
t.string :current_sign_in_ip
|
22
|
+
t.string :last_sign_in_ip
|
23
|
+
|
24
|
+
## Confirmable
|
25
|
+
# t.string :confirmation_token
|
26
|
+
# t.datetime :confirmed_at
|
27
|
+
# t.datetime :confirmation_sent_at
|
28
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
29
|
+
|
30
|
+
## Lockable
|
31
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
32
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
33
|
+
# t.datetime :locked_at
|
34
|
+
|
35
|
+
|
36
|
+
t.timestamps null: false
|
37
|
+
end
|
38
|
+
|
39
|
+
add_index :dq_admin_users, :email, unique: true
|
40
|
+
add_index :dq_admin_users, :reset_password_token, unique: true
|
41
|
+
# add_index :dq_admin_users, :confirmation_token, unique: true
|
42
|
+
# add_index :dq_admin_users, :unlock_token, unique: true
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateDqAdminFields < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :dq_admin_fields do |t|
|
4
|
+
t.string :key
|
5
|
+
t.text :config
|
6
|
+
t.string :group
|
7
|
+
t.string :lang
|
8
|
+
t.text :data
|
9
|
+
t.string :html_type
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/dq_admin.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "dq_admin/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "dq_admin"
|
9
|
+
s.version = DqAdmin::VERSION
|
10
|
+
s.authors = ["vincent178"]
|
11
|
+
s.email = ["vh7157@gmail.com"]
|
12
|
+
s.homepage = "https://github.com/vincent178/dq_admin"
|
13
|
+
s.summary = "Admin project"
|
14
|
+
s.description = "Admin project"
|
15
|
+
s.license = "MIT"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.required_ruby_version = '>= 2.1.0'
|
21
|
+
|
22
|
+
s.add_dependency "rails", "> 5.0.0"
|
23
|
+
|
24
|
+
s.add_development_dependency "sqlite3"
|
25
|
+
s.add_development_dependency 'pry'
|
26
|
+
s.add_development_dependency 'pry-nav'
|
27
|
+
|
28
|
+
s.add_dependency "jquery-rails"
|
29
|
+
s.add_dependency 'devise'
|
30
|
+
s.add_dependency 'carrierwave'
|
31
|
+
s.add_dependency 'autoprefixer-rails'
|
32
|
+
s.add_dependency 'kaminari'
|
33
|
+
end
|
data/lib/dq_admin.rb
ADDED