fix for 新聞與公告QA

1.8.新聞或公告的「檔案室」上傳圖片後再行編輯時,圖片無法正常顯示(但是可以正常被編輯調整並於前台顯示)
	2.add  上傳檔案大小限制: 3MB
	3.公告的發佈單位為何是顯示單位代碼:M00?應顯示發布單位
This commit is contained in:
Matthew K. Fu JuYuan committed 2012-06-26 17:46:02 +08:00
1 parent df722ba90f
commit 818c58c1ee
9 files changed
+48 -20

No files matched your search

@@ -20,4 +20,21 @@ module Panel::Announcement::BackEnd::BulletinsHelper
end
end
def file_picture_preview_setting(file_path)
res= ""
ext = File.extname(file_path)
unless file_path.nil?
case ext
when ".jpg",".png",".gif"
#res = '<div class="for_preview" style="display:none;">'
#res << image_tag(file_path, {:title => t(:view)})
#res << '</div>'
#res.html_safe
{"data-content" => "#{image_tag file_path}" }
else
{"data-content" => t("sys.not_previewable") }
end
end
end
end
@@ -14,9 +14,8 @@ module Panel::News::BackEnd::NewsBulletinsHelper
def show_news_bulletin_title_at_index (news_bulletin)
if news_bulletin.is_checked?
link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''
else
else
news_bulletin.title[I18n.locale]
end
end
@@ -237,6 +237,8 @@
<div id='add_news_bulletin_file' class="info_input news_bulletin_files_block">
<%= hidden_field_tag 'news_bulletin_file_field_count', @news_bulletin.news_bulletin_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
</div>
</td>
</tr>
@@ -249,10 +251,9 @@
<%= render :partial => 'form_news_bulletin_file', :object => news_bulletin_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
@@ -275,17 +276,20 @@
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
<script>
$('#add_news_bulletin_link a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_news_bulletin_links", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_link', f, :news_bulletin_links) %>").replace(old_id, new_id));
});
$('#add_news_bulletin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_news_bulletin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_file', f, :news_bulletin_files) %>").replace(old_id, new_id));
$(document).ready(function() {
$('#add_news_bulletin_link a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_news_bulletin_links", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_link', f, :news_bulletin_links) %>").replace(old_id, new_id));
});
$('#add_news_bulletin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_news_bulletin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_file', f, :news_bulletin_files) %>").replace(old_id, new_id));
});
$('.for_preview').popover({ html : true });
});
</script>
<% end %>
@@ -4,7 +4,8 @@
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
<%#= file_picture_preview_setting(form_news_bulletin_file.file.url) %>
<%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}.merge(file_picture_preview_setting(form_news_bulletin_file.file.url)) ) : '' %>
</div>
</div>
</td>