Module: Highrise::Taggable
Instance Method Summary collapse
- #get_document ⇒ Object
-
#tag!(tag_name) ⇒ Object
thanks for the user Inka, forum.37signals.com/highrise/forums/15/topics/1312?page=2.
- #tags ⇒ Object
- #untag!(tag_name) ⇒ Object
- #untag_id!(tag_id) ⇒ Object
Instance Method Details
#get_document ⇒ Object
27 28 29 30 |
# File 'lib/highrise/taggable.rb', line 27 def get_document @curl_helper ||= CurlHelper.new @doc = @curl_helper.get_document_from_id("#{self.class.collection_name}/#{self.id}") end |
#tag!(tag_name) ⇒ Object
thanks for the user Inka, forum.37signals.com/highrise/forums/15/topics/1312?page=2
6 7 8 |
# File 'lib/highrise/taggable.rb', line 6 def tag!(tag_name) self.post(:tags, :name => tag_name) unless tag_name.blank? end |
#tags ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/highrise/taggable.rb', line 19 def = [] get_document.search("#show_tags a").each{ |a| << Highrise::Tag.new(:id => a['href'].gsub(/.*\//, ''), :name => a.inner_html) if a['class'] == "grey tag" } end |
#untag!(tag_name) ⇒ Object
10 11 12 13 |
# File 'lib/highrise/taggable.rb', line 10 def untag!(tag_name) to_delete = self..find{|t| t.name==tag_name} unless tag_name.blank? self.untag_id!(to_delete.id) unless to_delete.nil? end |
#untag_id!(tag_id) ⇒ Object
15 16 17 |
# File 'lib/highrise/taggable.rb', line 15 def untag_id!(tag_id) self.delete("tags/#{tag_id}") end |