dq_admin 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -13
- data/app/controllers/dq_admin/application_controller.rb +6 -1
- data/app/controllers/dq_admin/sessions_controller.rb +29 -0
- data/app/helpers/dq_admin/application_helper.rb +0 -8
- data/app/views/sessions/new.html.erb +35 -0
- data/app/views/shared/_links.html.erb +25 -0
- data/config/routes.rb +1 -1
- data/lib/dq_admin/version.rb +1 -1
- data/lib/dq_admin.rb +0 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 568b209285749f60aaa20fb2b11f540fefd3c6a7
|
4
|
+
data.tar.gz: 5348e12e488305008e96eef16ed78a1d9ea3ebfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba15206f3cf4cf1a268c4021d84e0891587e24217e215e8c8f1371d0be425770a6b1c23fae26432e2a5215bb3794d28f659bc7209381826b3192f024743bafb
|
7
|
+
data.tar.gz: bef63cc5e08cfd180b70594df784fcee10df75fa143987441038058026db789fda9fd17d31675e51266639ed333fa72346d271c2973e85a57e1779b996ec309c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -11,21 +11,11 @@ Add this line to your application's Gemfile:
|
|
11
11
|
```ruby
|
12
12
|
gem 'dq_admin'
|
13
13
|
rails dq_admin:install:migrations
|
14
|
+
rails db:migrate
|
14
15
|
```
|
15
16
|
|
16
|
-
|
17
|
-
```bash
|
18
|
-
$ bundle
|
17
|
+
if view path is not correct, add below to your config/application.rb file
|
19
18
|
```
|
20
|
-
|
21
|
-
Or install it yourself as:
|
22
|
-
```bash
|
23
|
-
$ gem install dq_admin
|
19
|
+
config.railties_order = [DqAdmin::Engine, :main_app, :all]
|
24
20
|
```
|
25
21
|
|
26
|
-
## Contributing
|
27
|
-
Contribution directions go here.
|
28
|
-
|
29
|
-
## License
|
30
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
31
|
-
|
@@ -7,11 +7,16 @@ module DqAdmin
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def require_admin
|
10
|
-
return if
|
10
|
+
return if is_devise_page?
|
11
11
|
return if user_signed_in?
|
12
12
|
not_found
|
13
13
|
end
|
14
14
|
|
15
|
+
helper_method :is_devise_page?
|
16
|
+
def is_devise_page?
|
17
|
+
params['controller'] =~ /[sessions|passwords]/
|
18
|
+
end
|
19
|
+
|
15
20
|
def not_found
|
16
21
|
raise ActionController::RoutingError.new('Not Found')
|
17
22
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DqAdmin
|
4
|
+
class SessionsController < ::Devise::SessionsController
|
5
|
+
# before_action :configure_sign_in_params, only: [:create]
|
6
|
+
|
7
|
+
# GET /resource/sign_in
|
8
|
+
# def new
|
9
|
+
# super
|
10
|
+
# end
|
11
|
+
|
12
|
+
# POST /resource/sign_in
|
13
|
+
# def create
|
14
|
+
# super
|
15
|
+
# end
|
16
|
+
|
17
|
+
# DELETE /resource/sign_out
|
18
|
+
# def destroy
|
19
|
+
# super
|
20
|
+
# end
|
21
|
+
|
22
|
+
# protected
|
23
|
+
|
24
|
+
# If you have extra params to permit, append them to the sanitizer.
|
25
|
+
# def configure_sign_in_params
|
26
|
+
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
|
27
|
+
# end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<div class="login-box">
|
2
|
+
<div class="login-logo">
|
3
|
+
<a href="/">Admin</a>
|
4
|
+
</div>
|
5
|
+
<div class="login-box-body">
|
6
|
+
<p class="login-box-msg">Sign in to start your session</p>
|
7
|
+
|
8
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
9
|
+
|
10
|
+
<div class="form-group has-feedback">
|
11
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
|
12
|
+
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="form-group has-feedback">
|
16
|
+
<%= f.password_field :password, autocomplete: "off", class: "form-control" %>
|
17
|
+
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<% if devise_mapping.rememberable? -%>
|
21
|
+
<div class="form-group has-feedback">
|
22
|
+
<%= f.check_box :remember_me %>
|
23
|
+
<%= f.label :remember_me, style: "font-weight: normal;" %>
|
24
|
+
</div>
|
25
|
+
<% end -%>
|
26
|
+
|
27
|
+
<div class="row">
|
28
|
+
<div class="col-xs-4">
|
29
|
+
<%= f.submit "Sign in", class: "btn btn-primary btn-block btn-flat" %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
3
|
+
<% end -%>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
+
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
10
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
19
|
+
<% end -%>
|
20
|
+
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
+
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
|
24
|
+
<% end -%>
|
25
|
+
<% end -%>
|
data/config/routes.rb
CHANGED
data/lib/dq_admin/version.rb
CHANGED
data/lib/dq_admin.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dq_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vincent178
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- app/controllers/dq_admin/dashboard_controller.rb
|
166
166
|
- app/controllers/dq_admin/fields_controller.rb
|
167
167
|
- app/controllers/dq_admin/products_controller.rb
|
168
|
+
- app/controllers/dq_admin/sessions_controller.rb
|
168
169
|
- app/controllers/dq_admin/users_controller.rb
|
169
170
|
- app/helpers/dq_admin/application_helper.rb
|
170
171
|
- app/helpers/dq_admin/dashboard_helper.rb
|
@@ -211,6 +212,8 @@ files:
|
|
211
212
|
- app/views/kaminari/_paginator.html.erb
|
212
213
|
- app/views/kaminari/_prev_page.html.erb
|
213
214
|
- app/views/layouts/dq_admin/application.html.erb
|
215
|
+
- app/views/sessions/new.html.erb
|
216
|
+
- app/views/shared/_links.html.erb
|
214
217
|
- bin/rails
|
215
218
|
- config/initializers/devise.rb
|
216
219
|
- config/initializers/user.rb
|