per_page_loader 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 +12 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +150 -0
- data/LICENSE.txt +21 -0
- data/README.md +71 -0
- data/Rakefile +6 -0
- data/app/views/per_page_loader/_container.html.erb +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/generators/per_page_loader/base_generator.rb +11 -0
- data/lib/generators/per_page_loader/component_generator.rb +14 -0
- data/lib/generators/per_page_loader/controller_generator.rb +14 -0
- data/lib/generators/per_page_loader/templates/component.erb +5 -0
- data/lib/generators/per_page_loader/templates/controller.erb +5 -0
- data/lib/per_page_loader.rb +5 -0
- data/lib/per_page_loader/container.rb +21 -0
- data/lib/per_page_loader/engine.rb +7 -0
- data/lib/per_page_loader/per_page_helper.rb +23 -0
- data/lib/per_page_loader/version.rb +3 -0
- data/per_page_loader.gemspec +28 -0
- data/vendor/assets/javascripts/per_page_loader.js +31 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ce6a8984aa6ffb37fece5f1c97ad79291bfff9805c372f1b798ed3cb0e80a444
|
4
|
+
data.tar.gz: 42d4ace048e76903e1d169d0afd4dbc0f78c7e4d76e77fb62a968a16f69683ee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6792f643781d9593f66417b2151d0007b5622987901ef03f00d1429e6fade928ccd3f8dc4098dcf1fefb481e5262c5f5a8e8aab9925a5def3213ea281558771a
|
7
|
+
data.tar.gz: 49972155e03bc7d02838c83b9d6ec06def8c274505520ef83d86aaab33729f00813611fe2692ca21121993731f82574146bccf41a7e6cd8805a1bba3e5e6d2d7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
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 KDRaypole01@indianatech.net. 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 [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
per_page_loader (0.1.0)
|
5
|
+
rails (>= 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (5.2.4.2)
|
11
|
+
actionpack (= 5.2.4.2)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailer (5.2.4.2)
|
15
|
+
actionpack (= 5.2.4.2)
|
16
|
+
actionview (= 5.2.4.2)
|
17
|
+
activejob (= 5.2.4.2)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
actionpack (5.2.4.2)
|
21
|
+
actionview (= 5.2.4.2)
|
22
|
+
activesupport (= 5.2.4.2)
|
23
|
+
rack (~> 2.0, >= 2.0.8)
|
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.4.2)
|
28
|
+
activesupport (= 5.2.4.2)
|
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.4.2)
|
34
|
+
activesupport (= 5.2.4.2)
|
35
|
+
globalid (>= 0.3.6)
|
36
|
+
activemodel (5.2.4.2)
|
37
|
+
activesupport (= 5.2.4.2)
|
38
|
+
activerecord (5.2.4.2)
|
39
|
+
activemodel (= 5.2.4.2)
|
40
|
+
activesupport (= 5.2.4.2)
|
41
|
+
arel (>= 9.0)
|
42
|
+
activestorage (5.2.4.2)
|
43
|
+
actionpack (= 5.2.4.2)
|
44
|
+
activerecord (= 5.2.4.2)
|
45
|
+
marcel (~> 0.3.1)
|
46
|
+
activesupport (5.2.4.2)
|
47
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
48
|
+
i18n (>= 0.7, < 2)
|
49
|
+
minitest (~> 5.1)
|
50
|
+
tzinfo (~> 1.1)
|
51
|
+
arel (9.0.0)
|
52
|
+
builder (3.2.4)
|
53
|
+
coderay (1.1.2)
|
54
|
+
concurrent-ruby (1.1.6)
|
55
|
+
crass (1.0.6)
|
56
|
+
diff-lcs (1.3)
|
57
|
+
erubi (1.9.0)
|
58
|
+
generator_spec (0.9.4)
|
59
|
+
activesupport (>= 3.0.0)
|
60
|
+
railties (>= 3.0.0)
|
61
|
+
globalid (0.4.2)
|
62
|
+
activesupport (>= 4.2.0)
|
63
|
+
i18n (1.8.2)
|
64
|
+
concurrent-ruby (~> 1.0)
|
65
|
+
loofah (2.4.0)
|
66
|
+
crass (~> 1.0.2)
|
67
|
+
nokogiri (>= 1.5.9)
|
68
|
+
mail (2.7.1)
|
69
|
+
mini_mime (>= 0.1.1)
|
70
|
+
marcel (0.3.3)
|
71
|
+
mimemagic (~> 0.3.2)
|
72
|
+
method_source (1.0.0)
|
73
|
+
mimemagic (0.3.4)
|
74
|
+
mini_mime (1.0.2)
|
75
|
+
mini_portile2 (2.4.0)
|
76
|
+
minitest (5.14.0)
|
77
|
+
nio4r (2.5.2)
|
78
|
+
nokogiri (1.10.9)
|
79
|
+
mini_portile2 (~> 2.4.0)
|
80
|
+
pry (0.13.1)
|
81
|
+
coderay (~> 1.1)
|
82
|
+
method_source (~> 1.0)
|
83
|
+
rack (2.2.2)
|
84
|
+
rack-test (1.1.0)
|
85
|
+
rack (>= 1.0, < 3)
|
86
|
+
rails (5.2.4.2)
|
87
|
+
actioncable (= 5.2.4.2)
|
88
|
+
actionmailer (= 5.2.4.2)
|
89
|
+
actionpack (= 5.2.4.2)
|
90
|
+
actionview (= 5.2.4.2)
|
91
|
+
activejob (= 5.2.4.2)
|
92
|
+
activemodel (= 5.2.4.2)
|
93
|
+
activerecord (= 5.2.4.2)
|
94
|
+
activestorage (= 5.2.4.2)
|
95
|
+
activesupport (= 5.2.4.2)
|
96
|
+
bundler (>= 1.3.0)
|
97
|
+
railties (= 5.2.4.2)
|
98
|
+
sprockets-rails (>= 2.0.0)
|
99
|
+
rails-dom-testing (2.0.3)
|
100
|
+
activesupport (>= 4.2.0)
|
101
|
+
nokogiri (>= 1.6)
|
102
|
+
rails-html-sanitizer (1.3.0)
|
103
|
+
loofah (~> 2.3)
|
104
|
+
railties (5.2.4.2)
|
105
|
+
actionpack (= 5.2.4.2)
|
106
|
+
activesupport (= 5.2.4.2)
|
107
|
+
method_source
|
108
|
+
rake (>= 0.8.7)
|
109
|
+
thor (>= 0.19.0, < 2.0)
|
110
|
+
rake (12.3.2)
|
111
|
+
rspec (3.8.0)
|
112
|
+
rspec-core (~> 3.8.0)
|
113
|
+
rspec-expectations (~> 3.8.0)
|
114
|
+
rspec-mocks (~> 3.8.0)
|
115
|
+
rspec-core (3.8.0)
|
116
|
+
rspec-support (~> 3.8.0)
|
117
|
+
rspec-expectations (3.8.3)
|
118
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
119
|
+
rspec-support (~> 3.8.0)
|
120
|
+
rspec-mocks (3.8.0)
|
121
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
122
|
+
rspec-support (~> 3.8.0)
|
123
|
+
rspec-support (3.8.0)
|
124
|
+
sprockets (4.0.0)
|
125
|
+
concurrent-ruby (~> 1.0)
|
126
|
+
rack (> 1, < 3)
|
127
|
+
sprockets-rails (3.2.1)
|
128
|
+
actionpack (>= 4.0)
|
129
|
+
activesupport (>= 4.0)
|
130
|
+
sprockets (>= 3.0.0)
|
131
|
+
thor (1.0.1)
|
132
|
+
thread_safe (0.3.6)
|
133
|
+
tzinfo (1.2.6)
|
134
|
+
thread_safe (~> 0.1)
|
135
|
+
websocket-driver (0.7.1)
|
136
|
+
websocket-extensions (>= 0.1.0)
|
137
|
+
websocket-extensions (0.1.4)
|
138
|
+
|
139
|
+
PLATFORMS
|
140
|
+
ruby
|
141
|
+
|
142
|
+
DEPENDENCIES
|
143
|
+
generator_spec
|
144
|
+
per_page_loader!
|
145
|
+
pry
|
146
|
+
rake
|
147
|
+
rspec
|
148
|
+
|
149
|
+
BUNDLED WITH
|
150
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Kobe
|
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,71 @@
|
|
1
|
+
# PerPageLoader
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'per_page_loader'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install per_page_loader
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
PerPageLoader lets you attach page specific coffeescript to your rails application using jquery to load the specific coffee class and method that are needed for your controller action.
|
21
|
+
|
22
|
+
### Setup
|
23
|
+
After including the gem it is as simple as wrapping your application html in the `per_page_container` helper method.
|
24
|
+
|
25
|
+
```haml
|
26
|
+
%body
|
27
|
+
= per_page_container do
|
28
|
+
= yield
|
29
|
+
```
|
30
|
+
|
31
|
+
Adding this helper to the layouts will give PerPageLoader access to loading in javascript for every page.
|
32
|
+
|
33
|
+
### Generators
|
34
|
+
The PerPageLoader has a specific format of coffeescript controller that it looks for and we have built generators to help build these files for you.
|
35
|
+
|
36
|
+
`rails generate per_page_loader:controller User` will generate...
|
37
|
+
|
38
|
+
```coffeescript
|
39
|
+
# app/assets/javascripts/application/controllers/users_controller.coffee
|
40
|
+
class UsersController
|
41
|
+
window.UsersController = UsersController
|
42
|
+
```
|
43
|
+
|
44
|
+
Auto generating the actions is as easy as passing in the names of the actions.
|
45
|
+
|
46
|
+
`rails generate per_page_loader:controller User index show` will generate...
|
47
|
+
|
48
|
+
```coffeescript
|
49
|
+
# app/assets/javascripts/application/controllers/users_controller.coffee
|
50
|
+
class UsersController
|
51
|
+
|
52
|
+
indexAction: ->
|
53
|
+
|
54
|
+
showAction: ->
|
55
|
+
|
56
|
+
window.UsersController = UsersController
|
57
|
+
```
|
58
|
+
|
59
|
+
If it is necessary to change the location that the file is generated the `--dir=dir_name` flag can be used.
|
60
|
+
|
61
|
+
`rails generate per_page_loader:controller User --dir=admin` will generate...
|
62
|
+
|
63
|
+
```coffeescript
|
64
|
+
# app/assets/javascripts/admin/controllers/users_controller.coffee
|
65
|
+
class UsersController
|
66
|
+
window.UsersController = UsersController
|
67
|
+
```
|
68
|
+
|
69
|
+
## License
|
70
|
+
|
71
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "per_page_loader"
|
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,14 @@
|
|
1
|
+
require 'generators/per_page_loader/base_generator'
|
2
|
+
|
3
|
+
module PerPageLoader
|
4
|
+
module Generators
|
5
|
+
class ComponentGenerator < BaseGenerator
|
6
|
+
argument :actions, type: :array, default: [], banner: "Array of actions to be added to the component"
|
7
|
+
class_option :dir, type: :string, default: "application", desc: "The directory where the file should go"
|
8
|
+
|
9
|
+
def create_coffee_component_file
|
10
|
+
template 'component.erb', File.join("app/assets/javascripts/#{options[:dir]}/components", "#{file_name}_component.coffee")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'generators/per_page_loader/base_generator'
|
2
|
+
|
3
|
+
module PerPageLoader
|
4
|
+
module Generators
|
5
|
+
class ControllerGenerator < BaseGenerator
|
6
|
+
argument :actions, type: :array, default: [], banner: "Array of actions to be added to the controller"
|
7
|
+
class_option :dir, type: :string, default: "application", desc: "The directory where the file should go"
|
8
|
+
|
9
|
+
def create_coffee_controller_file
|
10
|
+
template 'controller.erb', File.join("app/assets/javascripts/#{options[:dir]}/controllers", "#{table_name}_controller.coffee")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PerPageLoader
|
2
|
+
class Container
|
3
|
+
attr_accessor :view_context
|
4
|
+
|
5
|
+
def initialize(view_context)
|
6
|
+
@view_context = view_context
|
7
|
+
end
|
8
|
+
|
9
|
+
def render
|
10
|
+
view_context.render(
|
11
|
+
partial: partial_name
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def partial_name
|
18
|
+
self.class.name.underscore
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PerPageLoader
|
2
|
+
module PerPageHelper
|
3
|
+
def per_page_container
|
4
|
+
PerPageLoader::Container.new(self).render
|
5
|
+
end
|
6
|
+
|
7
|
+
def javascript_controller
|
8
|
+
controller_path.gsub('/', '_').camelize
|
9
|
+
end
|
10
|
+
|
11
|
+
def javascript_action
|
12
|
+
controller.action_name.camelize(:lower) + 'Action'
|
13
|
+
end
|
14
|
+
|
15
|
+
def json_partial(partial, options = {})
|
16
|
+
options.reverse_merge! locals: nil
|
17
|
+
passed_options = {partial: partial, locals: options[:locals], formats: options[:formats]}
|
18
|
+
passed_options.merge!(collection: options[:collection]) if options[:collection]
|
19
|
+
|
20
|
+
render(passed_options).to_json.html_safe
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'lib/per_page_loader/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "per_page_loader"
|
5
|
+
spec.version = PerPageLoader::VERSION
|
6
|
+
spec.authors = ["Kobe"]
|
7
|
+
spec.email = ["Kobe@rouxbe.com"]
|
8
|
+
|
9
|
+
spec.summary = 'Per page loader for coffeescript on rails applications'
|
10
|
+
spec.description = 'Per page loader for coffeescript on rails applications'
|
11
|
+
spec.license = "MIT"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
|
+
|
14
|
+
# Specify which files should be added to the gem when it is released.
|
15
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
16
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "pry"
|
26
|
+
spec.add_development_dependency "generator_spec"
|
27
|
+
spec.add_dependency 'rails', '>= 3.0'
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
(function() {
|
2
|
+
var PerPageLoader;
|
3
|
+
|
4
|
+
PerPageLoader = (function() {
|
5
|
+
function PerPageLoader() {}
|
6
|
+
|
7
|
+
PerPageLoader.initialize = function() {
|
8
|
+
var action, container, controller, controller_instance, error;
|
9
|
+
container = document.getElementsByClassName('js-per-page-container')[0];
|
10
|
+
controller = container.dataset.controller;
|
11
|
+
action = container.dataset.action;
|
12
|
+
try {
|
13
|
+
controller_instance = new window[controller + "Controller"]();
|
14
|
+
return controller_instance[action]();
|
15
|
+
} catch (_error) {
|
16
|
+
error = _error;
|
17
|
+
return console.log(error);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
return PerPageLoader;
|
22
|
+
|
23
|
+
})();
|
24
|
+
|
25
|
+
window.PerPageLoader = PerPageLoader;
|
26
|
+
|
27
|
+
document.addEventListener('DOMContentLoaded', function() {
|
28
|
+
return PerPageLoader.initialize();
|
29
|
+
});
|
30
|
+
|
31
|
+
}).call(this);
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: per_page_loader
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kobe
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
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: rspec
|
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: pry
|
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: generator_spec
|
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: rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: Per page loader for coffeescript on rails applications
|
84
|
+
email:
|
85
|
+
- Kobe@rouxbe.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- CODE_OF_CONDUCT.md
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- app/views/per_page_loader/_container.html.erb
|
100
|
+
- bin/console
|
101
|
+
- bin/setup
|
102
|
+
- lib/generators/per_page_loader/base_generator.rb
|
103
|
+
- lib/generators/per_page_loader/component_generator.rb
|
104
|
+
- lib/generators/per_page_loader/controller_generator.rb
|
105
|
+
- lib/generators/per_page_loader/templates/component.erb
|
106
|
+
- lib/generators/per_page_loader/templates/controller.erb
|
107
|
+
- lib/per_page_loader.rb
|
108
|
+
- lib/per_page_loader/container.rb
|
109
|
+
- lib/per_page_loader/engine.rb
|
110
|
+
- lib/per_page_loader/per_page_helper.rb
|
111
|
+
- lib/per_page_loader/version.rb
|
112
|
+
- per_page_loader.gemspec
|
113
|
+
- vendor/assets/javascripts/per_page_loader.js
|
114
|
+
homepage:
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 2.3.0
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.7.9
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Per page loader for coffeescript on rails applications
|
138
|
+
test_files: []
|