fix for 新聞與公告QA
1.8.新聞或公告的「檔案室」上傳圖片後再行編輯時,圖片無法正常顯示(但是可以正常被編輯調整並於前台顯示) 2.add 上傳檔案大小限制: 3MB 3.公告的發佈單位為何是顯示單位代碼:M00?應顯示發布單位
This commit is contained in:
parent
df722ba90f
commit
818c58c1ee
|
@ -3,7 +3,7 @@ require 'mongo'
|
||||||
class GridfsController < ActionController::Metal
|
class GridfsController < ActionController::Metal
|
||||||
|
|
||||||
def serve
|
def serve
|
||||||
gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "").force_encoding("UTF-8")
|
gridfs_path = (params[:path]+'.'+params[:format]).gsub("/gridfs/", "").force_encoding("UTF-8")
|
||||||
begin
|
begin
|
||||||
gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r')
|
gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r')
|
||||||
self.response_body = gridfs_file.read
|
self.response_body = gridfs_file.read
|
||||||
|
|
|
@ -15,7 +15,7 @@ class SessionsController < Devise::SessionsController
|
||||||
if $nccu_ldap_connection.bind
|
if $nccu_ldap_connection.bind
|
||||||
logger.info "=LDAP Binded password ok..."
|
logger.info "=LDAP Binded password ok..."
|
||||||
result =check_auth_with_ldap(login_uid,login_password)
|
result =check_auth_with_ldap(login_uid,login_password)
|
||||||
if result #&& login_password!=''
|
if result && login_password!=''
|
||||||
logger.info "==LDAP password passed..."
|
logger.info "==LDAP password passed..."
|
||||||
nccu_id = get_nccu_id_from_mid_site(login_uid)
|
nccu_id = get_nccu_id_from_mid_site(login_uid)
|
||||||
resource = nccu_id.nil? ? nil : (User.first(conditions:{ nccu_ldap_uid: nccu_id }))
|
resource = nccu_id.nil? ? nil : (User.first(conditions:{ nccu_ldap_uid: nccu_id }))
|
||||||
|
|
|
@ -289,4 +289,7 @@ en:
|
||||||
modal:
|
modal:
|
||||||
close: Close
|
close: Close
|
||||||
preview: Preview
|
preview: Preview
|
||||||
|
sys:
|
||||||
|
not_previewable: "Preview not support"
|
||||||
|
limit_of_upload_file_size: "Upload file must be less than: %{best_size}"
|
||||||
|
|
||||||
|
|
|
@ -508,3 +508,6 @@ zh_tw:
|
||||||
modal:
|
modal:
|
||||||
close: "關閉"
|
close: "關閉"
|
||||||
preview: "預覽"
|
preview: "預覽"
|
||||||
|
sys:
|
||||||
|
not_previewable: "不支援預覽"
|
||||||
|
limit_of_upload_file_size: "上傳檔案大小限制: %{best_size}"
|
||||||
|
|
|
@ -141,6 +141,7 @@ Orbit::Application.routes.draw do
|
||||||
|
|
||||||
# routes for gridfs files
|
# routes for gridfs files
|
||||||
match "/gridfs/*path" => "gridfs#serve"
|
match "/gridfs/*path" => "gridfs#serve"
|
||||||
|
|
||||||
# match "/images/*path" => "gridfs#serve_images"
|
# match "/images/*path" => "gridfs#serve_images"
|
||||||
# match "/admin/pages/images/*path" => "gridfs#serve_images"
|
# match "/admin/pages/images/*path" => "gridfs#serve_images"
|
||||||
|
|
||||||
|
|
|
@ -20,4 +20,21 @@ module Panel::Announcement::BackEnd::BulletinsHelper
|
||||||
end
|
end
|
||||||
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
|
end
|
|
@ -14,9 +14,8 @@ module Panel::News::BackEnd::NewsBulletinsHelper
|
||||||
|
|
||||||
def show_news_bulletin_title_at_index (news_bulletin)
|
def show_news_bulletin_title_at_index (news_bulletin)
|
||||||
if news_bulletin.is_checked?
|
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 ''
|
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]
|
news_bulletin.title[I18n.locale]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -237,6 +237,8 @@
|
||||||
<div id='add_news_bulletin_file' class="info_input news_bulletin_files_block">
|
<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 %>
|
<%= 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>
|
<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>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -249,10 +251,9 @@
|
||||||
<%= render :partial => 'form_news_bulletin_file', :object => news_bulletin_file, :locals => {:f => f, :i => i} %>
|
<%= render :partial => 'form_news_bulletin_file', :object => news_bulletin_file, :locals => {:f => f, :i => i} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
|
||||||
|
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -275,17 +276,20 @@
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
||||||
<script>
|
<script>
|
||||||
$('#add_news_bulletin_link a.add').live('click', function(){
|
$(document).ready(function() {
|
||||||
var new_id = $(this).prev().attr('value');
|
$('#add_news_bulletin_link a.add').live('click', function(){
|
||||||
var old_id = new RegExp("new_news_bulletin_links", "g");
|
var new_id = $(this).prev().attr('value');
|
||||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
var old_id = new RegExp("new_news_bulletin_links", "g");
|
||||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_link', f, :news_bulletin_links) %>").replace(old_id, new_id));
|
$(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');
|
$('#add_news_bulletin_file a.add').live('click', function(){
|
||||||
var old_id = new RegExp("new_news_bulletin_files", "g");
|
var new_id = $(this).prev().attr('value');
|
||||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
var old_id = new RegExp("new_news_bulletin_files", "g");
|
||||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_file', f, :news_bulletin_files) %>").replace(old_id, new_id));
|
$(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>
|
</script>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.file_field :file %>
|
<%= 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>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
Reference in New Issue