This commit is contained in:
z9hang 2014-05-14 18:27:06 +08:00
commit 7137f2663c
17 changed files with 1152 additions and 944 deletions

View File

@ -1,6 +0,0 @@
#资源类型编辑control
class AttachmentTypeEditController < ApplicationController
def index
end
end

View File

@ -62,6 +62,17 @@ class AttachmentsController < ApplicationController
end end
end end
#更新资源文件类型
def updateType
@attachment = Attachment.find(params[:attachmentid])
if @attachment != nil
@attachment.attachtype = params[:newtype]
@attachment.save
render :text =>'success'
else
render :text=>'error'
end
end
def thumbnail def thumbnail
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size]) if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])

View File

@ -548,6 +548,14 @@ class UsersController < ApplicationController
format.api { render_validation_errors(@user) } format.api { render_validation_errors(@user) }
end end
end end
unless @user.id.nil?
#后台注册的用户默认权限为男性开发员
ue = UserExtensions.create(:identity => 3,
:gender => 0,
:user_id => @user.id)
ue.save
end
end end
def edit def edit

View File

@ -390,6 +390,16 @@ module ApplicationHelper
s.html_safe s.html_safe
end end
#扩展的checkbox生成
def principals_check_box_tags_ex(name, principals)
s = ''
principals.each do |principal|
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
end
s.html_safe
end
# Returns a string for users/groups option tags # Returns a string for users/groups option tags
def principals_options_for_select(collection, selected=nil) def principals_options_for_select(collection, selected=nil)
s = '' s = ''

View File

@ -55,7 +55,7 @@ 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

View File

@ -24,7 +24,7 @@ module MembersHelper
principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] #by young principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] #by young
principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
s = content_tag('div', principals_check_box_tags('membership[user_ids][]', principals), :id => 'principals') s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')
links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options| links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options|
link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true

View File

@ -285,6 +285,7 @@ class Attachment < ActiveRecord::Base
result result
end end
def self.attach_filesex(obj, attachments,attachment_type) def self.attach_filesex(obj, attachments,attachment_type)
result = obj.save_attachmentsex(attachments, User.current,attachment_type) result = obj.save_attachmentsex(attachments, User.current,attachment_type)
obj.attach_saved_attachments obj.attach_saved_attachments

View File

@ -191,6 +191,10 @@ class User < Principal
end end
} }
#选择项目成员时显示的用户信息文字
def userInfo
info=self.name + ' (' + self.login + ')';
end
###添加留言 fq ###添加留言 fq
def add_jour(user, notes, reference_user_id = 0, options = {}) def add_jour(user, notes, reference_user_id = 0, options = {})

View File

@ -0,0 +1,14 @@
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
<% if attachmenttypes.any? %>
<div id="put-tag-form-<%=attachment.id%>" class="hidden">
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName",attachment.attachtype), :onchange=>"attachmenttypes_change("+attachment.id.to_s + ",this.value)"%>
</div>
<%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box"+attachment.id.to_s ,
:onclick =>"$('#put-tag-form-" +attachment.id.to_s+ "').show();
$('#attach_type_id_label" +attachment.id.to_s+ "').hide();
$('#edit_box" +attachment.id.to_s+ "').hide();") if edit_allowed %>
<% end %>

View File

@ -1,24 +1,28 @@
<% selAttachType =@attachtype %>
<% selContentType =@contenttype %>
<% 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><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('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>
</thead>
<tbody> <tbody>
<% @containers.each do |container| %> <% @containers.each do |container| %>
<% next if container.attachments.empty? -%> <% next if container.attachments.empty? -%>
@ -31,10 +35,15 @@
<% end -%> <% end -%>
<% container.attachments.each do |file| %> <% container.attachments.each do |file| %>
<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; "><%= 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> -->
<td class="filesize"><%= number_to_human_size(file.filesize) %></td> <td class="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="attach_type"><%= file.attachmentstype.typeName %></td> <td class="attach_type">
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
<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="content_type"><%= file.show_suffix_type %></td>
<td class="downloads"><%= file.downloads %></td> <td class="downloads"><%= file.downloads %></td>
<!-- <td class="digest" width="300px"><%= file.description %></td> --> <!-- <td class="digest" width="300px"><%= file.description %></td> -->
@ -44,10 +53,10 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td class='description' colspan="5"> <td class='description' colspan="6">
<div class="tags_area"> <div class="tags_area">
<% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"}%> <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div> <div class="tags_gradint"></div>
</div> </div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a></div> <div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a></div>
@ -60,5 +69,4 @@
<!-- %= link_to "download all file", (downloadAll(@containers)) % --> <!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody> </tbody>
</table> </table>
</ul>

View File

@ -1,21 +1,20 @@
<% selAttachType =@attachtype %> <% selAttachType =@attachtype %>
<% selContentType =@contenttype %> <% selContentType =@contenttype %>
<% 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">
<table class="list files" id="ver-zebra1">
<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")%>
@ -23,17 +22,24 @@
<%= 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> </tr>
</thead> </thead>
<tbody> <tbody>
<% @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 isTypeOk(file,selAttachType,selContentType) %> <% 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; "><%= 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> -->
<td class="filesize"><%= number_to_human_size(file.filesize) %></td> <td class="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="attach_type"><%= file.attachmentstype.typeName %></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="content_type"><%= file.show_suffix_type %></td>
<td class="downloads"><%= file.downloads %></td> <td class="downloads"><%= file.downloads %></td>
<!-- <td class="digest" width="300px"><%= file.description %></td> --> <!-- <td class="digest" width="300px"><%= file.description %></td> -->
@ -43,9 +49,9 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td class='description' colspan="5"> <td class='description' colspan="6">
<div class="tags_area"> <div class="tags_area">
<% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div> <div class="tags_gradint"></div>
</div> </div>
@ -61,6 +67,5 @@
<!-- %= link_to "download all file", (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,225 +1,54 @@
<!-- <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(
attachments_autocomplete_path(:format => 'js'), attachments_autocomplete_path(:format => 'js'),
:remote => true, :remote => true,
:method => :post) do %> :method => :post) do %>
<%= label_tag(:atext_field_tagttach_search, "按关键字搜索:") %> <%= label_tag(:attach_search, "按关键字搜索:") %>
<%= (:attach_search) %> <%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %> <%#= submit_tag("Search") %>
<% end -%> <% end -%>
<%= 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,57 +93,96 @@
$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) {
<script type="text/javascript">
function attachmenttypes_searchex(value) {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type='
+ encodeURIComponent(value) + "&contentType=" + $('#attach_sufix_browse').val(),
type: "POST"
}).complete(function (xhr, textStatus) {
if (textStatus == 'success') { if (textStatus == 'success') {
eval(xhr.responseText); eval(xhr.responseText);
} else if (textStatus == 'error') { } else if (textStatus == 'error') {
alert('error'); alert('error');
} }
}); }
function attachmenttypes_searchex(value) {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: encodeURIComponent(value),
contentType:$('#attach_sufix_browse').val()
}
}).complete(eval_ajax);
} }
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(eval_ajax);
}
function attachtype_edit(value) {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
}
function attachmenttypes_change(id, type) {
$.ajax({
url: '<%=updateType_attachments_path%>',
type: "POST",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) { }).complete(function (xhr, textStatus) {
if (textStatus == 'success') { if (textStatus == 'success') {
eval(xhr.responseText); $.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
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');
} }
;
}); });
} }
</script> </script>

View File

@ -456,7 +456,11 @@ RedmineApp::Application.routes.draw do
get 'attachments/autocomplete' get 'attachments/autocomplete'
match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post] match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post]
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation' post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
resources :attachments, :only => [:show, :destroy] resources :attachments, :only => [:show, :destroy] do
collection do
match "updateType" , via: [:get, :post]
end
end
resources :groups do resources :groups do
member do member do

BIN
public/images/Edit/edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

File diff suppressed because it is too large Load Diff