Skip to content

gfish/popularity_contest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PopularityContest

Installation

Add this line to your application's Gemfile:

gem 'popularity_contest'

And then execute:

$ bundle

Or install it yourself as:

$ gem install popularity_contest

Usage

Add this rack application to your Rails routes:

require 'popularity_contest/web'
mount PopularityContest::Web, :at => "popularity"

You can now reach it from HOSTNAME/popularity.

To use in your views you have a helper here:

<%= popular_count_hit_path('event', 1337) %>
# /popularity/event/1337

Or if you have jQuery available you can use this:

<%= popular_count_hit_jquery('event', 1337) %>
# <script>
# (function(window, document, $, undefined) {
#  $.ajax({
#    url: '/popularity/event/1337',
#    dataType: 'html',
#    cache: false
#  })
# }(window, document, jQuery));
# </script>

Contributing

  1. Fork it
  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 new Pull Request

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages