diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index ceb63d7b0..099e9404a 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -161,6 +161,7 @@ class BoardsController < ApplicationController if @project render :action => 'show', :layout => 'base_projects' elsif @course + @left_nav_type = 2 @params=params render :action => 'show', :layout => 'base_courses' end @@ -185,6 +186,7 @@ class BoardsController < ApplicationController @board = @project.boards.build @board.safe_attributes = params[:board] if @project.project_type == 1 + @left_nav_type = 2 render :layout => 'base_courses' end end @@ -206,6 +208,7 @@ class BoardsController < ApplicationController def edit if @project.project_type == 1 + @left_nav_type = 2 render :layout => 'base_courses' end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index e8a08803c..41ea9c45e 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -907,6 +907,7 @@ class CoursesController < ApplicationController end @type = params[:type] + @left_nav_type = 1 respond_to do |format| format.js format.html{render :layout => 'base_courses'} @@ -938,6 +939,7 @@ class CoursesController < ApplicationController end @jour = paginateHelper @jours,10 @state = false + @left_nav_type = 6 respond_to do |format| format.html{render :layout => 'base_courses'} format.api @@ -1121,6 +1123,14 @@ class CoursesController < ApplicationController end end + #统计 + def statistics_course + @left_nav_type = 9 + respond_to do |format| + format.html {render :layout => 'base_courses'} + end + end + private def update_quotes attachment if attachment.copy_from diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index c3964c567..e3caaf9fb 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -29,6 +29,7 @@ class ExerciseController < ApplicationController exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc") end @exercises = paginateHelper exercises,20 #分页 + @left_nav_type = 8 respond_to do |format| format.html end @@ -72,6 +73,7 @@ class ExerciseController < ApplicationController end # @percent = get_percent(@exercise,User.current) @exercise_questions = @exercise.exercise_questions + @left_nav_type = 8 respond_to do |format| format.html {render :layout => 'base_courses'} end @@ -118,6 +120,7 @@ class ExerciseController < ApplicationController end def edit + @left_nav_type = 8 respond_to do |format| format.html{render :layout => 'base_courses'} end @@ -159,6 +162,7 @@ class ExerciseController < ApplicationController @exercise = Exercise.find(params[:id]) exercise_questions = @exercise.exercise_questions @exercise_questions = paginateHelper exercise_questions, 5 + @left_nav_type = 8 respond_to do |format| format.html{render :layout => 'base_courses'} end @@ -379,6 +383,7 @@ class ExerciseController < ApplicationController else @exercise_users_list = [] end + @left_nav_type = 8 respond_to do |format| format.html format.xls { @@ -566,6 +571,7 @@ class ExerciseController < ApplicationController eu = get_exercise_user(@exercise.id, @user.id) eu.update_attributes(:score => score) @exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first + @left_nav_type = 8 respond_to do |format| format.html {render :layout => 'base_courses'} end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index f06725d01..ed2b2ebfa 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -366,6 +366,7 @@ class FilesController < ApplicationController @tag_list = attachment_tag_list @all_attachments + @left_nav_type = 5 render :layout => 'base_courses' elsif params[:org_subfield_id] if params[:sort] @@ -445,6 +446,7 @@ class FilesController < ApplicationController @versions = @project.versions.sort @course_tag = @project.project_type if @project.project_type == 1 + @left_nav_type = 5 render :layout => 'base_courses' end end @@ -812,6 +814,7 @@ class FilesController < ApplicationController @attachtype = params[:type].to_i @contenttype = params[:contentType].to_s # render layout: 'base_courses' + @left_nav_type = 5 respond_to do |format| format.js format.html { diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6724f42bb..2020915f8 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -39,6 +39,7 @@ class HomeworkCommonController < ApplicationController end end + @left_nav_type = 3 respond_to do |format| format.js format.html @@ -60,6 +61,7 @@ class HomeworkCommonController < ApplicationController @is_in_course = params[:is_in_course].to_i @course_activity = params[:course_activity].to_i if @is_in_course == 1 || @course_activity == 1 + @left_nav_type = 3 respond_to do |format| format.html{render :layout => 'base_courses'} end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 160383e92..fae350a6a 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -124,6 +124,7 @@ class MessagesController < ApplicationController end else + @left_nav_type = 2 respond_to do |format| format.html { layout_file = @project ? 'base_projects' : 'base_courses' @@ -241,6 +242,7 @@ class MessagesController < ApplicationController if @project layout_file = 'base_projects' elsif @course + @left_nav_type = 2 layout_file = 'base_courses' elsif @org_subfield @organization = @org_subfield.organization diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 76b229dbf..190c3852b 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -56,7 +56,7 @@ class NewsController < ApplicationController :order => "#{News.table_name}.created_on DESC", :offset => @page * 10, :limit => 10) - + @left_nav_type = 4 respond_to do |format| format.html { @news = News.new # for adding news inline @@ -136,6 +136,7 @@ class NewsController < ApplicationController @newss = paginateHelper @newss,@limit #@newss = paginateHelper scope_order,10 + @left_nav_type = 4 respond_to do |format| format.html { @news = News.new @@ -176,6 +177,7 @@ class NewsController < ApplicationController if @news.course_id @course = Course.find(@news.course_id) if @course + @left_nav_type = 4 render :layout => 'base_courses' end elsif @news.org_subfield_id @@ -279,6 +281,7 @@ class NewsController < ApplicationController @organization = @org_subfield.organization end if @course + @left_nav_type = 4 render :layout => "base_courses" elsif @org_subfield render :layout => 'base_org' diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index e4cf31f55..ad04e68fa 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -15,6 +15,7 @@ class PollController < ApplicationController polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2") end @polls = paginateHelper polls,20 #分页 + @left_nav_type = 7 respond_to do |format| format.html{render :layout => 'base_courses'} end @@ -25,7 +26,7 @@ class PollController < ApplicationController def show @poll = Poll.find params[:id] - if @poll.polls_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) + if @poll.polls_status != 2 && !(User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) render_403 return end @@ -44,6 +45,7 @@ class PollController < ApplicationController @percent = get_percent(@poll,User.current) poll_questions = @poll.poll_questions @poll_questions = paginateHelper poll_questions,5 #分页 + @left_nav_type = 7 respond_to do |format| format.html {render :layout => 'base_courses'} end @@ -78,6 +80,7 @@ class PollController < ApplicationController def edit respond_to do |format| + @left_nav_type = 7 format.html{render :layout => 'base_courses'} end end @@ -112,6 +115,7 @@ class PollController < ApplicationController @poll = Poll.find(params[:id]) poll_questions = @poll.poll_questions @poll_questions = paginateHelper poll_questions, 5 + @left_nav_type = 7 respond_to do |format| format.html{render :layout => 'base_courses'} end @@ -393,6 +397,7 @@ class PollController < ApplicationController #显示某个学生某份问卷的填写结果 def poll_result @poll_questions = paginateHelper @poll.poll_questions,5 + @left_nav_type = 7 respond_to do |format| format.html{render :layout => 'base_courses'} end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 45b54cf0a..4992501c5 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -526,6 +526,7 @@ class StudentWorkController < ApplicationController @is_focus = params[:is_focus] ? params[:is_focus].to_i : 0 # 消息传过来的ID @message_student_work_id = params[:student_work_id] + @left_nav_type = 3 respond_to do |format| format.js format.html @@ -918,6 +919,7 @@ class StudentWorkController < ApplicationController ORDER BY absence #{order}") end @order = order == "desc" ? "asc" : "desc" + @left_nav_type = 3 respond_to do |format| format.html end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f256d7a06..e01f3c734 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -949,6 +949,7 @@ class UsersController < ApplicationController @student_work = StudentWork.new end @course = @homework.course + @left_nav_type = 3 respond_to do |format| format.js format.html {render :layout => 'base_courses'} diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index d1f4bfe97..42511f218 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -35,7 +35,7 @@ module CoursesHelper and (c.is_excellent =1 or c.excellent_option =1) and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;" default_ids = Course.find_by_sql(sql).flatten.map { |c| c.id } excellent_ids << default_ids.flatten - arr_result = excellent_ids.flatten.uniq.first(5) + arr_result = excellent_ids.flatten.uniq.first(3) excellent_courses = Course.find(arr_result) return excellent_courses end @@ -78,18 +78,18 @@ module CoursesHelper #生成课程老师成员链接 def course_teacher_link teacher_num if User.current.member_of_course?(@course) || User.current.admin? - link_to "#{teacher_num}", course_member_path(@course, :role => 1), :class => 'info_foot_num c_blue', :id => 'teacher_number' + link_to "#{teacher_num}", course_member_path(@course, :role => 1), :class => 'sy_cblue', :id => 'teacher_number' else - content_tag 'span',teacher_num, :class => 'info_foot_num c_blue' + content_tag 'span',teacher_num, :class => 'sy_cblue' end end #生成课程学生列表连接 def course_student_link student_num if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin? - link_to "#{student_num}", course_member_path(@course, :role => 2), :class => 'info_foot_num c_blue', :id => "student_number" + link_to "#{student_num}", course_member_path(@course, :role => 2), :class => 'sy_cblue', :id => "student_number" else - content_tag 'span',student_num, :class => 'info_foot_num c_blue' + content_tag 'span',student_num, :class => 'sy_cblue' end end @@ -772,12 +772,12 @@ module CoursesHelper url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined - link = link_to(text, url, :remote => true, :method => method, :class => "Blue-btn", :style => "margin_left: 0px;", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) + link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) else - link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "Blue-btn", :style => "margin_left: 0px;") + link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "sy_btn_grey fl") end else - link = "#{l(:label_course_join_student)}" + link = "#{l(:label_course_join_student)}" end link.html_safe end @@ -872,7 +872,7 @@ module CoursesHelper desc.html_safe end - # 学生按作业总分排序,取前8个 + # 学生按作业总分排序,取前3个 def hero_homework_score(course, score_sort_by) sql_select = "SELECT members.*,( SELECT SUM(work_score) @@ -884,14 +884,14 @@ module CoursesHelper FROM members JOIN students_for_courses ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id - WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 9" + WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 3" homework_scores = Member.find_by_sql(sql_select) end def contributor_course_scor(course_id) ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by (message_num*2 + message_reply_num + news_reply_num + news_num + - resource_num*5 + journal_num + homework_journal_num ) desc limit 9;") + resource_num*5 + journal_num + homework_journal_num ) desc limit 3;") end end diff --git a/app/views/courses/_course_activity_users.html.erb b/app/views/courses/_course_activity_users.html.erb index 3b19de355..8b4df3e83 100644 --- a/app/views/courses/_course_activity_users.html.erb +++ b/app/views/courses/_course_activity_users.html.erb @@ -1,13 +1,15 @@ <% unless contributor_course_scor(course.id).count == 0 %> - + + <% end %> \ No newline at end of file diff --git a/app/views/courses/_course_heroes.html.erb b/app/views/courses/_course_heroes.html.erb index ea05eea53..4699c12d2 100644 --- a/app/views/courses/_course_heroes.html.erb +++ b/app/views/courses/_course_heroes.html.erb @@ -1,9 +1,9 @@ <% hero_homework_scores = hero_homework_score(course, "desc") %> <% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
+ \ No newline at end of file diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 6bdc3753e..3ec6232db 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -7,7 +7,7 @@