Sha256: 598975622c0945c9af974d90bc994569a5ea932725c26dbd7393abbc87db6bc6

Contents?: true

Size: 748 Bytes

Versions: 5

Compression:

Stored size: 748 Bytes

Contents

if @favorite.new_record?
  #it didn't work
  page.alert(@favorite.errors.full_messages.join(', '))
else
  case @favorite.favoritable.class.to_s.tableize
    when 'clippings'
      page.select("#clipping_#{@favorite.favoritable.id}").each do |element|
        element.replace(render(:partial => 'clippings/clipping', :object => @favorite.favoritable)) 
      end
      page.select("#clipping_#{@favorite.favoritable.id}_meta").each do |element|
        element.replace(render(:partial => 'clippings/meta', :formats => [:html], :locals => {:clipping => @favorite.favoritable}))    
      end

    when 'posts'
      page.replace("post_#{@favorite.favoritable.id}_meta", :partial => 'posts/meta', :locals => {:post => @favorite.favoritable})
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
community_engine-2.3.2 app/views/favorites/create.js.rjs
community_engine-2.3.1 app/views/favorites/create.js.rjs
community_engine-2.3.0 app/views/favorites/create.js.rjs
community_engine-2.1.0 app/views/favorites/create.js.rjs
community_engine-2.0.0 app/views/favorites/create.js.rjs