parent
284e6ba20a
commit
25dba88a08
|
@ -74,6 +74,7 @@ class FilesController < ApplicationController
|
||||||
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
||||||
|
|
||||||
@attachtype = params[:type].to_i
|
@attachtype = params[:type].to_i
|
||||||
|
@contenttype = params[:contentType].to_s
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -44,9 +44,22 @@ module FilesHelper
|
||||||
File.new(zipfile_name,'w+')
|
File.new(zipfile_name,'w+')
|
||||||
end
|
end
|
||||||
|
|
||||||
def browseByCategory
|
# 判断指定的资源时候符合类型
|
||||||
isCategoryBrowser = 1
|
def isTypeOk(attachment, type, contentType)
|
||||||
#isCategoryBrowser
|
result = false
|
||||||
|
if type != 0
|
||||||
|
if attachment.attachtype == type
|
||||||
|
result = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
result = true
|
||||||
|
end
|
||||||
|
if result
|
||||||
|
if contentType != l(:attachment_all) && contentType != attachment.suffix_type
|
||||||
|
result = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<% if attachmenttypes.any? %>
|
<% if attachmenttypes.any? %>
|
||||||
<p> <label for="attachment_type"><%=l(:attachment_type)%></label>
|
<p> <label for="attachment_type"><%=l(:attachment_type)%></label>
|
||||||
<%= select_tag "attachment_type", content_tag('option', '') +
|
<%= select_tag "attachment_type",
|
||||||
options_from_collection_for_select(attachmenttypes, "id",
|
options_from_collection_for_select(attachmenttypes, "id",
|
||||||
"typeName") %>
|
"typeName") %>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<% selAttachType =@attachtype %>
|
<% selAttachType =@attachtype %>
|
||||||
|
<% selContentType =@contenttype %>
|
||||||
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||||
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||||
<div id="catarory_browse_div" class="catarory_browse_div">
|
<div id="catarory_browse_div" class="catarory_browse_div">
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
<% @containers.each do |container| %>
|
<% @containers.each do |container| %>
|
||||||
<% next if container.attachments.empty? -%>
|
<% next if container.attachments.empty? -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
<% if file.attachtype==selAttachType %>
|
<% if isTypeOk(file,selAttachType,selContentType) %>
|
||||||
<tr class="file <%= cycle("odd", "odd") %>">
|
<tr class="file <%= cycle("odd", "odd") %>">
|
||||||
<td class="filename" style="font-size: 13px; width: 240px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
<td class="filename" style="font-size: 13px; width: 240px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||||
<td class="created_on"><%= format_time(file.created_on) %></td>
|
<td class="created_on"><%= format_time(file.created_on) %></td>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<% if @attachtype==0%>
|
<% if @attachtype==0 && @contenttype==l(:attachment_all)%>
|
||||||
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
|
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
|
||||||
<%else%>
|
<%else%>
|
||||||
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>');
|
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>');
|
||||||
|
|
|
@ -184,13 +184,15 @@
|
||||||
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
|
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
|
||||||
|
|
||||||
<% if attachmenttypes.any? %>
|
<% if attachmenttypes.any? %>
|
||||||
<label for="attachment_browse"><%=l(:attachment_browse)%></label>
|
|
||||||
<%= select_tag "attachment_browse", content_tag('option', '') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
|
<label for="attachment_browse_label"><%=l(:attachment_browse)%></label>
|
||||||
|
<%= select_tag "attachment_browse", content_tag('option',l(:attachment_all)) +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
|
||||||
:onchange=>"attachmenttypes_searchex(this.value)"%>
|
:onchange=>"attachmenttypes_searchex(this.value)"%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if sufixtypes.any? %>
|
<% if sufixtypes.any? %>
|
||||||
<label for=""><%=l(:attachment_sufix_browse)%></label>
|
|
||||||
<%= select_tag "attach_sufix_browse", content_tag('option', '') +options_for_select(sufixtypes),
|
<label for="attach_sufix_browse_label"><%=l(:attachment_sufix_browse)%></label>
|
||||||
|
<%= select_tag "attach_sufix_browse", content_tag('option', l(:attachment_all)) +options_for_select(sufixtypes),
|
||||||
:onchange=>"attachment_contenttypes_searchex(this.value)"%>
|
:onchange=>"attachment_contenttypes_searchex(this.value)"%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
@ -286,7 +288,8 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function attachmenttypes_searchex(value) {
|
function attachmenttypes_searchex(value) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type=' + encodeURIComponent(value),
|
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type='
|
||||||
|
+ encodeURIComponent(value) + "&contentType=" + $('#attach_sufix_browse').val(),
|
||||||
type: "POST"
|
type: "POST"
|
||||||
|
|
||||||
}).complete(function (xhr, textStatus) {
|
}).complete(function (xhr, textStatus) {
|
||||||
|
@ -295,13 +298,14 @@
|
||||||
} else if (textStatus == 'error') {
|
} else if (textStatus == 'error') {
|
||||||
alert('error');
|
alert('error');
|
||||||
}
|
}
|
||||||
;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachment_contenttypes_searchex(value) {
|
function attachment_contenttypes_searchex(value) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type=' + encodeURIComponent(value),
|
|
||||||
|
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type='
|
||||||
|
+ $('#attachment_browse').val() + "&contentType=" + encodeURIComponent(value),
|
||||||
type: "POST"
|
type: "POST"
|
||||||
|
|
||||||
}).complete(function (xhr, textStatus) {
|
}).complete(function (xhr, textStatus) {
|
||||||
|
|
|
@ -132,6 +132,7 @@ en:
|
||||||
|
|
||||||
actionview_instancetag_blank_option: Please select
|
actionview_instancetag_blank_option: Please select
|
||||||
|
|
||||||
|
attachment_all: "All"
|
||||||
attachment_browse: "Attachment Content Browse"
|
attachment_browse: "Attachment Content Browse"
|
||||||
attachment_sufix_browse: "Attachment Type Browse"
|
attachment_sufix_browse: "Attachment Type Browse"
|
||||||
attachment_type: "Attachment Type"
|
attachment_type: "Attachment Type"
|
||||||
|
|
|
@ -140,6 +140,7 @@ zh:
|
||||||
|
|
||||||
actionview_instancetag_blank_option: 请选择
|
actionview_instancetag_blank_option: 请选择
|
||||||
|
|
||||||
|
attachment_all: "全部"
|
||||||
attachment_sufix_browse: "文件类型"
|
attachment_sufix_browse: "文件类型"
|
||||||
attachment_browse: "内容类型"
|
attachment_browse: "内容类型"
|
||||||
attachment_type: '资源分类'
|
attachment_type: '资源分类'
|
||||||
|
|
Loading…
Reference in New Issue