dq_admin 0.1.0
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 +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
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 11657cb5d0e1eff1c8536defcd82c25fc1df767e
|
|
4
|
+
data.tar.gz: 7c8071c84c063e370e07538ee344b1ee19241a04
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b8c0c60c3907adfca9176ca859d4d1d07267d166912bb1483fb86aeed743098cb825c699ec9783344d4d682aee5b8a499f7f82f825649f96360e7500270a5abf
|
|
7
|
+
data.tar.gz: 6b2203d6217872097022a9d4067aa1690e1b694459b0aa2d88b8d2ebe3ca4fec76a8fa1de766d0b2f01345522e682eed7f947e27b434a29ceb76dcad977bb5f2
|
data/.gitignore
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.bundle/
|
|
2
|
+
log/*.log
|
|
3
|
+
pkg/
|
|
4
|
+
test/dummy/db/*.sqlite3
|
|
5
|
+
test/dummy/db/*.sqlite3-journal
|
|
6
|
+
test/dummy/log/*.log
|
|
7
|
+
test/dummy/tmp/
|
|
8
|
+
*.rbc
|
|
9
|
+
|
|
10
|
+
capybara-*.html
|
|
11
|
+
.rspec
|
|
12
|
+
/log
|
|
13
|
+
/tmp
|
|
14
|
+
/db/*.sqlite3
|
|
15
|
+
/db/*.sqlite3-journal
|
|
16
|
+
/public/system
|
|
17
|
+
/coverage/
|
|
18
|
+
/spec/tmp
|
|
19
|
+
*.orig
|
|
20
|
+
rerun.txt
|
|
21
|
+
pickle-email-*.html
|
|
22
|
+
|
|
23
|
+
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
|
|
24
|
+
config/initializers/secret_token.rb
|
|
25
|
+
|
|
26
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
|
27
|
+
# config/secrets.yml
|
|
28
|
+
|
|
29
|
+
# dotenv
|
|
30
|
+
# TODO Comment out this rule if environment variables can be committed
|
|
31
|
+
.env
|
|
32
|
+
|
|
33
|
+
## Environment normalization:
|
|
34
|
+
/.bundle
|
|
35
|
+
/vendor/bundle
|
|
36
|
+
|
|
37
|
+
# these should all be checked in to normalize the environment:
|
|
38
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
|
39
|
+
|
|
40
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
41
|
+
.rvmrc
|
|
42
|
+
|
|
43
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
|
44
|
+
/vendor/assets/bower_components
|
|
45
|
+
*.bowerrc
|
|
46
|
+
bower.json
|
|
47
|
+
|
|
48
|
+
# Ignore pow environment settings
|
|
49
|
+
.powenv
|
|
50
|
+
|
|
51
|
+
# Ignore Byebug command history file.
|
|
52
|
+
.byebug_history
|
data/Gemfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Declare your gem's dependencies in dq_admin.gemspec.
|
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
|
5
|
+
# development dependencies will be added by default to the :development group.
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
|
11
|
+
# your gem to rubygems.org.
|
|
12
|
+
|
|
13
|
+
# To use a debugger
|
|
14
|
+
# gem 'byebug', group: [:development, :test]
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
dq_admin (0.1.0)
|
|
5
|
+
autoprefixer-rails
|
|
6
|
+
carrierwave
|
|
7
|
+
devise
|
|
8
|
+
jquery-rails
|
|
9
|
+
kaminari
|
|
10
|
+
rails (> 5.0.0)
|
|
11
|
+
|
|
12
|
+
GEM
|
|
13
|
+
remote: https://rubygems.org/
|
|
14
|
+
specs:
|
|
15
|
+
actioncable (5.1.5)
|
|
16
|
+
actionpack (= 5.1.5)
|
|
17
|
+
nio4r (~> 2.0)
|
|
18
|
+
websocket-driver (~> 0.6.1)
|
|
19
|
+
actionmailer (5.1.5)
|
|
20
|
+
actionpack (= 5.1.5)
|
|
21
|
+
actionview (= 5.1.5)
|
|
22
|
+
activejob (= 5.1.5)
|
|
23
|
+
mail (~> 2.5, >= 2.5.4)
|
|
24
|
+
rails-dom-testing (~> 2.0)
|
|
25
|
+
actionpack (5.1.5)
|
|
26
|
+
actionview (= 5.1.5)
|
|
27
|
+
activesupport (= 5.1.5)
|
|
28
|
+
rack (~> 2.0)
|
|
29
|
+
rack-test (>= 0.6.3)
|
|
30
|
+
rails-dom-testing (~> 2.0)
|
|
31
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
32
|
+
actionview (5.1.5)
|
|
33
|
+
activesupport (= 5.1.5)
|
|
34
|
+
builder (~> 3.1)
|
|
35
|
+
erubi (~> 1.4)
|
|
36
|
+
rails-dom-testing (~> 2.0)
|
|
37
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
38
|
+
activejob (5.1.5)
|
|
39
|
+
activesupport (= 5.1.5)
|
|
40
|
+
globalid (>= 0.3.6)
|
|
41
|
+
activemodel (5.1.5)
|
|
42
|
+
activesupport (= 5.1.5)
|
|
43
|
+
activerecord (5.1.5)
|
|
44
|
+
activemodel (= 5.1.5)
|
|
45
|
+
activesupport (= 5.1.5)
|
|
46
|
+
arel (~> 8.0)
|
|
47
|
+
activesupport (5.1.5)
|
|
48
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
49
|
+
i18n (~> 0.7)
|
|
50
|
+
minitest (~> 5.1)
|
|
51
|
+
tzinfo (~> 1.1)
|
|
52
|
+
arel (8.0.0)
|
|
53
|
+
autoprefixer-rails (8.1.0.1)
|
|
54
|
+
execjs
|
|
55
|
+
bcrypt (3.1.11)
|
|
56
|
+
builder (3.2.3)
|
|
57
|
+
carrierwave (1.2.2)
|
|
58
|
+
activemodel (>= 4.0.0)
|
|
59
|
+
activesupport (>= 4.0.0)
|
|
60
|
+
mime-types (>= 1.16)
|
|
61
|
+
coderay (1.1.2)
|
|
62
|
+
concurrent-ruby (1.0.5)
|
|
63
|
+
crass (1.0.3)
|
|
64
|
+
devise (4.4.3)
|
|
65
|
+
bcrypt (~> 3.0)
|
|
66
|
+
orm_adapter (~> 0.1)
|
|
67
|
+
railties (>= 4.1.0, < 6.0)
|
|
68
|
+
responders
|
|
69
|
+
warden (~> 1.2.3)
|
|
70
|
+
erubi (1.7.1)
|
|
71
|
+
execjs (2.7.0)
|
|
72
|
+
globalid (0.4.1)
|
|
73
|
+
activesupport (>= 4.2.0)
|
|
74
|
+
i18n (0.9.5)
|
|
75
|
+
concurrent-ruby (~> 1.0)
|
|
76
|
+
jquery-rails (4.3.1)
|
|
77
|
+
rails-dom-testing (>= 1, < 3)
|
|
78
|
+
railties (>= 4.2.0)
|
|
79
|
+
thor (>= 0.14, < 2.0)
|
|
80
|
+
kaminari (1.1.1)
|
|
81
|
+
activesupport (>= 4.1.0)
|
|
82
|
+
kaminari-actionview (= 1.1.1)
|
|
83
|
+
kaminari-activerecord (= 1.1.1)
|
|
84
|
+
kaminari-core (= 1.1.1)
|
|
85
|
+
kaminari-actionview (1.1.1)
|
|
86
|
+
actionview
|
|
87
|
+
kaminari-core (= 1.1.1)
|
|
88
|
+
kaminari-activerecord (1.1.1)
|
|
89
|
+
activerecord
|
|
90
|
+
kaminari-core (= 1.1.1)
|
|
91
|
+
kaminari-core (1.1.1)
|
|
92
|
+
loofah (2.2.0)
|
|
93
|
+
crass (~> 1.0.2)
|
|
94
|
+
nokogiri (>= 1.5.9)
|
|
95
|
+
mail (2.7.0)
|
|
96
|
+
mini_mime (>= 0.1.1)
|
|
97
|
+
method_source (0.8.2)
|
|
98
|
+
mime-types (3.1)
|
|
99
|
+
mime-types-data (~> 3.2015)
|
|
100
|
+
mime-types-data (3.2016.0521)
|
|
101
|
+
mini_mime (1.0.0)
|
|
102
|
+
mini_portile2 (2.3.0)
|
|
103
|
+
minitest (5.11.3)
|
|
104
|
+
nio4r (2.3.0)
|
|
105
|
+
nokogiri (1.8.2)
|
|
106
|
+
mini_portile2 (~> 2.3.0)
|
|
107
|
+
orm_adapter (0.5.0)
|
|
108
|
+
pry (0.10.4)
|
|
109
|
+
coderay (~> 1.1.0)
|
|
110
|
+
method_source (~> 0.8.1)
|
|
111
|
+
slop (~> 3.4)
|
|
112
|
+
pry-nav (0.2.4)
|
|
113
|
+
pry (>= 0.9.10, < 0.11.0)
|
|
114
|
+
rack (2.0.4)
|
|
115
|
+
rack-test (0.8.3)
|
|
116
|
+
rack (>= 1.0, < 3)
|
|
117
|
+
rails (5.1.5)
|
|
118
|
+
actioncable (= 5.1.5)
|
|
119
|
+
actionmailer (= 5.1.5)
|
|
120
|
+
actionpack (= 5.1.5)
|
|
121
|
+
actionview (= 5.1.5)
|
|
122
|
+
activejob (= 5.1.5)
|
|
123
|
+
activemodel (= 5.1.5)
|
|
124
|
+
activerecord (= 5.1.5)
|
|
125
|
+
activesupport (= 5.1.5)
|
|
126
|
+
bundler (>= 1.3.0)
|
|
127
|
+
railties (= 5.1.5)
|
|
128
|
+
sprockets-rails (>= 2.0.0)
|
|
129
|
+
rails-dom-testing (2.0.3)
|
|
130
|
+
activesupport (>= 4.2.0)
|
|
131
|
+
nokogiri (>= 1.6)
|
|
132
|
+
rails-html-sanitizer (1.0.3)
|
|
133
|
+
loofah (~> 2.0)
|
|
134
|
+
railties (5.1.5)
|
|
135
|
+
actionpack (= 5.1.5)
|
|
136
|
+
activesupport (= 5.1.5)
|
|
137
|
+
method_source
|
|
138
|
+
rake (>= 0.8.7)
|
|
139
|
+
thor (>= 0.18.1, < 2.0)
|
|
140
|
+
rake (12.3.0)
|
|
141
|
+
responders (2.4.0)
|
|
142
|
+
actionpack (>= 4.2.0, < 5.3)
|
|
143
|
+
railties (>= 4.2.0, < 5.3)
|
|
144
|
+
slop (3.6.0)
|
|
145
|
+
sprockets (3.7.1)
|
|
146
|
+
concurrent-ruby (~> 1.0)
|
|
147
|
+
rack (> 1, < 3)
|
|
148
|
+
sprockets-rails (3.2.1)
|
|
149
|
+
actionpack (>= 4.0)
|
|
150
|
+
activesupport (>= 4.0)
|
|
151
|
+
sprockets (>= 3.0.0)
|
|
152
|
+
sqlite3 (1.3.13)
|
|
153
|
+
thor (0.20.0)
|
|
154
|
+
thread_safe (0.3.6)
|
|
155
|
+
tzinfo (1.2.5)
|
|
156
|
+
thread_safe (~> 0.1)
|
|
157
|
+
warden (1.2.7)
|
|
158
|
+
rack (>= 1.0)
|
|
159
|
+
websocket-driver (0.6.5)
|
|
160
|
+
websocket-extensions (>= 0.1.0)
|
|
161
|
+
websocket-extensions (0.1.3)
|
|
162
|
+
|
|
163
|
+
PLATFORMS
|
|
164
|
+
ruby
|
|
165
|
+
|
|
166
|
+
DEPENDENCIES
|
|
167
|
+
dq_admin!
|
|
168
|
+
pry
|
|
169
|
+
pry-nav
|
|
170
|
+
sqlite3
|
|
171
|
+
|
|
172
|
+
BUNDLED WITH
|
|
173
|
+
1.16.1
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2018 vincent178
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# DqAdmin
|
|
2
|
+
Short description and motivation.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
How to use my plugin.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'dq_admin'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
```bash
|
|
21
|
+
$ gem install dq_admin
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Contributing
|
|
25
|
+
Contribution directions go here.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require 'rdoc/task'
|
|
8
|
+
|
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
+
rdoc.title = 'DqAdmin'
|
|
12
|
+
rdoc.options << '--line-numbers'
|
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
18
|
+
load 'rails/tasks/engine.rake'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
load 'rails/tasks/statistics.rake'
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
require 'bundler/gem_tasks'
|
|
26
|
+
|
|
27
|
+
require 'rake/testtask'
|
|
28
|
+
|
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
|
30
|
+
t.libs << 'test'
|
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
|
32
|
+
t.verbose = false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
task default: :test
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery_ujs
|
|
14
|
+
//= require_tree .
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
.content-header {
|
|
18
|
+
padding: 15px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.content-action {
|
|
22
|
+
padding-top: 10px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
.flex-center {
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.list-actions a {
|
|
33
|
+
flex: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.box {
|
|
37
|
+
padding-bottom: 1px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.list-body {
|
|
41
|
+
margin-bottom: 70px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.list-nav {
|
|
45
|
+
position: absolute;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
right: 20px;
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module DqAdmin
|
|
2
|
+
class ApplicationController < ActionController::Base
|
|
3
|
+
protect_from_forgery with: :exception
|
|
4
|
+
|
|
5
|
+
before_action :require_admin
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def require_admin
|
|
10
|
+
return if params['controller'] =~ /^devise\//
|
|
11
|
+
return if user_signed_in?
|
|
12
|
+
not_found
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def not_found
|
|
16
|
+
raise ActionController::RoutingError.new('Not Found')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require_dependency "dq_admin/application_controller"
|
|
2
|
+
|
|
3
|
+
module DqAdmin
|
|
4
|
+
class ProductsController < ApplicationController
|
|
5
|
+
|
|
6
|
+
def index
|
|
7
|
+
@products = Product.page(params[:page])
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def edit
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def update
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def destroy
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def required_params
|
|
28
|
+
params.require(:products).permit()
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require_dependency "dq_admin/application_controller"
|
|
2
|
+
|
|
3
|
+
module DqAdmin
|
|
4
|
+
class UsersController < ApplicationController
|
|
5
|
+
|
|
6
|
+
before_action :find_user, only: [:update, :edit, :destroy]
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
@users = User.page(params[:page])
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create
|
|
13
|
+
user = User.create(permit_params)
|
|
14
|
+
|
|
15
|
+
if user.errors.any?
|
|
16
|
+
flash[:error] = user.errors
|
|
17
|
+
else
|
|
18
|
+
redirect_to action: :index
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def new
|
|
23
|
+
@user = User.new
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update
|
|
27
|
+
@user.update(permit_params.reject {|key, value| value.blank?})
|
|
28
|
+
|
|
29
|
+
if @user.errors.any?
|
|
30
|
+
flash[:error] = @user.errors
|
|
31
|
+
else
|
|
32
|
+
redirect_to action: :index
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def edit
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def destroy
|
|
40
|
+
@user.destroy
|
|
41
|
+
if @user.errors.any?
|
|
42
|
+
flash[:error] = @user.errors
|
|
43
|
+
else
|
|
44
|
+
redirect_to action: :index
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def find_user
|
|
51
|
+
@user = User.find(params[:id])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def permit_params
|
|
55
|
+
params.require(:users).permit(:email, :username, :password, :password_confirmation)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|