app/assets/javascripts/blog/show.js.erb:


         $(document).ready(logView);
                function logView() {
var id = $('div.blog_post').data('id');
InternalAnalytics.postEvent(id, 'view');
        }
app/views/blog/show.html.erb:


                   <div class='column'>
<div class='column top'>
<a class='icon_text_button' href="javascript:;"> 
<span class='icon'>
&#59146;
</span>
<span class='text'> 
<%= @blog_post.view_count %>
</span>
</a>

   app/models/atom.rb:
                                   
                                        def count_view!
                                          self.inc(:view_count, 1)
                                          self.update_index
                                              end


app\views\home\index\_report.html.erb:

                                   

<div class='buttons'>
<a class='icon_text_button' href='<%= research_article_path(:url_fragment 
=> atom.url_fragment) %>'>
<span class='icon'>
&#59146;
</span>
<span class='text'>
<%= abbreviated_number(atom.view_count) %> <%= atom.view_count == 1 ? 
'view' : 'views' %>
</span>
</a>

        

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6f7d0983-1ef9-46c3-9d6b-3d4e52b37176%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to