1 Commits
Author SHA1 Message Date
spen 5987529771 fgu 2014-06-17 09:51:21 +08:00
5 changed files with 16 additions and 35 deletions

No files matched your search

+9 -2
View File
@@ -21,8 +21,6 @@ class Bulletin
field :title, localize: true field :title, localize: true
field :subtitle, localize: true field :subtitle, localize: true
field :text, localize: true field :text, localize: true
field :image_description, localize: true
field :create_user_id field :create_user_id
field :update_user_id, :class_name => "User" field :update_user_id, :class_name => "User"
@@ -46,6 +44,8 @@ class Bulletin
validates :title, :at_least_one => true validates :title, :at_least_one => true
validate :image_size
# def to_indexed_json # def to_indexed_json
# self.to_json # self.to_json
# end # end
@@ -173,5 +173,12 @@ class Bulletin
# self.tag_ids.delete('') # self.tag_ids.delete('')
# end # end
def image_size
if self.image.size > 500.kilobyte
errors.add( :image, I18n.t("announcement.image_limit"))
end
end
end end
@@ -139,32 +139,7 @@
</label> </label>
</div> </div>
</div> </div>
<div class="image_note"><br /><%= t("announcement.image_note")%><br /><%= t("announcement.image_size_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>
</div> </div>
@@ -8,11 +8,6 @@
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span> <span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
</div> </div>
</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"> <div class="news_paragraph">
<%= @bulletin.text.html_safe rescue '' %> <%= @bulletin.text.html_safe rescue '' %>
</div> </div>
+3 -1
View File
@@ -27,7 +27,9 @@ en:
bulletins: Announcement front-end bulletins: Announcement front-end
search_result: Search result search_result: Search result
image: Cover image image: Cover image
image_description: Cover Image Description image_note: The image will not show in content
image_size_note: Limited to 500KB
image_limit: Image upload size is limited to 500KB
link_name: Link Name link_name: Link Name
new_bulletin_category: New Bulletin Category new_bulletin_category: New Bulletin Category
picture: Cover Picture picture: Cover Picture
+3 -1
View File
@@ -29,7 +29,9 @@ zh_tw:
bulletins: 公告前台 bulletins: 公告前台
search_result: 搜尋結果頁 search_result: 搜尋結果頁
image: 封面圖片 image: 封面圖片
image_description: 封面圖片說明 image_note: 此處上傳的圖片不會在公告內文出現
image_size_note: 系統限制上傳500k以下的圖片
image_limit: 圖片上傳容量限制為500kB
link_name: 連結名稱 link_name: 連結名稱
new_bulletin_category: 新增公告類別 new_bulletin_category: 新增公告類別
picture: 刊頭圖片 picture: 刊頭圖片