Skip to content

Instantly share code, notes, and snippets.

@gaboesquivel
Created November 9, 2012 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaboesquivel/4049123 to your computer and use it in GitHub Desktop.
Save gaboesquivel/4049123 to your computer and use it in GitHub Desktop.
hola
- state = instance.favorite?(current_user) ? "favorite" : "not_favorite"
- position |= 'right'
#awesome_counter{class: [position, state, "#{instance.id}_#{instance.class.to_s.parameterize}"], "data-entry-id" => "#{instance.class.to_s.parameterize}_#{instance.id}", "data-current_user" => current_user.blank? ? 'false' : 'true', "data-state" => state}
%span
.favorite_count
- if state == "favorite"
.counter.favorite
= instance.favorites.count
= image_tag "awesome/awesome-counter-save.png"
.state.hide
= t("awesome.awesomed")
= render "shared/add_to_favorites_form", :instance => instance, :type => "small_awsm_with_counter", :favorite => (instance.favorite?(current_user) ? current_user.favorites.find_by_favoritable_id(instance) : Favorite.new())
-else
.counter.not_favorite
= instance.favorites.count
= image_tag "awesome/awesome-counter-saved.png"
.state.hide
= t("awesome.it")
= render "shared/add_to_favorites_form", :instance => instance, :type => "small_awsm_with_counter", :favorite => (instance.favorite?(current_user) ? current_user.favorites.find_by_favoritable_id(instance) : Favorite.new())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment