fix for announcement

This commit is contained in:
Matthew K. Fu JuYuan 2012-06-26 18:23:44 +08:00
parent 818c58c1ee
commit 83a72bdf6e
4 changed files with 8 additions and 3 deletions

View File

@ -25,7 +25,7 @@ module Panel::Announcement::BackEnd::BulletinsHelper
ext = File.extname(file_path)
unless file_path.nil?
case ext
when ".jpg",".png",".gif"
when ".jpg",".jpeg",".png",".gif"
#res = '<div class="for_preview" style="display:none;">'
#res << image_tag(file_path, {:title => t(:view)})
#res << '</div>'

View File

@ -232,6 +232,7 @@
<div id='add_bulletin_file' class="info_input bulletin_files_block">
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.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>
@ -270,6 +271,8 @@
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
<script>
$(document).ready(function() {
$('#add_bulletin_link a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_bulletin_links", "g");
@ -282,5 +285,7 @@
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id));
});
$('.for_preview').popover({ html : true });
});
</script>
<% end %>

View File

@ -4,7 +4,8 @@
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
<%#= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
<%= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}.merge(file_picture_preview_setting(form_bulletin_file.file.url)) ) : '' %>
</div>
</div>
</td>

View File

@ -4,7 +4,6 @@
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%#= 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>