Compare commits

..

5 Commits

Author SHA1 Message Date
spen 6b2eb0e90c update default_widget field i18n 2014-05-12 11:18:37 +08:00
spen bbda5bcfac fix widget reload_web_links 2014-05-08 14:13:54 +08:00
spen 67640e0fc4 add backend form append note and fix show image 2014-05-02 16:20:06 +08:00
spen 89a472ffb6 fix rss_link 2014-04-28 15:20:56 +08:00
spen b14218e312 ntu osa 2014-04-23 10:37:37 +08:00
2 changed files with 7 additions and 5 deletions

View File

@ -16,7 +16,7 @@ class Bulletin
# include Tire::Model::Search # include Tire::Model::Search
# include Tire::Model::Callbacks # include Tire::Model::Callbacks
is_impressionable is_impressionable :counter_cache => { :column_name => :view_count }
field :title, localize: true field :title, localize: true
field :subtitle, localize: true field :subtitle, localize: true
@ -28,6 +28,7 @@ class Bulletin
field :view_count, :type => Integer, :default => 0 field :view_count, :type => Integer, :default => 0
field :public, :type => Boolean, :default => true field :public, :type => Boolean, :default => true
field :rss_link
field :email_sent, :type => Boolean, :default => false field :email_sent, :type => Boolean, :default => false
field :email_sentdate , :type => DateTime field :email_sentdate , :type => DateTime
@ -158,10 +159,6 @@ class Bulletin
User.find(self.email_user_ids) rescue [] User.find(self.email_user_ids) rescue []
end end
def view_count
Impression.where(:impressionable_id=>self.id).count
end
protected protected
# def clean_values # def clean_values

View File

@ -32,6 +32,11 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<% unless @bulletin.rss_link.blank? %>
<div>
<%= link_to t('ntu.rss_origin'), @bulletin.rss_link %>
</div>
<% end %>
</div> </div>
<%= share_links(@bulletin, 'announcement') %> <%= share_links(@bulletin, 'announcement') %>