新建和编辑ISSUE,上传附件名称显示问题

This commit is contained in:
daiao 2016-11-07 15:21:00 +08:00
parent e70c66b5ac
commit 3d2d526149
3 changed files with 11 additions and 9 deletions

View File

@ -7,14 +7,15 @@
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly => 'readonly', :style=>'border:none;') %>
<%#= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly hidden', :readonly => 'readonly', :style=>'border:none;max-width:460px;width:initial;') %>
<span class="upload_filename hidden" style="border:none; max-width:460px; width:inherit; display:inline-block;" id=<%= "attachments[p#{i}][filename]" %> ><%= attachment.filename %></span>
<%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %>
<!--<span class="ispublic-label"><%#= l(:field_is_public) %>:</span>-->
<%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>
<%= if attachment.id.nil?
#待补充代码
else
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload', :style => 'vertical-align:top;')
end
%>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
@ -31,7 +32,7 @@
<span class="add_attachment" style="font-weight:normal;">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
<%= button_tag "上传附件", :id => "upload_attachments", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',

View File

@ -10,7 +10,7 @@
<!-- 鼠标不能移动是因为 href="javascript:void(0);"导致的 -->
<span> <a class="files_tag_select" ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%></a></span>
<% else%>
<span class="files_tag_icon" >
<span class="files_tag_icon break_word" >
<a title="双击可编辑"
onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(course)%>','<%= k%>','<%= @q%>','<%= course.id%>');"
ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%></a></span>

View File

@ -101,13 +101,13 @@ function addFile(inputEl, file, eagerUpload,btnId) {
});
fileSpan.append(
$('<input>', {
$('<span></span>', {
'type': 'text',
'class': 'upload_filename readonly',
'class': 'upload_filename readonly hidden',
'name': 'attachments[' + attachmentId + '][filename]',
'readonly': 'readonly',
'style': 'border:none;'
}).val(file.name),
'style': 'border:none;max-width:460px;display:inline-block;width:initial;'
}).text(file.name),
// $('<input>', {
// 'type': 'text',
// 'class': 'description',
@ -127,7 +127,8 @@ function addFile(inputEl, file, eagerUpload,btnId) {
// }).toggle(!eagerUpload),
$('<a>&nbsp</a>').attr({
'href': "#",
'class': 'remove-upload'
'class': 'remove-upload',
'style': 'vertical-align:top;'
}).click(function() {
if (confirm($(inputEl).data('areYouSure'))) {
removeFile();