From 51e22cc2a9963bdb234fc1c0879c175e4cf85600 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Tue, 28 Oct 2014 17:38:32 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=20#1383=20=E9=A1=B9=E7=9B=AE--wiki?=
=?UTF-8?q?=EF=BC=9A=E7=BC=96=E8=BE=91wiki=E5=8D=B4=E4=B8=8D=E8=83=BD?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E5=B7=B2=E7=BB=8F=E6=88=90=E5=8A=9F=E4=B8=8A?=
=?UTF-8?q?=E4=BC=A0=E7=9A=84=E9=99=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/wiki/edit.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb
index 1fdbcf92f..88c280608 100644
--- a/app/views/wiki/edit.html.erb
+++ b/app/views/wiki/edit.html.erb
@@ -46,7 +46,7 @@
<%=l(:label_attachment_plural)%>
- <%= render :partial => 'attachments/form' %>
+ <%= render :partial => 'attachments/form',:locals => {:container => @page} %>
From 95c2edad208562133f9f1527a526f602f15812d9 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Tue, 28 Oct 2014 19:48:51 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E3=80=8A=E6=96=B0?=
=?UTF-8?q?=E5=BB=BA=E7=89=88=E6=9C=AC=E6=97=B6=E8=BE=93=E5=85=A5wiki?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=BA=E9=9D=9E=E6=B1=89=E5=AD=97=E7=B1=BB?=
=?UTF-8?q?=E5=9E=8B=E4=B8=94=E9=95=BF=E5=BA=A6=E5=A4=9F=E9=95=BF=EF=BC=8C?=
=?UTF-8?q?=E7=82=B9=E5=87=BB=E6=8F=90=E4=BA=A4=E6=8A=A5500=E9=94=99?=
=?UTF-8?q?=E8=AF=AF=E3=80=8B=20Signed-off-by:=20alan=20<547533434@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/files_controller.rb | 2 ++
app/views/files/index.html.erb | 2 +-
app/views/versions/_form.html.erb | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index ee524ec55..0ee38f3f5 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -275,6 +275,8 @@ class FilesController < ApplicationController
respond_to do |format|
format.js
+
+
end
end
end
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index fcf54de75..65db74006 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -105,7 +105,7 @@
}
function course_attachmenttypes_searchex(value) {
- <% if @course%>
+ <% if @course %>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
diff --git a/app/views/versions/_form.html.erb b/app/views/versions/_form.html.erb
index df3b2ec4b..72c95ad7f 100644
--- a/app/views/versions/_form.html.erb
+++ b/app/views/versions/_form.html.erb
@@ -15,7 +15,7 @@
From dc5525f1000f5d11cbf09a7a5793af5bfe87186f Mon Sep 17 00:00:00 2001
From: gonglexin <18008490802@163.com>
Date: Tue, 28 Oct 2014 20:21:15 +0800
Subject: [PATCH 3/6] =?UTF-8?q?#1182=20=E4=BF=AE=E6=AD=A3wiki=E5=8E=86?=
=?UTF-8?q?=E5=8F=B2=E7=BA=AA=E5=BD=95=E6=9F=A5=E7=9C=8B=E5=B7=AE=E5=88=AB?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AE=BD=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/wiki/diff.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/wiki/diff.html.erb b/app/views/wiki/diff.html.erb
index c4769cdfa..adeaa7cab 100644
--- a/app/views/wiki/diff.html.erb
+++ b/app/views/wiki/diff.html.erb
@@ -28,6 +28,6 @@
-
+
<%= simple_format_without_paragraph @diff.to_html %>
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 4/6] 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 | 20 +-
app/views/files/index.html.erb | 497 +++++++++++++------------
6 files changed, 282 insertions(+), 267 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%>
+<% 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: "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 %>
+
+
+
+
+
+
From 2bd08d1aaac22419ab3399cef4d01074bdd6c69d Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Tue, 28 Oct 2014 23:38:14 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E3=80=8A=E9=80=89?=
=?UTF-8?q?=E5=AE=9A=E4=BA=86=E5=86=85=E5=AE=B9=E7=B1=BB=E5=9E=8B=E5=90=8E?=
=?UTF-8?q?=E5=86=8D=E7=82=B9=E5=87=BB=E8=A1=A8=E5=A4=B4=E8=BF=9B=E8=A1=8C?=
=?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=80=BB=E6=98=AF=E8=BF=94=E5=9B=9E=E4=B8=80?=
=?UTF-8?q?=E4=B8=AA=E7=A9=BA=E7=99=BD=E9=A1=B5=E3=80=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: alan <547533434@qq.com>
---
app/controllers/files_controller.rb | 68 +++++--
app/views/files/_course_file.html.erb | 11 +-
app/views/files/_project_file.html.erb | 12 +-
app/views/files/getattachtype.html.erb | 262 +++++++++++++++++++++++--
4 files changed, 325 insertions(+), 28 deletions(-)
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index f34a757e2..3d1970656 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,7 +122,7 @@ class FilesController < ApplicationController
end
end
end
- getattachtype
+
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers
@@ -262,21 +262,63 @@ class FilesController < ApplicationController
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
+ sort=''
+ if params[:sort]
+ params[:sort].split(",").each do |sort_type|
+ order_by = sort_type.split(":")
+
+ case order_by[0]
+ when "filename"
+ attribute = "filename"
+ when "size"
+ attribute = "filesize"
+ when "attach_type"
+ attribute = "attachtype"
+ when "content_type"
+ attribute = "created_on"
+ when "field_file_dense"
+ attribute = "is_public"
+ when "downloads"
+ attribute = "downloads"
+ when "created_on"
+ attribute = "created_on"
+ end
+
+ if order_by.count == 1
+ sort += "#{Attachment.table_name}.#{attribute} asc "
+ elsif order_by.count == 2
+ sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
+ end
+ if sort_type != params[:sort].split(",").last
+ sort += ","
+ end
+ end
+ end
if @project
+ @isproject = true
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
- @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
- elsif @course
- @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
- end
- show_attachments @containers
+ @containers += @project.versions.includes(:attachments).reorder(sort).all
- @attachtype = params[:type].to_i
- @contenttype = params[:contentType].to_s
-
- respond_to do |format|
- format.js
- format.html
+ show_attachments @containers
+ @attachtype = params[:type].to_i
+ @contenttype = params[:contentType].to_s
+ render :layout => 'base_projects'
+ elsif @course
+ @isproject = false
+ @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
+ show_attachments @containers
+ @attachtype = params[:type].to_i
+ @contenttype = params[:contentType].to_s
+ render :layout => 'base_courses'
end
+
+
+
+ # 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 55a36e125..a1dae9a33 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -67,7 +67,16 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
- <%= render :partial => 'course_show_all_attachment' %>
+ <%#= render :partial => 'course_show_all_attachment' %>
+ <% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %>
+
+ <%= render partial: "course_show_all_attachment"%>
+
+ <%else%>
+
+ <%= render partial: "course_sort_by_attachtypel"%>
+
+ <%end%>
<% 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 84a86d209..315314828 100644
--- a/app/views/files/_project_file.html.erb
+++ b/app/views/files/_project_file.html.erb
@@ -69,7 +69,17 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
- <%= render :partial => 'show_all_attachment' %>
+ <%#= render :partial => 'show_all_attachment' %>
+ <% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %>
+
+ <%= render partial: "show_all_attachment"%>
+
+
+ <%else%>
+
+ <%= render partial: "sort_by_attachtypel"%>
+
+ <%end%>
<% 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
index 6ffba58be..7f67189ac 100644
--- a/app/views/files/getattachtype.html.erb
+++ b/app/views/files/getattachtype.html.erb
@@ -1,13 +1,249 @@
-<% 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%>
+
+<% if @isproject %>
+ <%= render :partial => 'project_file', locals: {project: @project} %>
+<% else %>
+ <%= render :partial => 'course_file', locals: {course: @course} %>
+<% end %>
+
+
+
+
+
+
From a6698bf2f1d9f6457355804858b554a8bc349657 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Tue, 28 Oct 2014 23:48:58 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E3=80=8A=E9=80=89?=
=?UTF-8?q?=E5=AE=9A=E4=BA=86=E5=86=85=E5=AE=B9=E7=B1=BB=E5=9E=8B=E5=90=8E?=
=?UTF-8?q?=E5=86=8D=E7=82=B9=E5=87=BB=E8=A1=A8=E5=A4=B4=E8=BF=9B=E8=A1=8C?=
=?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=80=BB=E6=98=AF=E8=BF=94=E5=9B=9E=E4=B8=80?=
=?UTF-8?q?=E4=B8=AA=E7=A9=BA=E7=99=BD=E9=A1=B5=E3=80=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: alan <547533434@qq.com>
---
app/controllers/files_controller.rb | 32 ++++++++++++++++-------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 3d1970656..9171407eb 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -16,7 +16,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class FilesController < ApplicationController
- layout 'base_projects'#by young
+ if @project
+ layout 'base_projects' #by young
+ else
+ layout 'base_courses'
+ end
menu_item :files
before_filter :find_project_by_project_id#, :except => [:getattachtype]
@@ -300,25 +304,25 @@ class FilesController < ApplicationController
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder(sort).all
- show_attachments @containers
- @attachtype = params[:type].to_i
- @contenttype = params[:contentType].to_s
- render :layout => 'base_projects'
+
+ #render :layout => 'base_projects'
elsif @course
@isproject = false
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
- show_attachments @containers
- @attachtype = params[:type].to_i
- @contenttype = params[:contentType].to_s
- render :layout => 'base_courses'
- end
+ # show_attachments @containers
+ # @attachtype = params[:type].to_i
+ # @contenttype = params[:contentType].to_s
+ end
+ show_attachments @containers
+ @attachtype = params[:type].to_i
+ @contenttype = params[:contentType].to_s
- # respond_to do |format|
- # format.js
- # format.html
- # end
+ respond_to do |format|
+ format.js
+ format.html
+ end
end
end