diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 55a017019..a3f8ac9f6 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -48,6 +48,7 @@ module ApplicationHelper
end
end
end
+
# 获取组织成员中文名字
def get_org_member_role_name member
case member.roles[0].name
diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb
index be24629af..3dc2c66af 100644
--- a/app/helpers/attachments_helper.rb
+++ b/app/helpers/attachments_helper.rb
@@ -96,6 +96,7 @@ module AttachmentsHelper
end
false
end
+
#判断项目project中是否包含课件attachment,project中引用了attachment也算作包含
def project_contains_attachment? project,attachment
project.attachments.each do |att|
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index 57de7e3b6..9513baab0 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -102,7 +102,7 @@
- <%#= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%>
+ <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%>
diff --git a/app/views/files/_file_tools.html.erb b/app/views/files/_file_tools.html.erb
new file mode 100644
index 000000000..df4d9d738
--- /dev/null
+++ b/app/views/files/_file_tools.html.erb
@@ -0,0 +1,31 @@
+<% if User.current.logged? %>
+ <% if (is_project_manager?(User.current, @project) || file.author_id == User.current.id) && project_contains_attachment?(@project,file) %>
+ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @project.id && file.container_type == "Project" %>
+
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
+ <% if @project.is_public? %>
+ -
+
+ <%= link_to (file.is_public? ? "设为私有":"设为公开"),
+ update_file_dense_attachments_path(:attachmentid=>file.id,
+ :newtype=>(file.is_public? ? 0:1)),
+ :remote=>true,
+ :class=>"postOptionLink",
+ :method => :post %>
+
+
+ <%end%>
+ -
+ <%= link_to( '删除资源', attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @project.id && file.container_type == "Project" && file.destroyable %>
+
+
+ <% end %>
+ <%else%>
+
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
+
+ <% end %>
+<% end %>
diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb
index a92a925a5..31a23d9ed 100644
--- a/app/views/files/_project_file.html.erb
+++ b/app/views/files/_project_file.html.erb
@@ -97,7 +97,7 @@
- <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:project => @project, :tag_name => @tag_name}%>
+ <%= render :partial => "files/tag_yun_project", :locals => {:tag_list => @tag_list,:project => @project, :tag_name => @tag_name}%>
- <%#= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
+ <%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
<% html_title(l(:label_attachment_plural)) -%>
\ No newline at end of file
diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb
new file mode 100644
index 000000000..1b4e96a8d
--- /dev/null
+++ b/app/views/files/_project_list.html.erb
@@ -0,0 +1,59 @@
+<% delete_allowed = User.current.allowed_to?(:manage_files, project) %>
+<% project_attachments.each do |file| %>
+ <% if file.is_public? || User.current.member_of?(project) || User.current.admin? %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s,
+ :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+
+
+
上传时间:<%= format_date(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+
+
+
+ -
+ <%= render :partial => 'file_tools', :locals => {:project => @project, :file => file, :tag_name => @tag_name, :delete_allowed => delete_allowed} %>
+
+
+
+
+
+
+
+
+ <% else %>
+
<%= file.filename %>是私有资源
+ <% end %>
+<% end %>
+
+<% if project_attachments.count == 10%>
+ <% if params[:action] == 'search' %>
+ <%=link_to "点击展开更多", search_project_files_path({:project_id => project.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%else%>
+ <%=link_to "点击展开更多", project_files_path({:project_id => project.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%end%>
+<% end%>
+
diff --git a/app/views/files/_tag_yun_project.html.erb b/app/views/files/_tag_yun_project.html.erb
new file mode 100644
index 000000000..5be0baa1e
--- /dev/null
+++ b/app/views/files/_tag_yun_project.html.erb
@@ -0,0 +1,19 @@
+<% if project && tag_list && tag_list.empty? == false%>
+
+ 全部
+<% end %>
+<% unless tag_list.nil?%>
+ <% tag_list.each do |k,v|%>
+ <% if tag_name && tag_name == k%>
+
+
<%= k%> x<%= v%>
+ <% else%>
+
+ <%= k%> x<%= v%>
+ <% end%>
+ <% end%>
+<% end%>
\ No newline at end of file
diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb
index f7dcc40f5..d6506e010 100644
--- a/app/views/layouts/base_projects.html.erb
+++ b/app/views/layouts/base_projects.html.erb
@@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
- <%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
+ <%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','course','jquery/jquery-ui-1.9.2','header','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %>
<%= call_hook :view_layouts_base_html_head %>