课程列表、项目列表等修改
This commit is contained in:
parent
4258790453
commit
c357971e8a
|
@ -28,6 +28,7 @@ class BoardsController < ApplicationController
|
|||
helper :watchers
|
||||
helper :project_score
|
||||
helper :attachments
|
||||
include PraiseTreadHelper
|
||||
def index
|
||||
#modify by nwb
|
||||
@flag = params[:flag] || false
|
||||
|
@ -121,6 +122,15 @@ class BoardsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#根据 赞+回复数排序
|
||||
if @order.to_i == 2
|
||||
@type = 2
|
||||
@b_sort == 1 ? @topics = @topics.sort{|x,y| get_praise_num(x) + (x.parent ? x.parent.children.count : x.children.count) <=> get_praise_num(y) + (y.parent ? y.parent.children.count : y.children.count) } : @topics = @topics.sort{|x,y| get_praise_num(y) + (y.parent ? y.parent.children.count : y.children.count) <=> get_praise_num(x) + (x.parent ? x.parent.children.count : x.children.count) }
|
||||
@topics = @topics.sort{|x,y| y.sticky <=> x.sticky}
|
||||
else
|
||||
@type = 1
|
||||
end
|
||||
|
||||
#分页
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
|
@ -132,28 +142,34 @@ class BoardsController < ApplicationController
|
|||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
@message = Message.new(:board => @board)
|
||||
#modify by nwb
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {
|
||||
if @project
|
||||
render :action => 'show', :layout => 'base_projects'
|
||||
elsif @course
|
||||
@params=params
|
||||
render :action => 'show', :layout => 'base_courses'
|
||||
end
|
||||
}
|
||||
format.atom {
|
||||
@messages = @board.messages.
|
||||
reorder('created_on DESC').
|
||||
includes(:author, :board).
|
||||
limit(Setting.feeds_limit.to_i).
|
||||
all
|
||||
if @project
|
||||
render_feed(@messages, :title => "#{@project}: #{@board}")
|
||||
elsif @course
|
||||
render_feed(@messages, :title => "#{@course}: #{@board}")
|
||||
end
|
||||
}
|
||||
if (params[:page] || params[:order])
|
||||
respond_to do |format|
|
||||
format.js{render "show.js.erb"}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {
|
||||
if @project
|
||||
render :action => 'show', :layout => 'base_projects'
|
||||
elsif @course
|
||||
@params=params
|
||||
render :action => 'show', :layout => 'base_courses'
|
||||
end
|
||||
}
|
||||
format.atom {
|
||||
@messages = @board.messages.
|
||||
reorder('created_on DESC').
|
||||
includes(:author, :board).
|
||||
limit(Setting.feeds_limit.to_i).
|
||||
all
|
||||
if @project
|
||||
render_feed(@messages, :title => "#{@project}: #{@board}")
|
||||
elsif @course
|
||||
render_feed(@messages, :title => "#{@course}: #{@board}")
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#blog-list").html('<%= escape_javascript( render :partial => 'blogs/article', :locals => {:topics => @topics} ) %>');
|
||||
$("#blog-list").replaceWith('<%= escape_javascript( render :partial => 'blogs/article', :locals => {:topics => @topics} ) %>');
|
|
@ -1,5 +1,5 @@
|
|||
<% if @course %>
|
||||
<%= render :partial => 'users/course_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1} %>
|
||||
$("#course-boardlist").replaceWith('<%= escape_javascript( render :partial => 'users/course_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1}) %>');
|
||||
<% else %>
|
||||
$("#show_more_project_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/project_show_detail',:locals => {:topics => @topics, :page => @page} )%>");
|
||||
$("#project-boardlist").replaceWith('<%= escape_javascript( render :partial => 'users/project_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1}) %>');
|
||||
<% end %>
|
|
@ -1,5 +1,5 @@
|
|||
<div class = "cl"> </div>
|
||||
<div id="blog-list">
|
||||
<div id="course-boardlist">
|
||||
<div class="listbox mt10" >
|
||||
<h2 class="list-h2">问答区列表</h2>
|
||||
<div class="category">
|
||||
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
<script type="text/javascript">
|
||||
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-10;
|
||||
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight){
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class = "cl"> </div>
|
||||
<div id="blog-list">
|
||||
<div id="project-boardlist">
|
||||
<div class="listbox mt10" >
|
||||
<h2 class="list-h2">讨论区列表</h2>
|
||||
<div class="category">
|
||||
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
<script type="text/javascript">
|
||||
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-10;
|
||||
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight){
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="listbox">
|
||||
<div class="listbox" id="course-list">
|
||||
<h2 class="list-h2">课程列表</h2>
|
||||
<div class="category">
|
||||
<span class="grayTxt ">排序:</span>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="listbox">
|
||||
<div class="listbox" id="project-list">
|
||||
<h2 class="list-h2">项目列表</h2>
|
||||
<div class="category">
|
||||
<span class="grayTxt ">排序:</span>
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
<div id="courses-list">
|
||||
<%= render :partial => 'users/user_course_list'%>
|
||||
</div>
|
||||
<%= render :partial => 'users/user_course_list'%>
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#courses-list").html('<%= escape_javascript( render :partial => 'users/user_course_list') %>');
|
||||
$("#course-list").replaceWith('<%= escape_javascript( render :partial => 'users/user_course_list') %>');
|
|
@ -1,3 +1 @@
|
|||
<div id="project-list">
|
||||
<%= render :partial => 'users/user_project_list'%>
|
||||
</div>
|
||||
<%= render :partial => 'users/user_project_list'%>
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#project-list").html('<%= escape_javascript( render :partial => 'users/user_project_list') %>');
|
||||
$("#project-list").replaceWith('<%= escape_javascript( render :partial => 'users/user_project_list') %>');
|
48
db/schema.rb
48
db/schema.rb
|
@ -9,9 +9,8 @@
|
|||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160421011543) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
|
@ -335,6 +334,17 @@ ActiveRecord::Schema.define(:version => 20160421011543) do
|
|||
t.boolean "diff_all"
|
||||
end
|
||||
|
||||
create_table "code_tests", :force => true do |t|
|
||||
t.integer "homework_id"
|
||||
t.integer "wait_time", :default => 0
|
||||
t.integer "language"
|
||||
t.integer "status"
|
||||
t.integer "time_used", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "student_work_id", :default => 0
|
||||
end
|
||||
|
||||
create_table "comments", :force => true do |t|
|
||||
t.string "commented_type", :limit => 30, :default => "", :null => false
|
||||
t.integer "commented_id", :default => 0, :null => false
|
||||
|
@ -1681,6 +1691,7 @@ ActiveRecord::Schema.define(:version => 20160421011543) do
|
|||
t.integer "status", :default => 9
|
||||
t.text "results"
|
||||
t.text "src"
|
||||
t.integer "uwait_time", :default => 0
|
||||
end
|
||||
|
||||
create_table "student_works", :force => true do |t|
|
||||
|
@ -1699,8 +1710,8 @@ ActiveRecord::Schema.define(:version => 20160421011543) do
|
|||
t.integer "absence_penalty", :default => 0
|
||||
t.float "system_score", :default => 0.0
|
||||
t.boolean "is_test", :default => false
|
||||
t.integer "simi_id"
|
||||
t.integer "simi_value"
|
||||
t.integer "simi_id", :default => 0
|
||||
t.integer "simi_value", :default => 0
|
||||
end
|
||||
|
||||
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
|
||||
|
@ -1933,25 +1944,6 @@ ActiveRecord::Schema.define(:version => 20160421011543) do
|
|||
add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
|
||||
add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
|
||||
|
||||
create_table "user_wechats", :force => true do |t|
|
||||
t.integer "subscribe"
|
||||
t.string "openid"
|
||||
t.string "nickname"
|
||||
t.integer "sex"
|
||||
t.string "language"
|
||||
t.string "city"
|
||||
t.string "province"
|
||||
t.string "country"
|
||||
t.string "headimgurl"
|
||||
t.string "subscribe_time"
|
||||
t.string "unionid"
|
||||
t.string "remark"
|
||||
t.integer "groupid"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "login", :default => "", :null => false
|
||||
t.string "hashed_password", :limit => 40, :default => "", :null => false
|
||||
|
@ -2028,14 +2020,6 @@ ActiveRecord::Schema.define(:version => 20160421011543) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "wechat_logs", :force => true do |t|
|
||||
t.string "openid", :null => false
|
||||
t.text "request_raw"
|
||||
t.text "response_raw"
|
||||
t.text "session_raw"
|
||||
t.datetime "created_at", :null => false
|
||||
end
|
||||
|
||||
create_table "wiki_content_versions", :force => true do |t|
|
||||
t.integer "wiki_content_id", :null => false
|
||||
t.integer "page_id", :null => false
|
||||
|
|
Loading…
Reference in New Issue