#1968 解决IE8不能上传的问题, 只是解决,体验还是没有chrome,firefox的好

This commit is contained in:
guange 2015-03-14 12:01:08 +08:00
parent 08eae0e5eb
commit bcb162c600
4 changed files with 14 additions and 5 deletions

View File

@ -27,8 +27,10 @@ group :development do
gem 'grape-swagger'
#gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
#gem 'puma'
gem 'pry-rails'
gem 'pry-byebug'
#gem 'pry-rails'
#gem 'pry-byebug'
#gem 'pry-stack_explorer'
#gem 'pry-debugger'
gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
end

View File

@ -1994,4 +1994,10 @@ module ApplicationHelper
end
technical_title
end
def ie8?
request.env["HTTP_USER_AGENT"] =~ /MSIE 8.0/
end
end

View File

@ -22,13 +22,13 @@
</span>
</div>
<button name="button" class="f_l ml10" onclick="_file.click()" onmouseover="this.focus()" type="button" style="width:20%; height:26%;"><%= l(:label_browse)%></button>
<button name="button" class="f_l ml10" onclick="_file.click()" onmouseover="this.focus()" type="button" style="<%= ie8? ? 'display:none' : '' %>; width:20%; height:26%;"><%= l(:label_browse)%></button>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => 'display:none',
:style => ie8? ? '': 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),

View File

@ -4,7 +4,8 @@
<div class="upload_box">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form") do %>
<%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
<%= render :partial => 'attachement_list',:locals => {:course => course} %>
<div class="cl"></div>