调整资源文件界面
This commit is contained in:
parent
7e4343f00f
commit
7df6be8ff4
|
@ -224,4 +224,11 @@ private
|
|||
referer = request.headers['Referer']
|
||||
require_login unless referer =~ /softapplication/
|
||||
end
|
||||
|
||||
def renderTag
|
||||
@attachmentNew = Attachment.find(params[:attchmentId])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
</span>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 155, :placeholder => l(:label_optional_description), :class => 'description') +
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<%if @attachmentNew != nil%>
|
||||
$("#div-attachments[" + @attachmentNew.id + "]").html('<%= j(render :partial => 'tags/tag', :locals => {:obj => @attachmentNew, :object_flag => "6"})%>');
|
||||
<%end%>
|
|
@ -11,4 +11,6 @@ fileSpan.find('a.remove-upload')
|
|||
"href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
|
||||
})
|
||||
.off('click');
|
||||
var divattach = fileSpan.find('div.div_attachments');
|
||||
divattach.html('<%= j(render :partial => 'tags/tag', :locals => {:obj => @attachment, :object_flag => "6"})%>');
|
||||
<% end %>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
|
||||
:update => "tags_show",
|
||||
:complete => "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();" do |f| %>
|
||||
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
|
||||
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:style=>"width: 100px;"%>
|
||||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<%= f.submit l(:button_project_tags_add),:class => "small" %>
|
||||
|
|
|
@ -37,6 +37,7 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
mount SeemsRateable::Engine => '/rateable', :as => :rateable
|
||||
|
||||
|
||||
namespace :zipdown do
|
||||
match 'assort'
|
||||
end
|
||||
|
@ -458,9 +459,11 @@ RedmineApp::Application.routes.draw do
|
|||
get 'attachments/autocomplete'
|
||||
match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post]
|
||||
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
|
||||
get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/
|
||||
resources :attachments, :only => [:show, :destroy] do
|
||||
collection do
|
||||
match "updateType" , via: [:get, :post]
|
||||
match "renderTag" , via: [:get, :post]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
/* Redmine - project management software
|
||||
Copyright (C) 2006-2013 Jean-Philippe Lang */
|
||||
|
||||
function postUpMsg(attachmentId)
|
||||
{
|
||||
$.ajax({
|
||||
url: '/attachments/renderTag',
|
||||
type: "GET",
|
||||
data: {
|
||||
attachmentId: attachmentId
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
function addFile(inputEl, file, eagerUpload) {
|
||||
|
||||
if ($('#attachments_fields').children().length < 10) {
|
||||
|
@ -12,14 +23,15 @@ function addFile(inputEl, file, eagerUpload) {
|
|||
fileSpan.append(
|
||||
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
||||
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 255, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
|
||||
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload)
|
||||
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
|
||||
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
||||
).appendTo('#attachments_fields');
|
||||
|
||||
if(eagerUpload) {
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||
}
|
||||
if(eagerUpload) {
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||
|
||||
return attachmentId;
|
||||
}
|
||||
return attachmentId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1829,7 +1829,7 @@ fieldset#notified_events .parent { padding-left: 20px; }
|
|||
span.required {color: #bb0000;}
|
||||
.summary {font-style: italic;}
|
||||
|
||||
#attachments_fields input.description {margin-left:4px; width:340px; }
|
||||
#attachments_fields input.description {margin-left:4px; width:100px; }
|
||||
#attachments_fields span {display:block; white-space:nowrap; font-family:'微软雅黑';}
|
||||
#attachments_fields input.filename {border:0; height:1.8em; width:150px; color:#555; background-color:inherit; background:url(../images/attachment.png) no-repeat 1px 50%; padding-left:18px;}/*Modified by young*/
|
||||
#attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;}
|
||||
|
|
Loading…
Reference in New Issue