This commit is contained in:
yanxd 2014-05-14 17:12:04 +08:00
parent 4235ca8984
commit 829c77879a
6 changed files with 1080 additions and 972 deletions

View File

@ -55,9 +55,9 @@ module FilesHelper
result = true result = true
end end
if result if result
if contentType != l(:attachment_all) && contentType != attachment.suffix_type if contentType != '0' && contentType != attachment.suffix_type
result = false result = false
end end
end end
result result
end end

View File

@ -3,72 +3,72 @@
<% attachmenttypes = @project.attachmenttypes %> <% attachmenttypes = @project.attachmenttypes %>
<% 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) %>
<ul id="all_browse_ul"> <table class="list files" id="ver-zebra">
<table class="list files" id="ver-zebra" > <colgroup>
<colgroup> <col class="vzebra-odd"/>
<col class="vzebra-odd" /> <col class="vzebra-even"/>
<col class="vzebra-even" /> <col class="vzebra-odd"/>
<col class="vzebra-odd" /> <col class="vzebra-even"/>
<col class="vzebra-even" /> <!-- <col class="vzebra-odd"/> -->
<col class="vzebra-odd" /> </colgroup>
</colgroup> <thead>
<thead><tr> <tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%> <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
<%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope =>"col" , :id => "vzebra-comedy")%> <%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope =>"col", :id=> "vzebra-children")%> <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%> <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> --> <!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr></thead> </tr>
<tbody> </thead>
<% @containers.each do |container| %> <tbody>
<% next if container.attachments.empty? -%> <% @containers.each do |container| %>
<% if container.is_a?(Version) -%> <% next if container.attachments.empty? -%>
<tr> <% if container.is_a?(Version) -%>
<th colspan="5" align="left" style="line-height: 30px; font-size: 14px; "> <tr>
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> <th colspan="5" align="left" style="line-height: 30px; font-size: 14px; ">
</th> <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %>
</tr> </th>
<% end -%> </tr>
<% container.attachments.each do |file| %>
<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="created_on"><%= format_time(file.created_on) %></td>
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="attach_type">
<div id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></div>
&nbsp;
<div id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes,
:attachment => file,:contentype=>selContentType} %>
</div>
</td>
<td class="content_type"><%= file.show_suffix_type %></td>
<td class="downloads"><%= file.downloads %></td>
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
<td align="center">
<%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td>
</tr>
<tr>
<td class='description' colspan="5">
<div class="tags_area">
<% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"}%>
<div class="tags_gradint"></div>
</div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a></div>
</td>
</tr>
<% end -%>
<% reset_cycle %>
<% end -%> <% end -%>
<!-- %= h downloadAll(@containers) % --> <% container.attachments.each do |file| %>
<!-- %= link_to "download all file", (downloadAll(@containers)) % --> <tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; "><%= 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="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="attach_type">
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
&nbsp;
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes,
:attachment => file, :contentype => selContentType} %>
</span>
</td>
<td class="content_type"><%= file.show_suffix_type %></td>
<td class="downloads"><%= file.downloads %></td>
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
<td align="center">
<%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td>
</tr>
<tr>
<td class='description' colspan="6">
<div class="tags_area">
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div>
</div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a></div>
</td>
</tr>
<% end -%>
<% reset_cycle %>
<% end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody> </tbody>
</table> </table>
</ul>

View File

@ -3,73 +3,69 @@
<% attachmenttypes = @project.attachmenttypes %> <% attachmenttypes = @project.attachmenttypes %>
<% 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"> <table class="list files" id="ver-zebra">
<ul id="catarory_browse_ul"> <colgroup>
<table class="list files" id="ver-zebra1"> <col class="vzebra-odd"/>
<colgroup> <col class="vzebra-even"/>
<col class="vzebra-odd"/> <col class="vzebra-odd"/>
<col class="vzebra-even"/> <col class="vzebra-even"/>
<col class="vzebra-odd"/> <!-- <col class="vzebra-odd"/> -->
<col class="vzebra-even"/> </colgroup>
<col class="vzebra-odd"/> <thead>
</colgroup> <tr>
<thead> <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
<tr> <%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %> <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
<%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %> <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> <!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> </tr>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> --> </thead>
</tr> <tbody>
</thead> <% @containers.each do |container| %>
<tbody> <% next if container.attachments.empty? -%>
<% @containers.each do |container| %> <% container.attachments.each do |file| %>
<% next if container.attachments.empty? -%> <% if isTypeOk(file,selAttachType,selContentType) %>
<% container.attachments.each do |file| %> <tr class="file <%= cycle("odd", "odd") %>">
<% if isTypeOk(file,selAttachType,selContentType) %> <td class="filename" style="font-size: 13px; "><%= 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>
<tr class="file <%= cycle("odd", "odd") %>"> <!-- <td class="created_on"><%#= format_time(file.created_on) %></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="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="created_on"><%= format_time(file.created_on) %></td> <td class="attach_type">
<td class="filesize"><%= number_to_human_size(file.filesize) %></td> <span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
<td class="attach_type"> &nbsp;
<div id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></div> <span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
&nbsp; <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes,
<div id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;"> :attachment => file,:contentype=>selContentType} %>
<%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, </span>
:attachment => file,:contentype=>selContentType} %> </td>
</div> <td class="content_type"><%= file.show_suffix_type %></td>
</td> <td class="downloads"><%= file.downloads %></td>
<td class="content_type"><%= file.show_suffix_type %></td> <!-- <td class="digest" width="300px"><%= file.description %></td> -->
<td class="downloads"><%= file.downloads %></td> <td align="center">
<!-- <td class="digest" width="300px"><%= file.description %></td> --> <%= link_to(image_tag('delete.png'), attachment_path(file),
<td align="center"> :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
<%= link_to(image_tag('delete.png'), attachment_path(file), </td>
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> </tr>
</td> <tr>
</tr> <td class='description' colspan="6">
<tr> <div class="tags_area">
<td class='description' colspan="5"> <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<div class="tags_area"> <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> <div class="tags_gradint"></div>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> </div>
<div class="tags_gradint"></div> <div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
</div> </div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a> </td>
</div> </tr>
</td> <% end -%>
</tr> <% end -%>
<% end -%> <% reset_cycle %>
<% end -%> <% end -%>
<% reset_cycle %> <!-- %= h downloadAll(@containers) % -->
<% end -%> <!-- %= link_to "download all file", (downloadAll(@containers)) % -->
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody> </tbody>
</table> </table>
</ul>
</div>

View File

@ -1,5 +1,5 @@
<% if @attachtype==0 && @contenttype==l(:attachment_all)%> <% if @attachtype==0 && @contenttype=='0' %>
$("#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")%>');
<%end%> <%end%>

View File

@ -1,205 +1,34 @@
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 --> <!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
<% attachmenttypes = @project.attachmenttypes %> <% attachmenttypes = @project.attachmenttypes %>
<% sufixtypes = @project.contenttypes %> <% sufixtypes = @project.contenttypes %>
<style>
#ver-zebra, .file_table_des
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: 12px;
margin: 5px 10px;
width: 98%;
text-align: left;
border-collapse: collapse;
line-height: 20px;
font-size: 14px;
}
#ver-zebra th
{
font-size: 14px;
font-weight: normal;
padding: 12px 15px;
border-right: 1px solid #fff;
border-left: 1px solid #fff;
color: #039;
text-align: left;
}
#ver-zebra td
{
padding: 8px 15px;
border-right: 1px solid #fff;
border-left: 1px solid #fff;
color: #669;
}
#ver-zebra td.description {
background-color: white;
padding: 0px;
margin: 0px auto;
}
#ver-zebra1, .file_table_des
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: 12px;
margin: 5px 10px;
width: 98%;
text-align: left;
border-collapse: collapse;
line-height: 20px;
font-size: 14px;
}
#ver-zebra1 th
{
font-size: 14px;
font-weight: normal;
padding: 12px 15px;
border-right: 1px solid #fff;
border-left: 1px solid #fff;
color: #039;
text-align: left;
}
#ver-zebra1 td
{
padding: 8px 15px;
border-right: 1px solid #fff;
border-left: 1px solid #fff;
color: #669;
}
#ver-zebra1 td.description {
background-color: white;
padding: 0px;
margin: 0px auto;
}
div.tags_area {
padding: 2px 10px 10px 10px;
margin: 0px;
margin-bottom: 10px;
/*border-bottom: 1px dashed #CCCCCC;*/
overflow: hidden;
position: relative;
}
.tags_gradint {
}
.read-more{
padding: 5px;
border-top: 4px double #ddd;
background: #fff;
color: #333;
}
.read-more a{
padding-right: 22px;
background: no-repeat 100% 50%;
font-weight: bold;
text-decoration: none;
}
.read-more a:hover{
color: #000;
}
.vzebra-odd
{
background: #eff2ff;
}
.vzebra-even
{
background: #e8edff;
}
#ver-zebra #vzebra-adventure, #ver-zebra #vzebra-children
{
background: #ffffff;
border-bottom: 1px solid #c8d4fd;
}
#ver-zebra #vzebra-comedy, #ver-zebra #vzebra-action
{
background: #ffffff;
border-bottom: 1px solid #d6dfff;
}
#ver-zebra1 #vzebra-adventure, #ver-zebra #vzebra-children
{
background: #ffffff;
border-bottom: 1px solid #c8d4fd;
}
#ver-zebra1 #vzebra-comedy, #ver-zebra #vzebra-action
{
background: #ffffff;
border-bottom: 1px solid #d6dfff;
}
.filename{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
div.pagination{
margin: 10px 0px;
height: 1.5em;
text-align: left;
font-size: 13px;
}
.m5p5{
display: inline-block;
height: auto;
color: white !important;
margin: 8px;
padding: 3px 7px;
}
.m5p5:hover {
text-decoration: none;
/*padding-bottom: 3px;*/
/*border-bottom: 1px solid #666666;*/
border-radius: 4px;
border: 1px solid #15bccf;
box-shadow: 3px 3px 3px #666666;
}
.relation_file_div{
margin: 0px 25px;
}
.relation_file_div fieldset{
margin: 0px 0px;
padding: 10px;
border-radius: 5px;
transition: all 2s linear 1s;
}
.relation_file_div input#attach_search:focus{
border: 1px solid #1B95C6;
box-shadow: 0px 0px 4px #1B95C6;
width: 200px;
}
.relation_file_div input#attach_search{
width: 150px;
outline: none;
border-radius: 5px;
-webkit-transition: 1s width;
-moz-transition : 1s width;
-o-transition : 1s width;
transition : 1s width;
}
</style>
<span class="borad-title"><%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区</span>
<span class="borad-title"><%=(@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区</span>
<div class="content-title-top"> <div class="content-title-top">
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %> <%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<div class="clearfix"></div> <div class="clearfix"></div>
<div id="file_buttons" class="nhidden"> <div id="file_buttons" class="nhidden">
<%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> <%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to( l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %> <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") 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) %> <%= 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? %>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%=l(:attachment_browse)%></label> <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"), <%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +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? %>
&nbsp; &nbsp;
<label for="attach_sufix_browse_label"><%=l(:attachment_sufix_browse)%></label> <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), <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange=>"attachment_contenttypes_searchex(this.value)"%> :onchange => "attachment_contenttypes_searchex(this.value)" %>
<% end %> <% end %>
<div id="upload_file_div" class="relation_file_div hidden" > <div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'new', locals: {project: @project}%> <%= render :partial => 'new', locals: {project: @project} %>
</div> </div>
<div id="relation_file_div" class="relation_file_div hidden" > <div id="relation_file_div" class="relation_file_div hidden">
<fieldset> <fieldset>
<legend>搜索</legend> <legend>搜索</legend>
<%= form_tag( <%= form_tag(
@ -213,13 +42,13 @@
<%= form_tag attach_relation_path(:format => 'js'), <%= form_tag attach_relation_path(:format => 'js'),
method: :post, method: :post,
remote: true, remote: true,
id:"relation_file_form", id: "relation_file_form",
:class => 'hidden' do %> :class => 'hidden' do %>
<%= hidden_field_tag(:class_name, 'Project') %> <%= hidden_field_tag(:class_name, 'Project') %>
<%= hidden_field_tag(:class_id, params[:project_id]) %> <%= hidden_field_tag(:class_id, params[:project_id]) %>
<div id="relation_file" > <div id="relation_file">
</div> </div>
<div class="kclearfix" style='margin-top: 10px;' > <div class="kclearfix" style='margin-top: 10px;'>
<%= submit_tag(l(:button_add)) -%> <%= submit_tag(l(:button_add)) -%>
</div> </div>
<% end -%> <% end -%>
@ -234,15 +63,15 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<div id="all_browse_div" class="all_browse_div" > <div id="all_browse_div" class="all_browse_div">
<%= render :partial => 'show_all_attachment'%> <%= render :partial => 'show_all_attachment' %>
</div> </div>
<% html_title(l(:label_attachment_plural)) -%> <% html_title(l(:label_attachment_plural)) -%>
<script type='text/javascript'> <script type='text/javascript'>
var slideHeight = 29; var slideHeight = 29;
function readmore (aNode) { function readmore(aNode) {
// console.log(aNode) // console.log(aNode)
// var $td_tags_area = $(aNode).parent().parent(); // var $td_tags_area = $(aNode).parent().parent();
var $td_tags_area = $(aNode).parent().parent().parent().parent(); var $td_tags_area = $(aNode).parent().parent().parent().parent();
@ -253,7 +82,7 @@
var $tags = $td_tags_area.find('#tags') var $tags = $td_tags_area.find('#tags')
var $icona = $td_tags_area.find('.tags_icona') var $icona = $td_tags_area.find('.tags_icona')
var slideHeight = 20; //px var slideHeight = 5; //px
var defHeight = $tags.height(); var defHeight = $tags.height();
var curHeight = $tags_area.height(); var curHeight = $tags_area.height();
@ -264,90 +93,92 @@
$read_more_a.html('隐藏'); $read_more_a.html('隐藏');
$icona.html('<%=image_tag "/images/sidebar/minus.png"%>') $icona.html('<%=image_tag "/images/sidebar/minus.png"%>')
$tags_gradint.fadeOut(); $tags_gradint.fadeOut();
}else{ } else {
$tags_area.animate({ $tags_area.animate({
height: slideHeight height: slideHeight
}, 'normal'); }, 'normal');
$read_more_a.html('更多'); $read_more_a.html('更多');
$icona.html('<%=image_tag "/images/sidebar/add.png"%>') $icona.html('<%=image_tag "/images/sidebar/add.png"%>')
$tags_gradint.fadeIn(); $tags_gradint.fadeIn();
}; }
;
} }
$(function () { $(function () {
var slideHeight = 20; //px var slideHeight = 20; //px
var defHeight = $('.tags_area').height(); var defHeight = $('.tags_area').height();
if (defHeight >= slideHeight) { if (defHeight >= slideHeight) {
$('.tags_area').css('height', slideHeight +'px'); $('.tags_area').css('height', slideHeight + 'px');
}; }
;
}); });
</script> function eval_ajax (xhr, textStatus) {
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
}
<script type="text/javascript">
function attachmenttypes_searchex(value) { function attachmenttypes_searchex(value) {
$.ajax({ $.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type=' url: '<%=getattachtype_project_files_path(project_id: @project)%>',
+ encodeURIComponent(value) + "&contentType=" + $('#attach_sufix_browse').val(), type: "POST",
type: "POST" data: {
type: encodeURIComponent(value),
contentType:$('#attach_sufix_browse').val()
}
}).complete(function (xhr, textStatus) { }).complete(eval_ajax);
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
});
} }
function attachment_contenttypes_searchex(value) { function attachment_contenttypes_searchex(value) {
$.ajax({ $.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type=' url: '<%=getattachtype_project_files_path(project_id: @project)%>',
+ $('#attachment_browse').val() + "&contentType=" + encodeURIComponent(value), type: "POST",
type: "POST" data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(function (xhr, textStatus) { }).complete(eval_ajax);
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
;
});
} }
</script>
<script type='text/javascript'>
function attachtype_edit(value) { function attachtype_edit(value) {
$.ajax({ $.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type=' url: '<%=getattachtype_project_files_path(project_id: @project)%>',
+ $('#attachment_browse').val() + "&contentType=" + encodeURIComponent(value), type: "POST",
type: "POST" data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(function (xhr, textStatus) { }).complete(eval_ajax);
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
;
});
} }
function attachmenttypes_change(id,type) { function attachmenttypes_change(id, type) {
$.ajax({ $.ajax({
url: '<%=updateType_attachments_path%>' + '?attachmentid=' +encodeURIComponent(id) + "&newtype="+encodeURIComponent(type) , url: '<%=updateType_attachments_path%>',
type: "POST" type: "POST",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) { }).complete(function (xhr, textStatus) {
if (textStatus == 'success') { if (textStatus == 'success') {
$.ajax({ $.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type=' url: '<%=getattachtype_project_files_path(project_id: @project)%>',
+ $('#attachment_browse').val() + "&contentType=" +$('#attach_sufix_browse').val(), type: "POST",
type: "POST" data: {
type: $('#attachment_browse').val(),
contentType: $('#attach_sufix_browse').val()
}
}).error(function () {
alert('error');
}); });
} else if (textStatus == 'error') { } else if (textStatus == 'error') {
alert('error'); alert('error');

File diff suppressed because it is too large Load Diff