administrate-base_controller 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 +12 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/administrate-base_controller.iml +70 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.travis.yml +17 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +185 -0
- data/LICENSE.txt +21 -0
- data/README.md +182 -0
- data/Rakefile +10 -0
- data/administrate-base_controller.gemspec +43 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/administrate/base_controller.rb +96 -0
- data/lib/administrate/base_controller/version.rb +5 -0
- metadata +157 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: eca080c0f857f4c489166accd82cefb2f493ab27aab1fbdd29bee92832304ecf
|
|
4
|
+
data.tar.gz: f0592dea0fd246d7dd1c7566d63d992204f53874da4d364b3db62a1f6f9f4697
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3834f08d5635719eca35adf9fbbfde49ac638f137d00700efb6f1d1cbe60ec3fec0e6ab397241183cf63ada77030b4ed5beb14002708ede4d4853564ef96949b
|
|
7
|
+
data.tar.gz: '0299aca439ef265fb034c4afe637ffbff8b124c8c0158318465651e8696ebf7c4007a4f93b66d5447bb5e296c1696817cbe408b761b70b92e227ccd1a61c1a7f'
|
data/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build authorized_transaction-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install authorized_transaction-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install authorized_transaction-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push authorized_transaction-0.1.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<shared />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="NewModuleRootManager">
|
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
|
8
|
+
<orderEntry type="jdk" jdkName="ruby-2.5.3-p105" jdkType="RUBY_SDK" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="actioncable (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="actionpack (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="actionview (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="activejob (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="activestorage (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="administrate (v0.11.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="arel (v9.0.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="autoprefixer-rails (v9.4.10.2, ruby-2.5.3-p105) [gem]" level="application" />
|
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.5, ruby-2.5.3-p105) [gem]" level="application" />
|
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="crass (v1.0.4, ruby-2.5.3-p105) [gem]" level="application" />
|
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="datetime_picker_rails (v0.0.7, ruby-2.5.3-p105) [gem]" level="application" />
|
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.8.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="execjs (v2.7.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.10.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="globalid (v0.4.2, ruby-2.5.3-p105) [gem]" level="application" />
|
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.6.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="jquery-rails (v4.3.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari (v1.1.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari-actionview (v1.1.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari-activerecord (v1.1.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari-core (v1.1.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.2.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="mail (v2.7.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="marcel (v0.3.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.2, ruby-2.5.3-p105) [gem]" level="application" />
|
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="mimemagic (v0.3.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.0.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.4.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="momentjs-rails (v2.20.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="nio4r (v2.3.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.10.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="rack (v2.0.6, ruby-2.5.3-p105) [gem]" level="application" />
|
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="rack-test (v1.1.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="rails (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.0.4, ruby-2.5.3-p105) [gem]" level="application" />
|
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="railties (v5.2.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.10.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.10.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
57
|
+
<orderEntry type="library" scope="PROVIDED" name="sass (v3.7.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
58
|
+
<orderEntry type="library" scope="PROVIDED" name="sass-listen (v4.0.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
59
|
+
<orderEntry type="library" scope="PROVIDED" name="sass-rails (v5.0.7, ruby-2.5.3-p105) [gem]" level="application" />
|
|
60
|
+
<orderEntry type="library" scope="PROVIDED" name="selectize-rails (v0.12.6, ruby-2.5.3-p105) [gem]" level="application" />
|
|
61
|
+
<orderEntry type="library" scope="PROVIDED" name="sprockets (v3.7.2, ruby-2.5.3-p105) [gem]" level="application" />
|
|
62
|
+
<orderEntry type="library" scope="PROVIDED" name="sprockets-rails (v3.2.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
63
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v0.20.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
64
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, ruby-2.5.3-p105) [gem]" level="application" />
|
|
65
|
+
<orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.9, ruby-2.5.3-p105) [gem]" level="application" />
|
|
66
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, ruby-2.5.3-p105) [gem]" level="application" />
|
|
67
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
68
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
69
|
+
</component>
|
|
70
|
+
</module>
|
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JavaScriptSettings">
|
|
4
|
+
<option name="languageLevel" value="ES6" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.4.4-p296" project-jdk-type="RUBY_SDK" />
|
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/administrate-base_controller.iml" filepath="$PROJECT_DIR$/.idea/administrate-base_controller.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
sudo: false
|
|
3
|
+
language: ruby
|
|
4
|
+
cache: bundler
|
|
5
|
+
rvm:
|
|
6
|
+
- 2.5
|
|
7
|
+
- 2.6
|
|
8
|
+
- ruby-head
|
|
9
|
+
before_install:
|
|
10
|
+
- gem install bundler -v 2.0.1
|
|
11
|
+
- gem update --system
|
|
12
|
+
- gem --version
|
|
13
|
+
matrix:
|
|
14
|
+
allow_failures:
|
|
15
|
+
- rvm: ruby-head
|
|
16
|
+
install:
|
|
17
|
+
- bundle install --with development --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at derk-jan+github@karrenbeld.info. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
administrate-base_controller (0.1.0)
|
|
5
|
+
activesupport
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
actioncable (5.2.2.1)
|
|
11
|
+
actionpack (= 5.2.2.1)
|
|
12
|
+
nio4r (~> 2.0)
|
|
13
|
+
websocket-driver (>= 0.6.1)
|
|
14
|
+
actionmailer (5.2.2.1)
|
|
15
|
+
actionpack (= 5.2.2.1)
|
|
16
|
+
actionview (= 5.2.2.1)
|
|
17
|
+
activejob (= 5.2.2.1)
|
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
|
19
|
+
rails-dom-testing (~> 2.0)
|
|
20
|
+
actionpack (5.2.2.1)
|
|
21
|
+
actionview (= 5.2.2.1)
|
|
22
|
+
activesupport (= 5.2.2.1)
|
|
23
|
+
rack (~> 2.0)
|
|
24
|
+
rack-test (>= 0.6.3)
|
|
25
|
+
rails-dom-testing (~> 2.0)
|
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
27
|
+
actionview (5.2.2.1)
|
|
28
|
+
activesupport (= 5.2.2.1)
|
|
29
|
+
builder (~> 3.1)
|
|
30
|
+
erubi (~> 1.4)
|
|
31
|
+
rails-dom-testing (~> 2.0)
|
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
33
|
+
activejob (5.2.2.1)
|
|
34
|
+
activesupport (= 5.2.2.1)
|
|
35
|
+
globalid (>= 0.3.6)
|
|
36
|
+
activemodel (5.2.2.1)
|
|
37
|
+
activesupport (= 5.2.2.1)
|
|
38
|
+
activerecord (5.2.2.1)
|
|
39
|
+
activemodel (= 5.2.2.1)
|
|
40
|
+
activesupport (= 5.2.2.1)
|
|
41
|
+
arel (>= 9.0)
|
|
42
|
+
activestorage (5.2.2.1)
|
|
43
|
+
actionpack (= 5.2.2.1)
|
|
44
|
+
activerecord (= 5.2.2.1)
|
|
45
|
+
marcel (~> 0.3.1)
|
|
46
|
+
activesupport (5.2.2.1)
|
|
47
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
48
|
+
i18n (>= 0.7, < 2)
|
|
49
|
+
minitest (~> 5.1)
|
|
50
|
+
tzinfo (~> 1.1)
|
|
51
|
+
administrate (0.11.0)
|
|
52
|
+
actionpack (>= 4.2, < 6.0)
|
|
53
|
+
actionview (>= 4.2, < 6.0)
|
|
54
|
+
activerecord (>= 4.2, < 6.0)
|
|
55
|
+
autoprefixer-rails (>= 6.0)
|
|
56
|
+
datetime_picker_rails (~> 0.0.7)
|
|
57
|
+
jquery-rails (>= 4.0)
|
|
58
|
+
kaminari (>= 1.0)
|
|
59
|
+
momentjs-rails (~> 2.8)
|
|
60
|
+
sass-rails (~> 5.0)
|
|
61
|
+
selectize-rails (~> 0.6)
|
|
62
|
+
arel (9.0.0)
|
|
63
|
+
autoprefixer-rails (9.4.10.2)
|
|
64
|
+
execjs
|
|
65
|
+
builder (3.2.3)
|
|
66
|
+
concurrent-ruby (1.1.5)
|
|
67
|
+
crass (1.0.4)
|
|
68
|
+
datetime_picker_rails (0.0.7)
|
|
69
|
+
momentjs-rails (>= 2.8.1)
|
|
70
|
+
erubi (1.8.0)
|
|
71
|
+
execjs (2.7.0)
|
|
72
|
+
ffi (1.10.0)
|
|
73
|
+
ffi (1.10.0-x64-mingw32)
|
|
74
|
+
globalid (0.4.2)
|
|
75
|
+
activesupport (>= 4.2.0)
|
|
76
|
+
i18n (1.6.0)
|
|
77
|
+
concurrent-ruby (~> 1.0)
|
|
78
|
+
jquery-rails (4.3.3)
|
|
79
|
+
rails-dom-testing (>= 1, < 3)
|
|
80
|
+
railties (>= 4.2.0)
|
|
81
|
+
thor (>= 0.14, < 2.0)
|
|
82
|
+
kaminari (1.1.1)
|
|
83
|
+
activesupport (>= 4.1.0)
|
|
84
|
+
kaminari-actionview (= 1.1.1)
|
|
85
|
+
kaminari-activerecord (= 1.1.1)
|
|
86
|
+
kaminari-core (= 1.1.1)
|
|
87
|
+
kaminari-actionview (1.1.1)
|
|
88
|
+
actionview
|
|
89
|
+
kaminari-core (= 1.1.1)
|
|
90
|
+
kaminari-activerecord (1.1.1)
|
|
91
|
+
activerecord
|
|
92
|
+
kaminari-core (= 1.1.1)
|
|
93
|
+
kaminari-core (1.1.1)
|
|
94
|
+
loofah (2.2.3)
|
|
95
|
+
crass (~> 1.0.2)
|
|
96
|
+
nokogiri (>= 1.5.9)
|
|
97
|
+
mail (2.7.1)
|
|
98
|
+
mini_mime (>= 0.1.1)
|
|
99
|
+
marcel (0.3.3)
|
|
100
|
+
mimemagic (~> 0.3.2)
|
|
101
|
+
method_source (0.9.2)
|
|
102
|
+
mimemagic (0.3.3)
|
|
103
|
+
mini_mime (1.0.1)
|
|
104
|
+
mini_portile2 (2.4.0)
|
|
105
|
+
minitest (5.11.3)
|
|
106
|
+
momentjs-rails (2.20.1)
|
|
107
|
+
railties (>= 3.1)
|
|
108
|
+
nio4r (2.3.1)
|
|
109
|
+
nokogiri (1.10.1)
|
|
110
|
+
mini_portile2 (~> 2.4.0)
|
|
111
|
+
nokogiri (1.10.1-x64-mingw32)
|
|
112
|
+
mini_portile2 (~> 2.4.0)
|
|
113
|
+
rack (2.0.6)
|
|
114
|
+
rack-test (1.1.0)
|
|
115
|
+
rack (>= 1.0, < 3)
|
|
116
|
+
rails (5.2.2.1)
|
|
117
|
+
actioncable (= 5.2.2.1)
|
|
118
|
+
actionmailer (= 5.2.2.1)
|
|
119
|
+
actionpack (= 5.2.2.1)
|
|
120
|
+
actionview (= 5.2.2.1)
|
|
121
|
+
activejob (= 5.2.2.1)
|
|
122
|
+
activemodel (= 5.2.2.1)
|
|
123
|
+
activerecord (= 5.2.2.1)
|
|
124
|
+
activestorage (= 5.2.2.1)
|
|
125
|
+
activesupport (= 5.2.2.1)
|
|
126
|
+
bundler (>= 1.3.0)
|
|
127
|
+
railties (= 5.2.2.1)
|
|
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.4)
|
|
133
|
+
loofah (~> 2.2, >= 2.2.2)
|
|
134
|
+
railties (5.2.2.1)
|
|
135
|
+
actionpack (= 5.2.2.1)
|
|
136
|
+
activesupport (= 5.2.2.1)
|
|
137
|
+
method_source
|
|
138
|
+
rake (>= 0.8.7)
|
|
139
|
+
thor (>= 0.19.0, < 2.0)
|
|
140
|
+
rake (10.5.0)
|
|
141
|
+
rb-fsevent (0.10.3)
|
|
142
|
+
rb-inotify (0.10.0)
|
|
143
|
+
ffi (~> 1.0)
|
|
144
|
+
sass (3.7.3)
|
|
145
|
+
sass-listen (~> 4.0.0)
|
|
146
|
+
sass-listen (4.0.0)
|
|
147
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
148
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
149
|
+
sass-rails (5.0.7)
|
|
150
|
+
railties (>= 4.0.0, < 6)
|
|
151
|
+
sass (~> 3.1)
|
|
152
|
+
sprockets (>= 2.8, < 4.0)
|
|
153
|
+
sprockets-rails (>= 2.0, < 4.0)
|
|
154
|
+
tilt (>= 1.1, < 3)
|
|
155
|
+
selectize-rails (0.12.6)
|
|
156
|
+
sprockets (3.7.2)
|
|
157
|
+
concurrent-ruby (~> 1.0)
|
|
158
|
+
rack (> 1, < 3)
|
|
159
|
+
sprockets-rails (3.2.1)
|
|
160
|
+
actionpack (>= 4.0)
|
|
161
|
+
activesupport (>= 4.0)
|
|
162
|
+
sprockets (>= 3.0.0)
|
|
163
|
+
thor (0.20.3)
|
|
164
|
+
thread_safe (0.3.6)
|
|
165
|
+
tilt (2.0.9)
|
|
166
|
+
tzinfo (1.2.5)
|
|
167
|
+
thread_safe (~> 0.1)
|
|
168
|
+
websocket-driver (0.7.0)
|
|
169
|
+
websocket-extensions (>= 0.1.0)
|
|
170
|
+
websocket-extensions (0.1.3)
|
|
171
|
+
|
|
172
|
+
PLATFORMS
|
|
173
|
+
ruby
|
|
174
|
+
x64-mingw32
|
|
175
|
+
|
|
176
|
+
DEPENDENCIES
|
|
177
|
+
administrate (>= 0.11.0, < 1)
|
|
178
|
+
administrate-base_controller!
|
|
179
|
+
bundler (~> 2.0)
|
|
180
|
+
minitest (~> 5.0)
|
|
181
|
+
rails
|
|
182
|
+
rake (~> 10.0)
|
|
183
|
+
|
|
184
|
+
BUNDLED WITH
|
|
185
|
+
2.0.1
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Derk-Jan Karrenbeld
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Administrate::BaseController
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.com/XPBytes/administrate-base_controller)
|
|
4
|
+
[](https://badge.fury.io/rb/administrate-base_controller)
|
|
5
|
+
[](http://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
Extends the `ApplicationController` in [Administrate](https://github.com/thoughtbot/administrate)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add this line to your application's Gemfile:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'administrate-base_controller'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
And then execute:
|
|
18
|
+
|
|
19
|
+
$ bundle
|
|
20
|
+
|
|
21
|
+
Or install it yourself as:
|
|
22
|
+
|
|
23
|
+
$ gem install administrate-base_controller
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
When you require this gem, the base controller functionality will be added to the `administrate/application_controller`.
|
|
28
|
+
|
|
29
|
+
You get the following _protected_ methods for free, which you may override:
|
|
30
|
+
|
|
31
|
+
| method | short | description |
|
|
32
|
+
|--------|-------|-------------|
|
|
33
|
+
| `search_term` | `params[:search]` | Allows you to assign custom behaviour for the `search_term` on `index` pages |
|
|
34
|
+
| `index_scoped_resource` | `scoped_resource` | Allows you to overwrite which resources are shown on `index` or passed to search |
|
|
35
|
+
| `index_resources` | `Administrate::Search` | Allows you to turn off search on `index`, by overwriting this |
|
|
36
|
+
| `index_page` | `Administrate::Page::Collection` | Allows you to overwrite the `index` page |
|
|
37
|
+
| `show_page` | `Administrate::Page::Show` | Allows you to overwrite the `show` page |
|
|
38
|
+
| `new_page` | `Administrate::Page::Form` | Allows you to overwrite the `new` page |
|
|
39
|
+
| `edit_page` | `new_page` | Allows you to overwrite the `edit` page |
|
|
40
|
+
| `edit_page` | `new_page` | Allows you to overwrite the `edit` page |
|
|
41
|
+
| `authorize_resource` | `show_action?(action_name.to_sym, resource)` | Allows you to change how resources are authorized |
|
|
42
|
+
| `resource_params` | Calls `read_param(k, v)` for each instead of `transform_values` | Allows you to change how params are read |
|
|
43
|
+
| `read_param` | Calls `read_param_value` if applicable | Allows you to change how a param is read based on its key |
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
module Admin
|
|
47
|
+
class ApplicationController < Administrate::ApplicationController
|
|
48
|
+
# everything is available now
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Integrate with CanCan(Can)
|
|
54
|
+
|
|
55
|
+
This automatically hides links if the `current_admin_user` does not have the ability to `action` the `resource`.
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
module Admin
|
|
59
|
+
class ApplicationController < Administrate::ApplicationController
|
|
60
|
+
def current_ability
|
|
61
|
+
@_current_ability ||= Ability.new(current_admin_user)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def show_action?(action, resource)
|
|
65
|
+
current_ability.can?(action.to_sym, resource)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Additionally you can correctly hide resources the `current_ability` can not `action`:
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
module Admin
|
|
75
|
+
class ApplicationController < Administrate::ApplicationController
|
|
76
|
+
|
|
77
|
+
# ...
|
|
78
|
+
|
|
79
|
+
def scoped_resource
|
|
80
|
+
super.accessible_by(current_ability, action_name.to_sym)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Integrate with FriendlyId
|
|
87
|
+
|
|
88
|
+
This works without this gem, but this gem allows you to changed `scoped_resource` and `index_scoped_resource` easily.
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
module Admin
|
|
92
|
+
class BookController < ::Admin::ApplicationController
|
|
93
|
+
def find_resource(param)
|
|
94
|
+
scoped_resource.friendly.find(param)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Only show subset of resources on index
|
|
101
|
+
|
|
102
|
+
You might want to scope the `index` to a current view (like stored in `Admin::Current.view`), but not `404` if the
|
|
103
|
+
resource is accessed directly:
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
module Admin
|
|
107
|
+
class BookController < ::Admin::ApplicationController
|
|
108
|
+
def index_scoped_resource
|
|
109
|
+
super.where(author: Current.author)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
This only shows the books with the `Current.author`, but if you access `/book/uuid`, it will find the book even if its
|
|
116
|
+
by a different author.
|
|
117
|
+
|
|
118
|
+
### Preset attributes on a new resource
|
|
119
|
+
|
|
120
|
+
You might want to preset certain attributes when creating a new resource. You can do so by overriding `new_resource`.
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
module Admin
|
|
124
|
+
class BookController < ::Admin::ApplicationController
|
|
125
|
+
def new_resource
|
|
126
|
+
resource_class.new(author: Current.author)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Deserialize attributes (e.g. JSON field)
|
|
133
|
+
|
|
134
|
+
If you want to deserialize an attribute's value before it's assigned to the resource, for example from a custom JSON
|
|
135
|
+
field, which contents have been serialized, you can overwrite `read_param`:
|
|
136
|
+
|
|
137
|
+
```ruby
|
|
138
|
+
module Admin
|
|
139
|
+
class BookController < ::Admin::ApplicationController
|
|
140
|
+
JSON_FIELDS = %w[options content].freeze
|
|
141
|
+
|
|
142
|
+
def read_param(key, value)
|
|
143
|
+
return Oj.load(value) if JSON_FIELDS.include?(String(key))
|
|
144
|
+
super(key, value)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Alternatively you can use the [`administrate-serialized_fields`](https://github.com/XPBytes/administrate-serialized_fields) gem.
|
|
151
|
+
|
|
152
|
+
## Related
|
|
153
|
+
|
|
154
|
+
- [`Administrate`](https://github.com/thoughtbot/administrate): A Rails engine that helps you put together a super-flexible admin dashboard.
|
|
155
|
+
<!-- - [`Administrate::BaseController`](https://github.com/XPBytes/administrate-base_controller): A set of application controller improvements. -->
|
|
156
|
+
|
|
157
|
+
### Concerns
|
|
158
|
+
|
|
159
|
+
- [`Administrate::DefaultOrder`](https://github.com/XPBytes/administrate-default_order): Sets the default order for a resource in a administrate controller.
|
|
160
|
+
- [`Administrate::SerializedFields`](https://github.com/XPBytes/administrate-serialized_fields): Automatically deserialize administrate fields on form submit.
|
|
161
|
+
|
|
162
|
+
### Fields
|
|
163
|
+
|
|
164
|
+
- [`Administrate::Field::Code`](https://github.com/XPBytes/administrate-field-code): A `text` field that shows code.
|
|
165
|
+
- [`Administrate::Field::Hyperlink`](https://github.com/XPBytes/administrate-field-hyperlink): A `string` field that is shows a hyperlink.
|
|
166
|
+
- [`Adminisrtate::Field::JsonEditor`](https://github.com/XPBytes/administrate-field-json_editor): A `text` field that shows a [JSON editor](https://github.com/josdejong/jsoneditor).
|
|
167
|
+
- [`Administrate::Field::ScopedBelongsTo`](https://github.com/XPBytes/administrate-field-scoped_belongs_to): A `belongs_to` field that yields itself to the scope `lambda`.
|
|
168
|
+
- [`Administrate::Field::ScopedHasMany`](https://github.com/XPBytes/administrate-field-scoped_has_many): A `has_many` field that yields itself to the scope `lambda`.
|
|
169
|
+
- [`Administrate::Field::TimeAgo`](https://github.com/XPBytes/administrate-field-time_ago): A `date_time` field that shows its data as `time_ago` since.
|
|
170
|
+
|
|
171
|
+
## Development
|
|
172
|
+
|
|
173
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can
|
|
174
|
+
also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
175
|
+
|
|
176
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
|
177
|
+
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
|
178
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
179
|
+
|
|
180
|
+
## Contributing
|
|
181
|
+
|
|
182
|
+
Bug reports and pull requests are welcome on GitHub at [XPBytes/administrate-base_controller](https://github.com/XPBytes/administrate-base_controller).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'administrate/base_controller/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'administrate-base_controller'
|
|
7
|
+
spec.version = Administrate::BaseController::VERSION
|
|
8
|
+
spec.authors = ['Derk-Jan Karrenbeld']
|
|
9
|
+
spec.email = ['derk-jan@xpbytes.com']
|
|
10
|
+
|
|
11
|
+
spec.summary = 'Extends the ApplicationController in Administrate'
|
|
12
|
+
spec.homepage = 'https://github.com/XPBytes/administrate-base_controller'
|
|
13
|
+
spec.license = 'MIT'
|
|
14
|
+
|
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
17
|
+
if spec.respond_to?(:metadata)
|
|
18
|
+
# spec.metadata['allowed_push_host'] = 'TODO: Set to 'http://mygemserver.com''
|
|
19
|
+
|
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
21
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
22
|
+
spec.metadata['changelog_uri'] = spec.homepage + '/CHANGELOG.md'
|
|
23
|
+
else
|
|
24
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
|
25
|
+
'public gem pushes.'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Specify which files should be added to the gem when it is released.
|
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
30
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
31
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
32
|
+
end
|
|
33
|
+
spec.bindir = 'exe'
|
|
34
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
35
|
+
spec.require_paths = ['lib']
|
|
36
|
+
|
|
37
|
+
spec.add_dependency 'activesupport'
|
|
38
|
+
spec.add_development_dependency 'administrate', '>= 0.11.0', '< 1'
|
|
39
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
40
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
41
|
+
spec.add_development_dependency 'rails'
|
|
42
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
|
43
|
+
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "administrate/default_order"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
require 'active_support/concern'
|
|
2
|
+
require 'active_support/lazy_load_hooks'
|
|
3
|
+
require 'administrate/base_controller/version'
|
|
4
|
+
|
|
5
|
+
module Administrate
|
|
6
|
+
|
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
|
8
|
+
ApplicationController.class_eval do
|
|
9
|
+
def index
|
|
10
|
+
resources = index_resources
|
|
11
|
+
resources = apply_resource_includes(resources)
|
|
12
|
+
resources = order.apply(resources)
|
|
13
|
+
resources = resources.page(params[:page]).per(records_per_page)
|
|
14
|
+
page = index_page
|
|
15
|
+
|
|
16
|
+
render locals: {
|
|
17
|
+
resources: resources,
|
|
18
|
+
search_term: search_term,
|
|
19
|
+
page: page,
|
|
20
|
+
show_search_bar: show_search_bar?,
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def new
|
|
25
|
+
resource = new_resource
|
|
26
|
+
authorize_resource(resource)
|
|
27
|
+
render locals: { page: new_page(resource) }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def edit
|
|
31
|
+
render locals: { page: edit_page(requested_resource) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def show
|
|
35
|
+
render locals: { page: show_page }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
protected
|
|
39
|
+
|
|
40
|
+
def search_term
|
|
41
|
+
@search_term ||= params[:search].to_s.strip
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def index_scoped_resource
|
|
45
|
+
scoped_resource
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def index_resources
|
|
49
|
+
Administrate::Search.new(index_scoped_resource, dashboard_class, search_term).run
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def index_page
|
|
53
|
+
Administrate::Page::Collection.new(dashboard, order: order)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def show_page
|
|
57
|
+
Administrate::Page::Show.new(dashboard, requested_resource)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def new_page(resource)
|
|
61
|
+
Administrate::Page::Form.new(dashboard, resource)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def edit_page(resource)
|
|
65
|
+
new_page(resource)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def authorize_resource(resource)
|
|
69
|
+
return if show_action?(action_name.to_sym, resource)
|
|
70
|
+
raise "That's not a valid action."
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def resource_params
|
|
74
|
+
permitted = params.require(resource_class.model_name.param_key)
|
|
75
|
+
.permit(dashboard.permitted_attributes)
|
|
76
|
+
.to_h
|
|
77
|
+
|
|
78
|
+
permitted.each_with_object(permitted) do |(k, v), result|
|
|
79
|
+
result[k] = read_param(k, v)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def read_param(_, data)
|
|
84
|
+
if data.is_a?(ActionController::Parameters) && data[:type]
|
|
85
|
+
return read_param_value(data)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
data
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
private
|
|
92
|
+
|
|
93
|
+
attr_writer :search_term
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: administrate-base_controller
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Derk-Jan Karrenbeld
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-03-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activesupport
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: administrate
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.11.0
|
|
34
|
+
- - "<"
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '1'
|
|
37
|
+
type: :development
|
|
38
|
+
prerelease: false
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: 0.11.0
|
|
44
|
+
- - "<"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '1'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: bundler
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '2.0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '2.0'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: rake
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '10.0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '10.0'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: rails
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
type: :development
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: minitest
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '5.0'
|
|
96
|
+
type: :development
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '5.0'
|
|
103
|
+
description:
|
|
104
|
+
email:
|
|
105
|
+
- derk-jan@xpbytes.com
|
|
106
|
+
executables: []
|
|
107
|
+
extensions: []
|
|
108
|
+
extra_rdoc_files: []
|
|
109
|
+
files:
|
|
110
|
+
- ".gitignore"
|
|
111
|
+
- ".idea/.rakeTasks"
|
|
112
|
+
- ".idea/administrate-base_controller.iml"
|
|
113
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
|
114
|
+
- ".idea/misc.xml"
|
|
115
|
+
- ".idea/modules.xml"
|
|
116
|
+
- ".idea/vcs.xml"
|
|
117
|
+
- ".travis.yml"
|
|
118
|
+
- CHANGELOG.md
|
|
119
|
+
- CODE_OF_CONDUCT.md
|
|
120
|
+
- Gemfile
|
|
121
|
+
- Gemfile.lock
|
|
122
|
+
- LICENSE.txt
|
|
123
|
+
- README.md
|
|
124
|
+
- Rakefile
|
|
125
|
+
- administrate-base_controller.gemspec
|
|
126
|
+
- bin/console
|
|
127
|
+
- bin/setup
|
|
128
|
+
- lib/administrate/base_controller.rb
|
|
129
|
+
- lib/administrate/base_controller/version.rb
|
|
130
|
+
homepage: https://github.com/XPBytes/administrate-base_controller
|
|
131
|
+
licenses:
|
|
132
|
+
- MIT
|
|
133
|
+
metadata:
|
|
134
|
+
homepage_uri: https://github.com/XPBytes/administrate-base_controller
|
|
135
|
+
source_code_uri: https://github.com/XPBytes/administrate-base_controller
|
|
136
|
+
changelog_uri: https://github.com/XPBytes/administrate-base_controller/CHANGELOG.md
|
|
137
|
+
post_install_message:
|
|
138
|
+
rdoc_options: []
|
|
139
|
+
require_paths:
|
|
140
|
+
- lib
|
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
|
+
requirements:
|
|
148
|
+
- - ">="
|
|
149
|
+
- !ruby/object:Gem::Version
|
|
150
|
+
version: '0'
|
|
151
|
+
requirements: []
|
|
152
|
+
rubyforge_project:
|
|
153
|
+
rubygems_version: 2.7.6
|
|
154
|
+
signing_key:
|
|
155
|
+
specification_version: 4
|
|
156
|
+
summary: Extends the ApplicationController in Administrate
|
|
157
|
+
test_files: []
|