Sha256: 2753e687cc4c569d0638bad6d7c661232d5a0f7681db1469559333d37d79a57e

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

module OpenConferenceWare
  module UserFavoritesHelper
    # Add JavaScript to layout that populates the user's favorites and binds these controls.
    def include_user_favorites_javascript
      if user_favorites?
        expose_to_js :favorites_path, user_favorites_path(user_id: :me)
        run_when_dom_is_ready 'populate_user_favorites();'
        run_when_dom_is_ready 'bind_user_favorite_controls();'
      end
    end

    # Return link for a UserFavorite control for the given +proposal+.
    def user_favorite_control_for(proposal)
      if user_favorites?
        return link_to(content_tag(:span, "*"), user_favorites_path(:me), class: "favorite favorite_#{proposal.id}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
open_conference_ware-1.0.0.pre4 app/helpers/open_conference_ware/user_favorites_helper.rb
open_conference_ware-1.0.0.pre3 app/helpers/open_conference_ware/user_favorites_helper.rb