No commit activity in last 3 years
No release in over 3 years
clipboard.js and toastr.js to rails Gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

clipboard-toastr-rails

Gem Version Code Climate

Build Status GitHub issues Dependency Status Coverage Status

GitHub license

clipboard-toastr-rails gem is the integration of clipboard.js and toastr javascript library(using 2.2 Version) for your Rails 4, 5 application.

Ruby gems url: https://rubygems.org/gems/clipboard-toastr-rails

Installation

Add this line to your application's Gemfile:

gem 'clipboard-toastr-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install clipboard-toastr-rails

Now you need to edit your app/assets/javascripts/application.js file and add the following line:

//= require clipboard-toastr

And you need to edit your app/assets/stylesheets/application.css file and add the following line:

*= require toastr

If Use app/assets/stylesheets/application.scss file

@import "toastr";

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

$(document).ready(function(){

  clip = new Clipboard('.copy-target')

  toastr.options = {
    "positionClass": "toast-bottom-center",
    ....
    ....
  }

  $(".copy-target").click(function() {
    toastr.info "Copy Success Alert"
  });

  target_clip = new Clipboard('.copy-target1')

  toastr.options = {
    "positionClass": "toast-top-center",
    ....
    ....
  }

  $(".copy-target1").click(function() {
    toastr.info "Copy Success Alert"
  });




});
<html>
  <head>
  ...
  </head>

  <body>
    ...
    ...

    <input id="copy-content" value="This is Copy Content"/>

    <span class="copy-target1" data-clipboard-target="#copy-content">Copy This Content</span>

    ...
    ...

    <span class="copy-target" data-clipboard-text="COPY CONTENT">Copy Link</span>

    ...
    ...
  </body>

</html>

Full documentation

The Documentation is at

Clipboard.js Document

Toastr Document

Change Log

Current Version 1.3.0

This link listing Change Log

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

The gem is available as open source under the terms of the MIT License.