Skip to content

Commit

Permalink
Merge pull request #2 from JigneshSatam/infinite_scroll_select_and_sh…
Browse files Browse the repository at this point in the history
…ow_selection_count

Infinite scroll select and show selection count
  • Loading branch information
jigneshsatam committed Dec 8, 2016
2 parents 58fc181 + 4a94765 commit 85acf55
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 56 deletions.
46 changes: 31 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# SelectAll::Rails

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/select_all/rails`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

# select_all-rails
***Simple to check and uncheck checkboxes***
***
[![Gem Version](https://badge.fury.io/rb/select_all-rails.svg)](https://badge.fury.io/rb/select_all-rails) [![Code Climate](https://codeclimate.com/github/JigneshSatam/select_all-rails/badges/gpa.svg)](https://codeclimate.com/github/JigneshSatam/select_all-rails) [![Issue Count](https://codeclimate.com/github/JigneshSatam/select_all-rails/badges/issue_count.svg)](https://codeclimate.com/github/JigneshSatam/select_all-rails)

Select_all-rails is gem for implementing '**select-all**' functionality in more simple and effective way in your ruby-on-rails application.
## Functionalities
* [***Basic Usage***](http://jigneshsatam.github.io/checkbox_select_all/index_demo.html#basic_usage) - Selecting/Unselecting multiple checkboxes.
* [***Multiple Seletions***](http://jigneshsatam.github.io/checkbox_select_all/index_demo.html#multiple_selections) - Implementing more than one select-all functionalities in a page.
* [***Ajax Added Checkboxes***](http://jigneshsatam.github.io/checkbox_select_all/index_demo.html#ajax_added_checkboxes) - Implementing select-all functionality to new checkboxes added by an Ajax call.
* [***Show Selection/Count***](http://jigneshsatam.github.io/checkbox_select_all/index_demo.html#show_selected_count) - Display selected checkboxes count or checkboxes remaining to select count or selected checkboxes count out of total checkboxes.
## Installation

Add this line to your application's Gemfile:
Add this line to your application's **Gemfile**:

```ruby
gem 'select_all-rails'
Expand All @@ -19,26 +24,37 @@ And then execute:
Or install it yourself as:

$ gem install select_all-rails
And add the following line to your application.js file:

And add the following line to your **application.js** file after jquery:

//= require select_all.js

## Usage
Call the function **select_all()** on main checkbox and add class **'selectable'** to sub-checkboxes.

<p>Call the function on main checkbox and add class 'selectable' to sub-checkboxes.</p>
HTML example:
```html
<input type="checkbox" id="selectAll">All Items</input>

<p>Example link: http://jigneshsatam.github.io/checkbox_select_all/index_demo.html </p>
<input type="checkbox" class="selectable">Item 1</input>
<input type="checkbox" class="selectable">Item 2</input>
<input type="checkbox" class="selectable">Item 3</input>

<script type="text/javascript">
$("#selectAll").select_all();
</script>
```
***For more usage checkout*** [**Demo**](http://jigneshsatam.github.io/checkbox_select_all/index_demo.html)


Rails haml example:
```
```haml
= check_box_tag 'checkAll'
= check_box_tag 'selected_ids[]', "1", false, class: 'selectable'
= check_box_tag 'selected_ids[]', "2", false, class: 'selectable'
= check_box_tag 'selected_ids[]', "3", false, class: 'selectable'
- content_for :page_js do
:javascript
:javascript
$("#checkAll").select_all();
```

Expand All @@ -55,4 +71,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
5. Create a new Pull Request
2 changes: 1 addition & 1 deletion lib/select_all/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module SelectAll
module Rails
VERSION = "0.2.0"
VERSION = "0.3.0"
end
end
2 changes: 1 addition & 1 deletion select_all-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
spec.email = ["jigneshsatam@gmail.com"]

if spec.respond_to?(:metadata)
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
# spec.metadata['allowed_push_host'] = "Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
end

spec.summary = %q{Simple to select all checkboxes.}
Expand Down
40 changes: 1 addition & 39 deletions vendor/assets/javascripts/select_all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 85acf55

Please sign in to comment.