Module: MuckSharesHelper

Defined in:
app/helpers/muck_shares_helper.rb

Instance Method Summary collapse

Instance Method Details

#already_shared?(user, uri) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/helpers/muck_shares_helper.rb', line 25

def already_shared?(user, uri)
  user.shares.find(:all, :conditions => ['uri = ?', uri])
end

#delete_share(share, button_type = :button, button_text = t("muck.general.delete")) ⇒ Object

Renders a delete button for a share item



17
18
19
20
21
22
23
# File 'app/helpers/muck_shares_helper.rb', line 17

def delete_share(share, button_type = :button, button_text = t("muck.general.delete"))
  render :partial => 'shared/delete', :locals => { :delete_object => share,
                                                   :button_type => button_type,
                                                   :button_text => button_text,
                                                   :form_class => 'comment-delete',
                                                   :delete_path => share_path(share, :format => 'js') }
end

#share_ajax_message_containerObject



29
30
31
# File 'app/helpers/muck_shares_helper.rb', line 29

def share_ajax_message_container
  output_message_container('share-messages', 'share-messages-container')
end

#share_form(share = nil, options = {}, &block) ⇒ Object

share is an optional share object that can be used to pre populate the form. options: render_new - will determine whether the controller will redirect to new after create or

attempt to return to the last page stored by store_location


11
12
13
14
# File 'app/helpers/muck_shares_helper.rb', line 11

def share_form(share = nil, options = {}, &block)
  share ||= Share.new
  raw_block_to_partial('shares/form', options.merge(:share => share), &block)
end

#show_shares(shares) ⇒ Object



3
4
5
# File 'app/helpers/muck_shares_helper.rb', line 3

def show_shares(shares)
  render :partial => 'shares/share', :collection => shares
end