From b259f923816b23618d76a67e752a654926fa0b62 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Sun, 9 Oct 2016 09:02:12 +0800
Subject: [PATCH 01/10] =?UTF-8?q?=E4=B8=80=E7=BA=A7=E5=B8=96=E5=AD=90?=
=?UTF-8?q?=E6=A0=8F=E7=9B=AE=E9=BB=98=E8=AE=A4=E5=B1=95=E7=A4=BA5?=
=?UTF-8?q?=E4=B8=AA=EF=BC=8C=E7=82=B9=E5=87=BB=E5=8F=AF=E8=BF=9B=E5=85=A5?=
=?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=EF=BC=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/organizations_controller.rb | 10 +++++
.../_org_left_subfield_list.html.erb | 41 +++++++++----------
.../organizations/_org_subdomain.html.erb | 13 +++---
.../organizations/more_org_submains.js.erb | 1 +
config/routes.rb | 1 +
public/javascripts/org.js | 11 +++++
6 files changed, 49 insertions(+), 28 deletions(-)
create mode 100644 app/views/organizations/more_org_submains.js.erb
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 2b31cae13..edffdd28b 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -460,6 +460,16 @@ class OrganizationsController < ApplicationController
@members = paginateHelper @members, 20
end
+ def more_org_submains
+ @org_subfield = OrgSubfield.find params[:org_subfield_id].to_i
+
+ @page = params[:page]
+ @submains = @org_subfield.sub_domains.reorder('priority').uniq.page((params[:page].to_i || 1) +1).per(5)
+ respond_to do |format|
+ format.js
+ end
+ end
+
def more_org_projects
@organization = Organization.find params[:id]
@page = params[:page]
diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb
index 11f45ede1..ee467067b 100644
--- a/app/views/organizations/_org_left_subfield_list.html.erb
+++ b/app/views/organizations/_org_left_subfield_list.html.erb
@@ -43,12 +43,11 @@
$(this).prev().css("color","#808080");
$(this).css("z-index", "1");
});
-
//二级菜单滑动时箭头方向控制
$(".homepageLeftMenuMoreIcon").toggle(function(){
- $(this).css("background","url(/images/homepage_icon.png) 100px -624px no-repeat");
- },function(){
$(this).css("background","url(/images/homepage_icon.png) -74px -240px no-repeat");
+ },function(){
+ $(this).css("background","url(/images/homepage_icon.png) 100px -624px no-repeat");
});
})
@@ -103,17 +102,15 @@
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<% else %>
-
-
+ <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %>
<% end %>
-
-
+
- <%= render :partial => 'organizations/org_subdomain',:locals => {:subdomains => field.sub_domains.reorder('priority').uniq, :org_subfield_id => field.id} %>
+ <%= render :partial => 'organizations/org_subdomain',:locals => {:subdomains => field.sub_domains.reorder('priority').uniq.limit(5), :org_subfield_id => field.id, :page=>1, :org_id => organization.id } %>
@@ -139,20 +136,20 @@
<% elsif field.field_type == "Resource" %>
<% end %>
diff --git a/app/views/organizations/_org_subdomain.html.erb b/app/views/organizations/_org_subdomain.html.erb
index b096a14ae..8b8807533 100644
--- a/app/views/organizations/_org_subdomain.html.erb
+++ b/app/views/organizations/_org_subdomain.html.erb
@@ -3,9 +3,10 @@
<%= link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => org_subfield_id), :class => "coursesLineGrey hidden", :title => subdomain.name %>
<% end %>
-<%# if subdomains.size == 5 %>
-
-
-
-
-<%# end%>
\ No newline at end of file
+<% if subdomains.size == 5 %>
+
+
+
+
+<% end%>
+
diff --git a/app/views/organizations/more_org_submains.js.erb b/app/views/organizations/more_org_submains.js.erb
new file mode 100644
index 000000000..088c9ed34
--- /dev/null
+++ b/app/views/organizations/more_org_submains.js.erb
@@ -0,0 +1 @@
+$("#show_more_org_submains").replaceWith("<%= escape_javascript( render :partial => 'organizations/org_subdomain',:locals => {:subdomains => @submains, :org_subfield_id => @org_subfield.id, :page=> @page, :org_id => @organization } )%>");
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 4ff75cbf9..633ce465c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -73,6 +73,7 @@ RedmineApp::Application.routes.draw do
put 'set_homepage'
put 'cancel_homepage'
get 'members'
+ get 'more_org_submains'
get 'more_org_projects'
get 'more_org_courses'
get 'search_courses'
diff --git a/public/javascripts/org.js b/public/javascripts/org.js
index f1520a0ec..84711cded 100644
--- a/public/javascripts/org.js
+++ b/public/javascripts/org.js
@@ -34,6 +34,17 @@ function observeSearchfield(fieldId, targetId, url) {
});
}
+//显示更多子栏目
+function show_more_org_submain(url){
+ $.get(
+ url,
+ { page: $("#org_submains_page_num").val() },
+ function (data) {
+
+ }
+ );
+}
+
//显示更多的项目
function show_more_org_project(url){
$.get(
From dd4d20011ddefa1dca1e9df59db97e6ce05a3780 Mon Sep 17 00:00:00 2001
From: huang
Date: Thu, 13 Oct 2016 09:43:53 +0800
Subject: [PATCH 02/10] =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E5=BA=93=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 4 ++--
app/views/layouts/_logined_header.html.erb | 2 +-
app/views/users/user_resource.html.erb | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 78c60599a..556b1ed1b 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -3056,7 +3056,7 @@ class UsersController < ApplicationController
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
# user_org_ids = User.current.organizations.map {|o| o.id}
- if( params[:type] == "1") # 我的资源
+ if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
@@ -3070,7 +3070,7 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
- elsif (params[:type].blank? || params[:type] == "6") # 公共资源
+ elsif (params[:type] == "6") # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index b8235ff1c..4e501b2eb 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -8,7 +8,7 @@
<%= link_to "首页",user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页"%>
<% if hidden_unproject_infos %>