5 Commits
Author SHA1 Message Date
spen 88e7bdea61 ntu_cph 2014-08-22 15:33:28 +08:00
manson a7005c6e8b Removed impressionist counter cache 2014-06-16 15:03:25 +08:00
spen 8e89a1647d update default_widget field i18n 2014-05-12 11:16:06 +08:00
spen 7121223a4d fix widget reload_web_links 2014-05-08 14:12:06 +08:00
spen eb7627a28a add backend form append note and fix show image 2014-05-02 13:52:02 +08:00
5 changed files with 40 additions and 10 deletions

No files matched your search

+7 -2
View File
@@ -16,11 +16,13 @@ class Bulletin
# include Tire::Model::Search
# include Tire::Model::Callbacks
is_impressionable :counter_cache => { :column_name => :view_count }
is_impressionable
field :title, localize: true
field :subtitle, localize: true
field :text, localize: true
field :image_description, localize: true
field :create_user_id
field :update_user_id, :class_name => "User"
@@ -28,7 +30,6 @@ class Bulletin
field :view_count, :type => Integer, :default => 0
field :public, :type => Boolean, :default => true
field :rss_link
field :email_sent, :type => Boolean, :default => false
field :email_sentdate , :type => DateTime
@@ -159,6 +160,10 @@ class Bulletin
User.find(self.email_user_ids) rescue []
end
def view_count
Impression.where(:impressionable_id=>self.id).count
end
protected
# def clean_values
@@ -139,7 +139,32 @@
</label>
</div>
</div>
<div class="image_note"><%= t("announcement.image_note")%></div>
</div>
</div>
<!-- Image Description -->
<div class="control-group">
<%= f.label t("announcement.image_description"),{:class=>"control-label muted", :func=>"field_label"} %>
<div class="controls add-input">
<div class="add-target">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="image_description_<%= locale %>">
<%= f.fields_for :image_description_translations do |f| %>
<%= f.text_field locale, :value => (@bulletin.image_description_translations[locale] rescue nil), :placeholder=>"#{t("announcement.image_description")}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#image_description_<%= locale %>" data-toggle="tab"><%= I18nVariable.from_locale(locale) %></a>
<% end %>
</div>
</div>
</div>
</div>
</div>
@@ -8,6 +8,11 @@
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
</div>
</div>
<div class="news_image">
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
<%= link_to image_tag(@bulletin.image.url), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %>
<span class="image_description"><%= @bulletin.image_description unless @bulletin.image_description.blank? %></span>
</div>
<div class="news_paragraph">
<%= @bulletin.text.html_safe rescue '' %>
</div>
@@ -32,11 +37,6 @@
</div>
</div>
<% end %>
<% unless @bulletin.rss_link.blank? %>
<div>
<%= link_to t('ntu.rss_origin'), @bulletin.rss_link %>
</div>
<% end %>
</div>
<%= share_links(@bulletin, 'announcement') %>
+1 -1
View File
@@ -27,7 +27,7 @@ en:
bulletins: Announcement front-end
search_result: Search result
image: Cover image
image_note: The image will not show in content
image_description: Cover Image Description
link_name: Link Name
new_bulletin_category: New Bulletin Category
picture: Cover Picture
+1 -1
View File
@@ -29,7 +29,7 @@ zh_tw:
bulletins: 公告前台
search_result: 搜尋結果頁
image: 封面圖片
image_note: 此處上傳的圖片不會在公告內文出現
image_description: 封面圖片說明
link_name: 連結名稱
new_bulletin_category: 新增公告類別
picture: 刊頭圖片