README.md in clipboard-rails-1.3.1.1 vs README.md in clipboard-rails-1.4.0
- old
+ new
@@ -1,6 +1,7 @@
# clipboard-rails
+[![Gem Version](https://badge.fury.io/rb/clipboard-rails.svg)](http://badge.fury.io/rb/clipboard-rails)
clipboard-rails gem is the integration of clipboard.js javascript library for your Rails 4 application.
clipboard.js is a modern approach to copy text to clipboard No Flash. No dependencies. Just 2kb
source: https://github.com/zenorocha/clipboard.js
@@ -25,9 +26,38 @@
``` javascript
//= require clipboard
```
## Usage
+
+Here is the example working code to test with your Rails application.
+
+Add this sample code to your `app/assets/javascripts/application.js` file
+
+``` javascript
+$(document).ready(function(){
+
+ var clip = new Clipboard('.btn');
+ console.log(clip);
+
+});
+```
+
+*Note:* Here i am using `gem 'jquery-turbolinks'` for using the jquery $(document).ready function
+
+Add this sample code to your template file like `index.html.erb`
+
+``` html
+<!-- Target -->
+<textarea id="bar">Mussum ipsum cacilds...</textarea>
+
+<!-- Trigger -->
+<button class="btn" data-clipboard-action="cut" data-clipboard-target="#bar">
+ Cut to clipboard
+</button>
+```
+
+## Full documentation
Read the clipboard.js documentation here http://zenorocha.github.io/clipboard.js/
## Development