From 8639609832eb2b639441d14ba9ff9235206c3622 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 24 Dec 2015 15:42:05 +0800 Subject: [PATCH 001/205] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=86=E6=94=AF--?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=BE=85=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c4bbc4ebb..38c2b9e90 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -58,6 +58,12 @@ module ApplicationHelper end end + # 获取项/课程 news最新列表 + # params course ID or project ID + def news_act_order + + end + # Time 2015-03-24 16:38:05 # Author lizanle # Description after save后需要进行资源记录的更新 From f7f03b209490477f6e78cf00d5dfc28fcd6df53b Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 24 Dec 2015 16:10:41 +0800 Subject: [PATCH 002/205] 0 --- app/helpers/application_helper.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 38c2b9e90..0c8be7b84 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -59,9 +59,15 @@ module ApplicationHelper end # 获取项/课程 news最新列表 - # params course ID or project ID - def news_act_order - + # params course: course ID or project ID + def news_act_order(course) + a = [] + course.news.each do |new| + unless new.comments.blank? + new = new.comments.sort! { |a,b| a.created_on <=> b.created_on}.last.commented + end + a << new + end end # Time 2015-03-24 16:38:05 From e876cb09d9c2a5d7a7f20c86ae6ed0209f146467 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 31 Dec 2015 10:28:58 +0800 Subject: [PATCH 003/205] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=9A=84controller=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 1360 ++++++++++++------------ 1 file changed, 680 insertions(+), 680 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 444446ef4..a3e4f89c3 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -1,681 +1,681 @@ -class ExerciseController < ApplicationController - layout "base_courses" - - before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, - :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise, - :show_student_result,:student_exercise_list] - before_filter :find_course, :only => [:index,:new,:create] - include ExerciseHelper - - def index - publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) - publish_exercises.each do |exercise| - exercise.update_column('exercise_status', 2) - course = exercise.course - course.members.each do |m| - exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) - end - end - - if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?) - render_403 - return - end - remove_invalid_exercise(@course) - @is_teacher = User.current.allowed_to?(:as_teacher,@course) - if @is_teacher || User.current.admin? - exercises = @course.exercises.order("created_at asc") - else - exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc") - end - @exercises = paginateHelper exercises,20 #分页 - respond_to do |format| - format.html - end - end - - def show - publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) - publish_exercises.each do |exercise| - exercise.update_column('exercise_status', 2) - course = exercise.course - course.members.each do |m| - exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) - end - end - - unless User.current.member_of_course?(@course) || User.current.admin? - render_403 - return - end - @exercise = Exercise.find params[:id] - @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - exercise_end = @exercise.end_time > Time.now - if @exercise.time == -1 - @can_edit_excercise = exercise_end - else - @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end - end - unless @is_teacher - @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first - if @exercise_user.nil? - eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) - @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first - end - score = calculate_student_score(@exercise, User.current) - @exercise_user.update_attributes(:score => score) - end - # @percent = get_percent(@exercise,User.current) - @exercise_questions = @exercise.exercise_questions - respond_to do |format| - format.html {render :layout => 'base_courses'} - end - #end - end - - def new - option = { - :exercise_name => "", - :course_id => @course.id, - :exercise_status => 1, - :user_id => User.current.id, - :time => "", - :end_time => "", - :publish_time => "", - :exercise_description => "", - :show_result => 1 - } - @exercise = Exercise.create option - if @exercise - redirect_to edit_exercise_url @exercise.id - end - end - - def create - if params[:exercise] - exercise = Exercise.find(params[:exercise_id]) if params[:exercise_id] - exercise ||= Exercise.new - exercise.exercise_name = params[:exercise][:exercise_name] - exercise.exercise_description = params[:exercise][:exercise_description] - exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1) - exercise.publish_time = params[:exercise][:publish_time] - exercise.user_id = User.current.id - exercise.time = params[:exercise][:time] - exercise.course_id = params[:course_id] - exercise.exercise_status = 1 - if exercise.save - @exercise = exercise - respond_to do |format| - format.js - end - end - end - end - - def edit - respond_to do |format| - format.html{render :layout => 'base_courses'} - end - end - - def update - @exercise.exercise_name = params[:exercise][:exercise_name] - @exercise.exercise_description = params[:exercise][:exercise_description] - @exercise.time = params[:exercise][:time].blank? ? -1 : params[:exercise][:time] - @exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1) - @exercise.publish_time = params[:exercise][:publish_time] - @exercise.show_result = params[:exercise][:show_result].blank? ? 1 : params[:exercise][:show_result] - if @exercise.save - respond_to do |format| - format.js - end - else - render_404 - end - end - - def destroy - @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - if @exercise && @exercise.destroy - if @is_teacher - exercises = Exercise.where("course_id =?", @course.id) - else - exercises = Exercise.where("course_id =? and exercise_status =?", @course.id, 2) - end - @exercises = paginateHelper exercises,20 #分页 - respond_to do |format| - format.js - end - end - end - - # 统计结果 - def statistics_result - @exercise = Exercise.find(params[:id]) - exercise_questions = @exercise.exercise_questions - @exercise_questions = paginateHelper exercise_questions, 5 - respond_to do |format| - format.html{render :layout => 'base_courses'} - end - end - - # 添加题目 - # question_type 1:单选 2:多选 3:填空题 - def create_exercise_question - question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title] - option = { - :question_title => question_title, - :question_type => params[:question_type] || 1, - :question_number => params[:question_type] == "1"? @exercise.exercise_questions.where("question_type = 1").count + 1 : - (params[:question_type] == "2" ? (@exercise.exercise_questions.where("question_type = 2").count + 1) : - @exercise.exercise_questions.where("question_type = 3").count + 1), - :question_score => params[:question_score] - } - @exercise_questions = @exercise.exercise_questions.new option - # params[:question_answer] 题目选项 - if params[:question_answer] - for i in 1..params[:question_answer].count - answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1] - question_option = { - :choice_position => i, - :choice_text => answer - } - @exercise_questions.exercise_choices.new question_option - end - end - # 如果是插入的话,那么从插入的这个id以后的question_num都将要+1 - if params[:quest_id] - @is_insert = true - if @exercise_questions.question_type == 1 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number + 1") - #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") - elsif @exercise_questions.question_type == 2 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1") - else - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1") - end - # @exercise_question_num = params[:quest_num].to_i - @exercise_questions.question_number = params[:quest_num].to_i + 1 - end - if @exercise_questions.save - # params[:exercise_choice] 标准答案参数 - # 问答题标准答案有三个,单独处理 - if @exercise_questions.question_type == 3 - for i in 1..params[:exercise_choice].count - standart_answer = ExerciseStandardAnswer.new - standart_answer.exercise_question_id = @exercise_questions.id - standart_answer.answer_text = params[:exercise_choice].values[i-1] - standart_answer.save - end - else - standart_answer = ExerciseStandardAnswer.new - standart_answer.exercise_question_id = @exercise_questions.id - if @exercise_questions.question_type == 1 - standart_answer.exercise_choice_id = sigle_selection_standard_answer(params[:exercise_choice]) - else - standart_answer.exercise_choice_id = multiselect_standard_answer(params[:exercise_choice]) - end - standart_answer.save - end - respond_to do |format| - format.js - end - end - - end - - # 修改题目 - # params[:exercise_question] The id of exercise_question - # params[:question_answer] eg:A、B、C选项 - def update_exercise_question - @exercise_question = ExerciseQuestion.find params[:exercise_question] - @exercise_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title] - @exercise_question.question_score = params[:question_score] - # 处理选项:如果选了某个选项,那么则要删除之前的选项 - if params[:question_answer] - @exercise_question.exercise_choices.each do |answer| - answer.destroy unless params[:question_answer].keys.include? answer.id.to_s - end - for i in 1..params[:question_answer].count - question = @exercise_question.exercise_choices.find_by_id params[:question_answer].keys[i-1] - answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1] - if question - question.choice_position = i - question.choice_text = answer - question.save - else - question_option = { - :choice_position => i, - :choice_text => answer - } - @exercise_question.exercise_choices.new question_option - end - end - end - # 更新标准答案 - if params[:exercise_choice] - if @exercise_question.question_type == 3 - # 删除不合理的选项 - @exercise_question.exercise_standard_answers.each do |answer| - answer.destroy unless params[:exercise_choice].keys.include? answer.id.to_s - end - for i in 1..params[:exercise_choice].count - # 找到对应的标准答案 - question_standart = @exercise_question.exercise_standard_answers.find_by_id params[:exercise_choice].keys[i-1] - # 标准答案值 - answer_standart = (params[:exercise_choice].values[i-1].nil? || params[:exercise_choice].values[i-1].empty?) ? l(:label_new_answer) : params[:exercise_choice].values[i-1] - if question_standart - question_standart.answer_text = answer_standart - question_standart.save - else - standart_answer_option = { - :answer_text => answer_standart - } - @exercise_question.exercise_standard_answers.new standart_answer_option - end - end - else - answer_standart = @exercise_question.exercise_standard_answers.first - answer_standart.exercise_choice_id = @exercise_question.question_type == 1 ? sigle_selection_standard_answer(params[:exercise_choice]) : multiselect_standard_answer(params[:exercise_choice]) - answer_standart.save - end - @exercise_question.save - respond_to do |format| - format.js - end - end - end - - # 删除题目 - def delete_exercise_question - @exercise_question = ExerciseQuestion.find params[:exercise_question] - @exercise = @exercise_question.exercise - - if @exercise_question.question_type == 1 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1") - #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") - elsif @exercise_question.question_type == 2 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1") - else - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1") - end - # @exercise_question_num = params[:quest_num].to_i - # @exercise_questions.question_number = params[:quest_num].to_i - 1 - # - # exercise_questions = @exercise.exercise_questions.where("question_number > #{@exercise_question.question_number}") - # exercise_questions.each do |question| - # question.question_number -= 1 - # question.save - # end - if @exercise_question && @exercise_question.destroy - respond_to do |format| - format.js - end - end - end - - # 发布试卷 - def publish_exercise - @is_teacher = User.current.allowed_to?(:as_teacher,@course) - @index = params[:index] - @exercise.exercise_status = 2 - @exercise.publish_time = Time.now - if @exercise.save - @exercise.course.members.each do |m| - @exercise.course_messages << CourseMessage.create(:user_id =>m.user_id, :course_id => @exercise.course.id, :viewed => false,:status=>2) - end - #redirect_to exercise_index_url(:course_id=> @course.id) - respond_to do |format| - format.js - end - end - end - - # 重新发布试卷 - # 重新发布的时候会删除所有的答题 - def republish_exercise - @is_teacher = User.current.allowed_to?(:as_teacher,@course) - @index = params[:index] - @exercise.exercise_questions.each do |exercise_question| - exercise_question.exercise_answers.destroy_all - end - @exercise.course_messages.destroy_all - @exercise.exercise_users.destroy_all - @exercise.exercise_status = 1 - @exercise.publish_time = nil - @exercise.save - respond_to do |format| - format.js - end - end - - def student_exercise_list -=begin - if @exercise.end_time <= Time.now - @course.student.each do |student| - if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty? - ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0) - end - - s_score = calculate_student_score(@exercise, student.student) - exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, @exercise.id).first - exercise_user.update_attributes(:score => s_score) - end - end -=end - @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - @all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc") - @exercise_count = @exercise.exercise_users.where('score is not NULL').count - if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now) - @exercise_users_list = @exercise.exercise_users.where('score is not NULL') - @show_all = true; - elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time > Time.now - @exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id) - else - @exercise_users_list = [] - end - respond_to do |format| - format.html - end - end - - # 学生提交答卷,选中答案的过程中提交 - def commit_answer - eq = ExerciseQuestion.find(params[:exercise_question_id]) - # 已提交过的且是限时的则不允许答题 - if (has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?) && @exercise.time != -1) || @exercise.end_time < Time.now - render :json => {:text => "failure"} - return - end - if eq.question_type == 1 - # 单选题 - ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id],User.current.id) - if ea.nil? - # 尚未答该题,添加答案 - ea = ExerciseAnswer.new - ea.user_id = User.current.id - ea.exercise_question_id = params[:exercise_question_id] - end - #修改该题对应答案 - ea.exercise_choice_id = params[:exercise_choice_id] - if ea.save - # 保存成功返回成功信息及当前以答题百分比 - uncomplete_question = get_uncomplete_question(@exercise, User.current) - if uncomplete_question.count < 1 - complete = 1; - else - complete = 0; - end - @percent = get_percent(@exercise,User.current) - render :json => {:text => "ok" ,:complete => complete,:percent => format("%.2f" ,@percent)} - else - #返回失败信息 - render :json => {:text => "failure"} - end - elsif eq.question_type == 2 - #多选题 - ea = ExerciseAnswer.find_by_exercise_choice_id_and_user_id(params[:exercise_choice_id],User.current.id) - if ea.nil? - #尚未答该题,添加答案 - ea = ExerciseAnswer.new - ea.user_id = User.current.id - ea.exercise_question_id = params[:exercise_question_id] - ea.exercise_choice_id = params[:exercise_choice_id] - if ea.save - uncomplete_question = get_uncomplete_question(@exercise, User.current) - if uncomplete_question.count < 1 - complete = 1; - else - complete = 0; - end - @percent = get_percent(@exercise,User.current) - render :json => {:text => "ok",:complete => complete,:percent => format("%.2f" ,@percent)} - else - render :json => {:text => "failure"} - end - else - #pv不为空,则当前选项之前已被选择,再次点击则是不再选择该项,故删除该答案 - if ea.delete - @percent = get_percent(@exercise, User.current) - render :json => {:text => "false" ,:percent => format("%.2f" , @percent)} - else - render :json => {:text => "failure"} - end - end - elsif eq.question_type == 3 - #单行文本,多行文本题 - ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id], User.current.id) - if ea.nil? - # ea为空之前尚未答题,添加答案 - if params[:answer_text].nil? || params[:answer_text].blank? - #用户提交空答案,视作不作答 - @percent = get_percent(@exercise,User.current) - render :json => {:text => "",:percent => format("%.2f", @percent)} - else - #添加答案 - ea = ExerciseAnswer.new - ea.user_id = User.current.id - ea.exercise_question_id = params[:exercise_question_id] - ea.answer_text = params[:answer_text] - if ea.save - uncomplete_question = get_uncomplete_question(@exercise, User.current) - if uncomplete_question.count < 1 - complete = 1; - else - complete = 0; - end - @percent = get_percent(@exercise,User.current) - render :json => {:text => ea.answer_text,:complete => complete,:percent => format("%.2f",@percent)} - else - render :json => {:text => "failure"} - end - end - else - # ea不为空说明用户之前已作答 - if params[:answer_text].nil? || params[:answer_text].blank? - # 用户提交空答案,视为删除答案 - if ea.delete - @percent = get_percent(@exercise,User.current) - render :json => {:text => "",:percent => format("%.2f", @percent)} - else - render :json => {:text => "failure"} - end - else - #用户修改答案 - ea.answer_text = params[:answer_text] - if ea.save - @percent = get_percent(@exercise,User.current) - render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)} - else - render :json => {:text => "failure"} - end - end - end - - else - render :json => {:text => "failure"} - end - end - - # 提交问卷 - def commit_exercise - # 老师不需要提交 - if User.current.allowed_to?(:as_teacher,@course) - if @exercise.publish_time.nil? - @exercise.update_attributes(:show_result => params[:show_result]) - @exercise.update_attributes(:exercise_status => 2) - @exercise.update_attributes(:publish_time => Time.now) - course = @exercise.course - course.members.each do |m| - @exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) - end - redirect_to exercise_url(@exercise) - return - elsif @exercise.publish_time > Time.now - @exercise.update_attributes(:show_result => params[:show_result]) - redirect_to exercise_url(@exercise) - return - end - @exercise.update_attributes(:show_result => params[:show_result]) - redirect_to exercise_url(@exercise) - # REDO: 提示提交成功 - else - # 更新提交状态 - cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first - cur_exercise_user.update_attributes(:status => 1) - # 答题过程中需要统计完成量 - @uncomplete_question = get_uncomplete_question(@exercise, User.current) - # 获取改学生的考试得分 - @score = calculate_student_score(@exercise, User.current) - # @score = 100 - if @uncomplete_question.count < 1 - # 查看是否有已提交记录 - cur_exercise_user.score = @score - if cur_exercise_user.save - #redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course') - @status = 0 #提交成功 - else - @status = 2 #未知错误 - end - else - @status = 1 #有未做得必答题 - end - @save = params[:save].to_i if params[:save] - respond_to do |format| - format.js - end - end - end - - #查看学生的答卷情况 - def show_student_result - @user = User.find params[:user_id] - @can_edit_excercise = false - @exercise_questions = @exercise.exercise_questions - score = calculate_student_score(@exercise, @user) - 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 - respond_to do |format| - format.html {render :layout => 'base_courses'} - end - end - - # 计算学生得分 - def calculate_student_score(exercise, user) - score = 0 - score1 = 0 - score2 = 0 - score3 = 0 - exercise_qustions = exercise.exercise_questions - exercise_qustions.each do |question| - answer = get_user_answer(question, user) - standard_answer = get_user_standard_answer(question, user) - unless answer.empty? - # 问答题有多个答案 - if question.question_type == 3 && !standard_answer.empty? - if standard_answer.include?(answer.first.answer_text) - score1 = score1+ question.question_score unless question.question_score.nil? - end - elsif question.question_type == 1 && !standard_answer.nil? - if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id - score2 = score2 + question.question_score unless question.question_score.nil? - end - elsif question.question_type == 2 && !standard_answer.nil? - arr = get_mulscore(question, user) - if arr.to_i == standard_answer.exercise_choice_id - score3 = score3 + question.question_score unless question.question_score.nil? - end - # ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) - # arr = [] - # ecs.each do |ec| - # arr << ec.exercise_choice.choice_position - # end - # arr.sort - # arr = arr.join("") - # if arr.to_i == standard_answer.exercise_choice_id - # score3 = score + question.question_score unless question.question_score.nil? - # end - end - end - end - score = score1 + score2 + score3 - end - - private - - # ExerciseUser记录用户是否已提交问卷有对应的记录则已提交,没有则新建一个 - def get_exercise_user exercise_id,user_id - eu = ExerciseUser.find_by_exercise_id_and_user_id(exercise_id,user_id) - if eu.nil? - eu = ExerciseUser.new - end - eu - end - - # 获取当前学生回答问题的答案 - def get_user_answer(question,user) - # user_answer = ExerciseAnswer.where("user_id=? and exercise_question_id=?", user.id, question.id).first - user_answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}") - user_answer - end - - # 获取问题的标准答案 - def get_user_standard_answer(question,user) - if question.question_type == 3 - standard_answer =[] - question.exercise_standard_answers.each do |answer| - standard_answer << answer.answer_text - end - else - standard_answer = question.exercise_standard_answers.first - end - standard_answer - end - # 是否完成了答题 - def get_complete_question(exercise,user) - questions = exercise.exercise_questions - complete_question = [] - questions.each do |question| - answers = get_user_answer(question,user) - if !(answers.nil? || answers.count < 1) - complete_question << question - end - end - complete_question - end - - # 获取答题百分比 - def get_percent exercise,user - complete_count = get_complete_question(exercise,user).count - if exercise.exercise_questions.count == 0 - return 0 - else - return (complete_count.to_f / exercise.exercise_questions.count.to_f)*100 - end - end - - def remove_invalid_exercise(course) - exercises = course.exercises.where("exercise_name=?","") - unless exercises.empty? - exercises.each do |exercise| - if exercise.exercise_questions.empty? - exercise.destroy - end - end - end - end - - def find_exercise_and_course - @exercise = Exercise.find params[:id] - @course = Course.find @exercise.course_id - rescue Exception => e - render_404 - end - - def find_course - @course = Course.find params[:course_id] - rescue Exception => e - render_404 - end +class ExerciseController < ApplicationController + layout "base_courses" + + before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, + :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise, + :show_student_result,:student_exercise_list] + before_filter :find_course, :only => [:index,:new,:create] + include ExerciseHelper + + def index + publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + publish_exercises.each do |exercise| + exercise.update_column('exercise_status', 2) + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end + end + + if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?) + render_403 + return + end + remove_invalid_exercise(@course) + @is_teacher = User.current.allowed_to?(:as_teacher,@course) + if @is_teacher || User.current.admin? + exercises = @course.exercises.order("created_at asc") + else + exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc") + end + @exercises = paginateHelper exercises,20 #分页 + respond_to do |format| + format.html + end + end + + def show + publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + publish_exercises.each do |exercise| + exercise.update_column('exercise_status', 2) + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end + end + + unless User.current.member_of_course?(@course) || User.current.admin? + render_403 + return + end + @exercise = Exercise.find params[:id] + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + exercise_end = @exercise.end_time > Time.now + if @exercise.time == -1 + @can_edit_excercise = exercise_end + else + @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end + end + unless @is_teacher + @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first + if @exercise_user.nil? + eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) + @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first + end + score = calculate_student_score(@exercise, User.current) + @exercise_user.update_attributes(:score => score) + end + # @percent = get_percent(@exercise,User.current) + @exercise_questions = @exercise.exercise_questions + respond_to do |format| + format.html {render :layout => 'base_courses'} + end + #end + end + + def new + option = { + :exercise_name => "", + :course_id => @course.id, + :exercise_status => 1, + :user_id => User.current.id, + :time => "", + :end_time => "", + :publish_time => "", + :exercise_description => "", + :show_result => 1 + } + @exercise = Exercise.create option + if @exercise + redirect_to edit_exercise_url @exercise.id + end + end + + def create + if params[:exercise] + exercise = Exercise.find(params[:exercise_id]) if params[:exercise_id] + exercise ||= Exercise.new + exercise.exercise_name = params[:exercise][:exercise_name] + exercise.exercise_description = params[:exercise][:exercise_description] + exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1) + exercise.publish_time = params[:exercise][:publish_time] + exercise.user_id = User.current.id + exercise.time = params[:exercise][:time] + exercise.course_id = params[:course_id] + exercise.exercise_status = 1 + if exercise.save + @exercise = exercise + respond_to do |format| + format.js + end + end + end + end + + def edit + respond_to do |format| + format.html{render :layout => 'base_courses'} + end + end + + def update + @exercise.exercise_name = params[:exercise][:exercise_name] + @exercise.exercise_description = params[:exercise][:exercise_description] + @exercise.time = params[:exercise][:time].blank? ? -1 : params[:exercise][:time] + @exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1) + @exercise.publish_time = params[:exercise][:publish_time] + @exercise.show_result = params[:exercise][:show_result].blank? ? 1 : params[:exercise][:show_result] + if @exercise.save + respond_to do |format| + format.js + end + else + render_404 + end + end + + def destroy + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + if @exercise && @exercise.destroy + if @is_teacher + exercises = Exercise.where("course_id =?", @course.id) + else + exercises = Exercise.where("course_id =? and exercise_status =?", @course.id, 2) + end + @exercises = paginateHelper exercises,20 #分页 + respond_to do |format| + format.js + end + end + end + + # 统计结果 + def statistics_result + @exercise = Exercise.find(params[:id]) + exercise_questions = @exercise.exercise_questions + @exercise_questions = paginateHelper exercise_questions, 5 + respond_to do |format| + format.html{render :layout => 'base_courses'} + end + end + + # 添加题目 + # question_type 1:单选 2:多选 3:填空题 + def create_exercise_question + question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title] + option = { + :question_title => question_title, + :question_type => params[:question_type] || 1, + :question_number => params[:question_type] == "1"? @exercise.exercise_questions.where("question_type = 1").count + 1 : + (params[:question_type] == "2" ? (@exercise.exercise_questions.where("question_type = 2").count + 1) : + @exercise.exercise_questions.where("question_type = 3").count + 1), + :question_score => params[:question_score] + } + @exercise_questions = @exercise.exercise_questions.new option + # params[:question_answer] 题目选项 + if params[:question_answer] + for i in 1..params[:question_answer].count + answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1] + question_option = { + :choice_position => i, + :choice_text => answer + } + @exercise_questions.exercise_choices.new question_option + end + end + # 如果是插入的话,那么从插入的这个id以后的question_num都将要+1 + if params[:quest_id] + @is_insert = true + if @exercise_questions.question_type == 1 + ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number + 1") + #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") + elsif @exercise_questions.question_type == 2 + ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1") + else + ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1") + end + # @exercise_question_num = params[:quest_num].to_i + @exercise_questions.question_number = params[:quest_num].to_i + 1 + end + if @exercise_questions.save + # params[:exercise_choice] 标准答案参数 + # 问答题标准答案有三个,单独处理 + if @exercise_questions.question_type == 3 + for i in 1..params[:exercise_choice].count + standart_answer = ExerciseStandardAnswer.new + standart_answer.exercise_question_id = @exercise_questions.id + standart_answer.answer_text = params[:exercise_choice].values[i-1] + standart_answer.save + end + else + standart_answer = ExerciseStandardAnswer.new + standart_answer.exercise_question_id = @exercise_questions.id + if @exercise_questions.question_type == 1 + standart_answer.exercise_choice_id = sigle_selection_standard_answer(params[:exercise_choice]) + else + standart_answer.exercise_choice_id = multiselect_standard_answer(params[:exercise_choice]) + end + standart_answer.save + end + respond_to do |format| + format.js + end + end + + end + + # 修改题目 + # params[:exercise_question] The id of exercise_question + # params[:question_answer] eg:A、B、C选项 + def update_exercise_question + @exercise_question = ExerciseQuestion.find params[:exercise_question] + @exercise_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title] + @exercise_question.question_score = params[:question_score] + # 处理选项:如果选了某个选项,那么则要删除之前的选项 + if params[:question_answer] + @exercise_question.exercise_choices.each do |answer| + answer.destroy unless params[:question_answer].keys.include? answer.id.to_s + end + for i in 1..params[:question_answer].count + question = @exercise_question.exercise_choices.find_by_id params[:question_answer].keys[i-1] + answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1] + if question + question.choice_position = i + question.choice_text = answer + question.save + else + question_option = { + :choice_position => i, + :choice_text => answer + } + @exercise_question.exercise_choices.new question_option + end + end + end + # 更新标准答案 + if params[:exercise_choice] + if @exercise_question.question_type == 3 + # 删除不合理的选项 + @exercise_question.exercise_standard_answers.each do |answer| + answer.destroy unless params[:exercise_choice].keys.include? answer.id.to_s + end + for i in 1..params[:exercise_choice].count + # 找到对应的标准答案 + question_standart = @exercise_question.exercise_standard_answers.find_by_id params[:exercise_choice].keys[i-1] + # 标准答案值 + answer_standart = (params[:exercise_choice].values[i-1].nil? || params[:exercise_choice].values[i-1].empty?) ? l(:label_new_answer) : params[:exercise_choice].values[i-1] + if question_standart + question_standart.answer_text = answer_standart + question_standart.save + else + standart_answer_option = { + :answer_text => answer_standart + } + @exercise_question.exercise_standard_answers.new standart_answer_option + end + end + else + answer_standart = @exercise_question.exercise_standard_answers.first + answer_standart.exercise_choice_id = @exercise_question.question_type == 1 ? sigle_selection_standard_answer(params[:exercise_choice]) : multiselect_standard_answer(params[:exercise_choice]) + answer_standart.save + end + @exercise_question.save + respond_to do |format| + format.js + end + end + end + + # 删除题目 + def delete_exercise_question + @exercise_question = ExerciseQuestion.find params[:exercise_question] + @exercise = @exercise_question.exercise + + if @exercise_question.question_type == 1 + ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1") + #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") + elsif @exercise_question.question_type == 2 + ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1") + else + ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1") + end + # @exercise_question_num = params[:quest_num].to_i + # @exercise_questions.question_number = params[:quest_num].to_i - 1 + # + # exercise_questions = @exercise.exercise_questions.where("question_number > #{@exercise_question.question_number}") + # exercise_questions.each do |question| + # question.question_number -= 1 + # question.save + # end + if @exercise_question && @exercise_question.destroy + respond_to do |format| + format.js + end + end + end + + # 发布试卷 + def publish_exercise + @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @index = params[:index] + @exercise.exercise_status = 2 + @exercise.publish_time = Time.now + if @exercise.save + @exercise.course.members.each do |m| + @exercise.course_messages << CourseMessage.create(:user_id =>m.user_id, :course_id => @exercise.course.id, :viewed => false,:status=>2) + end + #redirect_to exercise_index_url(:course_id=> @course.id) + respond_to do |format| + format.js + end + end + end + + # 重新发布试卷 + # 重新发布的时候会删除所有的答题 + def republish_exercise + @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @index = params[:index] + @exercise.exercise_questions.each do |exercise_question| + exercise_question.exercise_answers.destroy_all + end + @exercise.course_messages.destroy_all + @exercise.exercise_users.destroy_all + @exercise.exercise_status = 1 + @exercise.publish_time = nil + @exercise.save + respond_to do |format| + format.js + end + end + + def student_exercise_list +=begin + if @exercise.end_time <= Time.now + @course.student.each do |student| + if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty? + ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0) + end + + s_score = calculate_student_score(@exercise, student.student) + exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, @exercise.id).first + exercise_user.update_attributes(:score => s_score) + end + end +=end + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + @all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc") + @exercise_count = @exercise.exercise_users.where('score is not NULL').count + if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now) + @exercise_users_list = @exercise.exercise_users.where('score is not NULL') + @show_all = true; + elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time > Time.now + @exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id) + else + @exercise_users_list = [] + end + respond_to do |format| + format.html + end + end + + # 学生提交答卷,选中答案的过程中提交 + def commit_answer + eq = ExerciseQuestion.find(params[:exercise_question_id]) + # 已提交过的且是限时的则不允许答题 + if (has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?) && @exercise.time != -1) || @exercise.end_time < Time.now + render :json => {:text => "failure"} + return + end + if eq.question_type == 1 + # 单选题 + ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id],User.current.id) + if ea.nil? + # 尚未答该题,添加答案 + ea = ExerciseAnswer.new + ea.user_id = User.current.id + ea.exercise_question_id = params[:exercise_question_id] + end + #修改该题对应答案 + ea.exercise_choice_id = params[:exercise_choice_id] + if ea.save + # 保存成功返回成功信息及当前以答题百分比 + uncomplete_question = get_uncomplete_question(@exercise, User.current) + if uncomplete_question.count < 1 + complete = 1; + else + complete = 0; + end + @percent = get_percent(@exercise,User.current) + render :json => {:text => "ok" ,:complete => complete,:percent => format("%.2f" ,@percent)} + else + #返回失败信息 + render :json => {:text => "failure"} + end + elsif eq.question_type == 2 + #多选题 + ea = ExerciseAnswer.find_by_exercise_choice_id_and_user_id(params[:exercise_choice_id],User.current.id) + if ea.nil? + #尚未答该题,添加答案 + ea = ExerciseAnswer.new + ea.user_id = User.current.id + ea.exercise_question_id = params[:exercise_question_id] + ea.exercise_choice_id = params[:exercise_choice_id] + if ea.save + uncomplete_question = get_uncomplete_question(@exercise, User.current) + if uncomplete_question.count < 1 + complete = 1; + else + complete = 0; + end + @percent = get_percent(@exercise,User.current) + render :json => {:text => "ok",:complete => complete,:percent => format("%.2f" ,@percent)} + else + render :json => {:text => "failure"} + end + else + #pv不为空,则当前选项之前已被选择,再次点击则是不再选择该项,故删除该答案 + if ea.delete + @percent = get_percent(@exercise, User.current) + render :json => {:text => "false" ,:percent => format("%.2f" , @percent)} + else + render :json => {:text => "failure"} + end + end + elsif eq.question_type == 3 + #单行文本,多行文本题 + ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id], User.current.id) + if ea.nil? + # ea为空之前尚未答题,添加答案 + if params[:answer_text].nil? || params[:answer_text].blank? + #用户提交空答案,视作不作答 + @percent = get_percent(@exercise,User.current) + render :json => {:text => "",:percent => format("%.2f", @percent)} + else + #添加答案 + ea = ExerciseAnswer.new + ea.user_id = User.current.id + ea.exercise_question_id = params[:exercise_question_id] + ea.answer_text = params[:answer_text] + if ea.save + uncomplete_question = get_uncomplete_question(@exercise, User.current) + if uncomplete_question.count < 1 + complete = 1; + else + complete = 0; + end + @percent = get_percent(@exercise,User.current) + render :json => {:text => ea.answer_text,:complete => complete,:percent => format("%.2f",@percent)} + else + render :json => {:text => "failure"} + end + end + else + # ea不为空说明用户之前已作答 + if params[:answer_text].nil? || params[:answer_text].blank? + # 用户提交空答案,视为删除答案 + if ea.delete + @percent = get_percent(@exercise,User.current) + render :json => {:text => "",:percent => format("%.2f", @percent)} + else + render :json => {:text => "failure"} + end + else + #用户修改答案 + ea.answer_text = params[:answer_text] + if ea.save + @percent = get_percent(@exercise,User.current) + render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)} + else + render :json => {:text => "failure"} + end + end + end + + else + render :json => {:text => "failure"} + end + end + + # 提交问卷 + def commit_exercise + # 老师不需要提交 + if User.current.allowed_to?(:as_teacher,@course) + if @exercise.publish_time.nil? + @exercise.update_attributes(:show_result => params[:show_result]) + @exercise.update_attributes(:exercise_status => 2) + @exercise.update_attributes(:publish_time => Time.now) + course = @exercise.course + course.members.each do |m| + @exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end + redirect_to exercise_url(@exercise) + return + elsif @exercise.publish_time > Time.now + @exercise.update_attributes(:show_result => params[:show_result]) + redirect_to exercise_url(@exercise) + return + end + @exercise.update_attributes(:show_result => params[:show_result]) + redirect_to exercise_url(@exercise) + # REDO: 提示提交成功 + else + # 更新提交状态 + cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first + cur_exercise_user.update_attributes(:status => 1) + # 答题过程中需要统计完成量 + @uncomplete_question = get_uncomplete_question(@exercise, User.current) + # 获取改学生的考试得分 + @score = calculate_student_score(@exercise, User.current) + # @score = 100 + if @uncomplete_question.count < 1 + # 查看是否有已提交记录 + cur_exercise_user.score = @score + if cur_exercise_user.save + #redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course') + @status = 0 #提交成功 + else + @status = 2 #未知错误 + end + else + @status = 1 #有未做得必答题 + end + @save = params[:save].to_i if params[:save] + respond_to do |format| + format.js + end + end + end + + #查看学生的答卷情况 + def show_student_result + @user = User.find params[:user_id] + @can_edit_excercise = false + @exercise_questions = @exercise.exercise_questions + score = calculate_student_score(@exercise, @user) + 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 + respond_to do |format| + format.html {render :layout => 'base_courses'} + end + end + + # 计算学生得分 + def calculate_student_score(exercise, user) + score = 0 + score1 = 0 + score2 = 0 + score3 = 0 + exercise_qustions = exercise.exercise_questions + exercise_qustions.each do |question| + answer = get_user_answer(question, user) + standard_answer = get_user_standard_answer(question, user) + unless answer.empty? + # 问答题有多个答案 + if question.question_type == 3 && !standard_answer.empty? + if standard_answer.include?(answer.first.answer_text) + score1 = score1+ question.question_score unless question.question_score.nil? + end + elsif question.question_type == 1 && !standard_answer.nil? + if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id + score2 = score2 + question.question_score unless question.question_score.nil? + end + elsif question.question_type == 2 && !standard_answer.nil? + arr = get_mulscore(question, user) + if arr.to_i == standard_answer.exercise_choice_id + score3 = score3 + question.question_score unless question.question_score.nil? + end + # ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) + # arr = [] + # ecs.each do |ec| + # arr << ec.exercise_choice.choice_position + # end + # arr.sort + # arr = arr.join("") + # if arr.to_i == standard_answer.exercise_choice_id + # score3 = score + question.question_score unless question.question_score.nil? + # end + end + end + end + score = score1 + score2 + score3 + end + + private + + # ExerciseUser记录用户是否已提交问卷有对应的记录则已提交,没有则新建一个 + def get_exercise_user exercise_id,user_id + eu = ExerciseUser.find_by_exercise_id_and_user_id(exercise_id,user_id) + if eu.nil? + eu = ExerciseUser.new + end + eu + end + + # 获取当前学生回答问题的答案 + def get_user_answer(question,user) + # user_answer = ExerciseAnswer.where("user_id=? and exercise_question_id=?", user.id, question.id).first + user_answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}") + user_answer + end + + # 获取问题的标准答案 + def get_user_standard_answer(question,user) + if question.question_type == 3 + standard_answer =[] + question.exercise_standard_answers.each do |answer| + standard_answer << answer.answer_text + end + else + standard_answer = question.exercise_standard_answers.first + end + standard_answer + end + # 是否完成了答题 + def get_complete_question(exercise,user) + questions = exercise.exercise_questions + complete_question = [] + questions.each do |question| + answers = get_user_answer(question,user) + if !(answers.nil? || answers.count < 1) + complete_question << question + end + end + complete_question + end + + # 获取答题百分比 + def get_percent exercise,user + complete_count = get_complete_question(exercise,user).count + if exercise.exercise_questions.count == 0 + return 0 + else + return (complete_count.to_f / exercise.exercise_questions.count.to_f)*100 + end + end + + def remove_invalid_exercise(course) + exercises = course.exercises.where("exercise_name=?","") + unless exercises.empty? + exercises.each do |exercise| + if exercise.exercise_questions.empty? + exercise.destroy + end + end + end + end + + def find_exercise_and_course + @exercise = Exercise.find params[:id] + @course = Course.find @exercise.course_id + rescue Exception => e + render_404 + end + + def find_course + @course = Course.find params[:course_id] + rescue Exception => e + render_404 + end end \ No newline at end of file From dae07d7e927b49d507a6cb027b01ab9968dcb4b8 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 4 Jan 2016 11:11:42 +0800 Subject: [PATCH 004/205] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AF=B9=E9=BD=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org.html.erb | 2 +- app/views/organizations/_show_home_page.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 8599ad750..f6961993f 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -140,7 +140,7 @@ <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> -
+
<%= render_flash_messages %> <%= yield %> <%= call_hook :view_layouts_base_content %> diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index c80c52b2f..7178cfe1d 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -1,4 +1,4 @@ -
+
From 8dd34f91c3b799e56f0cd6c646f4d679fda56e3f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 4 Jan 2016 15:12:38 +0800 Subject: [PATCH 005/205] =?UTF-8?q?=E8=AF=BE=E7=A8=8B/=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=85=B3=E8=81=94=E7=BB=84=E7=BB=87=EF=BC=8C?= =?UTF-8?q?=E4=BB=85=E5=85=B3=E8=81=94=E7=94=A8=E6=88=B7=E7=9A=84=E7=BB=84?= =?UTF-8?q?=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 18 ++++++++++-------- app/controllers/projects_controller.rb | 21 +++++++++++---------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 57e365aff..3e31a8571 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -38,14 +38,16 @@ class CoursesController < ApplicationController end limit = 15 course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id) - if course_org_ids.empty? - @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) - @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count - else - course_org_ids = "(" + course_org_ids.join(',') + ")" - @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) - @org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count - end + @orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit) + @org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count + # if course_org_ids.empty? + # @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) + # @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count + # else + # course_org_ids = "(" + course_org_ids.join(',') + ")" + # @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) + # @org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count + # end # @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count @orgs_page = Paginator.new @org_count, limit,params[:page] @hint_flag = params[:hint_flag] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ccebdccfa..31c70e92a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -76,16 +76,17 @@ class ProjectsController < ApplicationController condition = "%#{params[:name].strip}%".gsub(" ","") end limit = 15 - project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id) - if project_org_ids.empty? - @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) - @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count - else - project_org_ids = "(" + project_org_ids.join(',') + ")" - @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) - @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count - end - # @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count + project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id) << 0 + @orgs_not_in_project = User.current.organizations.where("organizations.id not in (#{project_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit) + @org_count = User.current.organizations.where("organizations.id not in (#{project_org_ids.join(',')}) and organizations.name like '#{condition}'").count + # if project_org_ids.empty? + # @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) + # @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count + # else + # project_org_ids = "(" + project_org_ids.join(',') + ")" + # @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) + # @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count + # end @orgs_page = Paginator.new @org_count, limit,params[:page] @no_roll_hint = params[:hint_flag] #render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json From abf6b5ff70f4f93ec1ed13c173448dd1b5c48bb9 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 4 Jan 2016 15:36:02 +0800 Subject: [PATCH 006/205] =?UTF-8?q?=E8=A7=A3=E5=86=B3base=5Forg=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E8=B5=84=E6=BA=90=E6=8C=89=E9=92=AE=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E4=B8=8A=E4=BC=A0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...g_subfield_upload_attachment_list.html.erb | 34 +++++++++++++++++++ .../files/_upload_subfield_file.html.erb | 4 +-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 app/views/files/_org_subfield_upload_attachment_list.html.erb diff --git a/app/views/files/_org_subfield_upload_attachment_list.html.erb b/app/views/files/_org_subfield_upload_attachment_list.html.erb new file mode 100644 index 000000000..efb5f64fb --- /dev/null +++ b/app/views/files/_org_subfield_upload_attachment_list.html.erb @@ -0,0 +1,34 @@ + + + <%= file_field_tag 'attachments[dummy][file]', + :id => "_file#{container.id}", + :class => ie8? ? '':'file_selector', + :multiple => true, + :onchange => "addInputFiles_board(this, '#{container.id}','"+"submit_resource"+"');", + :style => ie8? ? '': 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all), + :lebel_file_uploding => l(:lebel_file_uploding), + :containerid => "#{container.id}" + } %> + + + + + <%= l(:label_no_file_uploaded)%> + +(<%= l(:label_max_size) %>: +<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) +
+
+ + +
\ No newline at end of file diff --git a/app/views/files/_upload_subfield_file.html.erb b/app/views/files/_upload_subfield_file.html.erb index 33e4ce97c..20c29f238 100644 --- a/app/views/files/_upload_subfield_file.html.erb +++ b/app/views/files/_upload_subfield_file.html.erb @@ -17,8 +17,8 @@ <% else %> <% end %> - - <%= render :partial => 'files/attachement_list'%> + + <%= render :partial => 'files/org_subfield_upload_attachment_list', :locals => {:container => org_subfield}%>
<%= l(:button_cancel)%> <%= l(:button_confirm)%> From d8c6775f42a6435cbb8d3825c0e5591a98daa9ba Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 5 Jan 2016 16:46:06 +0800 Subject: [PATCH 007/205] =?UTF-8?q?1.=E8=A7=A3=E5=86=B3=E2=80=9C=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=8A=A8=E6=80=81=E4=B8=AD=E7=9A=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=8A=A8=E6=80=81=EF=BC=8C=E8=AF=84=E5=88=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E4=B8=8D=E8=83=BD=E5=85=B3=E9=97=AD=20?= =?UTF-8?q?=E2=80=9D=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B=202.=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E7=94=B3=E8=AF=B7=E5=AD=90=E5=9F=9F=E5=90=8D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 18 ++++++++- app/models/org_message.rb | 15 +++++++ .../_set_evalutation_att.html.erb | 2 +- .../homework_common/score_rule_set.js.erb | 2 +- .../start_evaluation_set.js.erb | 2 +- .../agree_apply_subdomain.js.erb | 1 + .../organizations/apply_subdomain.js.erb | 0 app/views/organizations/setting.html.erb | 29 ++++++++++---- .../_set_score_rule_detail.html.erb | 2 +- app/views/users/_user_message_org.html.erb | 39 +++++++++++++++++++ app/views/users/user_messages.html.erb | 2 + app/views/users/user_organizations.html.erb | 6 ++- config/routes.rb | 5 +++ .../20160105014033_create_org_messages.rb | 19 +++++++++ 14 files changed, 128 insertions(+), 14 deletions(-) create mode 100644 app/models/org_message.rb create mode 100644 app/views/organizations/agree_apply_subdomain.js.erb create mode 100644 app/views/organizations/apply_subdomain.js.erb create mode 100644 app/views/users/_user_message_org.html.erb create mode 100644 db/migrate/20160105014033_create_org_messages.rb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index dabf45da8..3c5266f79 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -28,7 +28,7 @@ class OrganizationsController < ApplicationController helper :project_score helper :issues include UsersHelper - before_filter :find_organization, :only => [:show, :members] + before_filter :find_organization, :only => [:show, :members, :apply_subdomain] layout 'base_org' def index @@ -291,4 +291,20 @@ class OrganizationsController < ApplicationController @org_subfield = OrgSubfield.find(params[:org_subfield_id]) @org_subfield.update_attribute(:hide, 0) end + + def apply_subdomain + @organization = Organization.find(params[:id]) + admins = User.where("admin=1") + admins.each do |admin| + OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain]) + end + end + + def agree_apply_subdomain + @organization = Organization.find(params[:organization_id]) + @organization.update_attribute(:domain, params[:org_domain]) + if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=#{params[:org_domain]}").count == 0 + OrgMessage.create(:user_id => params[:user_id], :organization_id => @organization.id, :message_type => 'AgreeApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain]) + end + end end diff --git a/app/models/org_message.rb b/app/models/org_message.rb new file mode 100644 index 000000000..baedc77f4 --- /dev/null +++ b/app/models/org_message.rb @@ -0,0 +1,15 @@ +class OrgMessage < ActiveRecord::Base + belongs_to :user + belongs_to :organization + has_many :message_alls, :as => :message, :dependent => :destroy + validates :message_type, :presence => true + validates :message_id, :presence => true + validates :organization_id, :presence => true + after_create :add_user_message + + def add_user_message + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + self.message_alls << MessageAll.new(:user_id => self.user_id) + end + end +end \ No newline at end of file diff --git a/app/views/homework_common/_set_evalutation_att.html.erb b/app/views/homework_common/_set_evalutation_att.html.erb index 59df88680..bc4e8e733 100644 --- a/app/views/homework_common/_set_evalutation_att.html.erb +++ b/app/views/homework_common/_set_evalutation_att.html.erb @@ -45,7 +45,7 @@ 确定
diff --git a/app/views/homework_common/score_rule_set.js.erb b/app/views/homework_common/score_rule_set.js.erb index 7fae1ecdc..da685b758 100644 --- a/app/views/homework_common/score_rule_set.js.erb +++ b/app/views/homework_common/score_rule_set.js.erb @@ -2,5 +2,5 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/se showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + - ""); + ""); $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); \ No newline at end of file diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb index 2a260dc4d..659441ce8 100644 --- a/app/views/homework_common/start_evaluation_set.js.erb +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -3,7 +3,7 @@ var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', bu showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + -""); +""); $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); $(function() { $('#evaluation_start_time').datepicker(datepickerOptions); $('#evaluation_end_time').datepicker(datepickerOptions); diff --git a/app/views/organizations/agree_apply_subdomain.js.erb b/app/views/organizations/agree_apply_subdomain.js.erb new file mode 100644 index 000000000..df25d018c --- /dev/null +++ b/app/views/organizations/agree_apply_subdomain.js.erb @@ -0,0 +1 @@ +$("#agree_apply_subdomain").text("已同意申请"); \ No newline at end of file diff --git a/app/views/organizations/apply_subdomain.js.erb b/app/views/organizations/apply_subdomain.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 3058d03a8..77cfdc985 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -54,14 +54,14 @@
- - - - - - - - +
组织URL: +
https:// + + .trustie.net申请 +

+ +
+
公开 : class="ml3" />
@@ -139,4 +139,17 @@ if ($("#subfield_name").val().trim() != "") $("#add_subfield_form").submit(); } + function apply_subdomain(id, domain){ + $.ajax({ + url:"<%= apply_subdomain_organization_path %>", + type:'post', + data:{ + id:id, + domain:domain + }, + success:function(){ + $("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); + } + }); + } \ No newline at end of file diff --git a/app/views/student_work/_set_score_rule_detail.html.erb b/app/views/student_work/_set_score_rule_detail.html.erb index 4739fba47..c8451e478 100644 --- a/app/views/student_work/_set_score_rule_detail.html.erb +++ b/app/views/student_work/_set_score_rule_detail.html.erb @@ -56,7 +56,7 @@ 确定
diff --git a/app/views/users/_user_message_org.html.erb b/app/views/users/_user_message_org.html.erb new file mode 100644 index 000000000..56d7d7b29 --- /dev/null +++ b/app/views/users/_user_message_org.html.erb @@ -0,0 +1,39 @@ +<% if ma.class == OrgMessage %> + <% if ma.message_type == 'ApplySubdomain'%> +
    +
  • + <%=link_to image_tag(url_to_avatar(ma.organization), :width => "30", :height => "30"), organization_path(ma.organization_id) %> +
  • +
  • + <%=link_to ma.organization.name, organization_path(ma.organization_id), :class => "newsBlue homepageNewsPublisher" %> + '>申请子域名: +
  • +
  • + <%= ma.content %> +
  • +
  • + <%=link_to ma.organization.domain.nil? ? "同意申请":"已同意申请", agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id ), + :id => 'agree_apply_subdomain', + :method => 'post', + :remote => true, + :class => "green_btn_cir ml10", + :style => "color:#fff" %> +
  • +
  • <%= time_tag(ma.created_at).html_safe %>
  • +
+ <% end %> + <% if ma.message_type == 'AgreeApplySubdomain'%> + + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index d690f7e43..391709b52 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -31,6 +31,8 @@ <%= render :partial => 'users/user_message_userfeedaback', :locals => {:ma => ma} %> + <%= render :partial => 'users/user_message_org', :locals => {:ma => ma} %> + <% end %>
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb index ed8238169..e9709f766 100644 --- a/app/views/users/user_organizations.html.erb +++ b/app/views/users/user_organizations.html.erb @@ -22,7 +22,11 @@
- <%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %> + <% if org.domain.nil? %> + <%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %> + <% else %> + <%= org.name %> + <% end %>
<%= org.description %>
创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %>
diff --git a/config/routes.rb b/config/routes.rb index 2d195f0d2..543cd1645 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -47,12 +47,14 @@ RedmineApp::Application.routes.draw do post 'join_project_menu' post 'join_projects' post 'logout' + post 'apply_subdomain' end collection do get 'check_uniq' get 'autocomplete_search' post 'hide_org_subfield' post 'show_org_subfield' + post 'agree_apply_subdomain' end resources :org_document_comments do member do @@ -64,6 +66,9 @@ RedmineApp::Application.routes.draw do end end + Organization.where("domain is not null").each do |org| + get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: {subdomain: org.domain} + end get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'} get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'} diff --git a/db/migrate/20160105014033_create_org_messages.rb b/db/migrate/20160105014033_create_org_messages.rb new file mode 100644 index 000000000..9ea18ccb0 --- /dev/null +++ b/db/migrate/20160105014033_create_org_messages.rb @@ -0,0 +1,19 @@ +class CreateOrgMessages < ActiveRecord::Migration + def up + create_table :org_messages do |t| + t.integer :user_id + t.integer :sender_id + t.integer :organization_id + t.string :message_type + t.integer :message_id + t.integer :viewed + t.string :content + + t.timestamps + end + end + + def down + drop_table :org_messages + end +end From 9ccca401f6c85664243a66235b083dde700d915d Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 5 Jan 2016 16:47:55 +0800 Subject: [PATCH 008/205] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=97=B6=E4=B9=9F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=B3=BB=E7=BB=9F=E6=B5=8B=E8=AF=95=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_programing_work_show.html.erb | 86 +++++++++---------- .../student_work/_student_work_list.html.erb | 54 +++++++++--- 2 files changed, 83 insertions(+), 57 deletions(-) diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index f7ecb0ccf..d98a9fe0f 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -31,52 +31,50 @@
- <% if @is_teacher%> -
  • - - 测试结果: - -
    - <% work.student_work_tests.each_with_index do |test, index| %> -
    -

    - 第<%= work.student_work_tests.count - index%>次测试 -

    - - <%= test.created_at.to_s(:db) %> - -
    +
  • + + 测试结果: + +
    + <% work.student_work_tests.each_with_index do |test, index| %> +
    +

    + 第<%= work.student_work_tests.count - index%>次测试 +

    + + <%= test.created_at.to_s(:db) %> + +
    +
    + <% if test.status.to_i == -2 %> +
    + <%= test.results.first %> +
    + <% else %> +
    +
      + <% test.results.each_with_index do |x, i| %> +
    • + 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: + <%=x["result"]%> + 正确输出: + <%=x["output"]%> +
      + <% else %> + 测试正确! +
      + <% end %> +
    • + <% end %> +
    - <% if test.status.to_i == -2 %> -
    - <%= test.results.first %> -
    - <% else %> -
    -
      - <% test.results.each_with_index do |x, i| %> -
    • - 测试<%=i+1%> - <% if x["status"].to_i != 0 %> - 测试错误! - 您的输出: - <%=x["result"]%> - 正确输出: - <%=x["output"]%> -
      - <% else %> - 测试正确! -
      - <% end %> -
    • - <% end %> -
    -
    - <% end %> <% end %> -
    -
  • - <% end%> + <% end %> +
    +
  • <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 5598092e9..4f891f4c8 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -40,18 +40,46 @@ <% end%>
    - <% if @homework.homework_type != 3 && student_work.user == User.current && !@is_evaluation %> - <% if @homework.homework_type == 2%> - <%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> - <% else %> - <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> - <% end %> - <% elsif @homework.homework_type == 3 %> - <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> - <% if pro && pro.student_work_id == student_work.id && !@is_evaluation %> - <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> - <% end %> - <% end %>
    -<% end%> \ No newline at end of file +<% end%> + \ No newline at end of file From 244e1338032ce7a150110ea8bd1ba2ffe2a37928 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 6 Jan 2016 09:57:54 +0800 Subject: [PATCH 009/205] =?UTF-8?q?=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_course_homework.html.erb | 2 +- app/views/users/_course_homework.html.erb | 2 +- app/views/users/_user_homework_detail.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 8cf5f7183..22b0b2cb4 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -148,7 +148,7 @@ <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
    <% projects = activity.student_work_projects.where("is_leader = 1") %> -
    +
    已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
    <% projects.each do |pro| %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index e443a54b4..db276d88b 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -149,7 +149,7 @@ <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
    <% projects = activity.student_work_projects.where("is_leader = 1") %> -
    +
    已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
    <% projects.each do |pro| %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 529dd852c..6cb502d77 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -152,7 +152,7 @@ <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
    <% projects = homework_common.student_work_projects.where("is_leader = 1") %> -
    +
    已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
    <% projects.each do |pro| %> From cf125159f24ade513cb50358ea115b0846db4780 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 6 Jan 2016 10:36:53 +0800 Subject: [PATCH 010/205] =?UTF-8?q?=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_course_homework.html.erb | 2 +- app/views/users/_course_homework.html.erb | 2 +- app/views/users/_user_homework_detail.html.erb | 2 +- public/stylesheets/public.css | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 22b0b2cb4..e3e2938ec 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -172,7 +172,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

    <%=(User.find project.user_id).show_name %>(组长)

    -

    <%=time_from_now time %>

    +

    <%=time_from_now time %>  <%=changesets_num project %>提交

    项目名称:<%=project.name %>
    创建者:<%=(User.find project.user_id).show_name %>(组长)
    diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index db276d88b..f74cdcf54 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -173,7 +173,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

    <%=(User.find project.user_id).show_name %>(组长)

    -

    <%=time_from_now time %>

    +

    <%=time_from_now time %>  <%=changesets_num project %>提交

    项目名称:<%=project.name %>
    创建者:<%=(User.find project.user_id).show_name %>(组长)
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 6cb502d77..b39f5a647 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -175,7 +175,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

    <%=(User.find project.user_id).show_name %>(组长)

    -

    <%=time_from_now time %>

    +

    <%=time_from_now time %>  <%=changesets_num project %>提交

    项目名称:<%=project.name %>
    创建者:<%=(User.find project.user_id).show_name %>(组长)
    diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index ed0874751..94e274505 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -69,6 +69,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml35{margin-left: 35px;} .ml40{ margin-left:40px;} .ml45{ margin-left:45px;} +.ml48{ margin-left:48px;} .ml55{ margin-left:55px;} .ml30{ margin-left:30px;} .ml38{ margin-left:38px;} From e9d986b311b3d140d3fc0c1c2f61797e18844d93 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 6 Jan 2016 11:01:00 +0800 Subject: [PATCH 011/205] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=85=B3=E8=81=94?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_homework.html.erb | 3 ++- public/stylesheets/new_user.css | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f74cdcf54..f7eae22db 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -152,6 +152,7 @@
    已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
    +
    <% projects.each do |pro| %> <% project = Project.find pro.project_id %> -
    +
    <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> <% else %> diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 346d6b3a7..7c59f673b 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -121,6 +121,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .w70{ width:70px;} .w80{ width:80px;} .w90{ width:90px;} +.w110{width:110px;} .w210{ width:210px;} .w150{ width:150px;} .w280{ width:280px;} @@ -1384,7 +1385,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;} .hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} .mr150 {margin-right:150px;} -.captainName {max-width:40px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;} +.captainName {max-width:75px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;} /* @功能 定义 */ span.at {color:#269ac9;} From 7d4e3cdd5cdad37a44ae55faecfda5b45f52df93 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 6 Jan 2016 16:22:13 +0800 Subject: [PATCH 012/205] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE/?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=BF=AB=E6=8D=B7=E5=8A=9F=E8=83=BD=EF=BC=9B?= =?UTF-8?q?=202.=E5=A2=9E=E5=8A=A0=E7=A7=81=E4=BF=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 9 ++++- app/controllers/words_controller.rb | 6 ++- app/models/journals_for_message.rb | 5 ++- app/views/files/upload_files_menu.js.erb | 15 +++++++ app/views/layouts/_user_courses.html.erb | 15 ++++++- app/views/layouts/_user_projects.html.erb | 14 ++++++- app/views/layouts/new_base_user.html.erb | 38 +++++++++++++++++- app/views/users/user_newfeedback.html.erb | 11 ++++- config/routes.rb | 1 + ...55_add_private_to_journals_for_messages.rb | 5 +++ db/schema.rb | 19 +++++++-- public/images/hwork_icon.png | Bin 0 -> 5024 bytes public/stylesheets/new_user.css | 30 ++++++++++++++ public/stylesheets/public.css | 28 ++++++++++++- public/stylesheets/users.css | 10 ++++- 15 files changed, 192 insertions(+), 14 deletions(-) create mode 100644 app/views/files/upload_files_menu.js.erb create mode 100644 db/migrate/20160106065255_add_private_to_journals_for_messages.rb create mode 100644 public/images/hwork_icon.png diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 121cd3a42..c5f5c0fc2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -24,7 +24,10 @@ class FilesController < ApplicationController before_filter :auth_login1, :only => [:index] before_filter :logged_user_by_apptoken,:only => [:index] before_filter :find_project_by_project_id#, :except => [:getattachtype] - before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,:search_files_in_subfield] + before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project, + :search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment, + :search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache, + :search_files_in_subfield,:upload_files_menu] helper :sort include SortHelper @@ -784,4 +787,8 @@ class FilesController < ApplicationController def subfield_upload_file @org_subfield = OrgSubfield.find(params[:org_subfield_id]) end + + def upload_files_menu + p 1 + end end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index df9fd30f2..79981ec4d 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -236,7 +236,11 @@ class WordsController < ApplicationController if User.current.logged? @user = User.find(params[:id]) if params[:new_form][:user_message].size>0 && User.current.logged? && @user - @user.add_jour(User.current, params[:new_form][:user_message]) + if params[:private] && params[:private] == '1' + @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:user_message], :reply_id => 0, :status => true, :is_readed => false, :private => 1) + else + @user.add_jour(User.current, params[:new_form][:user_message]) + end end redirect_to feedback_path(@user) else diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 59da817f4..d3e76addc 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -15,8 +15,9 @@ class JournalsForMessage < ActiveRecord::Base "m_parent_id", # 留言信息的父留言id "is_readed", # 留言是否已读 "m_reply_count", # 留言的回复数量 - "m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id) - "is_comprehensive_evaluation" # 1 教师评论、2 匿评、3 留言 + "m_reply_id" , # 回复某留言的留言id(a留言回复了b留言,这是b留言的id) + "is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言 + "private" acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC" after_destroy :delete_kindeditor_assets belongs_to :project, diff --git a/app/views/files/upload_files_menu.js.erb b/app/views/files/upload_files_menu.js.erb new file mode 100644 index 000000000..3e44f5644 --- /dev/null +++ b/app/views/files/upload_files_menu.js.erb @@ -0,0 +1,15 @@ +<% if @project %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/upload_project_files_on_navbar',:locals => {:container => @project}) %>'); + showModal('ajax-modal', '513px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().addClass("popbox_polls"); +<% elsif @course %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>'); + showModal('ajax-modal', '513px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().addClass("popbox_polls"); +<% end %> \ No newline at end of file diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index a71dd099f..03abf77c7 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -1,6 +1,19 @@ <% courses.each do |course|%> -
  • +
  • <%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}", :title => course.name+"("+course.time.to_s+course.term+")"%> +
    +
      + +
    +
  • <% end %> diff --git a/app/views/layouts/_user_projects.html.erb b/app/views/layouts/_user_projects.html.erb index da078c963..134b9952b 100644 --- a/app/views/layouts/_user_projects.html.erb +++ b/app/views/layouts/_user_projects.html.erb @@ -1,6 +1,18 @@ <% projects.each do |project|%> -
  • +
  • <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => project.name%> +
    +
      + +
    +
  • <% end %> <% if projects.size == 5%> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index b77c5b875..2993aa685 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -10,7 +10,7 @@ <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_user', 'user_leftside','prettify','users',:media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> - <%= javascript_include_tag "bootstrap","avatars","new_user",'prettify'%> + <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -27,6 +27,42 @@ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); + diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index f53983228..0b0ba9d48 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -26,9 +26,11 @@ <%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%>

    +
    - 取消 - 留言 + + 留言 + 私信 <% end%>
    @@ -52,6 +54,11 @@ + +
    +
    <%= @org_subfield.name %>
    +
    + +<% if @org_activities %> + <%= render :partial => 'org_subfields/show_details', + :locals => {:org_activities => @org_activities, + :page=> @page, + :org => @organization, + :org_act_count=> @org_activities.count} %> +<% end %> + + + + + diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb index 40ad1cafb..cf214e038 100644 --- a/app/views/org_subfields/show.html.erb +++ b/app/views/org_subfields/show.html.erb @@ -1,7 +1,10 @@ - -
    - <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> -
    +<% if @org_subfield.field_type == 'Resource' %> +
    + <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> +
    +<% else %> + <%= render :partial => 'org_subfields/show_post_type'%> +<% end %> +
    • @@ -31,7 +61,7 @@ <%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.project_score.issue_num * 4 + @project.project_score.issue_journal_num %>
    • - <%= link_to l(:label_file_attachment_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.project_score.attach_num * 5 %> + <%= link_to l(:label_file_attachment_score), "javascript:void(0)", :onclick => "show_div('file_score_index')"%> : <%= @project.project_score.attach_num * 5 %>
    • <%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> : <%= @project.project_score.board_num * 2 + @project.project_score.board_message_num %> diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index fe89e64e3..ffa2c1cc5 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -433,6 +433,7 @@ zh: label_file_score: 文档得分 label_file_number: 文档的数量 + lable_file_attachment_number: 资源数 label_file_attachment_score: 资源得分 label_code_submit_score: 代码提交得分 From 6b7ce68e4a0c4622e8d62d5c73c1f7a77382c821 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 14 Jan 2016 17:52:48 +0800 Subject: [PATCH 127/205] =?UTF-8?q?=E5=90=84=E7=A7=8Dbug=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 1 + app/controllers/organizations_controller.rb | 1 + .../attachments/update_file_dense.js.erb | 4 +- app/views/courses/private_or_public.js.erb | 2 + app/views/layouts/_user_courses.html.erb | 2 +- app/views/org_subfields/show.html.erb | 60 +++++++++++++++++++ .../organizations/_subfield_list.html.erb | 4 +- app/views/projects/_attachment_acts.html.erb | 1 + app/views/projects/_project_create.html.erb | 1 + app/views/projects/_project_news.html.erb | 1 + app/views/users/_course_attachment.html.erb | 1 + .../users/_course_journalsformessage.html.erb | 1 + .../users/_resource_share_for_orgs.html.erb | 2 +- app/views/users/_show_detail_info.html.erb | 2 +- config/routes.rb | 16 ++--- db/schema.rb | 9 ++- public/stylesheets/org.css | 11 ++-- 17 files changed, 98 insertions(+), 21 deletions(-) diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 5850629f0..9f1d964ef 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -1,5 +1,6 @@ class OrgSubfieldsController < ApplicationController helper :attachments + include FilesHelper layout 'base_org' def create if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0 diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 25ee3dc48..b431678af 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -311,6 +311,7 @@ class OrganizationsController < ApplicationController def agree_apply_subdomain @organization = Organization.find(params[:organization_id]) + OrgMessage.find(params[:act_id]).update_attribute(:viewed, 1) @organization.update_attribute(:domain, params[:org_domain]) if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=?",params[:org_domain]).count == 0 OrgMessage.create(:user_id => params[:user_id], :organization_id => @organization.id, :message_type => 'AgreeApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain]) diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb index 0a3124e83..7709ee288 100644 --- a/app/views/attachments/update_file_dense.js.erb +++ b/app/views/attachments/update_file_dense.js.erb @@ -6,8 +6,8 @@ $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@atta :remote => true, :class => "postOptionLink", :method => :post) %>"); <% else %> -$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), - :remote=>true,:class=>"f_l re_open",:method => :post) %>"); +$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), + :remote=>true,:class=>"postOptionLink",:method => :post) %>"); <% end %> <% if @attachment.is_public? %> $("#image_private_<%= @attachment.id%>").html('') diff --git a/app/views/courses/private_or_public.js.erb b/app/views/courses/private_or_public.js.erb index 2f222fdfb..10b787dd4 100644 --- a/app/views/courses/private_or_public.js.erb +++ b/app/views/courses/private_or_public.js.erb @@ -10,7 +10,9 @@ <% else %> <% if @course.is_public? %> $("#set_course_public_<%= @course.id %>").text("设为私有"); + $("#show_course_<%= @course.id %>").attr("title","公开课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)"); <% else %> $("#set_course_public_<%= @course.id %>").text("设为公开"); + $("#show_course_<%= @course.id %>").attr("title","私有课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)"); <% end %> <% end %> \ No newline at end of file diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index cc07950e3..1d69306de 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -2,7 +2,7 @@
    • <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %> <%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}", - :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+course.time.to_s+course.term+")"%> + :id => "show_course_#{course.id}",:title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+course.time.to_s+course.term+")"%> <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
      • diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb index cf214e038..c7b52a7b8 100644 --- a/app/views/org_subfields/show.html.erb +++ b/app/views/org_subfields/show.html.erb @@ -6,6 +6,7 @@ <%= render :partial => 'org_subfields/show_post_type'%> <% end %> + + -
        - <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> - <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> - <% end %> - <% time=project.updated_on %> - <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

        <%=(User.find project.user_id).show_name %>(组长)

        - -

        <%=time_from_now time %>  <%= project.project_score.changeset_num %>提交

        -
        - 项目名称:<%=project.name %>
        - 创建者:<%=(User.find project.user_id).show_name %>(组长)
        - 更新时间:<%=time_from_now time %> -
        -
        - <% end %> -
    +
    + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> + <% end %> + <% time=project.updated_on %> + <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> +

    <%=(User.find project.user_id).show_name %>(组长)

    +

    <%=time_from_now time %>  <%= project.project_score.changeset_num %>提交

    +
    + 项目名称:<%=project.name %>
    + 创建者:<%=(User.find project.user_id).show_name %>(组长)
    + 更新时间:<%=time_from_now time %> +
    +
    + <% if i == 9 && projects.count > 10 %> + 更多>> + <% end %> + <% if i > 9 && i == (projects.count - 1) %> + 收回<< + <% end %> + <% end %> + + <% end %> <% end %>
    <% if is_teacher%> @@ -313,5 +340,14 @@ diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 371334be1..df89f31eb 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -80,8 +80,8 @@ $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>"); <% end %> <% end %> + $('#score_<%= work.id%>').peSlider({range: 'min'}); <% end %> - $('#score_<%= work.id%>').peSlider({range: 'min'}); <% end %> }); \ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 81627f9d6..d89b44651 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -130,58 +130,86 @@ <% if activity.student_works.count != 0 %> <% sw = activity.student_works.reorder("created_at desc").first %>
    - <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 + # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
    <% end %>
    <% if activity.student_works.count != 0 %> <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> - <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> + <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> + <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> <% unless student_work_scores.empty? %> <% last_score = student_work_scores.first %> -
    - <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品 +
    +

    # <%=time_from_now last_score.created_at %> + <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行: +

    + <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %> + <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %> + <% student_works.each_with_index do |sw, i| %> +
    + <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> + + + <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> +

    分数:<%=format("%.1f",score<0 ? 0 : score) %>分

    +
    + <% if i == 4 %> + <% break %> + <% end %> + <% end %> + <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%> +
    <% end %> <% end %>
    <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %> -
    <% projects = activity.student_work_projects.where("is_leader = 1") %> -
    - 已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %> -
    -
    - <% projects.each do |pro| %> - <% project = Project.find pro.project_id %> - + -
    - <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> - <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> +
    + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> + <% end %> + <% time=project.updated_on %> + <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> +

    <%=(User.find project.user_id).show_name %>(组长)

    +

    <%=time_from_now time %>  <%= project.project_score.changeset_num %>提交

    +
    + 项目名称:<%=project.name %>
    + 创建者:<%=(User.find project.user_id).show_name %>(组长)
    + 更新时间:<%=time_from_now time %> +
    +
    + <% if i == 9 && projects.count > 10 %> + 更多>> + <% end %> + <% if i > 9 && i == (projects.count - 1) %> + 收回<< + <% end %> <% end %> - <% time=project.updated_on %> - <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

    <%=(User.find project.user_id).show_name %>(组长)

    -

    <%=time_from_now time %>  <%= project.project_score.changeset_num %>提交

    -
    - 项目名称:<%=project.name %>
    - 创建者:<%=(User.find project.user_id).show_name %>(组长)
    - 更新时间:<%=time_from_now time %> -
    <% end %> -
    <% end %>
    <% if is_teacher%> @@ -313,5 +341,14 @@
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 8c4a8ac0d..b12f1c0af 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -132,59 +132,87 @@ <% if homework_common.student_works.count != 0 %> <% sw = homework_common.student_works.reorder("created_at desc").first %>
    - <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 + # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
    <% end %>
    <% if homework_common.student_works.count != 0 %> - <% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %> - <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> - <% unless student_work_scores.empty? %> + <% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %> + <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> + <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> + <% unless student_work_scores.empty? %> <% last_score = student_work_scores.first %> -
    - <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品 +
    +

    # <%=time_from_now last_score.created_at %> + <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行: +

    + <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %> + <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %> + <% student_works.each_with_index do |sw, i| %> + + <% if i == 4 %> + <% break %> + <% end %> + <% end %> + <%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%> +
    - <% end %> - <% end %> + <% end %> + <% end %>
    - <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %> -
    - <% projects = homework_common.student_work_projects.where("is_leader = 1") %> -
    - 已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %> -
    -
    - <% projects.each do |pro| %> - <% project = Project.find pro.project_id %> - -
    - <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %> - <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %> - <% end %> - <% time=project.updated_on %> - <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

    <%=(User.find project.user_id).show_name %>(组长)

    - -

    <%=time_from_now time %>  <%= project.project_score.changeset_num %>提交

    -
    - 项目名称:<%=project.name %>
    - 创建者:<%=(User.find project.user_id).show_name %>(组长)
    - 更新时间:<%=time_from_now time %> + <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %> + <% projects = homework_common.student_work_projects.where("is_leader = 1") %> + <% unless projects.empty? %> + <% sort_projects = project_sort_update projects %> +
    +
    + # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: +
    +
    + <% sort_projects.each_with_index do |pro, i| %> + <% project = Project.find pro.project_id %> + + +
    + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %> + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %> + <% end %> + <% time=project.updated_on %> + <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> +

    <%=(User.find project.user_id).show_name %>(组长)

    +

    <%=time_from_now time %>  <%= project.project_score.changeset_num %>提交

    +
    + 项目名称:<%=project.name %>
    + 创建者:<%=(User.find project.user_id).show_name %>(组长)
    + 更新时间:<%=time_from_now time %> +
    -
    - <% end %> -
    - <% end %> + <% if i == 9 && projects.count > 10 %> + 更多>> + <% end %> + <% if i > 9 && i == (projects.count - 1) %> + 收回<< + <% end %> + <% end %> +
    + <% end %> + <% end %>
    <% if is_teacher%> <% comment_status = homework_common.homework_detail_manual.comment_status%> @@ -315,5 +343,14 @@
    \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 045455bb7..e0bd1d6f6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1366,6 +1366,7 @@ ActiveRecord::Schema.define(:version => 20160114131753) do t.integer "changeset_num", :default => 0 t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 + t.integer "act_num", :default => 0 t.integer "attach_num", :default => 0 end diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 16ef3c5df..841392cea 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1221,7 +1221,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} .mr150 {margin-right:150px;} .relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;} -.captainName {max-width:40px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;} +.captainName {max-width:75px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;} /*上传资源弹窗*/ .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} @@ -1257,3 +1257,6 @@ div.disable_link {background-color: #c1c1c1 !important;} .fn {font-weight:normal} .boutiqueP {position:absolute; left:0px; top:0px;} + +.mh18 {max-height: 18px;} +.relatePWrap{max-height: 210px;overflow:hidden;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index ac9b50d0f..8d935e70e 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -77,6 +77,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .ml36{ margin-left:36px; } .ml40{ margin-left:40px;} .ml45{ margin-left:45px;} +.ml50{ margin-left: 50px;} .ml55{ margin-left:55px;} .ml30{ margin-left:30px;} .ml60{ margin-left:60px;} @@ -95,6 +96,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .mr20{ margin-right:20px;} .mr30{ margin-right:30px !important;} .mr40{ margin-right:40px !important;} +.mr65 {margin-right: 65px;} .mw20{ margin: 0 20px;} .mt-20 {margin-top:-20px;} .mt-4 {margin-top: -4px;} @@ -121,6 +123,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .w70{ width:70px;} .w80{ width:80px;} .w90{ width:90px;} +.w100 {width: 100px;} .w110{width:110px;} .w210{ width:210px;} .w150{ width:150px;} @@ -581,7 +584,7 @@ a.homepageImageNumber:hover {color:#269ac9;} .homepageLeftMenuCourses {font-size:13px; border-bottom:1px solid #dddddd;} .homepageLeftMenuCoursesLine {height:38px; line-height:38px; vertical-align:middle;} .homepageLeftMenuCoursesLine:hover {background-color:#269ac9;} -a.coursesLineGrey {padding-left:25px; padding-right:25px; color:#808080; display:block;} +a.coursesLineGrey {padding-left:25px; padding-right:25px; color:#808080; display:block;} a.coursesLineGrey:hover {color:#ffffff;} .homepageLeftMenuMore {height:18px;} .homepageLeftMenuMore:hover {background-color:#269ac9;} @@ -1416,3 +1419,4 @@ span.at a{color:#269ac9;text-decoration: none;} .orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} .orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} +.relatePWrap{max-height: 210px;overflow:hidden;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 87097a052..234905c7a 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -71,6 +71,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml40{ margin-left:40px;} .ml45{ margin-left:45px;} .ml48{ margin-left:48px;} +.ml50{ margin-left: 50px;} .ml53{margin-left:53px;} .ml55{ margin-left:55px;} .ml58{margin-left:58px;} @@ -102,6 +103,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mr50{margin-right: 50px;} .mr55{margin-right: 55px;} .mr60 {margin-right:60px;} +.mr65 {margin-right:65px;} .mr70{margin-right: 70px;} .mw15{margin:0 15px;} .mr90 {margin-right:90px;} @@ -113,6 +115,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mt5{ margin-top:5px;} .mt8{ margin-top:8px;} .mt10{ margin-top:10px !important;} +.mt20{margin-top: 20px;} .mt30{ margin-top: 30px;} .mt40{ margin-top: 40px;} .mt12 { margin-top:12px !important;} @@ -168,6 +171,7 @@ h4{ font-size:14px; color:#3b3b3b;} .h150{ height:150px;} .p10 {padding-left:10px; padding-right:10px;} .mw400 {max-width: 400px;} +.mh18 {max-height: 18px;} /* Font & background Color */ a.b_grey{ background: #F5F5F5;} @@ -1004,3 +1008,5 @@ a:hover.userCancel{border:1px solid #888888; } .userCard em {display:block; border-width:8px; position:absolute; bottom:-17px; left:110px; border-style:solid dashed dashed dashed; border-color:#eaeaea transparent transparent transparent; font-size:0; line-height:0;} .userCardM {width:201px; height:20px; border:1px solid #dddddd; resize:none;} .resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;} + +.relatePWrap{max-height: 210px;overflow:hidden;} From f52b0c1cc69c30820d90567f73cae64f6651db21 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Jan 2016 10:16:29 +0800 Subject: [PATCH 153/205] =?UTF-8?q?=E6=A0=87=E8=AE=B0=E7=B2=BE=E5=93=81?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=EF=BC=8C=E7=B2=BE=E5=93=81=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=8E=A8=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 5 +++ app/views/courses/_recommendation.html.erb | 41 ++++++++++++++++++++++ app/views/layouts/_project_info.html.erb | 4 +-- app/views/layouts/base_courses.html.erb | 40 +-------------------- config/locales/zh.yml | 4 ++- db/schema.rb | 3 +- 6 files changed, 54 insertions(+), 43 deletions(-) create mode 100644 app/views/courses/_recommendation.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 07f7a0ed8..336c6937b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,6 +49,11 @@ module ApplicationHelper end end + # 判断课程是否为精品课程 + def is_excellent_course course + course.is_excellent? ? true : false + end + # 获取项目/课程总分 # 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分 def static_project_score obj diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb new file mode 100644 index 000000000..8e14e1130 --- /dev/null +++ b/app/views/courses/_recommendation.html.erb @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index 60fc6f96d..9a9d34e54 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -3,14 +3,14 @@ <% student_num = studentCount(@course) %> <% course_file_num = visable_attachemnts_incourse(@course).count%>
    <%= @course.is_public == 0 ? "私有课程" : "公开课程" %> - <% if @course.id == 370 %> + <% if is_excellent_course(@course) %> 精品课程 <% end %>
    diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index b57e9ac54..9d61a6fbb 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -205,45 +205,7 @@
    - + <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
    diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 34a526734..d5b249e8d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2106,4 +2106,6 @@ zh: label_org_name: 组织名称: label_blank_user_lists_for_org: 用户不能为空 - + # 课程推荐 + label_homework_commont: 作业 + label_homework_recommendation: 课程推荐 \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index bac1882c5..601b09561 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160115125217) do +ActiveRecord::Schema.define(:version => 20160118014219) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -499,6 +499,7 @@ ActiveRecord::Schema.define(:version => 20160115125217) do t.integer "is_delete", :default => 0 t.integer "end_time" t.string "end_term" + t.integer "is_excellent", :default => 0 end create_table "custom_fields", :force => true do |t| From 03df9abfebb35fa5c780766e0d1c0cd1dd09bb9d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 18 Jan 2016 10:43:22 +0800 Subject: [PATCH 154/205] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E6=80=A7=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 6 ++++- app/controllers/organizations_controller.rb | 4 +++ .../organizations/check_uniq_domain.js.erb | 5 ++++ app/views/organizations/setting.html.erb | 25 +++++++++++++++---- config/routes.rb | 1 + 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 app/views/organizations/check_uniq_domain.js.erb diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 9f1d964ef..d051a91f7 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -27,7 +27,11 @@ class OrgSubfieldsController < ApplicationController @sort = "" @order = "" @is_remote = false - @organization = Organization.find(params[:id]) + if params[:id] + @organization = Organization.find(params[:id]) + else + @organization = Organization.where("domain=?",request.subdomain).first + end @org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+ "subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+ " org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index b431678af..39ece6fbe 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -136,6 +136,10 @@ class OrganizationsController < ApplicationController end end + def check_uniq_domain + @is_exist = (Organization.where("domain=?", params[:org_domain]).count > 0) + end + def find_organization @organization = Organization.find(params[:id]) end diff --git a/app/views/organizations/check_uniq_domain.js.erb b/app/views/organizations/check_uniq_domain.js.erb new file mode 100644 index 000000000..e49bb0cad --- /dev/null +++ b/app/views/organizations/check_uniq_domain.js.erb @@ -0,0 +1,5 @@ +<% if @is_exist %> + $is_exist = true; +<% else %> + $is_exist = false; +<% end %> \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 962a7a497..45ac302ca 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -149,18 +149,33 @@ if ($("#subfield_name").val().trim() != "") $("#add_subfield_form").submit(); } + var $is_exist = false; function apply_subdomain(id, domain){ var reg = new RegExp("^[a-zA-Z0-9_]{1,}$"); if (reg.exec(domain)){ $.ajax({ - url:"<%= apply_subdomain_organization_path %>", - type:'post', + url: "<%= check_uniq_domain_organizations_path %>", + type: 'get', data:{ - id:id, - domain:domain + org_domain:domain }, success:function(){ - $("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); + if(!$is_exist){ + $.ajax({ + url:"<%= apply_subdomain_organization_path %>", + type:'post', + data:{ + id:id, + domain:domain + }, + success:function(){ + $("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); + } + }); + } + else{ + $("#apply_hint").text("您申请的子域名已存在,请重新输入"); + } } }); } diff --git a/config/routes.rb b/config/routes.rb index ce5b09aec..67694edb7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,6 +66,7 @@ RedmineApp::Application.routes.draw do end collection do get 'check_uniq' + get 'check_uniq_domain' get 'autocomplete_search' post 'hide_org_subfield' post 'show_org_subfield' From 5e102d24dd2f6d50dcc7ac51cd8991a3bbfca2d2 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 18 Jan 2016 11:01:04 +0800 Subject: [PATCH 155/205] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E6=8A=A5500=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_article.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 22df4499a..0516a431a 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -78,7 +78,7 @@ 发帖时间:<%= format_time(activity.created_on) %>
    - 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %> + 更新时间:<%= format_time(activity.updated_on) %>
    From 909e0e846b09a0fa24f3ddfd34c2e0c3907cc9a1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 18 Jan 2016 11:06:08 +0800 Subject: [PATCH 156/205] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index cdf715a0e..ccbe67004 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -74,7 +74,7 @@ RedmineApp::Application.routes.draw do end end - get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id' + constraints(Subdomain.new) do get '/', to: 'organizations#show' end @@ -1125,6 +1125,8 @@ RedmineApp::Application.routes.draw do resources :at + get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id' + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| file = File.join(plugin_dir, "config/routes.rb") if File.exists?(file) From 9cabb0248a955797a2ca7b94872424ffd16ae7d2 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Jan 2016 15:12:47 +0800 Subject: [PATCH 157/205] =?UTF-8?q?=E5=B7=B2=E7=82=B9=E8=BF=87=E8=B5=9E?= =?UTF-8?q?=E7=9A=84=E5=8A=A8=E6=80=81=E6=98=BE=E7=A4=BA=E2=80=9D=E5=B7=B2?= =?UTF-8?q?=E8=B5=9E=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/praise_tread_controller.rb | 7 +++++-- app/views/praise_tread/_praise.html.erb | 10 ++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index b99963e2f..291a71f26 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -24,7 +24,7 @@ class PraiseTreadController < ApplicationController end return end - #@horizontal = params[:horizontal].downcase == "false" ? false:true + @horizontal = params[:horizontal].downcase == "false" ? false:true if params[:horizontal] if @obj.respond_to?("author_id") author_id = @obj.author_id elsif @obj.respond_to?("user_id") @@ -127,6 +127,8 @@ class PraiseTreadController < ApplicationController @obj = Comment.find_by_id(id) when 'Journal' @obj = Journal.find_by_id(id) + else + @obj = nil end return @obj end @@ -143,7 +145,8 @@ class PraiseTreadController < ApplicationController # end #再创建或更新praise_tread_cache表 - @ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type) + #@ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type) + @ptc = PraiseTreadCache.where("object_id = ? and object_type = ?",id.to_i,type).first @ptc = @ptc.nil? ? PraiseTreadCache.new : @ptc @ptc.object_id = id.to_i @ptc.object_type = type diff --git a/app/views/praise_tread/_praise.html.erb b/app/views/praise_tread/_praise.html.erb index 4fd961251..63b57f8a6 100644 --- a/app/views/praise_tread/_praise.html.erb +++ b/app/views/praise_tread/_praise.html.erb @@ -1,7 +1,13 @@ <% if PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",activity.id,activity.class.to_s,User.current.id).empty? %> + + <% num = get_praise_num(activity) %> + <%= num > 0 ? "(#{num})" : "" %> + <% else %> + 已赞 + <% num = get_praise_num(activity) %> + <%= num > 0 ? "(#{num})" : "" %> + <% end %> \ No newline at end of file From ef0a2a54c5ccf85249fea2a08d46017e69f691bd Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Jan 2016 15:48:26 +0800 Subject: [PATCH 158/205] =?UTF-8?q?=E7=B2=BE=E5=93=81=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=8E=A8=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 5 ++ app/helpers/courses_helper.rb | 26 ++++++++ app/models/course.rb | 25 +++++--- app/views/courses/_recommendation.html.erb | 59 ++++++------------- .../20160118014219_define_excellent_course.rb | 17 ++++++ 5 files changed, 84 insertions(+), 48 deletions(-) create mode 100644 db/migrate/20160118014219_define_excellent_course.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 336c6937b..66f60d020 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,6 +54,11 @@ module ApplicationHelper course.is_excellent? ? true : false end + # 判断课程对成员是否可见 + def visible_course?(course) + (course.is_delete? or (!course.is_public? && !User.current.member_of_course?(course))) ? false : true + end + # 获取项目/课程总分 # 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分 def static_project_score obj diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 097a3c1a4..780d73de2 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -11,6 +11,32 @@ module CoursesHelper #StudentRoles = [5, 10] #AllPeople = StudentRoles+TeacherRoles ## return people count + + # 推荐的精品课程 + def excellent_course_recommend course + q = "%#{course.name.strip}%" + result = find_excelletn_course(q, course) + end + + # 查询符合条件的精品课程 + def find_excelletn_course keywords, course + # 用新课程名去匹配精品课程中按课程名和Tag名 + if !course.is_public? && !User.current.member_of_course?(course) + sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and + ts.taggable_type = 'Course' and (t.name like '%#{keywords}%'or c.name like '%#{keywords}%')" + resultSetTag = Course.find_by_sql(sql) + else + sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and + ts.taggable_type = 'Course' and (t.name like '%#{keywords}%'or c.name like '%#{keywords}%') ORDER BY c.updated_at desc limit 0,5;" + resultSetTag = Course.visible.find_by_sql(sql) + end + + end + + # 判断精品课程是否可见,非课程成员无法查看私有课程 + def visible_excellent_course obj + # if course.is_pu + end # 返回x项目成员数量,即roles表中定义的所有成员 def projectCount project diff --git a/app/models/course.rb b/app/models/course.rb index 24e955d15..13e6be0ae 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -72,7 +72,7 @@ class Course < ActiveRecord::Base before_save :self_validate # 公开课程变成私有课程,所有资源都变成私有 after_update :update_files_public,:update_course_ealasticsearch_index,:update_activity - after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index + after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index, :add_course_ead before_destroy :delete_all_members,:delete_course_ealasticsearch_index safe_attributes 'extra', @@ -384,6 +384,12 @@ class Course < ActiveRecord::Base def act_as_course_message self.course_messages << CourseMessage.new(:user_id => self.tea_id, :course_id => self.id, :viewed => false) end + + # 发布新课导语 + def add_course_ead + + end + #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #def name # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) @@ -405,6 +411,7 @@ class Course < ActiveRecord::Base self.__elasticsearch__.index_document end end + def update_course_ealasticsearch_index if self.is_public == 1 and self.is_delete == 0 #如果是初次更新成为公开或者恢复被删除的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性 begin @@ -428,13 +435,17 @@ class Course < ActiveRecord::Base end end + + #动态的更新 + def update_activity + update_course_activity(self.class, self.id) + update_user_activity(self.class, self.id) + update_org_activity(self.class, self.id) + end + end -#动态的更新 -def update_activity - update_course_activity(self.class, self.id) - update_user_activity(self.class, self.id) - update_org_activity(self.class, self.id) -end + + # Delete the previous articles index in Elasticsearch # Course.__elasticsearch__.client.indices.delete index: Course.index_name rescue nil diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index 8e14e1130..c7e459c95 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -1,41 +1,18 @@ - \ No newline at end of file +<% unless excellent_course_recommend(course).count == 0 %> +
      +

      <%= l(:label_homework_recommendation) %>

      + <% excellent_course_recommend(course).each do |c_course| %> +
    • <%= image_tag(url_to_avatar(c_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %> +
      +

      +

      + <%= l(:project_module_attachments) %>(<%= link_to c_course.attachments.count, course_files_path(c_course), :class => "linkBlue2" %>) + <%= l(:label_homework_commont) %>(<%= link_to c_course.homework_commons.count, homework_common_index_path(c_course), :class => "linkBlue2" %>)

      +
      +
      +
    • + <% end %> +
      +
    +<% end %> + diff --git a/db/migrate/20160118014219_define_excellent_course.rb b/db/migrate/20160118014219_define_excellent_course.rb new file mode 100644 index 000000000..911c14a3e --- /dev/null +++ b/db/migrate/20160118014219_define_excellent_course.rb @@ -0,0 +1,17 @@ +class DefineExcellentCourse < ActiveRecord::Migration + def up + arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:is_excellent, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end \ No newline at end of file From c5935a6a465fa647895c0d0a7253668e3ffa2a26 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Jan 2016 15:52:38 +0800 Subject: [PATCH 159/205] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/praise_tread_controller.rb | 54 +++++++++++----------- app/views/blogs/_article.html.erb | 32 +++++++++++-- app/views/users/_user_blog.html.erb | 30 ++++++++++-- 3 files changed, 81 insertions(+), 35 deletions(-) diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index 291a71f26..1a01a2f07 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -103,32 +103,34 @@ class PraiseTreadController < ApplicationController def find_object_by_type_and_id(type,id) @obj = nil case type - when 'User' - @obj = User.find_by_id(id) - when 'Issue' - @obj = Issue.find_by_id(id) - when 'Project' - @obj = Project.find_by_id(id) - when 'Bid' - @obj = Bid.find_by_id(id) - when 'Contest' - @obj = Contest.find_by_id(id) - when 'Memo' - @obj = Memo.find_by_id(id) - when 'Message' - @obj = Message.find_by_id(id) - when 'HomeworkCommon' - @obj = HomeworkCommon.find_by_id(id) - when 'JournalsForMessage' - @obj = JournalsForMessage.find_by_id(id) - when 'News' - @obj = News.find_by_id(id) - when 'Comment' - @obj = Comment.find_by_id(id) - when 'Journal' - @obj = Journal.find_by_id(id) - else - @obj = nil + when 'Memo' + @obj = Memo.find_by_id(id) + when 'Message' + @obj = Message.find_by_id(id) + when 'HomeworkCommon' + @obj = HomeworkCommon.find_by_id(id) + when 'JournalsForMessage' + @obj = JournalsForMessage.find_by_id(id) + when 'News' + @obj = News.find_by_id(id) + when 'Comment' + @obj = Comment.find_by_id(id) + when 'Journal' + @obj = Journal.find_by_id(id) + when 'BlogComment' + @obj = BlogComment.find_by_id(id) + when 'User' + @obj = User.find_by_id(id) + when 'Issue' + @obj = Issue.find_by_id(id) + when 'Project' + @obj = Project.find_by_id(id) + when 'Bid' + @obj = Bid.find_by_id(id) + when 'Contest' + @obj = Contest.find_by_id(id) + else + @obj = nil end return @obj end diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 22df4499a..2c18a144c 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -125,11 +125,17 @@ <% count=activity.children.count%> <% end %>
    -
    -
    -
    回复( - <%= count %> - )
    +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
    <%#=format_date(activity.updated_on)%>
    <%if count > 3 %>
    @@ -164,6 +170,13 @@ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(reply.created_on) %> + + <% if reply.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> + <% end %> +
    <%= reply.content.html_safe %> @@ -203,5 +216,14 @@
    diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 3ce0926a8..440bcb773 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -50,10 +50,16 @@
    <% count=activity.children.count %>
    -
    -
    -
    - 回复(<%= count %>) +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> +
    <%#= format_date(activity.updated_on) %>
    <%if count>3 %> @@ -88,6 +94,13 @@ <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> + + <% if comment.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> +
    <%= comment.content.html_safe %>
    @@ -126,5 +139,14 @@
    From b4521d3582579eb14201123367f34462a1330f7c Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Jan 2016 16:18:40 +0800 Subject: [PATCH 160/205] =?UTF-8?q?=E8=AF=BE=E7=A8=8B/=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=9A=84=E6=9B=B4=E5=A4=9A=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=94=B6=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_courses.html.erb | 5 ++++- app/views/layouts/base_projects.html.erb | 4 ++++ app/views/projects/_development_group.html.erb | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index cb5c2502f..4e3d10558 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -126,7 +126,7 @@ <%# 工具栏展开 %> <% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 || course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %> - + @@ -292,6 +292,9 @@ obj.parent().parent().next("div").hide(); } + $("#expand_tools_expand").click(function(){ + $("#navContentCourse").toggle(); + }); \ No newline at end of file diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 58289b352..b7e8a5d6d 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -245,6 +245,10 @@ $('#ajax-modal').parent().css("top","40%").css("left","36%"); $('#ajax-modal').parent().addClass("popbox_polls"); } + + $("#expand_tools_expand").click(function(){ + $("#navContent").toggle(); + });
    diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 95d0fccf6..6cac445ee 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -54,7 +54,7 @@
    <% end %> - + From b93b86b9a0c926c4d617de688cfe9b486ee26765 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Jan 2016 17:16:33 +0800 Subject: [PATCH 161/205] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8F=91=E9=80=81board?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/models/course.rb | 5 ++++- app/views/users/_course_message.html.erb | 8 ++++++++ db/migrate/20160118083751_add_status_to_message.rb | 5 +++++ db/schema.rb | 3 ++- 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20160118083751_add_status_to_message.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 279975c77..43a49c7d9 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -509,7 +509,7 @@ class CoursesController < ApplicationController if @course respond_to do |format| flash[:notice] = l(:notice_successful_create) - format.html {redirect_to settings_course_url(@course, :course_type => 1)} + format.html {redirect_to course_url(@course)} format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } end else diff --git a/app/models/course.rb b/app/models/course.rb index 13e6be0ae..433a5801e 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -387,7 +387,10 @@ class Course < ActiveRecord::Base # 发布新课导语 def add_course_ead - + name = Redmine::Configuration['course_message_lead_subject'] + content = Redmine::Configuration['course_message_lead_content'] + # message的status状态为0为正常,为1表示创建课程时发送的message + Message.create(:subject => name, :content => content, :board_id => self.boards.first.id, :author_id => self.tea_id , :sticky => true, :status => true ) end #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index d8268d698..7d732bc8e 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -43,6 +43,14 @@ <%= activity.parent.content.to_s.html_safe%> <% end %>
    + <% if activity.status == 1 %> + <%= activity.created_on.year %> + + <%= activity.created_on.month %> + + <%= activity.created_on.day %> + + <% end %>
    diff --git a/db/migrate/20160118083751_add_status_to_message.rb b/db/migrate/20160118083751_add_status_to_message.rb new file mode 100644 index 000000000..46d63de3a --- /dev/null +++ b/db/migrate/20160118083751_add_status_to_message.rb @@ -0,0 +1,5 @@ +class AddStatusToMessage < ActiveRecord::Migration + def change + add_column :messages, :status, :integer, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 601b09561..1cad3bd21 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160118014219) do +ActiveRecord::Schema.define(:version => 20160118083751) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1073,6 +1073,7 @@ ActiveRecord::Schema.define(:version => 20160118014219) do t.integer "sticky", :default => 0 t.integer "reply_id" t.integer "quotes" + t.integer "status", :default => 0 end add_index "messages", ["author_id"], :name => "index_messages_on_author_id" From 5862c16c680d503e41d6e04d431d3f70a1e95f84 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Jan 2016 17:36:18 +0800 Subject: [PATCH 162/205] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=B2=BE=E5=93=81?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8E=A8=E8=8D=90=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=8E=89=E7=A7=81=E6=9C=89=E8=AF=BE=E7=A8=8B=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E6=8E=89=E5=B7=B2=E5=88=A0=E9=99=A4=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 780d73de2..712f2d075 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -21,16 +21,10 @@ module CoursesHelper # 查询符合条件的精品课程 def find_excelletn_course keywords, course # 用新课程名去匹配精品课程中按课程名和Tag名 - if !course.is_public? && !User.current.member_of_course?(course) - sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and + sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and ts.taggable_type = 'Course' and (t.name like '%#{keywords}%'or c.name like '%#{keywords}%')" - resultSetTag = Course.find_by_sql(sql) - else - sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and - ts.taggable_type = 'Course' and (t.name like '%#{keywords}%'or c.name like '%#{keywords}%') ORDER BY c.updated_at desc limit 0,5;" - resultSetTag = Course.visible.find_by_sql(sql) - end - + resultSetTag = Course.find_by_sql(sql).select{|e_course| e_course.is_public ==1 unless User.current.member_of_course?(e_course)}.first(3) + resultSetTag end # 判断精品课程是否可见,非课程成员无法查看私有课程 From 6e582fa631f57f9093a6bb23ab9055b97e6fa129 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Jan 2016 09:55:28 +0800 Subject: [PATCH 163/205] =?UTF-8?q?=E8=80=81=E5=B8=88=E8=AF=84=E9=98=85?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=97=B6=E5=8F=AF=E4=BB=A5=E4=B8=8D=E5=86=99?= =?UTF-8?q?=E8=AF=84=E8=AF=AD=EF=BC=8C=E5=8F=AA=E6=9C=89=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E7=9A=84=E6=97=B6=E5=80=99=E6=89=8D=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E5=86=99=E8=AF=84=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_add_score.html.erb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index 052443155..9d747790f 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -23,13 +23,17 @@ <% end%> \ No newline at end of file From 8e9c4bab6b0add76007314c9dde797682f2eac9d Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Jan 2016 10:08:28 +0800 Subject: [PATCH 164/205] =?UTF-8?q?=E8=B5=9E=E5=A2=9E=E5=8A=A0tip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_article.html.erb | 4 ++-- app/views/organizations/_org_course_homework.html.erb | 4 ++-- app/views/organizations/_org_course_message.html.erb | 4 ++-- app/views/organizations/_org_course_news.html.erb | 4 ++-- app/views/organizations/_org_project_issue.html.erb | 4 ++-- app/views/organizations/_org_subfield_message.html.erb | 4 ++-- app/views/organizations/_project_message.html.erb | 4 ++-- app/views/projects/_project_news.html.erb | 4 ++-- app/views/users/_course_homework.html.erb | 4 ++-- app/views/users/_course_message.html.erb | 4 ++-- app/views/users/_course_news.html.erb | 4 ++-- app/views/users/_project_issue.html.erb | 4 ++-- app/views/users/_project_message.html.erb | 4 ++-- app/views/users/_user_blog.html.erb | 4 ++-- app/views/users/_user_homework_detail.html.erb | 4 ++-- app/views/users/_user_journalsformessage.html.erb | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index d6ce215c6..afe89362f 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -130,7 +130,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -172,7 +172,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 50d4a07db..56c19f994 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -256,7 +256,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -297,7 +297,7 @@ <%= format_time(comment.created_on) %> <% if comment.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb index 55be0bf91..79b9bbe05 100644 --- a/app/views/organizations/_org_course_message.html.erb +++ b/app/views/organizations/_org_course_message.html.erb @@ -77,7 +77,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -119,7 +119,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index ddad08279..7d6940f52 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -49,7 +49,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -90,7 +90,7 @@ <%= format_time(comment.created_on) %> <% if comment.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 9c1863992..78964efbe 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -62,7 +62,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -103,7 +103,7 @@ <%= format_time(reply.created_on) %> <% if reply.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 901c2ecf4..f8f412732 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -62,7 +62,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -99,7 +99,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index c7d99c5fb..d15ceca38 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -62,7 +62,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -100,7 +100,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 2e7b1316a..ceee318a4 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -49,7 +49,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -90,7 +90,7 @@ <%= format_time(comment.created_on) %> <% if comment.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index d89b44651..f73e039f9 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -256,7 +256,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -297,7 +297,7 @@ <%= format_time(comment.created_on) %> <% if comment.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index d8268d698..bc14793db 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -97,7 +97,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -139,7 +139,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index ddad08279..7d6940f52 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -49,7 +49,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -90,7 +90,7 @@ <%= format_time(comment.created_on) %> <% if comment.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 954c24dac..6f1fc8b7a 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -74,7 +74,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -115,7 +115,7 @@ <%= format_time(reply.created_on) %> <% if reply.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 75940b32c..ab7502bd5 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -96,7 +96,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -134,7 +134,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 440bcb773..1a4b90768 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -55,7 +55,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -96,7 +96,7 @@ <%= format_time(comment.created_on) %> <% if comment.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 652d2aca8..d1b3f62fc 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -260,7 +260,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if homework_common.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%> <% end %> @@ -300,7 +300,7 @@ <% end %> <%= format_time(comment.created_on) %> <% if comment.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index dd55155d0..609b1e35b 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -40,7 +40,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -76,7 +76,7 @@ <%= format_time(comment.created_on) %> <% if comment.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> From 610b54b27c632627d7f50a1f54069ad72aaf5ae4 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 19 Jan 2016 10:29:57 +0800 Subject: [PATCH 165/205] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AF=BC=E8=AF=AD?= =?UTF-8?q?=E6=94=BE=E7=BD=AE=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=E4=B9=8B?= =?UTF-8?q?=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 10 +--------- app/models/course_activity.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index 433a5801e..480c00480 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -72,7 +72,7 @@ class Course < ActiveRecord::Base before_save :self_validate # 公开课程变成私有课程,所有资源都变成私有 after_update :update_files_public,:update_course_ealasticsearch_index,:update_activity - after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index, :add_course_ead + after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index before_destroy :delete_all_members,:delete_course_ealasticsearch_index safe_attributes 'extra', @@ -385,14 +385,6 @@ class Course < ActiveRecord::Base self.course_messages << CourseMessage.new(:user_id => self.tea_id, :course_id => self.id, :viewed => false) end - # 发布新课导语 - def add_course_ead - name = Redmine::Configuration['course_message_lead_subject'] - content = Redmine::Configuration['course_message_lead_content'] - # message的status状态为0为正常,为1表示创建课程时发送的message - Message.create(:subject => name, :content => content, :board_id => self.boards.first.id, :author_id => self.tea_id , :sticky => true, :status => true ) - end - #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #def name # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index e1f9ab9f5..88351acfd 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -6,6 +6,7 @@ class CourseActivity < ActiveRecord::Base belongs_to :user has_many :user_acts, :class_name => 'UserAcivity',:as =>:act after_save :add_user_activity, :add_course_activity + after_create :add_course_lead before_destroy :destroy_user_activity, :destroy_org_activity #在个人动态里面增加当前动态 @@ -60,4 +61,16 @@ class CourseActivity < ActiveRecord::Base org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'") org_activity.destroy_all end + + # 发布新课导语 + # 导语要放置在课程创建信息之后 + # 导语 + def add_course_lead + if self.course_act_type == "Course" + name = Redmine::Configuration['course_message_lead_subject'] + content = Redmine::Configuration['course_message_lead_content'] + # message的status状态为0为正常,为1表示创建课程时发送的message + Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true ) + end + end end From e293805488570ccd8705692133ed623fe9b69f1e Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Jan 2016 15:41:53 +0800 Subject: [PATCH 166/205] =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E9=97=AE=E5=8D=B7=E6=97=B6=E8=8B=A5=E6=9C=AA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=88=99=E7=9B=B4=E6=8E=A5=E8=B7=B3=E5=88=B0=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index ec54ae8a4..78babc43c 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -2,6 +2,7 @@ class PollController < ApplicationController before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll] before_filter :find_container, :only => [:new,:create, :index] + before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result] before_filter :is_member_of_course, :only => [:index,:show,:poll_result] before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll] include PollHelper @@ -503,6 +504,10 @@ class PollController < ApplicationController end end + def is_logged + redirect_to signin_path unless User.current.logged? + end + def is_member_of_course render_403 unless(@course && (User.current.member_of_course?(@course) || User.current.admin?)) end From d0c2eabddd127952088d28d195061a22a79d6cda Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 19 Jan 2016 16:42:10 +0800 Subject: [PATCH 167/205] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E9=99=86=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=EF=BC=8C=E4=B9=9F=E8=83=BD=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- app/helpers/application_helper.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index fd43977ee..514f68d49 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -600,7 +600,7 @@ private def has_login unless @attachment && @attachment.container_type == "PhoneAppVersion" - render_403 unless User.current.logged? + render_403 if !User.current.logged? && @attachment.container_type != 'OrgSubfield' && @attachment.container_type != 'OrgDocumentComment' end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 07f7a0ed8..9f08a63ed 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1996,6 +1996,8 @@ module ApplicationHelper candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) elsif attachment.container.is_a?(OrgSubfield) candown = true + elsif attachment.container.is_a?(OrgDocumentComment) + candown = true elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board && attachment.container.board.course course = attachment.container.board.course From 6e56a0706a9c9444a95607a4907c07aa93899399 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Jan 2016 16:53:34 +0800 Subject: [PATCH 168/205] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=8D=95=E8=AF=8D=E6=8A=98=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_article.html.erb | 16 +++++++--------- app/views/blogs/_homepage.html.erb | 5 ++--- app/views/org_document_comments/show.html.erb | 7 ++++++- .../organizations/_org_course_homework.html.erb | 7 ++----- .../organizations/_org_course_message.html.erb | 16 +++++++--------- .../organizations/_org_course_news.html.erb | 6 +----- .../organizations/_org_course_poll.html.erb | 7 ++----- .../organizations/_org_project_issue.html.erb | 8 +------- .../organizations/_org_subfield_message.html.erb | 15 ++++++--------- .../organizations/_project_message.html.erb | 15 ++++++--------- app/views/organizations/_show_home_page.html.erb | 5 ++++- .../organizations/_show_org_document.html.erb | 5 ++++- app/views/projects/_project_news.html.erb | 6 +----- app/views/users/_course_homework.html.erb | 7 ++----- app/views/users/_course_message.html.erb | 15 ++++++--------- app/views/users/_course_news.html.erb | 6 +----- app/views/users/_course_poll.html.erb | 6 +----- app/views/users/_intro_content.html.erb | 12 ++++++++++++ app/views/users/_project_issue.html.erb | 8 +------- app/views/users/_project_message.html.erb | 15 ++++++--------- app/views/users/_user_blog.html.erb | 6 +----- app/views/users/_user_homework_detail.html.erb | 6 +----- app/views/users/user_system_messages.html.erb | 2 +- public/stylesheets/courses.css | 2 +- public/stylesheets/new_user.css | 4 ++-- public/stylesheets/project.css | 2 +- 26 files changed, 85 insertions(+), 124 deletions(-) create mode 100644 app/views/users/_intro_content.html.erb diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 22df4499a..4e0270da2 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -81,15 +81,13 @@ 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
    -
    + <% if activity.parent_id.nil? %> + <% content= activity.content%> + <% else %> + <% content= activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %> +
    - <% if User.current.logged? %> -
    - <%= link_to '文章', organization_org_document_comments_path(@organization) %>  - <% if User.current.logged? %> - ( - <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> - ) - <% end %> -  |  - <%= link_to '成员', members_organization_path(@organization.id) %>  - <% if User.current.logged? %> - (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) - <% end %> -
    - <% end %> +
    + <%= link_to '文章', organization_org_document_comments_path(@organization) %>  + <%# if User.current.logged? %> + ( + <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> + ) + <%# end %> + <% if User.current.logged? %> +  |  + <%= link_to '成员', members_organization_path(@organization.id) %>  + (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) + <% end %> +
    <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index 32d3ad10d..f6d5fc9ea 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -2,15 +2,13 @@
    - <% if User.current.logged? %>
    <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
    - <% end %> <% unless document.content.blank? %>
    <%= document.content.html_safe %>
    <% end %> - <% if params[:show_homepage].nil? and User.current.logged? %> + <% if params[:show_homepage].nil? %>
    发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
    From fe0414c83fa9256d5e1a2f6ff502f5fa8e2facbd Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 20 Jan 2016 10:53:05 +0800 Subject: [PATCH 173/205] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E5=92=8C=E5=8D=9A=E5=AE=A2=E7=9A=84=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/praise_tread_controller.rb | 2 ++ app/views/blog_comments/show.html.erb | 24 +++++++++++++++---- app/views/org_document_comments/show.html.erb | 24 +++++++++++++++---- .../organizations/_show_org_document.html.erb | 20 ++++++++++++++-- 4 files changed, 60 insertions(+), 10 deletions(-) diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index 1a01a2f07..96eeab884 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -119,6 +119,8 @@ class PraiseTreadController < ApplicationController @obj = Journal.find_by_id(id) when 'BlogComment' @obj = BlogComment.find_by_id(id) + when 'OrgDocumentComment' + @obj = OrgDocumentComment.find_by_id(id) when 'User' @obj = User.find_by_id(id) when 'Issue' diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 02f1ad1ad..6f4397569 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -116,9 +116,18 @@ <% count=@article.children.count%> <% end %>
    - <% unless count == 0 %> + <%# unless count == 0 %>
    -
    回复(<%=count %>)
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if @article.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%> + <% end %> + +
    -
    -
    -<% end %> - - \ No newline at end of file diff --git a/app/views/exercise/commit_exercise.js.erb b/app/views/exercise/commit_exercise.js.erb index ac8c242d1..8b6e9f00c 100644 --- a/app/views/exercise/commit_exercise.js.erb +++ b/app/views/exercise/commit_exercise.js.erb @@ -1,8 +1,8 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>'); -showModal('ajax-modal', '270px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>'); +showModal('ajax-modal', '270px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb index 9b6961e6c..8637273f1 100644 --- a/app/views/exercise/index.html.erb +++ b/app/views/exercise/index.html.erb @@ -25,7 +25,7 @@ $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); - $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } @@ -57,7 +57,7 @@ $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); - $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } } diff --git a/app/views/exercise/publish_exercise.js.erb b/app/views/exercise/publish_exercise.js.erb index c1c4a4fd5..004ca9625 100644 --- a/app/views/exercise/publish_exercise.js.erb +++ b/app/views/exercise/publish_exercise.js.erb @@ -1,10 +1,10 @@ -$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>"); -$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); -showModal('ajax-modal', '250px'); -//$('#ajax-modal').css('height','111px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>"); +$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); +showModal('ajax-modal', '250px'); +//$('#ajax-modal').css('height','111px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("poll_alert_form"); \ No newline at end of file diff --git a/app/views/exercise/republish_exercise.js.erb b/app/views/exercise/republish_exercise.js.erb index 2b4e67606..a55cefbde 100644 --- a/app/views/exercise/republish_exercise.js.erb +++ b/app/views/exercise/republish_exercise.js.erb @@ -1,10 +1,10 @@ -$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>"); -$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); -showModal('ajax-modal', '250px'); -//$('#ajax-modal').css('height','80px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>"); +$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); +showModal('ajax-modal', '250px'); +//$('#ajax-modal').css('height','80px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("poll_alert_form"); \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 9513baab0..85b230be3 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -40,7 +40,7 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } diff --git a/app/views/files/_project_file_new.html.erb b/app/views/files/_project_file_new.html.erb index 4ee1ccede..b66c470e3 100644 --- a/app/views/files/_project_file_new.html.erb +++ b/app/views/files/_project_file_new.html.erb @@ -6,7 +6,7 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } diff --git a/app/views/files/quote_resource_show.js.erb b/app/views/files/quote_resource_show.js.erb index 76025fbd2..12b6ea241 100644 --- a/app/views/files/quote_resource_show.js.erb +++ b/app/views/files/quote_resource_show.js.erb @@ -7,5 +7,5 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/quote_resource_show_org_subfield.js.erb b/app/views/files/quote_resource_show_org_subfield.js.erb index fe34e9624..a9207f7f4 100644 --- a/app/views/files/quote_resource_show_org_subfield.js.erb +++ b/app/views/files/quote_resource_show_org_subfield.js.erb @@ -1,11 +1,11 @@ -<% if @can_quote %> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>'); -<% else %> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>'); -<% end %> - -showModal('ajax-modal', '513px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","").css("left",""); +<% if @can_quote %> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>'); +<% else %> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>'); +<% end %> + +showModal('ajax-modal', '513px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/quote_resource_show_project.js.erb b/app/views/files/quote_resource_show_project.js.erb index 41dc19fc5..22a47fda9 100644 --- a/app/views/files/quote_resource_show_project.js.erb +++ b/app/views/files/quote_resource_show_project.js.erb @@ -7,5 +7,5 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","30%").css("left","35%"); +$('#ajax-modal').parent().css("top","30%").css("left","35%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/subfield_upload_file.js.erb b/app/views/files/subfield_upload_file.js.erb index fc3afc0ff..340a2890f 100644 --- a/app/views/files/subfield_upload_file.js.erb +++ b/app/views/files/subfield_upload_file.js.erb @@ -1,6 +1,6 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); -showModal('ajax-modal', '513px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); +showModal('ajax-modal', '513px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/upload_files_menu.js.erb b/app/views/files/upload_files_menu.js.erb index e083fac85..deec53ea3 100644 --- a/app/views/files/upload_files_menu.js.erb +++ b/app/views/files/upload_files_menu.js.erb @@ -3,13 +3,13 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); <% elsif @course %> $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>'); showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); <% end %> \ No newline at end of file diff --git a/app/views/homework_attach/show.js.erb b/app/views/homework_attach/show.js.erb index 953d8bab2..98742e03e 100644 --- a/app/views/homework_attach/show.js.erb +++ b/app/views/homework_attach/show.js.erb @@ -1,10 +1,10 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>'); -showModal('ajax-modal', '513px'); -$('#ajax-modal').css('height','569px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("alert_box"); - +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>'); +showModal('ajax-modal', '513px'); +$('#ajax-modal').css('height','569px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +$('#ajax-modal').parent().addClass("alert_box"); + diff --git a/app/views/homework_common/alert_anonymous_comment.js.erb b/app/views/homework_common/alert_anonymous_comment.js.erb index 1c354aa45..96e958648 100644 --- a/app/views/homework_common/alert_anonymous_comment.js.erb +++ b/app/views/homework_common/alert_anonymous_comment.js.erb @@ -1,6 +1,6 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + -""); -$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed"); \ No newline at end of file +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + +""); +$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file diff --git a/app/views/homework_common/alert_forbidden_anonymous_comment.js.erb b/app/views/homework_common/alert_forbidden_anonymous_comment.js.erb index 5177f4d92..1e81df9e7 100644 --- a/app/views/homework_common/alert_forbidden_anonymous_comment.js.erb +++ b/app/views/homework_common/alert_forbidden_anonymous_comment.js.erb @@ -1,6 +1,6 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed"); \ No newline at end of file +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file diff --git a/app/views/homework_common/score_rule_set.js.erb b/app/views/homework_common/score_rule_set.js.erb index da685b758..f83b51b55 100644 --- a/app/views/homework_common/score_rule_set.js.erb +++ b/app/views/homework_common/score_rule_set.js.erb @@ -3,4 +3,4 @@ showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); -$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); \ No newline at end of file +$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb index 659441ce8..6ed74d0f0 100644 --- a/app/views/homework_common/start_evaluation_set.js.erb +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -4,7 +4,7 @@ showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); -$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); +$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); $(function() { $('#evaluation_start_time').datepicker(datepickerOptions); $('#evaluation_end_time').datepicker(datepickerOptions); }); \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index c37360a3b..969e2643b 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -279,7 +279,7 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } // 鼠标经过的时候显示内容 diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index b7e8a5d6d..880c6cc1c 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -242,7 +242,7 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } diff --git a/app/views/my/clear_user_avatar_temp.js.erb b/app/views/my/clear_user_avatar_temp.js.erb index 788678673..8795177fc 100644 --- a/app/views/my/clear_user_avatar_temp.js.erb +++ b/app/views/my/clear_user_avatar_temp.js.erb @@ -1,8 +1,8 @@ - $("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); - $('#ajax-modal').html($("#nh_tx_dialog_html").html()); - showModal('ajax-modal','460px'); - $('#ajax-modal').siblings().hide(); - $('#ajax-modal').parent().removeClass("alert_praise"); - //$('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("alert_box"); - $('#ajax-modal').parent().css("border", "2px solid #15bccf").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); \ No newline at end of file + $("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); + $('#ajax-modal').html($("#nh_tx_dialog_html").html()); + showModal('ajax-modal','460px'); + $('#ajax-modal').siblings().hide(); + $('#ajax-modal').parent().removeClass("alert_praise"); + //$('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("alert_box"); + $('#ajax-modal').parent().css("border", "3px solid #269ac9").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); \ No newline at end of file diff --git a/app/views/org_subfields/_resource.html.erb b/app/views/org_subfields/_resource.html.erb index 3cce9748f..9935555d3 100644 --- a/app/views/org_subfields/_resource.html.erb +++ b/app/views/org_subfields/_resource.html.erb @@ -1,96 +1,96 @@ - - -
    -
    -
    - <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> - <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> - <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %> - <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> - <% end %> - <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> - -

    - 上传: - 课件 |  - 软件 |  - 媒体 |  - 代码 |  - 论文 |  - 其他 -

    - <% end %> -
    -
    - -
    - <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> -
    - -
    -
    + + +
    +
    +
    + <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> + <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> + <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %> + <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> + <% end %> + <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> + +

    + 上传: + 课件 |  + 软件 |  + 媒体 |  + 代码 |  + 论文 |  + 其他 +

    + <% end %> +
    +
    + +
    + <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> +
    + +
    +
    <% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index c5c016583..e6b667075 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -1,397 +1,397 @@ -<%= stylesheet_link_tag 'polls', :media => 'all' %> - - -
    - - - -
    - <%= render :partial => 'edit_head', :locals => {:poll => @poll}%> -
    - - -
    - <%= render :partial => 'poll_content', :locals => {:poll => @poll}%> -
    - - - - -
    -
    - -
    - - <%= l(:label_memo_create)%> - -
    - - -
    -
    -
    - - -
    +<%= stylesheet_link_tag 'polls', :media => 'all' %> + + +
    + + + +
    + <%= render :partial => 'edit_head', :locals => {:poll => @poll}%> +
    + + +
    + <%= render :partial => 'poll_content', :locals => {:poll => @poll}%> +
    + + + + +
    +
    + +
    + + <%= l(:label_memo_create)%> + +
    + + +
    +
    +
    + + +
    diff --git a/app/views/poll/commit_poll.js.erb b/app/views/poll/commit_poll.js.erb index 76e5e53df..a5c7f74cd 100644 --- a/app/views/poll/commit_poll.js.erb +++ b/app/views/poll/commit_poll.js.erb @@ -5,5 +5,5 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb index 92a42cbac..e9deff3f4 100644 --- a/app/views/poll/index.html.erb +++ b/app/views/poll/index.html.erb @@ -1,91 +1,91 @@ -<%= stylesheet_link_tag 'polls', :media => 'all' %> - -
    - <%= render :partial => 'poll_list'%> +<%= stylesheet_link_tag 'polls', :media => 'all' %> + +
    + <%= render :partial => 'poll_list'%>
    \ No newline at end of file diff --git a/app/views/poll/other_poll.js.erb b/app/views/poll/other_poll.js.erb index eee4ed4a1..26ec89046 100644 --- a/app/views/poll/other_poll.js.erb +++ b/app/views/poll/other_poll.js.erb @@ -1,13 +1,13 @@ - -<% if @polls.empty? %> - alert('您目前还没有自己新建的问卷'); -<% else %> - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); - - - showModal('ajax-modal', '513px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("popbox_polls"); + +<% if @polls.empty? %> + alert('您目前还没有自己新建的问卷'); +<% else %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); + + + showModal('ajax-modal', '513px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); + $('#ajax-modal').parent().addClass("popbox_polls"); <% end %> \ No newline at end of file diff --git a/app/views/poll/publish_poll.js.erb b/app/views/poll/publish_poll.js.erb index 516e32f34..91dcdc882 100644 --- a/app/views/poll/publish_poll.js.erb +++ b/app/views/poll/publish_poll.js.erb @@ -6,5 +6,5 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("poll_alert_form"); \ No newline at end of file diff --git a/app/views/poll/republish_poll.js.erb b/app/views/poll/republish_poll.js.erb index 3b5c5bd3b..1d025a5b2 100644 --- a/app/views/poll/republish_poll.js.erb +++ b/app/views/poll/republish_poll.js.erb @@ -6,5 +6,5 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("poll_alert_form"); \ No newline at end of file diff --git a/app/views/projects/join_project.js.erb b/app/views/projects/join_project.js.erb index 92cdfcf2c..679e86d3f 100644 --- a/app/views/projects/join_project.js.erb +++ b/app/views/projects/join_project.js.erb @@ -1,10 +1,10 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>'); -showModal('ajax-modal', '540px'); -$('#ajax-modal').css('height','260px'); -//$('#ajax-modal').siblings().remove(); -$('#ajax-modal').siblings().hide(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("alert_box"); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>'); +showModal('ajax-modal', '540px'); +$('#ajax-modal').css('height','260px'); +//$('#ajax-modal').siblings().remove(); +$('#ajax-modal').siblings().hide(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +$('#ajax-modal').parent().addClass("alert_box"); diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb index 67a1ccb50..1dea5965f 100644 --- a/app/views/student_work/create.js.erb +++ b/app/views/student_work/create.js.erb @@ -1,24 +1,24 @@ -<% if @has_commit %> - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>'); - showModal('ajax-modal', '500px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("anonymos"); -<% elsif @submit_result%> - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); - showModal('ajax-modal', '500px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("anonymos"); -<% else %> - window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>'; -<% end %> - -function clickCanel() { - hideModal('#popbox02'); - window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; +<% if @has_commit %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); + $('#ajax-modal').parent().addClass("anonymos"); +<% elsif @submit_result%> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); + $('#ajax-modal').parent().addClass("anonymos"); +<% else %> + window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>'; +<% end %> + +function clickCanel() { + hideModal('#popbox02'); + window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; } \ No newline at end of file diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index cb8e7edf9..f72faaac2 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -1,118 +1,118 @@ -
    -
    编辑作品
    -
    -
    - -
    - -
    -
    - - - 截止时间:<%= @homework.end_time%> - -
    - - <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%> - -
    -
    - <%= @homework.description.html_safe %> -
    -
    -
    -
    - -
    - <%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%> -
    - 提示:作品名称和描述中不要出现真实的姓名信息 -
    -
    - <% if @homework.homework_type == 3 %> - - - <% str = User.current.id.to_s%> - <% @work.student_work_projects.where("is_leader = ?", 0).each do |pro| %> - <% str += ','+pro.user_id.to_s %> - <% end %> - <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %> - <% end %> -
    - -
    -

    -
    -
    - - -
    -

    -
    - -
    - <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %> -
    - - <% if @homework.homework_type == 3 %> - - <% end %> - -
    - 确定 - - <%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%> -
    -
    - <% end%> -
    -
    - +
    +

    +
    + +
    + <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %> +
    + + <% if @homework.homework_type == 3 %> + + <% end %> + +
    + 确定 + + <%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%> +
    +
    + <% end%> +
    +
    + \ 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 b314bcf6d..afc97aca9 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -30,7 +30,7 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); - $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); + $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); } $(function(){ diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index bd13fb7c1..99c317314 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -1,177 +1,177 @@ - - - -
    -
    提交作品
    -
    -
    - -
    - -
    -
    - - - 截止时间:<%= @homework.end_time%> - -
    - - <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%> - -
    -
    - <%= @homework.description.html_safe %> -
    -
    - <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %> -
    -
    -
    -
    -
    - -
    - <%= form_for(@student_work, - :html => { :multipart => true }, - :url => {:controller => 'student_work', - :action => 'create', - :homework => @homework.id - },:remote=>true ) do |f| %> -
    - 提示:作品名称和描述中不要出现真实的姓名信息 -
    -
    - <% if @homework.homework_type == 3 %> - - - <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %> - <% end %> -
    - <%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %> -
    -

    -
    -
    - <%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%> - -
    -

    -
    - -
    - <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %> -
    -
    -
    -
    -
    - - <% if @homework.homework_type == 3 %> - - <% end %> - - - - - -
    - 提交 - - <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%> -
    -
    - <% end%> -
    + + + +
    +
    提交作品
    +
    +
    + +
    + +
    +
    + + + 截止时间:<%= @homework.end_time%> + +
    + + <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%> + +
    +
    + <%= @homework.description.html_safe %> +
    +
    + <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %> +
    +
    +
    +
    +
    + +
    + <%= form_for(@student_work, + :html => { :multipart => true }, + :url => {:controller => 'student_work', + :action => 'create', + :homework => @homework.id + },:remote=>true ) do |f| %> +
    + 提示:作品名称和描述中不要出现真实的姓名信息 +
    +
    + <% if @homework.homework_type == 3 %> + + + <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %> + <% end %> +
    + <%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %> +
    +

    +
    +
    + <%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%> + +
    +

    +
    + +
    + <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %> +
    +
    +
    +
    +
    + + <% if @homework.homework_type == 3 %> + + <% end %> + + + + + +
    + 提交 + + <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%> +
    +
    + <% end%> +
    \ No newline at end of file diff --git a/app/views/student_work/update.js.erb b/app/views/student_work/update.js.erb index f485cb8cc..9dc381e42 100644 --- a/app/views/student_work/update.js.erb +++ b/app/views/student_work/update.js.erb @@ -1,16 +1,16 @@ -<% if @submit_result%> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("anonymos"); -<% else %> -window.location.href = '<%= edit_student_work_url(@work)%>'; -<% end %> - -function clickCanel() { - hideModal('#popbox02'); - window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; +<% if @submit_result%> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +$('#ajax-modal').parent().addClass("anonymos"); +<% else %> +window.location.href = '<%= edit_student_work_url(@work)%>'; +<% end %> + +function clickCanel() { + hideModal('#popbox02'); + window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; } \ No newline at end of file diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index d145dab90..01afbfebe 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -131,10 +131,10 @@
    - diff --git a/app/views/users/_share_news_to_course.html.erb b/app/views/users/_share_news_to_course.html.erb new file mode 100644 index 000000000..9865f6af2 --- /dev/null +++ b/app/views/users/_share_news_to_course.html.erb @@ -0,0 +1,56 @@ + + +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_course_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_news_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !courses.empty? %> + <% courses.each do |course| %> +
      +
    • + +
    • +
    • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb new file mode 100644 index 000000000..f57a91ae6 --- /dev/null +++ b/app/views/users/_share_news_to_org.html.erb @@ -0,0 +1,59 @@ +
    +
    发送到
    +
    + +
    + <%= form_tag search_user_org_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_org_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + <% end %> +
    +
    +<%= form_tag share_news_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + +
      + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
    • + +
    • + <%end%> + <%end%> +
    +
    +
    +
      + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
    +
    +
    +
    目标地址:
    +
    + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> +
    +
    + 取消 +
    +
    +<%end %> \ No newline at end of file diff --git a/app/views/users/_share_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb new file mode 100644 index 000000000..0ae011caf --- /dev/null +++ b/app/views/users/_share_news_to_project.html.erb @@ -0,0 +1,54 @@ +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_project_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_news_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !projects.empty? %> + <% projects.each do |project| %> +
      +
    • + +
    • +
    • <%= project.name%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index d0ac40ed0..138eab6f9 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -9,7 +9,11 @@ //$("#upload_box").css('left','').css('top',''); //$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); //$("#upload_box").css('display','block'); -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% if params[:send_type].present? && params[:send_type] == 'news' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% else %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index db099fe72..fb6efec9a 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,4 +1,8 @@ -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% if params[:send_type].present? && params[:send_type] == 'news' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% else %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index 5218c22ab..926b7aa58 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,4 +1,8 @@ -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% if params[:send_type].present? && params[:send_type] == 'news' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% else %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); diff --git a/app/views/users/share_news_to_course.js.erb b/app/views/users/share_news_to_course.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_news_to_course.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_news_to_org.js.erb b/app/views/users/share_news_to_org.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_news_to_org.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_news_to_project.js.erb b/app/views/users/share_news_to_project.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_news_to_project.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ccbe67004..c2b089c02 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -532,6 +532,9 @@ RedmineApp::Application.routes.draw do post "add_exist_file_to_course" post "add_exist_file_to_project" post 'add_exist_file_to_org' + post 'share_news_to_course' + post 'share_news_to_project' + post 'share_news_to_org' get 'resource_preview' get 'rename_resource' get 'search_user_project' diff --git a/db/schema.rb b/db/schema.rb index bac1882c5..92cf224fc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160115125217) do +ActiveRecord::Schema.define(:version => 20160120032758) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1082,14 +1082,15 @@ ActiveRecord::Schema.define(:version => 20160115125217) do create_table "news", :force => true do |t| t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" t.text "description" - t.integer "author_id", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false + t.integer "comments_count", :default => 0, :null => false t.integer "course_id" - t.integer "sticky", :default => 0 + t.integer "sticky", :default => 0 + t.integer "org_subfield_id" end add_index "news", ["author_id"], :name => "index_news_on_author_id" @@ -1709,6 +1710,10 @@ ActiveRecord::Schema.define(:version => 20160115125217) do t.string "extra" end + create_table "temp", :id => false, :force => true do |t| + t.integer "id", :default => 0, :null => false + end + create_table "time_entries", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false From 0db69e1ebfc991a88f3785bf2b19f1a885660d17 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 20 Jan 2016 16:32:47 +0800 Subject: [PATCH 178/205] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=AF=BC=E8=AF=AD=E6=97=B6=E9=97=B4=E5=92=8C=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=8A=A8=E6=80=81=E6=97=B6=E9=97=B4=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 2 +- app/models/course.rb | 10 +--------- app/models/course_activity.rb | 4 +++- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 13d8e99b6..7b7bcbcf4 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -37,7 +37,7 @@ module CoursesHelper a_courses = [] courses = Course.search(keywords) courses.each do |c| - a_courses << c.id unless current_course.id != c.id + a_courses << c.id end a_courses << a_tags unless a_tags.length == 0 # 过滤条件:精品课程、本身不在搜索范围 diff --git a/app/models/course.rb b/app/models/course.rb index e715e9198..0d663b19a 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -72,7 +72,7 @@ class Course < ActiveRecord::Base before_save :self_validate # 公开课程变成私有课程,所有资源都变成私有 after_update :update_files_public,:update_course_ealasticsearch_index,:update_activity - after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index, :add_course_ead + after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index before_destroy :delete_all_members,:delete_course_ealasticsearch_index safe_attributes 'extra', @@ -405,14 +405,6 @@ class Course < ActiveRecord::Base self.course_messages << CourseMessage.new(:user_id => self.tea_id, :course_id => self.id, :viewed => false) end - # 发布新课导语 - def add_course_ead - name = Redmine::Configuration['course_message_lead_subject'] - content = Redmine::Configuration['course_message_lead_content'] - # message的status状态为0为正常,为1表示创建课程时发送的message - Message.create(:subject => name, :content => content, :board_id => self.boards.first.id, :author_id => self.tea_id , :sticky => true, :status => true ) - end - #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #def name # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 88351acfd..194e1183a 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -70,7 +70,9 @@ class CourseActivity < ActiveRecord::Base name = Redmine::Configuration['course_message_lead_subject'] content = Redmine::Configuration['course_message_lead_content'] # message的status状态为0为正常,为1表示创建课程时发送的message - Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true ) + message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true ) + # 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直 + message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) end end end From f3b5f4e5f762b6c52bf698c2b12b33cbd546f0a6 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 20 Jan 2016 16:58:41 +0800 Subject: [PATCH 179/205] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8tab=E9=A1=B5=E9=80=9A=E8=BF=87=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=9D=97=E5=B1=95=E7=A4=BA=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 66f60d020..ebc60c312 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -969,7 +969,17 @@ module ApplicationHelper first_page = FirstPage.find_by_page_type('project') if args.empty? title = @html_title || [] - title << @project.name if @project + if @project + title << @project.name + elsif @course + title << @course.name + elsif @organization + title << @organization.name + elsif @user + title << @user.login + else + title << User.current.login + end if first_page.nil? || first_page.web_title.nil? title << Setting.app_title unless Setting.app_title == title.last else From 340d404ecd2f626689b35f06caf5e286ef3cde49 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 20 Jan 2016 17:23:02 +0800 Subject: [PATCH 180/205] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E9=80=9A=E7=9F=A5=E5=A2=9E=E5=8A=A0=E6=9F=A5=E3=80=81?= =?UTF-8?q?=E6=94=B9=E3=80=81=E5=88=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 15 ++ app/models/news.rb | 6 +- .../news/_edit_for_org_subfield.html.erb | 49 +++++ app/views/news/_organization_show.html.erb | 173 ++++++++++++++++++ app/views/news/edit.html.erb | 8 +- app/views/news/show.html.erb | 2 + ...60120032758_add_org_subfield_id_to_news.rb | 5 + public/javascripts/project.js | 21 ++- 8 files changed, 273 insertions(+), 6 deletions(-) create mode 100644 app/views/news/_edit_for_org_subfield.html.erb create mode 100644 app/views/news/_organization_show.html.erb create mode 100644 db/migrate/20160120032758_add_org_subfield_id_to_news.rb diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index d3ac71b99..8d0309588 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -144,6 +144,10 @@ class NewsController < ApplicationController if @course render :layout => 'base_courses' end + elsif @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + @organization = @org_subfield.organization + render :layout => 'base_org' end end @@ -221,8 +225,14 @@ class NewsController < ApplicationController end def edit + if @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + @organization = @org_subfield.organization + end if @course render :layout => "base_courses" + elsif @org_subfield + render :layout => 'base_org' end end @@ -240,12 +250,17 @@ class NewsController < ApplicationController end def destroy + if @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + end @news.destroy # modify by nwb if @project redirect_to project_news_index_url(@project) elsif @course redirect_to course_news_index_url(@course) + elsif @org_subfield + redirect_to organization_path(@org_subfield.organization, :org_subfield_id => @org_subfield.id) end end diff --git a/app/models/news.rb b/app/models/news.rb index 0ff0786ab..fee5d2801 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -58,7 +58,7 @@ class News < ActiveRecord::Base after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count after_update :update_activity - after_destroy :delete_kindeditor_assets, :decrease_news_count + after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities scope :visible, lambda {|*args| includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) @@ -188,4 +188,8 @@ class News < ActiveRecord::Base Mailer.run.news_added(self) if Setting.notified_events.include?('news_added') end + def delete_org_activities + OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all + end + end \ No newline at end of file diff --git a/app/views/news/_edit_for_org_subfield.html.erb b/app/views/news/_edit_for_org_subfield.html.erb new file mode 100644 index 000000000..75f24e6b7 --- /dev/null +++ b/app/views/news/_edit_for_org_subfield.html.erb @@ -0,0 +1,49 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +
    +
    +
    +
    + +

    +
    + +
    +
    +
    \ No newline at end of file diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb new file mode 100644 index 000000000..aa610720c --- /dev/null +++ b/app/views/news/_organization_show.html.erb @@ -0,0 +1,173 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + + + + +
    +
    +
    + <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %> +
    +
    + <% if User.current.logged? %> + + <%end%> + +
    + +
    + <% if @news.try(:author).try(:realname) == ' ' %> + <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
    +
    <%= format_time( @news.created_on)%>
    +
    +
    + <%= @news.description.html_safe%> +
    +
    +
    + <%= link_to_attachments_course @news, :author => false %> +
    +
    +
    +
    +
    +
    + <% unless @comments.empty? %> +
    +
    回复(<%=@comments.count %>)
    +
    +
    +
    + <% @comments.each_with_index do |reply,i| %> + +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
    +
    + <%= reply.comments.html_safe%> +
    +
    + <%= format_time(reply.created_on) %> + +
    +

    +
    +
    +
    + <% end %> +
    + + <% end %> +
    + <% if @news.commentable? %> +
    + +
    +
    + <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> +
    + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :comments, :editor_id => 'comment_editor', + :owner_id => @comment.nil? ? 0: @comment.id, + :owner_type => OwnerTypeHelper::COMMENT, + :width => '99%', + :height => 100, + :minHeight=>100, + :input_html => { :id => 'comment_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
    +

    +

    + + <%= l(:label_cancel_with_space) %> + + + <%= l(:label_comment_with_space) %> + +

    + <% end %> +
    +
    +
    + <% end %> +
    +
    diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index b043b06f8..24d7f2040 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -16,8 +16,10 @@
    <%= labelled_form_for :news, @news, :url => news_path(@news), :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> - <%#= labelled_form_for :news, :url =>{:controller=>'news',:action => 'new', :course_id => @course.id}, - :html => {:nhname=>'form',:multipart => true, :id => 'news-form'} do |f| %> - <%= render :partial => 'course_news_new', :locals => {:f => f, :news => @news, :edit_mode => true, :course => @course} %> + <% if @org_subfield %> + <%= render :partial => 'edit_for_org_subfield', :locals => {:f => f, :news => @news} %> + <% else %> + <%= render :partial => 'course_news_new', :locals => {:f => f, :news => @news, :edit_mode => true, :course => @course} %> + <% end %> <% end %> diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index 846be063f..4f6ca056e 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -2,6 +2,8 @@ <%= render :partial => 'project_show', locals: {project: @project} %> <% elsif @course %> <%= render :partial => 'course_show', locals: {course: @course} %> +<% elsif @organization %> + <%= render :partial => 'organization_show', :locals => {:org_subfield => @org_subfield} %> <% end %> \ No newline at end of file diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index be212fb29..45721fd1b 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -114,7 +114,9 @@ $(function(){ dialogClass: 'BluePopupBox', minWidth: 753 }); - $('#BluePopupBox').parent().css("border","3px solid #269ac9"); + $('#BluePopupBox').parent().resizable("disable"); + $('#BluePopupBox').parent().removeClass("ui-state-disabled"); + $('#BluePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); $('a.ProBtn').live('click', function(){ $("#BluePopupBox").dialog("open"); @@ -205,7 +207,9 @@ $(function(){ dialogClass: 'BluePopupBox', minWidth: 290 }); - $('#GroupPopupBox').parent().css("border","3px solid #269ac9"); + $('#GroupPopupBox').parent().resizable("disable"); + $('#GroupPopupBox').parent().removeClass("ui-state-disabled"); + $('#GroupPopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); $('a.groupBtn').live('click', function(){ $("#GroupPopupBox").dialog("open"); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index fb5e64523..64cd2e959 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1,3 +1,4 @@ + /* CSS Document */ /* 2015-06-26 */ body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} @@ -555,7 +556,7 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no- /*.navHomepageProfile ul li ul {display:none;} .navHomepageProfile ul li:hover ul {display:block;}*/ .homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;} -.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px;} +.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px; margin-top:10px;} .homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px;} .homepagePortraitImage {width:78px; height:78px; position:relative; border:1px solid #cbcbcb; padding: 2px;} .homepagePortraitImage:hover {border:1px solid #269ac9;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 234905c7a..7770fa1ac 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -306,7 +306,7 @@ a:hover.bgreen_n_btn{background:#08a384;} .blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;} .orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;white-space:nowrap;} .bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;white-space:nowrap;} -.grey_border{border:1px solid #dddddd !important; } +.grey_border{border:1px solid #dddddd !important;} /* commonpic */ .pic_date{ display:block; background:url(../images/new_project/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; float:left;} .pic_add{ display:block; background:url(../images/new_project/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; float:left;} From 01016c67a92b06abf6d635507b9b73f2b56a50cd Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 20 Jan 2016 18:28:27 +0800 Subject: [PATCH 182/205] =?UTF-8?q?issue=E5=B1=9E=E6=80=A7=E5=B1=80?= =?UTF-8?q?=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 2 + .../users/_project_issue_detail.html.erb | 134 ++++++++++++++++++ public/stylesheets/project.css | 6 +- public/stylesheets/public.css | 4 + 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 app/views/users/_project_issue_detail.html.erb diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 6f1fc8b7a..4c89110ad 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -57,6 +57,8 @@ <% end %> + <%# 局部刷新:修改xissue属性 %> + <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>
    diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb new file mode 100644 index 000000000..0c0ac2f1d --- /dev/null +++ b/app/views/users/_project_issue_detail.html.erb @@ -0,0 +1,134 @@ + +
    +
    +
      +
    • +

       状态  : 

      +

      新增

      + +
    • +
      +
    • +

       指派  : 

      + + +
    • +
      +
    +
      +
    • +

       优先级  : 

      + 立刻 + +
    • +
      +
    • +

       完成度  : 

      + 0% + +
    • +
      +
    +
      +
    • +

       开始  : 

      +

      2015-12-11

      +
    • +
      +
    • +

       周期  : 

      + 0.00 小时
    • +
      +
    + + +
    \ No newline at end of file diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 46364eee0..cf23eb963 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1163,4 +1163,8 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .mb10 {margin-bottom: 10px} .mb15 {margin-bottom: 15px} div.disable_link {background-color: #c1c1c1 !important;} -.reUploadDetail{border:1px solid #dddddd; float:left; resize:none; width:400px; height:80px; overflow-y:auto;outline: none;} \ No newline at end of file +.reUploadDetail{border:1px solid #dddddd; float:left; resize:none; width:400px; height:80px; overflow-y:auto;outline: none;} + +/*问题跟踪局部修改属性*/ +.proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;} +.proInfoBox2 ul li{ height:24px; position:relative;} \ No newline at end of file diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 2126e36d8..baa3f6fcf 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -140,6 +140,7 @@ h4{ font-size:14px; color:#3b3b3b;} .w50 {width:50px;} .w60{ width:60px;} .w70{ width:70px;} +.w80{ width:80px;} .w90{ width:90px;} .w100{width: 100px;} .w210{ width:210px;} @@ -323,6 +324,9 @@ a:hover.bgreen_n_btn{background:#08a384;} .pic_text02{display:block; background:url(../images/new_project/public_icon.png) 0px -642px no-repeat; width:20px; height:19px;} .pic_edit{display:block; background:url(../images/new_project/public_icon.png) 0px -32px no-repeat; width:20px; height:15px;} .pic_edit:hover{display:block; background:url(../images/new_project/public_icon.png) -32px -32px no-repeat; width:20px; height:15px;} +.pic_edit2{display:inline-block; background:url(../images/public_icon.png) 0px -32px no-repeat; width:20px; height:15px; vertical-align:middle; display:none;} +.pic_edit2:hover{display:inline-block; background:url(../images/public_icon.png) -32px -32px no-repeat; width:20px; height:15px;} + From c7522067e6e1f5b4d5779d19d0c9f47d57f9576f Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 20 Jan 2016 18:37:39 +0800 Subject: [PATCH 183/205] =?UTF-8?q?=E4=BF=AE=E6=94=B9base=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_recommendation.html.erb | 2 +- app/views/layouts/base_courses.html.erb | 2 +- app/views/layouts/base_projects.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index bd44afad2..455ced056 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -1,6 +1,6 @@ <% unless excellent_course_recommend(course).count == 0 %>
      -

      <%= l(:label_homework_recommendation) %>

      +

      <%= l(:label_homework_recommendation) %>:

      <% excellent_course_recommend(course).each do |e_course| %>
    • <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
      diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 12331b088..5f53e5203 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -199,7 +199,7 @@
      -

      <%= l(:label_tag)%>:

      +

      <%= l(:label_tag)%>:

      <%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %>
      diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 880c6cc1c..657873f8b 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -150,7 +150,7 @@
      -

      <%= l(:label_tag)%>:

      +

      <%= l(:label_tag)%>:

      <%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%> From 3b180aca90990ed1bbd5366e396172577a55e55b Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 20 Jan 2016 18:37:47 +0800 Subject: [PATCH 184/205] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E7=95=99=E8=A8=80=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 24 ++++++- app/controllers/words_controller.rb | 6 +- app/views/users/_jour_form.html.erb | 19 ++++++ app/views/users/_user_jours_list.html.erb | 32 +++++++++ app/views/users/user_newfeedback.html.erb | 78 +++++++--------------- app/views/users/user_newfeedback.js.erb | 1 + public/images/mes_icon.png | Bin 0 -> 2459 bytes public/javascripts/new_user.js | 37 ++++++++++ public/stylesheets/share.css | 2 +- 9 files changed, 140 insertions(+), 59 deletions(-) create mode 100644 app/views/users/_jour_form.html.erb create mode 100644 app/views/users/_user_jours_list.html.erb create mode 100644 app/views/users/user_newfeedback.js.erb create mode 100644 public/images/mes_icon.png diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 449d8b9de..b7e507b28 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -746,14 +746,34 @@ class UsersController < ApplicationController end end # end - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @page = params[:page] ? params[:page].to_i + 1 : 0 + if params[:type].present? + case params[:type] + when "public" + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + when "private" + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + else + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + end + else + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + end + @type = params[:type] if User.current == @user jours.update_all(:is_readed => true, :status => false) jours.each do |journal| fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) end end - @jour = paginateHelper jours,10 @state = false render :layout=>'new_base_user' end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index ebd46caa7..8115f3f91 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -225,11 +225,11 @@ class WordsController < ApplicationController def leave_user_message if User.current.logged? @user = User.find(params[:id]) - if params[:new_form][:user_message].size>0 && User.current.logged? && @user + if params[:new_form][:content].size>0 && User.current.logged? && @user if params[:private] && params[:private] == '1' - @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:user_message], :reply_id => 0, :status => true, :is_readed => false, :private => 1) + @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:content], :reply_id => 0, :status => true, :is_readed => false, :private => 1) else - @user.add_jour(User.current, params[:new_form][:user_message]) + @user.add_jour(User.current, params[:new_form][:content]) end end redirect_to feedback_path(@user) diff --git a/app/views/users/_jour_form.html.erb b/app/views/users/_jour_form.html.erb new file mode 100644 index 000000000..13bf6d79a --- /dev/null +++ b/app/views/users/_jour_form.html.erb @@ -0,0 +1,19 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + +<%= error_messages_for 'message' %> +
    • + <%= text_area :quote,:quote,:style => 'display:none' %> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :content, :editor_id => 'jour_content_editor', + :width => '99.7%', + :height => 40, + :minHeight=>40, + :input_html => { :id => 'jour_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
      +

      +
    • +
      diff --git a/app/views/users/_user_jours_list.html.erb b/app/views/users/_user_jours_list.html.erb new file mode 100644 index 000000000..cc5a589b5 --- /dev/null +++ b/app/views/users/_user_jours_list.html.erb @@ -0,0 +1,32 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%#= javascript_include_tag "init_KindEditor","user" %> +<% end %> + +<%if jours %> + <% jours.each do |jour|%> + <% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %> + + <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id} %> + <%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %> + <% end %> + <%end%> +<% end%> +<% if (jours.count + page * 10) < count %> + <%= link_to "点击展开更多",feedback_path(@user.id, :type => type, :page => page),:id => "show_more_jours",:remote => "true",:class => "loadMore mt10 f_grey"%> +<% end %> \ No newline at end of file diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index 1035f5656..24f625e03 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,68 +1,40 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> - <%= javascript_include_tag "init_KindEditor","user" %> -<% end %> - - -
      +
      -
      留言
      -
      - +
      留言
      +
        +
      • +
          +
        • <%= link_to "全部", {:controller => "users", :action => "user_newfeedback", :type => nil}, :class =>"resourcesTypeAll resourcesGrey"%>
        • +
        • <%= link_to "留言", {:controller => "users", :action => "user_newfeedback", :type => "public"}, :class => "mesIcon resourcesGrey"%>
        • +
        • <%= link_to "私信", {:controller => "users", :action => "user_newfeedback", :type => "private"}, :class => "personalIcon resourcesGrey"%>
        • +
        +
      • +
      +
      -
      -
      - <%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%> - -

      - -
      - - 留言 - 私信
      - <% end%> -
      -
      - -
      - <%if @jour%> - <% @jour.each do |jour|%> - <% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %> - <%= render :partial => 'user_jours_new', :locals => {:jour => jour} %> - <% end %> - <%end%> - <% end%> - -
        - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
      -
      +
      +
      <%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %> +
      + <%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%> + <%=render :partial => "jour_form", :locals => {:f => f} %> + + 留言 + 私信 + <% end %> +
      + <%=render :partial => "users/user_jours_list", :locals => {:jours =>@jour, :page => 0, :type => @type, :count => @jour_count} %>
      - \ No newline at end of file diff --git a/app/views/users/user_newfeedback.js.erb b/app/views/users/user_newfeedback.js.erb new file mode 100644 index 000000000..cfac4cef2 --- /dev/null +++ b/app/views/users/user_newfeedback.js.erb @@ -0,0 +1 @@ +$("#show_more_jours").replaceWith("<%= escape_javascript( render :partial => 'users/user_jours_list',:locals => {:jours => @jour, :page => @page,:type => @type, :count => @jour_count} )%>"); diff --git a/public/images/mes_icon.png b/public/images/mes_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4a37cca0cabf24a62cfcdb371b03e048afd1e5ee GIT binary patch literal 2459 zcmeAS@N?(olHy`uVBq!ia0vp^xeN@9%Q)D8tg;1MQ-PFZiEBhjaDG}zd16s2gJVj5 zQmTSyZen_BP-l zO)W`OsL0L9E4HezRRWu91!RMS^_3LBN=mYAl^~9a@C{IK&M!(;Fx4~GO*SwzR4_Bs zGc++ZGc(jtFfuSS(l-DiGhIUyD^oKoBXb2PPy*Ukl#*r@}n3+2no0=FJx|%v!SeRHkTNpVz zIvW}}SvbS=y5uL9=BDPA!1Sgd^jhH53rY&P1wfl!Qj0RnQd8WD@^clyUbf1_?G{s< z=0WwQ;C71{PQCg-$LND17Ac}(Lcr7mV#1RxkONQnsd>QEUIa|mZ*GYBF)*<4d%8G= zRNQ)V*S{k)ROZ0P>T|W{ditjR7uckvWYCl$sHv;7LC8d@DEPuLo+9OoY8@GY-HSpK zbhEC8X)V-P>|5{2(W}5R*{rSG#Anf_WA?_M-@Pn<-fPwR%%tbNVC}vS_jZ5ZSDyZ$ z#^(FnnT_dMOGAF;PhH?BY~t9gmeIuKdx3>_)&kC1V3FVP3u|{hU#zusmzVFlps8lZ z-(H;LwaV*j%pBV(UiZRQZL;gre>peM@5tSIYNqd(t*Y96(zm92*{RFEpWfWN zW)0saeWqt~gG{|=UAZgQE$_hC3m|g_2r)R-D|9Ndz$zB+1IY$J@>96CUeE_j%llZ9hLZZHTd(|tT_HP zyO|R2vZg)GFZ`WY^}HfSe*UuEmebF9x9ys5ympE2^K`$jab8!IpU?369Co?H{7Ch! zlgmu}kAAZ){1OtZ_P+mb?(_X_bq4~@$Ip#i6S{6rrm&T!sRdvT@8SM9GZ?>!xJQ~3M!W7XG;KUU~`<3IM;UwlUF z{v&snYuj(xSnM+*hM@o za-Y0wIq%m$PsNX2VDY^GOAep}qLx8|h@Skdee1vNHMFtWWEgt2t0MRJ#1e5^#jkdD zAD(~w__6=`n#j#ZKg7+``+2cZnep548#h)hyPX@@_V4A^xAqOY)`j=>_1(+PVDAuH zn{jZL?Uq+T8JBgko%m8$nVL+;|UO}l!E zYcf7Iq(_;y&%7pa>)^R9Chaq)@xEmcS2D~NGxIgxT6N~IdgPA##mMFsr^5@%_bA*1~WUmeaROWxn?I9Z}}3Y`nIUf zGiR-B@v{;sIXSC&#kCsqtOP6G{@+ueb?)b}3w#2(Nl8h^A06#p-z{k(WxT>wy8rg6 zyzMtt9nHew$rzyA^3>W>$9O0^c{=x8E5oZ}@H6eER=4!-9R@n(-Ik zPLr|smhU*s&XoUZ=gu`2ru`Y>3v=H09jm@|d85NknSiesE;MPS%@us>{Lh3Lns=p4 zfVmkIQ}EnOya-BMg9-!G*e6Pa7j7L)J16NPD5VitI~gL28K@8>7y(I!L(q#?DH9^H f(X!&dngUdxCqzGtxt)Lim(^>bP0l+XkKGm_$b literal 0 HcmV?d00001 diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 567d2322f..f273f0b77 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -55,6 +55,43 @@ function show_more_project(url){ ); } +//个人留言 +function jour_submit(){ + if(jourReplyVerify()){ + $("#private_flag").val("0"); + jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值 + $("#user_feedback_new").submit(); + } +} + +function private_jour_submit(){ + if(jourReplyVerify()){ + $("#private_flag").val("1"); + jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值 + $("#user_feedback_new").submit(); + } +} + +function jourReplyVerify() { + var content = jour_content_editor.html();//$.trim($("#message_content").val()); + if (jour_content_editor.isEmpty()) { + $("#jour_content_span").text("回复不能为空"); + $("#jour_content_span").css('color', '#ff0000'); + $("#submit_feedback_user").one('click',function() { + jour_submit(); + }); + $("#private_submit_feedback_user").one('click',function() { + private_jour_submit(); + }); + return false; + } + else { + $("#jour_content_span").text("填写正确"); + $("#jour_content_span").css('color', '#008000'); + return true; + } +} + //老师提交 新建/修改 作业 function submit_homework(id){ if(!regex_homework_name()){ diff --git a/public/stylesheets/share.css b/public/stylesheets/share.css index 43e0bc8f6..02d91304f 100644 --- a/public/stylesheets/share.css +++ b/public/stylesheets/share.css @@ -35,7 +35,7 @@ ul.subNavArrow:hover li ul {display:block;} a.mesIcon {background:url(../images/mes_icon.png) -5px -73px no-repeat; padding-left:23px;} a.personalIcon {background:url(../images/mes_icon.png) -6px -16px no-repeat; padding-left:23px;} .mesType {background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 15px; left:-50px; font-size:12px; color:#888888; display:none; line-height:2; z-index:999; white-space:nowrap;} -a.greyBtn2 {float:right; text-align:center; font-size:12px; color:#ffffff; background-color:#cecece; padding:3px 10px;} +a.greyBtn2 {float:right; text-align:center; font-size:12px; color:#ffffff; background-color:#aaaaaa; padding:3px 10px;} .PMTag {padding:0px 5px; background-color:#555555; border-radius:3px; color:#ffffff;} .upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;} .upload_box{ width:430px; margin:15px auto;} From ece9f9dc6fb65395719072d44b52a1d23975bda9 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 10:33:53 +0800 Subject: [PATCH 185/205] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=96=B9=E5=9D=97=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 15 ++ app/views/news/_project_news.html.erb | 103 +++------ app/views/news/_project_news_detail.html.erb | 56 +++++ app/views/news/_project_news_new.html.erb | 60 +++++ app/views/news/_project_show.html.erb | 221 ++++++++++++++----- app/views/news/edit.html.erb | 4 +- app/views/users/_project_news.html.erb | 141 ++++++++++-- config/routes.rb | 2 + 8 files changed, 451 insertions(+), 151 deletions(-) create mode 100644 app/views/news/_project_news_detail.html.erb create mode 100644 app/views/news/_project_news_new.html.erb diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 8d0309588..5c9c48904 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -155,6 +155,21 @@ class NewsController < ApplicationController #modify by nwb if @project @news = News.new(:project => @project, :author => User.current) + @news.safe_attributes = params[:news] + @news.save_attachments(params[:attachments]) + if @news.save + if params[:asset_id] + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS + end + render_attachment_warning_if_needed(@news) + #flash[:notice] = l(:notice_successful_create) + redirect_to project_news_index_url(@project) + else + redirect_to project_news_index_url(@project) + #layout_file = 'base_courses' + #render :action => 'new', :layout => layout_file + end elsif @course @news = News.new(:course => @course, :author => User.current) #render :layout => 'base_courses' diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index efbb74e46..fa2a99cd7 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -1,77 +1,36 @@ - -<% - btn_tips = l(:label_news_new) - label_tips = l(:label_news) -%> -
      -

      <%= label_tips %>

      -
      -
      -

      <%= l(:label_total_news) %><%= @news_count %><%= l(:label_project_new_list) %>

      - <% if @project && User.current.allowed_to?(:manage_news, @project) %> - <%= link_to(btn_tips, new_project_news_path(@project), - :class => 'problem_new_btn fl c_dorange') %> -
      - - <% end %> -
      -
      -
      - <% if @newss.empty? %> -

      - <%= l(:label_no_data) %> -

      - <% else %> - <% @newss.each do |news| %> -
      - <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> -
      - <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> - <%= l(:label_add_news) %>:<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> - <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w_news" %>
      -
      -

      <%=textAreailizable news.description %>

      - - <%= l(:label_create_time) %> :<%= format_time(news.created_on) %> -
      -
      -
      + +
      +
      +
      + 项目通知 +
      +
      + <% if @project && User.current.allowed_to?(:manage_news, @project) %> + <%= labelled_form_for @news, :url =>{:controller=>'news',:action => 'new', :project_id => @project.id}, + :html => {:nhname=>'form',:multipart => true, :id => 'news-form'} do |f| %> + <%= render :partial => 'project_news_new', :locals => {:f => f, :news => @news, :edit_mode => false} %> <% end %> <% end %> + <%= render :partial=> 'project_news_detail',:locals =>{:all_news => @newss, :page => 0} %>
      - -
        - <%= pagination_links_full @news_pages, @news_count, :per_page_links => false, :remote => false, :flag => true%> -
      - - <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> - <% end %> - - <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> - <%= stylesheet_link_tag 'scm' %> - <% end %> - - <% html_title(l(:label_news_plural)) -%> - - diff --git a/app/views/news/_project_news_detail.html.erb b/app/views/news/_project_news_detail.html.erb new file mode 100644 index 000000000..fdb035bf5 --- /dev/null +++ b/app/views/news/_project_news_detail.html.erb @@ -0,0 +1,56 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor" %> +<% end %> + + +<% if all_news %> + <% all_news.each do |news| %> + + <% if news %> + <%= render :partial => 'users/project_news', :locals => {:activity => news, :user_activity_id => news.id} %> + <% end %> + <% end %> + + <% if all_news.count == 10 %> + <%= link_to "点击展开更多",news_index_path(:project_id => @project.id ,:page => page),:id => "show_more_project_news",:remote => "true",:class => "loadMore mt10 f_grey"%> + <% end %> +<% end%> + diff --git a/app/views/news/_project_news_new.html.erb b/app/views/news/_project_news_new.html.erb new file mode 100644 index 000000000..0e9b03c6f --- /dev/null +++ b/app/views/news/_project_news_new.html.erb @@ -0,0 +1,60 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +
      +
      +
      +
      + +

      +
      + +
      +
      +
      \ No newline at end of file diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 463b0f489..7a62ec314 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -1,72 +1,173 @@ -
      -

      <%= l(:label_news) %>

      -
      +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + + + -<% if authorize_for('news', 'edit') %> - <% end %> - diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 2e43c7089..763a76d5e 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -139,6 +139,3 @@
      - diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 1e13c4c95..96ed6adff 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -133,6 +133,3 @@ - diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index df43b1af2..baa687107 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -134,6 +134,3 @@ - diff --git a/app/views/projects/_attachment_acts.html.erb b/app/views/projects/_attachment_acts.html.erb index adc21fdcc..de0820bff 100644 --- a/app/views/projects/_attachment_acts.html.erb +++ b/app/views/projects/_attachment_acts.html.erb @@ -22,18 +22,14 @@ 发布时间:<%= format_time(activity.created_on) %>

      <%= textAreailizable activity, :description %>

      -
      +
      - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 7a797535a..2614462d7 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -120,7 +120,4 @@
      - - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 5aeaea20e..651a284e4 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -347,5 +347,4 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); - $(description_show_hide(<%=user_activity_id %>)); diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 8b28d13e9..5abd08224 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -177,6 +177,4 @@ <% end %> - + diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 606b9aecd..100a1a1bf 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -120,7 +120,4 @@
      - - + \ No newline at end of file diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index 3e29b255b..970fb516e 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -55,6 +55,3 @@ <% end %> - diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb index d5806c078..668a26cec 100644 --- a/app/views/users/_intro_content.html.erb +++ b/app/views/users/_intro_content.html.erb @@ -1,4 +1,4 @@ -
      +
      <%= content.to_s.html_safe%>
      @@ -8,5 +8,6 @@ var postContent = $("#intro_content_<%= user_activity_id%>").html(); postContent = postContent.replace(/ /g," "); $("#intro_content_<%= user_activity_id%>").html(postContent); + description_show_hide(<%=user_activity_id %>); }); \ No newline at end of file diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index e342256d4..009e63404 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -151,6 +151,3 @@
      - diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index db65562e6..d4a7a9e60 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -167,6 +167,3 @@ - diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 5b109a56d..581bfb53c 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -144,5 +144,4 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); - $(description_show_hide(<%=user_activity_id %>)); diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index ee0c5595b..b3e14d174 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -348,5 +348,4 @@ $("#relatePWrap_<%=homework_common.id %>").toggleClass('relatePWrap'); $("#moreProject_<%=homework_common.id %>").show(); }); - $(homework_description_show_hide(<%=homework_common.id %>)); \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 193b358dc..e94954a10 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -23,23 +23,6 @@ function description_show_hide(id){ }); } -function homework_description_show_hide(id){ - showNormalImage('homework_description_'+id); - if($("#intro_content_"+id).height() > 810) { - $("#intro_content_show_"+id).show(); - } - $("#intro_content_show_"+id).click(function(){ - $("#homework_description_"+id).toggleClass("maxh360"); - $("#intro_content_show_"+id).hide(); - $("#intro_content_hide_"+id).show(); - }); - $("#intro_content_hide_"+id).click(function(){ - $("#homework_description_"+id).toggleClass("maxh360"); - $("#intro_content_hide_"+id).hide(); - $("#intro_content_show_"+id).show(); - }); -} - function cleanArray (actual){ var newArray = new Array(); for (var i = 0; i< actual.length; i++){ diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index de5190290..810cd0fec 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1099,7 +1099,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 88a5757ec..b1f950960 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -841,7 +841,7 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;display: inline} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 46364eee0..c671f30ec 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1109,7 +1109,7 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;} From c303f7ff3fb07eacca19001491d52b50b579e2dd Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 14:33:31 +0800 Subject: [PATCH 190/205] =?UTF-8?q?=E5=B0=86=E5=88=86=E4=BA=AB=E7=9A=84js?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=BB=9F=E4=B8=80=EF=BC=8C=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E3=80=81=E9=80=9A=E7=9F=A5=E7=AD=89=E5=9D=87?= =?UTF-8?q?=E5=8F=AF=E5=A4=8D=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 10 +- app/views/files/_course_list.html.erb | 4 +- app/views/files/_file_tools.html.erb | 4 +- app/views/files/_org_subfield_list.html.erb | 4 +- app/views/files/_tool_settings.html.erb | 4 +- app/views/files/index.html.erb | 98 --------------- app/views/news/index.html.erb | 113 ----------------- app/views/news/index.js.erb | 2 +- .../org_subfields/_show_post_type.html.erb | 115 ----------------- app/views/org_subfields/show.html.erb | 98 --------------- .../organizations/_org_subfield_news.html.erb | 2 +- app/views/users/_course_news.html.erb | 2 +- app/views/users/_project_news.html.erb | 2 +- .../users/_resource_share_for_orgs.html.erb | 4 +- ..._resource_share_for_project_popup.html.erb | 4 +- .../users/_resource_share_popup.html.erb | 4 +- .../users/_share_news_to_course.html.erb | 4 +- app/views/users/_share_news_to_org.html.erb | 4 +- .../users/_share_news_to_project.html.erb | 4 +- app/views/users/user_resource.html.erb | 96 +------------- public/javascripts/application.js | 117 ++++++++++++++++++ 21 files changed, 153 insertions(+), 542 deletions(-) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 5c9c48904..0962deb10 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -46,15 +46,16 @@ class NewsController < ApplicationController @course = Course.find(params[:course_id]) end if @project + @page = params[:page] ? params[:page].to_i + 1 : 0 scope = @project ? @project.news.visible : News.visible @news_count = scope.count - @news_pages = Paginator.new @news_count, @limit, params['page'] - @offset ||= @news_pages.offset + #@news_pages = Paginator.new @news_count, @limit, params['page'] + #@offset ||= @news_pages.offset @newss = scope.all(:include => [:author, :project], :order => "#{News.table_name}.created_on DESC", - :offset => @offset, - :limit => @limit) + :offset => @page * 10, + :limit => 10) respond_to do |format| format.html { @@ -63,6 +64,7 @@ class NewsController < ApplicationController render :layout => false if request.xhr? } + format.js format.api format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index f1d96d22c..47c08d2fb 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -43,7 +43,7 @@ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
        -
      • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
      • +
      • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
      • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
      • <% if @course.is_public? %>
      • @@ -61,7 +61,7 @@ <% end %> <%else%>
          -
        • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
        • +
        • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
        <% end %> <% end %> diff --git a/app/views/files/_file_tools.html.erb b/app/views/files/_file_tools.html.erb index df4d9d738..91b475600 100644 --- a/app/views/files/_file_tools.html.erb +++ b/app/views/files/_file_tools.html.erb @@ -2,7 +2,7 @@ <% if (is_project_manager?(User.current, @project) || file.author_id == User.current.id) && project_contains_attachment?(@project,file) %> <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @project.id && file.container_type == "Project" %>
          -
        • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
        • +
        • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
        • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
        • <% if @project.is_public? %>
        • @@ -25,7 +25,7 @@ <% end %> <%else%>
            -
          • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
          • +
          • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
          <% end %> <% end %> diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index 424319889..7a5d95125 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -38,7 +38,7 @@ <% if User.current.logged? %> <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
            -
          • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
          • +
          • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
          • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
          • @@ -52,7 +52,7 @@
          <%else%>
            -
          • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
          • +
          • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
          <% end %> <% end %> diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb index 72ec6d89f..41d74b7df 100644 --- a/app/views/files/_tool_settings.html.erb +++ b/app/views/files/_tool_settings.html.erb @@ -4,7 +4,7 @@ <% if (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file) %> <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" %>
            -
          • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
          • +
          • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
          • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
          • <% if project.is_public? %>
          • @@ -20,7 +20,7 @@ <% end %> <% else %>
              -
            • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
            • +
            • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
            <% end %> <% end %> diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index b702d5872..8cb547b13 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -245,105 +245,7 @@ }); } - function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) { - $('#'+fieldId).each(function() { - var $this = $(this); - $this.addClass('autocomplete'); - $this.attr('data-value-was', $this.val()); - var check = function() { - var val = $this.val(); - if ($this.attr('data-value-was') != val){ - $this.attr('data-value-was', val); - $.ajax({ - url: url, - type: 'get', - data: {search: $this.val(),send_id:send_id,send_ids:send_ids}, - success: function(data){ }, - beforeSend: function(){ $this.addClass('ajax-loading'); }, - complete: function(){ $this.removeClass('ajax-loading'); } - }); - } - }; - var reset = function() { - if (timer) { - clearInterval(timer); - timer = setInterval(check, 300); - } - }; - var timer = setInterval(check, 300); - $this.bind('keyup click mousemove', reset); - }); - } - function check_des(event){ - if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){ - event.preventDefault(); - $(".orgDirection").text('目标地址组织不能为空') - return false; - }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){ - event.preventDefault(); - $(".orgDirection").text('目标地址栏目不能为空') - return false; - }else{ - return true; - } - } - <% if User.current.logged? %> - var sendType = '1'; - var lastSendType ;//初始为发送到我的课程 - function show_send(id){ - if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id - }); - }else if(lastSendType == '1'){ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id - }); - }else if( lastSendType == '3'){//组织 - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id - }); - }else{ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id - }); - } - } - - //id 发送的id - //发送的id数组 - function chooseSendType(res_id,res_ids){ - - sendType = $(".resourcesSendType").val(); - if (sendType === lastSendType) { - return; - } else if(lastSendType != null) { //不是第一次点击的时候 - if (sendType == '1') { - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id - }); - } else if(sendType == '2') { - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id - }); - }else if(sendType == '3'){ - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id - }); - } - } - - lastSendType = sendType; - } - <% end %> <% if @course %> var tagNameHtml; //当前双击的链接的父节点的html var tagName; //标签的值 diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index bd3c99672..c4dd11ea0 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -4,118 +4,5 @@ <%= render :partial => 'course_news', locals: {course: @course} %> <% end %> - diff --git a/app/views/news/index.js.erb b/app/views/news/index.js.erb index 302c0cf9d..d2cac877c 100644 --- a/app/views/news/index.js.erb +++ b/app/views/news/index.js.erb @@ -1,5 +1,5 @@ <% if @project %> - $("#news_list").html("<%= escape_javascript(render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count})%>"); + $("#show_more_project_news").replaceWith("<%= escape_javascript(render :partial => 'project_news_detail', :locals=>{ :all_news=>@newss,:page => @page})%>"); <% else %> $("#show_more_course_news").replaceWith("<%= escape_javascript( render :partial => 'course_news_detail', :locals =>{:newss => @newss, :page => @page} )%>"); <% end %> \ No newline at end of file diff --git a/app/views/org_subfields/_show_post_type.html.erb b/app/views/org_subfields/_show_post_type.html.erb index 6faabd3e9..bc95c0774 100644 --- a/app/views/org_subfields/_show_post_type.html.erb +++ b/app/views/org_subfields/_show_post_type.html.erb @@ -29,121 +29,6 @@ :org_act_count=> @org_activities.count} %> <% end %> - - diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb index 374088acf..82203b4de 100644 --- a/app/views/org_subfields/show.html.erb +++ b/app/views/org_subfields/show.html.erb @@ -238,105 +238,7 @@ }); } - function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) { - $('#'+fieldId).each(function() { - var $this = $(this); - $this.addClass('autocomplete'); - $this.attr('data-value-was', $this.val()); - var check = function() { - var val = $this.val(); - if ($this.attr('data-value-was') != val){ - $this.attr('data-value-was', val); - $.ajax({ - url: url, - type: 'get', - data: {search: $this.val(),send_id:send_id,send_ids:send_ids}, - success: function(data){ }, - beforeSend: function(){ $this.addClass('ajax-loading'); }, - complete: function(){ $this.removeClass('ajax-loading'); } - }); - } - }; - var reset = function() { - if (timer) { - clearInterval(timer); - timer = setInterval(check, 300); - } - }; - var timer = setInterval(check, 300); - $this.bind('keyup click mousemove', reset); - }); - } - function check_des(event){ - if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){ - event.preventDefault(); - $(".orgDirection").text('目标地址组织不能为空') - return false; - }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){ - event.preventDefault(); - $(".orgDirection").text('目标地址栏目不能为空') - return false; - }else{ - return true; - } - } - - <% if User.current.logged? %> - var sendType = '1'; - var lastSendType ;//初始为发送到我的课程 - function show_send(id){ - if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id - }); - }else if(lastSendType == '1'){ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id - }); - }else if( lastSendType == '3'){//组织 - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id - }); - }else{ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id - }); - } - } - - //id 发送的id - //发送的id数组 - function chooseSendType(res_id,res_ids){ - - sendType = $(".resourcesSendType").val(); - if (sendType === lastSendType) { - return; - } else if(lastSendType != null) { //不是第一次点击的时候 - if (sendType == '1') { - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id - }); - } else if(sendType == '2') { - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id - }); - }else if(sendType == '3'){ - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id - }); - } - } - lastSendType = sendType; - } - <% end %> <% if @course %> var tagNameHtml; //当前双击的链接的父节点的html var tagName; //标签的值 diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb index 3cb530860..074d15a42 100644 --- a/app/views/organizations/_org_subfield_news.html.erb +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -35,7 +35,7 @@
          • <% if User.current.logged? %>
              -
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}')") %>
            • +
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %>
            <% end %>
          • diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index fdb8f2476..ea61e2895 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -40,7 +40,7 @@
          • <% if User.current.logged? %>
              -
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}')") %>
            • +
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
            <% end %>
          • diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 57597d6e4..eb4941668 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -37,7 +37,7 @@
          • <% if User.current.logged? %>
              -
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}')") %>
            • +
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %>
            <% end %>
          • diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 5a712b857..792db7546 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -1,7 +1,7 @@
            发送到
            - @@ -13,7 +13,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <% end %>
            diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index f15c29e90..33fa03061 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -2,7 +2,7 @@
            发送到
            - @@ -18,7 +18,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index af7bd5bd3..74265cabb 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -4,7 +4,7 @@
            发送到
            - @@ -20,7 +20,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> diff --git a/app/views/users/_share_news_to_course.html.erb b/app/views/users/_share_news_to_course.html.erb index 9865f6af2..144792201 100644 --- a/app/views/users/_share_news_to_course.html.erb +++ b/app/views/users/_share_news_to_course.html.erb @@ -4,7 +4,7 @@
            发送到
            - @@ -20,7 +20,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb index f57a91ae6..794c6db89 100644 --- a/app/views/users/_share_news_to_org.html.erb +++ b/app/views/users/_share_news_to_org.html.erb @@ -1,7 +1,7 @@
            发送到
            - @@ -13,7 +13,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <% end %>
            diff --git a/app/views/users/_share_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb index 0ae011caf..37bac105a 100644 --- a/app/views/users/_share_news_to_project.html.erb +++ b/app/views/users/_share_news_to_project.html.erb @@ -2,7 +2,7 @@
            发送到
            - @@ -18,7 +18,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 2f94e4401..e395604f4 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -141,7 +141,7 @@
          • 预览
          • 重命名
          • -
          • 发送
          • +
          • 发送
          • 删除
          @@ -330,7 +330,7 @@ - function show_send(){ + function show_send_(){ $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} line.children().css("background-color",'white'); @@ -338,12 +338,14 @@ if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 $.ajax({ type: 'get', - url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id + url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id, + data:{send_type:'file'} }); }else{ $.ajax({ type: 'get', - url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id + url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id, + data:{send_type:'file'} }); } } @@ -476,91 +478,5 @@ } } - //id 发送的id - //发送的id数组 - function chooseSendType(res_id,res_ids){ - - sendType = $(".resourcesSendType").val(); - if (sendType === lastSendType) { - return; - } else if (lastSendType != null) { //不是第一次点击的时候 - if(res_ids == "") {//如果是单个发送 - if (sendType === '1') { - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id - }); - } else if(sendType === '2') { - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id - }); - }else if(sendType ==='3') - { - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(@user)%>' + '?send_id=' + res_id - }); - } - }else{//如果是多个发送 - if (sendType === '1'){ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize() - }); - }else if(sendType === '2'){ - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize() - }); - }else if(sendType === '3'){ - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(User.current)%>' + '?'+$("#resources_list_form").serialize() - }); - } - } - } - - lastSendType = sendType; - } - - function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) { - $('#'+fieldId).each(function() { - var $this = $(this); - $this.addClass('autocomplete'); - $this.attr('data-value-was', $this.val()); - var check = function() { - var val = $this.val(); - if ($this.attr('data-value-was') != val){ - $this.attr('data-value-was', val); - $.ajax({ - url: url, - type: 'get', - data: {search: $this.val(),send_id:send_id,send_ids:send_ids}, - success: function(data){ }, - beforeSend: function(){ $this.addClass('ajax-loading'); }, - complete: function(){ $this.removeClass('ajax-loading'); } - }); - } - }; - var reset = function() { - if (timer) { - clearInterval(timer); - timer = setInterval(check, 300); - } - }; - var timer = setInterval(check, 300); - $this.bind('keyup click mousemove', reset); - }); - } - - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 193b358dc..2487a3ff0 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1035,3 +1035,120 @@ function showNormalImage(id) { } } + +//文件、帖子、通知分享 +function org_id_click(){ + var sendText = $("input[name='org_id']:checked").next().text(); + var orgDirection = "目标地址:"; + $(".orgDirection").text(orgDirection + sendText); +} +function subfield_click(){ + var sendText = $("input[name='org_id']:checked").next().text(); + var orgDirection = "目标地址:"; + var sendColumn = $("input[name='subfield']:checked").next().text(); + $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); +} + +function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { + $('#'+fieldId).each(function() { + var $this = $(this); + $this.addClass('autocomplete'); + $this.attr('data-value-was', $this.val()); + var check = function() { + var val = $this.val(); + if ($this.attr('data-value-was') != val){ + $this.attr('data-value-was', val); + $.ajax({ + url: url, + type: 'get', + data: {search: $this.val(),send_id:send_id,send_ids:send_ids, send_type:send_type}, + success: function(data){ }, + beforeSend: function(){ $this.addClass('ajax-loading'); }, + complete: function(){ $this.removeClass('ajax-loading'); } + }); + } + }; + var reset = function() { + if (timer) { + clearInterval(timer); + timer = setInterval(check, 300); + } + }; + var timer = setInterval(check, 300); + $this.bind('keyup click mousemove', reset); + }); +} +function check_des(event){ + if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址组织不能为空'); + return false; + }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址栏目不能为空'); + return false; + }else{ + return true; + } +} + +var sendType = '1'; +var lastSendType ;//初始为发送到我的课程 +function show_send(id, user_id, send_type){ + if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:id, send_type:send_type} + }); + }else if(lastSendType == '1'){ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:id, send_type:send_type} + }); + }else if( lastSendType == '3'){//组织 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org', + data:{send_id:id, send_type:send_type} + }); + }else{ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:id, send_type:send_type} + }); + } +} + +//id 发送的id +//发送的id数组 +function chooseSendType(res_id,res_ids, user_id, send_type){ + + sendType = $(".resourcesSendType").val(); + if (sendType === lastSendType) { + return; + } else if(lastSendType != null) { //不是第一次点击的时候 + if (sendType == '1') { + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:res_id, send_type:send_type} + }); + } else if(sendType == '2') { + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:res_id, send_type:send_type} + }); + }else if(sendType == '3'){ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org', + data:{send_id:res_id, send_type:send_type} + }); + } + } + lastSendType = sendType; +} From 5672b029feee2b93afa2804e827469dae9247b6c Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 21 Jan 2016 14:50:16 +0800 Subject: [PATCH 191/205] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=8A=A0=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 01afbfebe..902e1277f 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -32,7 +32,7 @@
          - <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%> + <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业(将于2016年春上线)") unless edit_mode%> <% if edit_mode %> <% end %> From 6b44b93f0ee26fcc7e5b3d71e7461c81e19b98b2 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 14:54:20 +0800 Subject: [PATCH 192/205] =?UTF-8?q?=E5=9C=A8=E9=80=9A=E7=9F=A5=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=EF=BC=8C=E4=B9=9F=E6=9C=89=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_show.html.erb | 11 +++++++++++ app/views/news/_organization_show.html.erb | 1 + app/views/news/_project_show.html.erb | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 914b1a6a1..07aaef26d 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -41,6 +41,7 @@
            • +
            • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{@news.id}','#{User.current.id}','news')") %>
            • <%= link_to( l(:button_edit), @@ -59,6 +60,16 @@
          + <% elsif User.current.logged? %> + <%end%>
          通知: <%= @news.title%> diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb index aa610720c..98d14c3ab 100644 --- a/app/views/news/_organization_show.html.erb +++ b/app/views/news/_organization_show.html.erb @@ -41,6 +41,7 @@
            • +
            • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{@news.id}','#{User.current.id}','news')") %>
            • <%= link_to( l(:button_edit), diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 7a62ec314..26ff807db 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -41,6 +41,7 @@
                • +
                • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{@news.id}','#{User.current.id}','news')") %>
                • <%= link_to( l(:button_edit), @@ -59,6 +60,16 @@
          + <% elsif User.current.logged? %> + <%end%>
          通知: <%= @news.title%> From 99cda66d0004d930d28e0bf6563b941e07333476 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 21 Jan 2016 15:02:12 +0800 Subject: [PATCH 193/205] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=9A=E6=AF=8F=E6=AC=A1=E6=8F=90=E4=BA=A4=E4=BA=86=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=9B=86=E5=90=8E=EF=BC=8C=E9=A1=B5=E9=9D=A2=E9=83=BD?= =?UTF-8?q?=E4=BC=9A=E8=B7=B3=E5=88=B0=E4=BD=9C=E4=B8=9A=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E6=9C=80=E5=BA=95=E7=AB=AF=EF=BC=8C=E8=BF=98=E5=BE=97?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E7=BF=BB=E5=88=B0=E9=A1=B5=E9=9D=A2=E6=9C=80?= =?UTF-8?q?=E9=A1=B6=E7=AB=AF=EF=BC=8C=E5=86=8D=E7=82=B9=E2=80=9C=E5=8F=91?= =?UTF-8?q?=E9=80=81=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_form.html.erb | 1 + app/views/users/_user_programing_attr.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 902e1277f..5c9386f94 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -25,6 +25,7 @@ <% end %>
          +

          diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb index 45f3089a4..3f2e53fe8 100644 --- a/app/views/users/_user_programing_attr.html.erb +++ b/app/views/users/_user_programing_attr.html.erb @@ -32,7 +32,7 @@
          温馨提示:您可以在发布作业后,在作业“模拟答题”中进行标准代码的检测。 - 确  定 + 确  定
          From 024e29981737d81e5ce78d8a173556d550cca1ed Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 21 Jan 2016 15:29:06 +0800 Subject: [PATCH 194/205] =?UTF-8?q?gitlab=E5=90=8C=E6=AD=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/trustie/gitlab/sync.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index 1f6f7c146..d41b813e7 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -53,6 +53,19 @@ module Trustie ) project.gpid = gproject.id project.save! + + # 创建的时候一并同步成员及角色 + project.members.each do |m| + begin + gid = m.user.gid + unless gid + gid = sync_user(m.user).id + end + self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER) + rescue => e + puts e + end + end end def sync_project(project, opt={}) From bd99352ab1b3ed481e8a341bddff476b3634fe4a Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 15:31:36 +0800 Subject: [PATCH 195/205] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=85=81=E8=AE=B8=E6=B8=B8=E5=AE=A2=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E7=9A=84=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- app/controllers/organizations_controller.rb | 1 + app/views/organizations/new.html.erb | 6 ++++++ app/views/organizations/setting.html.erb | 3 +++ ...0121070232_add_allow_guest_download_to_organizations.rb | 5 +++++ db/schema.rb | 7 ++++--- 6 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20160121070232_add_allow_guest_download_to_organizations.rb diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 514f68d49..23fe19333 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -600,7 +600,7 @@ private def has_login unless @attachment && @attachment.container_type == "PhoneAppVersion" - render_403 if !User.current.logged? && @attachment.container_type != 'OrgSubfield' && @attachment.container_type != 'OrgDocumentComment' + render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download) end end end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 0ba6d35a6..361303833 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -116,6 +116,7 @@ class OrganizationsController < ApplicationController @organization.description = params[:organization][:description] # @organization.domain = params[:organization][:domain] @organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0 + @organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0 #@organization.name = params[:organization][:name] @organization.save respond_to do |format| diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index ab0a4ec50..ea7fbbb30 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -34,6 +34,12 @@ (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
        • +
        • + + + (打钩为允许游客下载文件) +
          +
        • 创建 <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%> diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 45ac302ca..436d571f5 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -65,6 +65,9 @@
          公开 : class="ml3" />
          +
          允许游客下载: + class="ml3" /> +
          保存 <% end %> diff --git a/db/migrate/20160121070232_add_allow_guest_download_to_organizations.rb b/db/migrate/20160121070232_add_allow_guest_download_to_organizations.rb new file mode 100644 index 000000000..edf5c47b0 --- /dev/null +++ b/db/migrate/20160121070232_add_allow_guest_download_to_organizations.rb @@ -0,0 +1,5 @@ +class AddAllowGuestDownloadToOrganizations < ActiveRecord::Migration + def change + add_column :organizations, :allow_guest_download, :boolean, :default => true + end +end diff --git a/db/schema.rb b/db/schema.rb index 92cf224fc..7ced70118 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160120032758) do +ActiveRecord::Schema.define(:version => 20160121070232) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1262,8 +1262,9 @@ ActiveRecord::Schema.define(:version => 20160120032758) do t.integer "home_id" t.string "domain" t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "allow_guest_download", :default => true end create_table "phone_app_versions", :force => true do |t| From 56e804b423b242240bcfc877941d9de29a0b39e3 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 21 Jan 2016 15:52:07 +0800 Subject: [PATCH 196/205] =?UTF-8?q?issue=E9=82=AE=E4=BB=B6name=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 81c568133..e7a17d4d1 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -384,7 +384,7 @@ class Mailer < ActionMailer::Base @author = issue.author.login @issue_name = issue.subject @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) - @subject = "#{l(:mail_issue)}#{issue.name} #{l(:mail_issue_due_date)} " + @subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} " mail :to => recipients, :subject => @subject end From 0ba724776ed6ac549602107fd623a4737e30a6e0 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 21 Jan 2016 16:06:50 +0800 Subject: [PATCH 197/205] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E5=B7=A6=E4=BE=A7=E6=B7=BB=E5=8A=A0=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_development_group.html.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 6cac445ee..2c7d36fb5 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -47,6 +47,9 @@ <% else %> <%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "f14 c_blue02" %> <% end %> + <% unless @project.project_score.changeset_num == 0 %> + <%= link_to "(#{@project.project_score.changeset_num})", ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> + <% end %> <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %> <%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> From e2fc88e3d1d4d0b93fbc9a3d837ee67e647bdd2e Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 21 Jan 2016 16:14:39 +0800 Subject: [PATCH 198/205] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E6=A0=B7=E5=BC=8F=E6=B7=B7=E4=B9=B1=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_message.html.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index abfbba993..dbc9c3041 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -35,11 +35,11 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
          - <% if activity.parent_id.nil? %> + <% if activity.parent_id.nil? %> <% content = activity.content%> - <% else %> + <% else %> <% content = activity.parent.content%> - <% end %> + <% end %> <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %> <% if activity.status == 1 %> <%= activity.created_on.year %> @@ -49,7 +49,6 @@ <%= activity.created_on.day %> <% end %> -
          From 448a412abf0c03bd14a205030c847e54ea36467c Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 21 Jan 2016 17:29:46 +0800 Subject: [PATCH 199/205] =?UTF-8?q?issue=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=9C=A8=20user=E5=8A=A8=E6=80=81=E3=80=81project?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/_project_issue_detail.html.erb | 98 +++++++------------ public/stylesheets/new_user.css | 11 +++ 2 files changed, 49 insertions(+), 60 deletions(-) diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index 0c0ac2f1d..f6d66a371 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -36,98 +36,76 @@
          •  状态  : 

            -

            新增

            - +

            <%= activity.status.name %>

            + <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + { :include_blank => false,:selected=>@status_id ? @status_id : 0 + }, + {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} + ) + %>
          •  指派  : 

            - - + + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> + + <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), + { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0 + }, + {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"w70 undis issueEdit"} + ) + %>
          •  优先级  : 

            - 立刻 - + <%= activity.priority.name %> + <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), + { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 + }, + {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"} + ) + %>
          •  完成度  : 

            - 0% - + <%= activity.done_ratio %>% + <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), + { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 + }, + {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"} + ) + %> + <%#= select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), + {:required => @issue.required_attribute?('done_ratio'), :no_label => true}, + :onchange => "PrecentChange(this.value)", + :class => "w150" %>
          •  开始  : 

            -

            2015-12-11

            +

            <%= format_date(activity.start_date) %>

          •  周期  : 

            - 0.00 小时
          • + <%= l_hours(activity.estimated_hours) %>
          •  计划完成  : 

            - --
          • + <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
          •  目标版本  : 

            -
          • + <%= (activity.fixed_version ? link_to_version(activity.fixed_version) : "--") %>
          diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index b1f950960..26bf53c62 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1422,3 +1422,14 @@ span.at a{color:#269ac9;text-decoration: none;} .orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} .relatePWrap{max-height: 210px;overflow:hidden;} + +/*20160115问题跟踪*/ +.proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;} +.proInfoBox2 ul li{ height:24px; position:relative;} +.pic_edit2{display:inline-block; background:url(../images/public_icon.png) 0px -32px no-repeat; width:20px; height:15px; vertical-align:middle; display:none;} +.pic_edit2:hover{display:inline-block; background:url(../images/public_icon.png) -32px -32px no-repeat; width:20px; height:15px;} +.w70{ width:70px;} +.w80{ width:80px;} +.label03{ width:70px; text-align:right; display:block; float:left;} +.pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } +.proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } \ No newline at end of file From 42cc8bc69e3d3013d61b5acd2654a6fb2a75d81a Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 09:30:52 +0800 Subject: [PATCH 200/205] =?UTF-8?q?issue=E5=B1=9E=E6=80=A7=E5=88=B7?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue_detail.html.erb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index f6d66a371..34405e5db 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -30,17 +30,20 @@ stopPropagation(e); }); }); + function remote_function(id) { + $(id).submit(); + }
            + <%= form_tag({:controller => 'issues', :action => 'update', :project_id => activity.project},:remote=>'true', :method => :post, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %>
          •  状态  : 

            <%= activity.status.name %>

            <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), - { :include_blank => false,:selected=>@status_id ? @status_id : 0 - }, - {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} + {:include_blank => false, :selected => @status_id ? @status_id : 0 }, + {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} ) %>
          • @@ -53,7 +56,7 @@ <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0 }, - {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"w70 undis issueEdit"} + {:onchange=>"remote_function();",:id=>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"} ) %> @@ -75,7 +78,7 @@

             完成度  : 

            <%= activity.done_ratio %>% <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), - { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 + { :include_blank => false, :selected => @priority_id ? @priority_id : 0 }, {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"} ) @@ -85,6 +88,7 @@ :onchange => "PrecentChange(this.value)", :class => "w150" %> + <% end %>
            From 8ef3018adc3566a7a89937d38b93b6c31a214944 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 22 Jan 2016 09:41:05 +0800 Subject: [PATCH 201/205] =?UTF-8?q?issue=E5=B1=80=E9=83=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E4=BD=BF=E7=94=A8update,=E6=96=B9=E5=BC=8F=E6=98=AFpu?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue_detail.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index 34405e5db..b984c54fb 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -37,7 +37,7 @@
              - <%= form_tag({:controller => 'issues', :action => 'update', :project_id => activity.project},:remote=>'true', :method => :post, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :project_id => activity.project},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %>
            •  状态  : 

              <%= activity.status.name %>

              From 59aa1e9c6fc03f8e17bc8c691c7182249e622c4c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 09:55:58 +0800 Subject: [PATCH 202/205] =?UTF-8?q?issue=E6=88=AA=E6=AD=A2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 2 +- app/views/mailer/issue_due_date.html.erb | 2 +- lib/tasks/issue_due_date.rake | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index e7a17d4d1..ee37927d3 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -381,7 +381,7 @@ class Mailer < ActionMailer::Base # issue截止时间提醒 def issue_due_date(issue, recipients) - @author = issue.author.login + @author = issue.author @issue_name = issue.subject @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) @subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} " diff --git a/app/views/mailer/issue_due_date.html.erb b/app/views/mailer/issue_due_date.html.erb index a4fd81236..f0ac2907a 100644 --- a/app/views/mailer/issue_due_date.html.erb +++ b/app/views/mailer/issue_due_date.html.erb @@ -2,7 +2,7 @@
              • <%= l(:mail_issue_content)%> -

                <%=link_to @author, user_url(@author) %> 发布的问题跟踪:<%=link_to @issue_name, @issue_url %> 截止时间快到了,请您关注!

                +

                <%=link_to @author.login, user_url(@author) %> 发布的问题跟踪:<%=link_to @issue_name, @issue_url %> 截止时间快到了,请您关注!

              diff --git a/lib/tasks/issue_due_date.rake b/lib/tasks/issue_due_date.rake index 8d101ff94..74ee242f5 100644 --- a/lib/tasks/issue_due_date.rake +++ b/lib/tasks/issue_due_date.rake @@ -8,7 +8,9 @@ namespace :issue_due_date do if ForgeMessage.where("forge_message_type =? and forge_message_id =? and status =?", "Issue", issue.id, 1).first.nil? recipients = [] assigner = User.find(issue.assigned_to_id) - recipients << issue.author + unless assigner.id == issue.author.id + recipients << issue.author + end recipients << assigner recipients.each do |r| issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1) From edd198e91f4babc0e4ab004a71c8f63240adbf22 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 14:21:17 +0800 Subject: [PATCH 203/205] =?UTF-8?q?issue=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 42 +++++++++++++----- app/helpers/users_helper.rb | 5 +++ app/views/issues/add_journal.js.erb | 2 + app/views/users/_project_issue.html.erb | 8 ++-- .../users/_project_issue_detail.html.erb | 43 +++++++++---------- 5 files changed, 65 insertions(+), 35 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index af8990f37..72dd0a741 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -81,6 +81,7 @@ class IssuesController < ApplicationController @priority_id = params[:priority_id] @status_id = params[:status_id] @subject = params[:subject] + @done_ratio = parmas[:done_ratio] @issue_count = @query.issue_count @issue_pages = Paginator.new @issue_count, @limit, params['page'] params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 @@ -220,19 +221,27 @@ class IssuesController < ApplicationController end def update - return unless update_issue_from_params - @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) - saved = false - begin - @saved = @issue.save_issue_with_child_records(params, @time_entry) - rescue ActiveRecord::StaleObjectError - @conflict = true - if params[:last_journal_id] - @conflict_journals = @issue.journals_after(params[:last_journal_id]).all - @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) + if params[:issue_detail] + issue = Issue.find(params[:issue_id]) + issue = update_user_issue_detail(issue, params) + @saved = update_user_issue_detail(issue, params) + return + else + return unless update_issue_from_params + @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) + saved = false + begin + @saved = @issue.save_issue_with_child_records(params, @time_entry) + rescue ActiveRecord::StaleObjectError + @conflict = true + if params[:last_journal_id] + @conflict_journals = @issue.journals_after(params[:last_journal_id]).all + @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) + end end end + if @saved #修改界面增加跟踪者 watcherlist = @issue.watcher_users @@ -278,6 +287,19 @@ class IssuesController < ApplicationController end end + def update_user_issue_detail(issue, params) + case params[:type] + when "status" + issue.update_attribute(:status_id, params[:status_id]) + when "assigned" + issue.update_attribute(:assigned_to_id, params[:assigned_to_id]) + when "ratio" + issue.update_attribute(:done_ratio, params[:done_ratio]) + when "prior" + issue.update_attribute(:priority_id, params[:priority_id]) + end + end + # Updates the issue form when changing the project, status or tracker # on issue creation/update def update_form diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index bfc01a102..43ef7cefc 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -85,6 +85,11 @@ module UsersHelper end end + def link_to_user_version(version, options = {}) + return '' unless version && version.is_a?(Version) + link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " + end + # 统计未读消息数 def unviewed_message(user) course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index eca7685cb..e6a84da50 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -1,6 +1,7 @@ <% if @issue_id %> //issue详情中回复 $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); +// $("#div_user_issue_detail_<%#=@issue.id %>").html("<%#= escape_javascript(render :partial => 'users/project_issue_detail', :locals => {:issue => Issue.find( @issue_id), :activity => Issue.find( @issue_id)}) %>"); $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); issue_desc_editor = KindEditor.create('#issue_description', @@ -17,6 +18,7 @@ "uploadJson":"/kindeditor/upload", "fileManagerJson":"/kindeditor/filemanager"}); // $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>"); + $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); <%else%> diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 9f4e396de..f0dc4f19e 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -52,7 +52,9 @@
            <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%# 局部刷新:修改xissue属性 %> - <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> +
            + <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> +
            @@ -136,8 +138,8 @@
            <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
            -
            - <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> +
            + <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f| %>
            diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index b984c54fb..e46761bd1 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -37,7 +37,12 @@
              - <%= form_tag({:controller => 'issues', :action => 'update', :project_id => activity.project},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> + <%#= labelled_fields_for :issue, @issue do |f| %> + <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])), + {:include_blank => false, :selected => @status_id ? @status_id : 0 }, + {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> + <%# end %> + <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %>
            •  状态  : 

              <%= activity.status.name %>

              @@ -47,48 +52,42 @@ ) %>
            • + <% end %>
              + <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
            •  指派  : 

              <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), - { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0 - }, - {:onchange=>"remote_function();",:id=>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"} - ) - %> + { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, + {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"}) %>
            • + <% end %>
              + <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %>
            •  优先级  : 

              <%= activity.priority.name %> <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), - { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 - }, - {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"} - ) - %> + {:include_blank => false,:selected=>@priority_id ? @priority_id : 0}, + {:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %>
            • + <% end %>
              + <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %>
            •  完成度  : 

              <%= activity.done_ratio %>% <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), - { :include_blank => false, :selected => @priority_id ? @priority_id : 0 - }, - {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"} - ) - %> - <%#= select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), - {:required => @issue.required_attribute?('done_ratio'), :no_label => true}, - :onchange => "PrecentChange(this.value)", - :class => "w150" %> -
            • + {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, + {:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %> <% end %> + +
              @@ -109,7 +108,7 @@
            •  目标版本  : 

              - <%= (activity.fixed_version ? link_to_version(activity.fixed_version) : "--") %>
            • + <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
            From 2947ff89979ebd0b84d020d42815216639920060 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 16:46:23 +0800 Subject: [PATCH 204/205] =?UTF-8?q?=E7=B2=BE=E5=93=81=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- ...22083400_add_excellent_option_to_course.rb | 6 +++++ ...22083507_define_excellent_option_course.rb | 19 ++++++++++++++++ db/schema.rb | 22 ++++++++----------- 4 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20160122083400_add_excellent_option_to_course.rb create mode 100644 db/migrate/20160122083507_define_excellent_option_course.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 22c7df263..51138f2ef 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -51,7 +51,7 @@ module ApplicationHelper # 判断课程是否为精品课程 def is_excellent_course course - course.is_excellent? ? true : false + (course.is_excellent? or course.excellent_option?) ? true : false end # 判断课程对成员是否可见 diff --git a/db/migrate/20160122083400_add_excellent_option_to_course.rb b/db/migrate/20160122083400_add_excellent_option_to_course.rb new file mode 100644 index 000000000..560153781 --- /dev/null +++ b/db/migrate/20160122083400_add_excellent_option_to_course.rb @@ -0,0 +1,6 @@ +class AddExcellentOptionToCourse < ActiveRecord::Migration + def change + add_column :courses, :excellent_option, :integer, :default => false + end +end + diff --git a/db/migrate/20160122083507_define_excellent_option_course.rb b/db/migrate/20160122083507_define_excellent_option_course.rb new file mode 100644 index 000000000..7b4a4ae4a --- /dev/null +++ b/db/migrate/20160122083507_define_excellent_option_course.rb @@ -0,0 +1,19 @@ +class DefineExcellentOptionCourse < ActiveRecord::Migration + def up + arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50, + 419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175, + 124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:excellent_option, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index be1fdb1a4..7e6291806 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160121070232) do +ActiveRecord::Schema.define(:version => 20160122083507) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -500,6 +500,7 @@ ActiveRecord::Schema.define(:version => 20160121070232) do t.integer "end_time" t.string "end_term" t.integer "is_excellent", :default => 0 + t.integer "excellent_option", :default => 0 end create_table "custom_fields", :force => true do |t| @@ -1084,14 +1085,14 @@ ActiveRecord::Schema.define(:version => 20160121070232) do create_table "news", :force => true do |t| t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" t.text "description" - t.integer "author_id", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false + t.integer "comments_count", :default => 0, :null => false t.integer "course_id" - t.integer "sticky", :default => 0 + t.integer "sticky", :default => 0 t.integer "org_subfield_id" end @@ -1216,7 +1217,6 @@ ActiveRecord::Schema.define(:version => 20160121070232) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" - t.string "role" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end @@ -1265,8 +1265,8 @@ ActiveRecord::Schema.define(:version => 20160121070232) do t.integer "home_id" t.string "domain" t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.boolean "allow_guest_download", :default => true end @@ -1714,10 +1714,6 @@ ActiveRecord::Schema.define(:version => 20160121070232) do t.string "extra" end - create_table "temp", :id => false, :force => true do |t| - t.integer "id", :default => 0, :null => false - end - create_table "time_entries", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false From faf1fcaf229416d89d54f1ceb5d02c8f4d8e8915 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 17:27:21 +0800 Subject: [PATCH 205/205] =?UTF-8?q?issue=E5=9B=9E=E5=A4=8D=E5=B1=80?= =?UTF-8?q?=E9=83=A8=E5=88=B7=E6=96=B0=20=E9=99=84=E4=BB=B6=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E9=97=AE=E9=A2=98=20=E6=98=B5=E7=A7=B0=E6=94=B9?= =?UTF-8?q?=E6=88=90=E7=99=BB=E5=BD=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 +- app/api/mobile/apis/users.rb | 2 +- app/views/account/login.html.erb | 6 +- app/views/admin/latest_login_users.html.erb | 2 +- app/views/attachments/_form.html.erb | 2 +- app/views/attachments/_form_project.html.erb | 2 +- app/views/courses/_searchmembers.html.erb | 2 +- app/views/courses/settings.html.erb | 2 +- .../homework_attach/_homeworks_list.html.erb | 2 +- app/views/issues/add_journal.js.erb | 4 +- app/views/organizations/setting.html.erb | 2 +- .../_student_work_attachment_form.html.erb | 2 +- app/views/users/_project_issue.html.erb | 90 +------------------ app/views/users/_project_issue_reply.html.erb | 89 ++++++++++++++++++ app/views/welcome/_search_project.html.erb | 2 +- config/locales/navigatiors/zh.yml | 2 +- config/locales/projects/zh.yml | 2 +- config/locales/zh.yml | 2 +- 18 files changed, 109 insertions(+), 108 deletions(-) create mode 100644 app/views/users/_project_issue_reply.html.erb diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 076e0b1c7..591a4e288 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -272,7 +272,7 @@ module Mobile params do requires :token,type:String requires :course_id,type:Integer,desc: '课程id' - optional :name,type:String,desc:'学生的姓名或者昵称或者学号可能包含的字符' + optional :name,type:String,desc:'学生的姓名或者登录名或者学号可能包含的字符' end get ":course_id/members" do cs = CoursesService.new diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 583a130d1..6ce3cacbb 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -82,7 +82,7 @@ module Mobile desc "用户搜索" params do requires :name, type: String, desc: '用户名关键字' - requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名' + requires :search_by, type: String,desc: '搜索依据:0 登录名,1 用户名,2 邮箱,3 登录名和姓名' optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教' optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户' optional :user_id,type:Integer,desc:'用户id' diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 3d07f69b2..f2b43c9a3 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -224,7 +224,7 @@ <%= back_url_hidden_field_tag %>
            <%= text_field_tag 'username', params[:username], :tabindex => '1' , - :class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称', :onkeypress => "user_name_keypress(event);"%> + :class=>'loginSignBox',:placeholder=>'请输入邮箱地址或登录名', :onkeypress => "user_name_keypress(event);"%>
            <% if Setting.openid? %> @@ -283,8 +283,8 @@
            - <%= f.text_field :login, :size => 25,:placeholder=>"请输入用户昵称",:class=>'loginSignBox'%> - + <%= f.text_field :login, :size => 25,:placeholder=>"请输入用户登录名",:class=>'loginSignBox'%> +
            diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb index 28ef8091e..a32bdd33a 100644 --- a/app/views/admin/latest_login_users.html.erb +++ b/app/views/admin/latest_login_users.html.erb @@ -38,7 +38,7 @@ 用户姓名 - 用户昵称 + 用户登录名 用户身份 diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index aac365a15..6786a06a7 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -31,7 +31,7 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/attachments/_form_project.html.erb b/app/views/attachments/_form_project.html.erb index a9cb068ad..f97bd8bea 100644 --- a/app/views/attachments/_form_project.html.erb +++ b/app/views/attachments/_form_project.html.erb @@ -109,7 +109,7 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/courses/_searchmembers.html.erb b/app/views/courses/_searchmembers.html.erb index 1956f34c4..b864bfd8f 100644 --- a/app/views/courses/_searchmembers.html.erb +++ b/app/views/courses/_searchmembers.html.erb @@ -1,5 +1,5 @@ <%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %> - <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生昵称、姓名、学号进行搜索'%> + <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生登录名、姓名、学号进行搜索'%> <% if @group %> <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %> diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index f62951236..32db48def 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -109,7 +109,7 @@
            <%= form_tag(search_member_course_path,:id => "course_member_search_form", :method => :get, :class => "search_form_course",:remote => true) do %> - <%= text_field_tag 'name', params[:name], :placeholder => "昵称、学号、姓名搜索", :class => "search_text fl" %> + <%= text_field_tag 'name', params[:name], :placeholder => "登录名、学号、姓名搜索", :class => "search_text fl" %> <%= l(:label_search)%> diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index c82a729de..2696bf9ec 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -20,7 +20,7 @@ <%= link_to l(:label_export_excel), get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_batch_homeworks%> <%= link_to l(:label_export_excel), get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if not_batch_homework%> <%= link_to l(:label_export_excel), get_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_all_homeworks%> - + 搜索 diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index e6a84da50..5708f6b3d 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -1,7 +1,6 @@ <% if @issue_id %> //issue详情中回复 $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); -// $("#div_user_issue_detail_<%#=@issue.id %>").html("<%#= escape_javascript(render :partial => 'users/project_issue_detail', :locals => {:issue => Issue.find( @issue_id), :activity => Issue.find( @issue_id)}) %>"); $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); issue_desc_editor = KindEditor.create('#issue_description', @@ -18,11 +17,10 @@ "uploadJson":"/kindeditor/upload", "fileManagerJson":"/kindeditor/filemanager"}); // $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>"); - $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); <%else%> - $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); + $("#div_user_issue_reply_<%=@user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); <%end %> diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 436d571f5..21e611929 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -86,7 +86,7 @@

            添加成员

            <%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%> - + <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %>
            <%= find_user_not_in_current_org_by_name(@project) %> diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb index d82aea7f9..21928492e 100644 --- a/app/views/student_work/_student_work_attachment_form.html.erb +++ b/app/views/student_work/_student_work_attachment_form.html.erb @@ -3,7 +3,7 @@
            - <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn mb0' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn mb0' %> <%= file_field_tag 'attachments[dummy][file]', :id => "_file#{work.id}", :class => 'file_selector', diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index f0dc4f19e..618dc3185 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -65,93 +65,7 @@
            - <% count = activity.journals.count %> -
            -
            -
            回复 - <%= count>0 ? "(#{count})" : "" %> - - <% if activity.author == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> - <% end %> - -
            -
            <%#= format_date(activity.updated_on) %>
            - <% if count > 3 %> - - <% end %> -
            - - <% replies_all_i = 0 %> - <% if count > 0 %> -
            -
              - <% activity.journals.reorder("created_on desc").each do |reply| %> - - <% replies_all_i=replies_all_i + 1 %> -
            • -
              - <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> -
              -
              -
              - <% if reply.try(:user).try(:realname) == ' ' %> - <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% end %> - <%= format_time(reply.created_on) %> - - <% if reply.user == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> - <% end %> - -
              -
              - <% if reply.details.any? %> - <% details_to_strings(reply.details).each do |string| %> -

              <%= string %>

              - <% end %> - <% end %> -

              <%= reply.notes.html_safe %>

              -
              -
              -
              -
            • - <% end %> -
            -
            - <% end %> - -
            -
            <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
            -
            -
            - <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f| %> - - -
            - -
            -

            - <% end%> -
            -
            -
            -
            -
            - +
            + <%= render :partial => 'users/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
            diff --git a/app/views/users/_project_issue_reply.html.erb b/app/views/users/_project_issue_reply.html.erb new file mode 100644 index 000000000..0a84ba9c4 --- /dev/null +++ b/app/views/users/_project_issue_reply.html.erb @@ -0,0 +1,89 @@ +<% count = activity.journals.count %> +
            +
            +
            回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
            +
            <%#= format_date(activity.updated_on) %>
            + <% if count > 3 %> + + <% end %> +
            + + <% replies_all_i = 0 %> + <% if count > 0 %> +
            +
              + <% activity.journals.reorder("created_on desc").each do |reply| %> + + <% replies_all_i=replies_all_i + 1 %> +
            • +
              + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> +
              +
              +
              + <% if reply.try(:user).try(:realname) == ' ' %> + <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(reply.created_on) %> + + <% if reply.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> + <% end %> + +
              +
              + <% if reply.details.any? %> + <% details_to_strings(reply.details).each do |string| %> +

              <%= string %>

              + <% end %> + <% end %> +

              <%= reply.notes.html_safe %>

              +
              +
              +
              +
            • + <% end %> +
            +
            + <% end %> + +
            +
            <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
            +
            +
            + <%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id),:method => "post", :remote => true) do |f| %> + + +
            + +
            +

            + <% end%> +
            +
            +
            +
            +
            + +
            \ No newline at end of file diff --git a/app/views/welcome/_search_project.html.erb b/app/views/welcome/_search_project.html.erb index 6679f559d..fba855bde 100644 --- a/app/views/welcome/_search_project.html.erb +++ b/app/views/welcome/_search_project.html.erb @@ -91,7 +91,7 @@ form #search_by { if($("#search_type").val() == "users") { - $("#q").attr('placeholder','昵称/姓名/邮箱'); + $("#q").attr('placeholder','登录名/姓名/邮箱'); // $("#search_by").show(); } else diff --git a/config/locales/navigatiors/zh.yml b/config/locales/navigatiors/zh.yml index 97c6da61a..c0df616f3 100644 --- a/config/locales/navigatiors/zh.yml +++ b/config/locales/navigatiors/zh.yml @@ -63,7 +63,7 @@ zh: course: 课程 user: 用户 userinfo: - nickname: 昵称 + nickname: 登录名 showname: 姓名 email: 邮箱 diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 765060675..8bf3f03be 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -369,7 +369,7 @@ zh: label_input_email: 请输入邮箱地址 label_invite_trustie_user: "邀请Trustie注册用户" - label_invite_trustie_user_tips: "支持姓名、邮箱、昵称搜索!" + label_invite_trustie_user_tips: "支持姓名、邮箱、登录名搜索!" label_user_role_null: 用户和角色不能留空! label_invite_project: 邀请您加入项目 label_mail_invite_success: 您已成功加入项目! diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d5b249e8d..daa0c3a31 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1855,7 +1855,7 @@ zh: excel_user_id: 学生id excel_user_name: 用户名 - excel_nickname: 昵称 + excel_nickname: 登录名 excel_student_id: 学号 excel_mail: 电子邮箱 excel_homework_name: 作品名