active_admin-advanced_create_another 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2dbd7443ab255e02174f60c39ab4dded00c6c285
4
+ data.tar.gz: 3c5f371480e348b6311ec452edcd555eaa4b82a2
5
+ SHA512:
6
+ metadata.gz: 8d269429c29651b5ce7382bbd9789248eee91014ca0cfa4d2aef8b168b1ed0ff5b35dae5a91e686a63103dae35e1e5bda92da937b966bf5cd85c93695ea53f14
7
+ data.tar.gz: 4ce36dbcce6cdea340b2997bf8403676e62eddd47690d1e972f4a25b47d1045ce19f6b22293f5d768d64608a168304eeadc6bd2791afe094e421558ff5462fe6
data/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ # http://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ pkg
2
+ doc
3
+ log
4
+ *.lock
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,39 @@
1
+ # Contributing
2
+
3
+ ## Issues
4
+
5
+ If you want to request a feature or report a bug, please use the following template.
6
+
7
+ ```markdown
8
+ ## Description
9
+
10
+ [Add feature/bug description here]
11
+
12
+ ## How to reproduce
13
+
14
+ [Add steps on how to reproduce this issue]
15
+
16
+ ## What do you expect
17
+
18
+ [Describe what do you expect to happen]
19
+
20
+ ## What happened instead
21
+
22
+ [Describe the actual results]
23
+
24
+ ## Gem version:
25
+
26
+ Version: [Add gem version here]
27
+ ```
28
+
29
+ ## Writing code
30
+
31
+ Once you've made your great commits (include tests, please):
32
+
33
+ 1. [Fork](http://help.github.com/forking/) the [original repository](http://github.com/dhyegofernando/active_admin-advanced_create_another)
34
+ 2. Create a topic branch - `git checkout -b my_branch`
35
+ 3. Push to your branch - `git push origin my_branch`
36
+ 4. [Create an Issue](http://github.com/dhyegofernando/active_admin-advanced_create_another/issues) with a link to your branch
37
+ 5. That's it!
38
+
39
+ Please respect the code style using [editorconfig](http://editorconfig.org/) in your text editor.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_admin-advanced_create_another.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Dhyego Fernando
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,26 @@
1
+ # ActiveAdmin Advanced Create Another
2
+ Create another resource with strength by default in your ActiveAdmin forms.
3
+
4
+ ## Installation
5
+ Include to your Gemfile
6
+ ```ruby
7
+ gem 'active_admin-advanced_create_another'
8
+ ```
9
+
10
+ ## Options
11
+ **Disable it in a specific resource**
12
+ ```ruby
13
+ ActiveAdmin.register User do
14
+ config.create_another = false
15
+ end
16
+ ```
17
+
18
+ **Disable by default at all resources (change `config/initializers/active_admin.rb`)**
19
+ ```ruby
20
+ ActiveAdmin.setup do
21
+ config.create_another = false
22
+ end
23
+ ```
24
+
25
+ ## Maintainer
26
+ [Dhyego Fernando](https://github.com/dhyegofernando)
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.test_files = FileList['./test/**/*_test.rb']
7
+ end
8
+
9
+ task default: :test
@@ -0,0 +1,25 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ require './lib/active_admin/advanced_create_another/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'active_admin-advanced_create_another'
7
+ spec.version = ActiveAdmin::AdvancedCreateAnother::Version::STRING
8
+ spec.authors = ['Dhyego Fernando']
9
+ spec.email = ['dhyegofernando@gmail.com']
10
+
11
+ spec.summary = 'Create another resource with strength by default in your ActiveAdmin forms.'
12
+ spec.description = spec.summary
13
+ spec.homepage = 'http://github.com/dhyegofernando/active_admin-advanced_create_another'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+
18
+ spec.add_dependency 'activeadmin', '>= 1.0.0.pre1'
19
+
20
+ spec.add_development_dependency 'bundler'
21
+ spec.add_development_dependency 'rake'
22
+ spec.add_development_dependency 'minitest'
23
+ spec.add_development_dependency 'minitest-utils'
24
+ spec.add_development_dependency 'pry-meta'
25
+ end
@@ -0,0 +1,12 @@
1
+ require 'active_support/core_ext'
2
+ require 'active_admin'
3
+
4
+ module ActiveAdmin
5
+ module AdvancedCreateAnother
6
+ autoload :Version, 'active_admin/advanced_create_another/version'
7
+ end
8
+ end
9
+
10
+ ActiveAdmin::Application.inheritable_setting :create_another, true
11
+ require_relative 'resource/action_items'
12
+
@@ -0,0 +1,10 @@
1
+ module ActiveAdmin
2
+ module AdvancedCreateAnother
3
+ module Version
4
+ MAJOR = 0
5
+ MINOR = 1
6
+ PATCH = 0
7
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ module ActiveAdmin
2
+ class Resource
3
+ module ActionItems
4
+ def add_default_new_action_item
5
+ add_action_item :new, only: :index do
6
+ if controller.action_methods.include?('new') && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
7
+ localizer = ActiveAdmin::Localizers.resource(active_admin_config)
8
+ path = active_admin_config.create_another ? new_resource_path(create_another: true) : new_resource_path
9
+ link_to localizer.t(:new_model), path
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_admin-advanced_create_another
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dhyego Fernando
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activeadmin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0.pre1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0.pre1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-utils
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-meta
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Create another resource with strength by default in your ActiveAdmin
98
+ forms.
99
+ email:
100
+ - dhyegofernando@gmail.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".editorconfig"
106
+ - ".gitignore"
107
+ - CONTRIBUTING.md
108
+ - Gemfile
109
+ - LICENSE
110
+ - README.md
111
+ - Rakefile
112
+ - active_admin-advanced_create_another.gemspec
113
+ - lib/active_admin/advanced_create_another.rb
114
+ - lib/active_admin/advanced_create_another/version.rb
115
+ - lib/active_admin/resource/action_items.rb
116
+ homepage: http://github.com/dhyegofernando/active_admin-advanced_create_another
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.4.8
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Create another resource with strength by default in your ActiveAdmin forms.
140
+ test_files: []