Merge branch 'yuanke' into develop

Conflicts:
	app/controllers/users_controller.rb
	app/views/blogs/_article.html.erb
	app/views/layouts/new_base_user.html.erb
This commit is contained in:
huang 2016-05-06 11:35:27 +08:00
commit 572a051b04
20 changed files with 251 additions and 199 deletions

View File

@ -125,7 +125,7 @@ class BoardsController < ApplicationController
if @order.to_i == 2
@type = 2
@topics.each do |topic|
topic[:infocount] = get_praise_num(topic) + (topic.parent ? x.parent.children.count : topic.children.count)
topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count)
if topic[:infocount] < 0
topic[:infocount] = 0
end

View File

@ -83,6 +83,8 @@ class NewsController < ApplicationController
sort_type = @b_sort == 1 ? "asc" : "desc"
#scope = News.find_by_sql("select a.*,b.updated_at from news a, course_activities b where a.course_id = 532 and a.course_id = b.course_id and b.course_act_id = a.id ) ")
scope = @course ? @course.news.course_visible : News.course_visible
news_arr = scope.map{|news| news.id}
@ -101,7 +103,8 @@ class NewsController < ApplicationController
end
scope_order.each do |topic|
topic[:updated_at] = CourseActivity.where("course_act_type='#{topic.class}' and course_act_id =#{topic.id}").first.updated_at
topic[:updated_at] = topic.course_acts.first.updated_at
#topic[:updated_at] = CourseActivity.where("course_act_type='#{topic.class}' and course_act_id =#{topic.id}").first.updated_at
end
#根据 赞+回复数排序

View File

@ -2945,11 +2945,10 @@ class UsersController < ApplicationController
@c_sort = 2
end
sort_name = "created_at"
sort_name = "updated_at"
sort_type = @c_sort == 1 ? "asc" : "desc"
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a #{sort_type}")
@courses = @user.courses.visible.where("is_delete =?", 0).order("#{sort_name} #{sort_type}")
#根据 作业+资源数排序
if @order.to_i == 2
@type = 2
@ -2989,10 +2988,11 @@ class UsersController < ApplicationController
@c_sort = 2
end
sort_name = "created_on"
sort_name = "updated_on"
sort_type = @c_sort == 1 ? "asc" : "desc"
@projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a #{sort_type}")
@projects = @user.projects.visible.order("#{sort_name} #{sort_type}")
# @projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a #{sort_type}")
#根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num
if @order.to_i == 2

View File

@ -16,6 +16,7 @@
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% if topics.any? %>
<% topics.each do |activity| %>
<ul class="list-file">
<li><span class="item_list fl"></span>
@ -61,6 +62,9 @@
</ul>
<div class="cl"></div>
</div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
</div>
</div>

View File

@ -29,7 +29,9 @@
<div class="cl"></div>
</div>
<% end %>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %>
</ul>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>

View File

@ -41,9 +41,6 @@
<div id="topics_list">
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %>
</ul>
<!--<div class="pageRoll">-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>-->

View File

@ -1,2 +1 @@
$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos})%>")
$("#pages").html('<%= pagination_links_full @topic_pages, @topic_count,:per_page_links => false,:remote =>true%>');

View File

@ -84,10 +84,10 @@
<% end%>
<script type="text/javascript">
var coursecount = <%= @user.courses.visible.where("is_delete =?", 0).select("courses.* FROM `course_activities` WHERE course_activities.course_id = courses.id) ").count %>;
var coursecount = <%= @user.courses.visible.where("is_delete =?", 0).count %>;
var courseshowcount = document.getElementsByClassName("coursesLineGrey").length;
if((coursecount == courseshowcount)&&(coursecount > 5) ){
if((coursecount <= courseshowcount)&&(coursecount > 5) ){
$("#user_show_more_course").hide();
$('#user_hide_course').show();
}

View File

@ -64,10 +64,10 @@
<% end%>
<script type="text/javascript">
var projectcount = <%= @user.projects.visible.select("projects.* FROM `forge_activities` WHERE forge_activities.project_id = projects.id) ").count %>;
var projectcount = <%= @user.projects.visible.count %>;
var projectshowcount = document.getElementsByClassName("projectsLineGrey").length;
if((projectcount == projectshowcount)&&(projectcount > 5)){
if((projectcount <= projectshowcount)&&(projectcount > 5)){
$("#user_show_more_project").hide();
$('#user_hide_project').show();
}

View File

@ -226,8 +226,8 @@
end
%>
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" >
<div class = "leftCoursesList" id="homepageLeftMenuCourses">
<ul>
@ -258,7 +258,8 @@
end
%>
<% projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<%# projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" >
<div class = "leftProjecsList" id="homepageLeftMenuForge">
<ul>
@ -347,28 +348,30 @@
</div><!--floatbox end-->
</div>
<script type="text/javascript">
$(function(){
$('#user_hide_course').hide();
$('#user_hide_project').hide();
});
$("#courseMenu").mouseenter(function(){
$("#topnav_course_menu").show();
});
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
$('#user_hide_course').hide();
function leftCourseslistChange(){
$('#homepageLeftMenuCourses').slideToggle();
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");
$('#hide_show_courseicon').toggleClass("homepageLeftMenuMoreIcon");
}
$('#user_hide_project').hide();
function leftProjectslistChange(){
$('#homepageLeftMenuForge').slideToggle();
$('#hide_show_projecticon').toggleClass("homepageLeftMenuHideIcon");
$('#hide_show_projecticon').toggleClass("homepageLeftMenuMoreIcon");
}
</script>
</body>
</html>

View File

@ -15,6 +15,7 @@
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% if topics.any? %>
<% topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
@ -63,6 +64,9 @@
</ul>
<div class="cl"></div>
</div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
</div>
</div>

View File

@ -15,6 +15,7 @@
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% if topics.any? %>
<% topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
@ -47,6 +48,9 @@
</ul>
<div class="cl"></div>
</div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
</div>
</div>

View File

@ -15,6 +15,7 @@
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% if topics.any? %>
<% topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
@ -63,6 +64,9 @@
</ul>
<div class="cl"></div>
</div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
</div>
</div>

View File

@ -14,6 +14,7 @@
</div>
<div class="bloglistbox">
<% if @courses.any? %>
<% @courses.each do |course|%>
<ul class="list-file">
<li>
@ -30,6 +31,7 @@
<span class="grayTxt">
创建时间:<%= format_time(course.created_at) %>
</span>
<span class="grayTxt">更新时间:<%= format_time(course.updated_at) %></span>
<span class="grayTxt">
开课学期:&nbsp;&nbsp;<span><%= current_time_and_term course %></span>
</span>
@ -49,6 +51,9 @@
</ul>
<div class="cl"></div>
</div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
</div>

View File

@ -14,6 +14,7 @@
</div>
<div class="bloglistbox">
<% if @projects.any? %>
<% @projects.each do |project|%>
<ul class="list-file">
<li>
@ -27,6 +28,7 @@
<div class="cl"></div>
<li class="ml15">
<span class="grayTxt">创建时间:<%= format_time(project.created_on) %></span>
<span class="grayTxt">更新时间:<%= format_time(project.updated_on) %></span>
<p class="list-info fr grayTxt"><span><%= project.project_score.issue_num %></span><span>问题</span><span>|</span><span> <%= project.project_score.attach_num %></span><span>资源</span></p>
</li>
<div class="cl"></div>
@ -38,6 +40,9 @@
</ul>
<div class="cl"></div>
</div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
</div>

View File

@ -283,7 +283,7 @@ KindEditor.plugin('table', function(K) {
for (var i = 0; i < rows; i++) {
html += '<tr>';
for (var j = 0; j < cols; j++) {
html += '<td style="border:solid windowtext 1.0px;text-overflow:inherit;overflow: hidden;white-space: nowrap" >' + (K.IE ? '&nbsp;' : '<br />') + '</td>';
html += '<td style="text-overflow:inherit;overflow: hidden;white-space: nowrap" >' + (K.IE ? '&nbsp;' : '<br />') + '</td>';
}
html += '</tr>';
}

View File

@ -128,9 +128,15 @@ a.postTypeGrey:hover {color:#269ac9;}
.homepagePostSubmit {font-size:14px; color:#888888; border:1px solid #dddddd; background-color:#eaeaea; float:left; margin-right:20px; padding:0px 10px;}
.homepagePostSubmit:hover {background-color:#d8d8d8;}
.homepagePostIntro {font-size:14px; color:#484848;overflow:hidden;}
.homepagePostIntro ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;}
.homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;}
.homepagePostReply {width:710px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;}
.homepagePostReply ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReply ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;}
.borderBottomNone {border-bottom:none !important;}
.topBorder {border-top: 1px solid #e4e4e4;}
@ -166,6 +172,8 @@ a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;}
.homepagePostReplyDes {float:left; width:632px; margin-left:15px;}
.homepagePostReplyPublisher {font-size:12px; color:#888888; margin-bottom:5px;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;}
.homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReplyContent ul li{list-style-type: disc;margin-left: 20px;}
.table_maxWidth table {max-width: 642px;}
.homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;}
.homepagePostAssignTo {float:left; font-size:14px; color:#269ac9;}

View File

@ -597,7 +597,7 @@ a.projectsLineGrey:hover {color:#ffffff;}
.homepageLeftMenuMore {height:18px;}
.homepageLeftMenuMore:hover {background-color:#269ac9;}
.homepageLeftMenuMoreIcon {background:url(../images/homepage_icon.png) -74px -240px no-repeat; display:block; height:18px;}
.homepageLeftMenuHideIcon {background:url(../images/homepage_icon.png) -74px -220px no-repeat;display:block; height:18px;}
.homepageLeftMenuHideIcon {background:url(../images/homepage_icon.png) 100px -624px no-repeat;display:block; height:18px;}
.homepageMenuSetting {display:inline-block; background:url(../images/homepage_icon2.png) -190px -365px no-repeat; width:15px; height:15px; margin-top: 16px; margin-right: 15px;}
.homepageMenuSetting:hover {background:url(../images/homepage_icon2.png) -190px -407px no-repeat;}
a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;}
@ -675,6 +675,10 @@ a.postTypeGrey:hover {color:#269ac9;}
.homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;}
.homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;}
.homepagePostReply {width:720px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;}
.homepagePostIntro ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostReply ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReply ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;}
.borderBottomNone {border-bottom:none !important;}
.topBorder {border-top: 1px solid #e4e4e4;}
@ -709,6 +713,8 @@ a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;}
.homepagePostReplyDes {float:left; width:642px; margin-left:15px;}
.homepagePostReplyPublisher {font-size:12px; color:#888888; margin-bottom:5px;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family:"微软雅黑","宋体";}
.homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReplyContent ul li{list-style-type: disc;margin-left: 20px;}
.table_maxWidth table {max-width: 642px;}
.homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;}
.homepagePostAssignTo {float:left; font-size:14px; color:#269ac9;}

View File

@ -969,6 +969,10 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
margin: 10px auto 0px;
background-color: #F1F1F1;
}
.homepagePostIntro ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostReply ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReply ul li{list-style-type: disc;margin-left: 20px;}
.topBorder {
border-top: 1px solid #E4E4E4;
}

View File

@ -599,6 +599,8 @@ a.postTypeGrey:hover {color:#269ac9;}
.homepagePostSubmit {font-size:14px; color:#888888; border:1px solid #dddddd; background-color:#eaeaea; float:left; margin-right:20px; padding:0px 10px;}
.homepagePostSubmit:hover {background-color:#d8d8d8;}
.homepagePostIntro {font-size:14px; color:#484848;overflow:hidden;}
.homepagePostIntro ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;}
.homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;}
.homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;}
@ -632,6 +634,8 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostReplyDes {float:left; width:620px; margin-left:15px;}
.homepagePostReplyPublisher {font-size:12px; color:#484848; margin-bottom:5px;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;}
.homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReplyContent ul li{list-style-type: disc;margin-left: 20px;}
.table_maxWidth table {max-width: 642px;}
.homepagePostProjectState {width:42px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;}
.homepagePostAssignTo {float:left; font-size:14px; color:#15bccf;}