From dde40ed3b3be8e50153529d9a25984a2ca4b66a0 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Tue, 28 Oct 2014 22:34:51 +0800
Subject: [PATCH] Signed-off-by: alan <547533434@qq.com>
---
app/controllers/files_controller.rb | 6 +-
app/views/files/_course_file.html.erb | 11 +-
app/views/files/_project_file.html.erb | 2 +-
app/views/files/getattachtype.html.erb | 13 +
app/views/files/getattachtype.js.erb | 22 +-
app/views/files/index.html.erb | 497 +++++++++++++------------
6 files changed, 283 insertions(+), 268 deletions(-)
create mode 100644 app/views/files/getattachtype.html.erb
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 0ee38f3f5..f34a757e2 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -84,7 +84,7 @@ class FilesController < ApplicationController
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder(sort).all
-
+ getattachtype
show_attachments @containers
render :layout => !request.xhr?
@@ -122,6 +122,7 @@ class FilesController < ApplicationController
end
end
end
+ getattachtype
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers
@@ -275,8 +276,7 @@ class FilesController < ApplicationController
respond_to do |format|
format.js
-
-
+ format.html
end
end
end
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index d00a51bc1..55a36e125 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -2,11 +2,11 @@
<% attachmenttypes = @course.attachmenttypes %>
<% sufixtypes = @course.contenttypes %>
-
- <%= l(:label_coursefile_sharingarea) %>
-
+<%= t(:label_user_course) %>资源共享区
+
+ <%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @course) %>
<%= 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, @course) %>
@@ -55,7 +55,7 @@
<% if sufixtypes.any? %>
<%= l(:attachment_sufix_browse) %>
- <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') + options_for_select(sufixtypes),
+ <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange => "course_attachment_contenttypes_searchex(this.value)" %>
<% end %>
@@ -69,4 +69,5 @@
<%= render :partial => 'course_show_all_attachment' %>
-<% html_title(l(:label_course_file)) -%>
\ No newline at end of file
+
+<% html_title(l(:label_attachment_plural)) -%>
\ No newline at end of file
diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb
index 532cf0e6c..84a86d209 100644
--- a/app/views/files/_project_file.html.erb
+++ b/app/views/files/_project_file.html.erb
@@ -72,4 +72,4 @@
<%= render :partial => 'show_all_attachment' %>
-<% html_title(l(:project_module_files)) -%>
\ No newline at end of file
+<% html_title(l(:label_attachment_plural)) -%>
\ No newline at end of file
diff --git a/app/views/files/getattachtype.html.erb b/app/views/files/getattachtype.html.erb
new file mode 100644
index 000000000..6ffba58be
--- /dev/null
+++ b/app/views/files/getattachtype.html.erb
@@ -0,0 +1,13 @@
+<% if @attachtype==0 && @contenttype=='0' %>
+ <% if @project%>
+ <%= render partial: "show_all_attachment"%>
+ <% elsif @course%>
+ <%= render partial: "course_show_all_attachment"%>
+ <%end%>
+<%else%>
+ <% if @project%>
+ <%= render partial: "sort_by_attachtypel"%>
+ <% elsif @course%>
+ <%= render partial: "course_sort_by_attachtypel"%>
+ <%end%>;
+<%end%>
diff --git a/app/views/files/getattachtype.js.erb b/app/views/files/getattachtype.js.erb
index 7acf849ce..88722073f 100644
--- a/app/views/files/getattachtype.js.erb
+++ b/app/views/files/getattachtype.js.erb
@@ -1,13 +1,13 @@
<% if @attachtype==0 && @contenttype=='0' %>
- <% if @project%>
- $("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
- <% elsif @course%>
- $("#all_browse_div").html('<%= j(render partial: "course_show_all_attachment")%>');
- <%end%>
-<%else%>
- <% if @project%>
- $("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>')
- <% elsif @course%>
- $("#all_browse_div").html('<%= j(render partial: "course_sort_by_attachtypel")%>')
- <%end%>;
+<% if @project%>
+$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
+<% elsif @course%>
+$("#all_browse_div").html('<%= j(render partial: "course_show_all_attachment")%>');
+<%end%>
+<%else%>
+<% if @project%>
+$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>')
+<% elsif @course%>
+$("#all_browse_div").html('<%= j(render partial: "course_sort_by_attachtypel")%>')
+<%end%>;
<%end%>
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index 65db74006..69b41fc28 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -1,248 +1,249 @@
-
-<% if @isproject %>
- <%= render :partial => 'project_file', locals: {project: @project} %>
-<% else %>
- <%= render :partial => 'course_file', locals: {course: @course} %>
-<% end %>
-
-
-
-
-
-
+
+<% if @isproject %>
+ <%= render :partial => 'project_file', locals: {project: @project} %>
+<% else %>
+ <%= render :partial => 'course_file', locals: {course: @course} %>
+<% end %>
+
+
+
+
+
+