Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder

dev_aliyun
jingquan huang 5 years ago
commit 7b8598b5ec

@ -67,12 +67,12 @@ class CollegesController < ApplicationController
user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count)
@teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count,
(SELECT count(c.id) FROM courses c, members m, member_roles mr WHERE c.id != 1309 and m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) and c.school_id = #{@school.id} AND m.user_id=users.id AND c.is_delete = 0) as course_count
(SELECT count(c.id) FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) and c.school_id = #{@school.id} AND m.user_id=users.id AND c.is_delete = 0) as course_count
FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
# ).order("publish_shixun_count desc, experience desc").limit(10)
@teachers =
@teachers.map do |teacher|
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE c.id != 1309 and m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{@school.id}")
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{@school.id}")
course_count = course_ids.size
homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id))
un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count

@ -32,9 +32,8 @@ class CompetitionTeamsController < ApplicationController
# todo使用新版course_members
course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01'))
.joins('join members on members.course_id = courses.id')
.joins('join member_roles on member_roles.member_id = members.id and member_roles.role_id in (3,7,9)')
.where(members: { user_id: @team_user_ids }).pluck(:id)
.joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)')
.where(course_members: { user_id: @team_user_ids }).pluck(:id)
courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()')
@courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count')
.group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0')

@ -87,7 +87,7 @@ class CoursesController < ApplicationController
course_ids = course_ids.present? ? course_ids.join(",") : -1
@courses = Course.where("courses.is_delete = 0 and courses.is_hidden = 0 #{course_ids == -1 ? "" : "and courses.id in (#{course_ids})"}").select("courses.id, courses.tea_id, courses.name, courses.is_public, courses.members_count, courses.homework_commons_count,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("courses.id = 1309 desc, a desc")
elsif @order == "mine"
my_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9,10) AND m.user_id=#{@user.id} AND c.is_delete = 0")
my_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3,4) AND m.user_id=#{@user.id} AND c.is_delete = 0")
course_ids = course_ids.present? ? my_course_ids.map(&:id) & course_ids : my_course_ids.map(&:id)
course_ids = course_ids.size > 0 ? course_ids.join(",") : "-1"
@courses = Course.find_by_sql("select c.id, c.tea_id, c.name, c.is_public, c.members_count, c.homework_commons_count, u.login, u.nickname, u.lastname, u.firstname, u.show_realname, ue.school_id from courses c, users u, user_extensions ue where c.tea_id = u.id and u.id = ue.user_id and c.is_delete = 0 and c.is_hidden = 0 and c.id in (#{course_ids}) order by c.id = 1309 desc, #{order_str} desc")
@ -894,7 +894,7 @@ class CoursesController < ApplicationController
# @teacher_count = TeacherAndAssistantCount @course
if @course.try(:id) != 1309 || User.current.admin? || User.current.try(:id) == 15582
@teacher_count = @course.members.includes(:roles, :user).where("roles.id" => [3,7,9]).count
@teacher_count = @course.course_members.includes(:roles, :user).where("roles.id" => [3,7,9]).count
else
@teacher_count = @course.members.includes(:roles, :user).where("roles.id" => [3,7]).count
end

@ -1133,6 +1133,12 @@ end
render :json => {:status => 1}
end
def update_competition_text
text = CompetitionTextConfig.find(params[:id])
text.update_attributes(name: params[:name], description: params[:description])
render :json => {:status => 1}
end
def delete_competition_text
ctc = CompetitionTextConfig.find params[:id]
ctc.destroy
@ -2944,20 +2950,20 @@ end
course_group = CourseGroup.where(:course_id => course.id, :name => group_name).first ||
CourseGroup.create(:name => group_name, :course_id => course.id) if group_name
member = course.members.where(:user_id => user.id).first
member = course.course_members.where(:user_id => user.id, :role => 4).first
# 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班
if member.present? && member.member_roles.pluck(:role_id).include?(10) && member.course_group_id != course_group.try(:id).to_i
if member.present? && member.course_group_id != course_group.try(:id).to_i
member.update_column("course_group_id", course_group.try(:id).to_i)
member_count += 1
elsif !member.present?
member = Member.new(:role_ids => [member_role], :user_id => user.id)
if member_role == 10
StudentsForCourse.create(:student_id => user.id, :course_id => course.id)
end
member = CourseMember.new(:role => 4, :user_id => user.id)
# if member_role == 10
# StudentsForCourse.create(:student_id => user.id, :course_id => course.id)
# end
Tiding.create(:user_id => user.id, :trigger_user_id => course.tea_id, :container_id => course.id, :container_type => 'TeacherJoinCourse',
:belong_container_id => course.id, :belong_container_type => "Course", :tiding_type => "System", :extra => member_role)
member.course_group_id = course_group.try(:id).to_i
course.members << member
course.course_members << member
member_count += 1
end
@ -4262,7 +4268,7 @@ end
teacher_name = course.teacher ? course.teacher.show_real_name : ""
sheet1[count_row,0] = course.id
sheet1[count_row,1] = course.name
sheet1[count_row,2] = course.members.count
sheet1[count_row,2] = course.course_members_count
sheet1[count_row,3] = course.attachments.count
sheet1[count_row,4] = course.homework_commons.where(:homework_type => 1).count
sheet1[count_row,5] = course.homework_commons.where(:homework_type => 4).count

@ -2438,14 +2438,14 @@ class UsersController < ApplicationController
case @type
when "a_course"
student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, students_for_courses sfc WHERE sfc.course_id = c.id AND sfc.student_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
manage_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
manage_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
course_ids = student_course_ids.map(&:id) + manage_course_ids.map(&:id)
@objects = Course.where(:id => course_ids.uniq).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("updated_at #{order}")
when "l_course"
student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, students_for_courses sfc WHERE sfc.course_id = c.id AND sfc.student_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id and m.role = 4 AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
@objects = Course.where(:id => student_course_ids.map(&:id)).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("updated_at #{order}")
when "p_course"
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
@objects = Course.where(:id => course_ids.map(&:id)).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("id = 1309 desc, updated_at #{order}")
when "a_shixun"
shixun_ids = @user.shixun_members.map(&:shixun_id) + @user.myshixuns.map(&:shixun_id)

@ -1,4 +1,4 @@
class CompetitionTextConfig < ActiveRecord::Base
# attr_accessible :title, :body
attr_accessible :name, :description, :competition_id
belongs_to :competition
end

@ -33,6 +33,8 @@ class Course < ActiveRecord::Base
belongs_to :syllabus
belongs_to :course_list
# has_many :bid
has_many :course_members, dependent: :destroy
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
has_many :memberships, :class_name => 'Member'
has_many :member_principals, :class_name => 'Member',
@ -290,12 +292,16 @@ class Course < ActiveRecord::Base
# 课堂的老师不包括助教
def course_teachers
self.members.select{|m| m.roles.to_s.include?("Manager") || m.roles.to_s.include?("Teacher")}
self.course_members.where(:role => [1, 2])
end
# 课堂的老师包括助教
def teachers
self.members.includes(:roles).where("roles.id" => [3,7,9])
self.course_members.where(:role => [1, 2, 3])
end
def students
self.course_members.where(:role => [4])
end
def self.visible_condition(user, options={})

@ -1,6 +1,7 @@
class CourseGroup < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :course
has_many :course_members
has_many :members
has_many :memberships, :class_name => 'Member'
has_many :member_principals, :class_name => 'Member',

@ -0,0 +1,7 @@
class CourseMember < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :course, counter_cache: true
belongs_to :user
belongs_to :course_group, counter_cache: true
end

@ -54,6 +54,7 @@ class Message < ActiveRecord::Base
belongs_to :reply, :class_name => 'Message', :foreign_key => 'reply_id'
#has_one :message_detail, :dependent => :destroy
has_one :message_detail, dependent: :destroy
#转发表
has_many :forwards, :as => :from, :dependent => :destroy
@ -102,7 +103,7 @@ class Message < ActiveRecord::Base
}
safe_attributes 'subject', 'content', 'reply_id', 'root_id', 'visits'
safe_attributes 'subject', 'reply_id', 'root_id', 'visits'
safe_attributes 'board_id','locked', 'sticky',
:if => lambda {|message, user|
if message.project
@ -115,7 +116,7 @@ class Message < ActiveRecord::Base
}
def description
self.content
message_detail.try(:content)
end
# def content

@ -0,0 +1,4 @@
class MessageDetail < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :message, :touch => true
end

@ -254,7 +254,7 @@ class Tiding < ActiveRecord::Base
elsif self.tiding_type == "Comment"
container.present? ? ("评论了你" + (container.parent.present? ? "的回复:" : "发布的项目issue") + message_content(container.notes)) : ""
else
"更新了Issue#{container.issue.subject}"
container.present? ? "更新了Issue#{container.try(:issue).try(:subject)}" : ""
end
when 'Issue'
"指派了Issue给你" + container.subject

@ -97,6 +97,8 @@ class User < Principal
has_many :homework_evaluations, :dependent => :destroy
has_many :syllabuses, :dependent => :destroy
has_many :syllabus_members, :dependent => :destroy
has_many :course_members, :dependent => :destroy
#问卷相关关关系
has_many :poll_users, :dependent => :destroy
has_many :poll_votes, :dependent => :destroy
@ -1125,7 +1127,7 @@ class User < Principal
end
def member_of_course?(course)
courses.to_a.include?(course) || User.current.business?
course.course_members.exists?(user_id: self.id) || User.current.business?
end
def member_of_contest?(contest)

@ -313,8 +313,8 @@ class UsersService
limit = params[:limit]||5
page = params[:page].to_i
offset = (page-1) * limit
courses = Course.find_by_sql("SELECT c.* FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND
mr.role_id in (3,7,9,10) AND
courses = Course.find_by_sql("SELECT c.* FROM courses c, course_members m WHERE m.course_id = c.id AND
m.role in (1,2,3,4) AND
m.user_id=#{current_user.id} AND c.is_delete = 0 order by id desc limit #{limit} offset #{offset} ")
# 如果还没有课程则显示示例课堂
courses = Course.where(:id => 1309) if courses.count == 0

@ -4,54 +4,59 @@
<div class="openSource_2" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<% @competition.competition_stages.each_with_index do |stage, i| %>
<div class="openSource_<%= index + 1 %>" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<%
first_section = stage.competition_stage_sections[0]
second_section = stage.competition_stage_sections[1]
%>
<div class="enter_panel" style="height: 285px">
<ul>
<p class="font-22 enter_title padding30 clearfix">
<span class="fl ml30">
<span class="mr20 font-bd"><%= first_section.try(:name) %></span>
<span><%= first_section.start_time.try(:strftime, '%Y年%m月%d日') %>~<%= first_section.end_time.try(:strftime, '%Y年%m月%d日') %></span>
</span>
<span class="fr mr30">
<span class="mr20 font-bd"><%= second_section.try(:name) %></span>
<span><%= second_section.try(:start_time).try(:strftime, '%Y年%m月%d日') %>~<%= second_section.try(:end_time).try(:strftime, '%Y年%m月%d日') %></span>
</span>
</p>
<li class="inline enter_btn mt20">
<% is_start = Time.now > first_section.start_time %>
<% first_section.competition_entries.each_with_index do |entry, j| %>
<%
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="li-1 <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
<% end %>
</li>
</ul>
<div class="openSource_3" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<div class="enter_panel" style="height: 300px">
<p class="desc_game">
<%= @competition.competition_text_configs.first.try(:description) %>
</p>
</div>
</div>
<% index += 1 %>
<%
first_stage = @competition.competition_stages.first
first_section = first_stage.competition_stage_sections.first
first_entry = first_section.competition_entries.first
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{first_entry.url}?eid=#{User.current.id}" : "#{first_entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<div class="openSource_4" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<div class="educontent">
<a href="javascript:void(0)" data-url="<%= btn_url %>" class="enroll-btn <%= is_start ? 'active' : '' %>" style="float:right;height:282px;width:50%"></a>
</div>
</div>
<% index += 1 %>
<% end %>
<div class="openSource_5" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_6" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_7" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_7" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
<%
course_id = nil
user_enrolled = false
invite_code = nil
if first_entry.url.present?
course_id = first_entry.url.split('/')[-2, 1]
course = Course.find_by_id(course_id)
if course.present? && @user && @user.logged?
user_enrolled = @user.member_of_course?(course)
invite_code = course.invite_code
end
end
%>
var userEnrolled = <%= user_enrolled %>;
$(".enter_btn .li-1.active").on("click", function(){
$(".enroll-btn.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
@ -60,7 +65,20 @@
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
$.ajax({
url: "/api/courses/apply_to_join_course.json",
type: "post",
dataType: 'json',
data: {
student: 1,
invite_code: "<%= invite_code %>"
},
success: function(){
var newTab = window.open("_blank");
newTab.location = url;
window.location.reload()
}
})
return;
}

@ -43,7 +43,7 @@
</ul>
</div>
<div class="seperateLine"></div>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="搜索实训项目"/>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" class="search-icon fl" id="header_keyword_search">
<i class="iconfont icon-sousuo color-blue mt14 fl"></i>
</a>

@ -41,7 +41,7 @@
</ul>
</div>
<div class="seperateLine"></div>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="搜索实训项目"/>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" class="search-icon fl" id="header_keyword_search">
<!--<svg class="icon fl mt23" width="20px" height="20px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#333333" d="M463.9 804.4c-194.7 0-353.1-158.4-353.1-353.1S269.2 98.2 463.9 98.2 817 256.6 817 451.3 658.6 804.4 463.9 804.4z m0-651.9c-164.8 0-298.8 134-298.8 298.8s134 298.8 298.8 298.8 298.8-134 298.8-298.8-134-298.8-298.8-298.8zM884.9 926.6c-7.2 0-14.4-2.9-19.8-8.6l-198-210.6c-10.3-10.9-9.7-28.1 1.2-38.4 10.9-10.3 28.1-9.8 38.4 1.2l198 210.6c10.3 10.9 9.7 28.1-1.2 38.4-5.2 5-11.9 7.4-18.6 7.4z" /></svg>-->
<i class="iconfont icon-sousuo color-blue mt14 fl"></i>

@ -24,7 +24,7 @@
<td><%= (@page-1)*@limit + index + 1 %></td>
<td><%= course.id %></td>
<td class="edu-txt-left"><%= link_to course.name, course_path(course.id) ,:target => '_blank'%></td>
<td><%= course.members.count %></td>
<td><%= course.course_members_count %></td>
<td><%= course.attachments.count %></td>
<td><%= course.homework_commons.where(:homework_type => 1).count %></td>
<td><%= course.homework_commons.where(:homework_type => 4).count %></td>

@ -3,7 +3,7 @@
<div class="bor-grey-e mb20" id="homePagePara">
<p class="clearfix bor-bottom-greyE pr20 pt5 pb5">
<input type="text" value="首页文字说明" name="config_name" class="panel-box-sizing childcenter_title_input"/>
<a href="javascript:void(0)" class="fr color-blue" onclick="create_submit_data(this);">保存</a>
<a href="javascript:void(0)" class="fr color-blue" onclick="save_submit_data(null, this);">保存</a>
<a href="javascript:void(0)" class="fr mr20" onclick="removePanel();">删除</a>
</p>
<div class="padding15">
@ -130,7 +130,7 @@
<div class="bor-grey-e mb20" id="homePagePara_<%= text.id %>">
<p class="clearfix bor-bottom-greyE pr20 pt5 pb5">
<input type="text" value="<%= text.name %>" name="config_name" class="panel-box-sizing childcenter_title_input">
<a href="javascript:void(0)" class="fr color-blue" onclick="create_submit_data(this);">保存</a>
<a href="javascript:void(0)" class="fr color-blue" onclick="save_submit_data(<%= text.id %>, this);">保存</a>
<a href="javascript:void(0)" class="fr mr20" onclick="removePanel(<%= text.id %>);">删除</a>
</p>
<div class="padding15">
@ -563,6 +563,27 @@
})
}
function save_submit_data(id, nThis){
if (!id) {
create_submit_data(nThis);
return;
}
var textContainer = $('#homePagePara_' + id);
var name = textContainer.find('input[name="config_name"]').val();
var description = textContainer.find('textarea[name="config_description"]').val();
$.ajax({
url: "<%= update_competition_text_managements_path %>",
data: {id: id, name: name, description: description},
type: "post",
success: function (data) {
if(data.status == 1) {
notice_box("保存成功!");
}
}
});
}
$(function(){
$('.add-competition-staff-btn').on('click', function(){
$('.competition-staff-settings').append($('.competition-staff-row-example').html());

@ -16,7 +16,7 @@
<td class="edu-txt-left"><%= link_to message.board.course.name, course_path(message.board.course_id), target: '_blank'%></td>
<td><%= message.board.course.teacher.show_real_name %></td>
<td><%= format_time(message.created_on) %></td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;"><%= link_to message_content(message.content), board_message_path(message.board_id, message), target: '_blank'%></td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;"><%= link_to message_content(message.description), board_message_path(message.board_id, message), target: '_blank'%></td>
<td>
<%= Message.where(:parent_id => message.id).count %>
</td>

@ -25,7 +25,7 @@
<td width="15%" class="edu-txt-left"><%= link_to shixun_task.name,course_path(shixun_task),:target => '_blank' %></td>
<td width="8%"><%= shixun_task.teacher ? link_to(shixun_task.teacher.show_real_name, user_path(shixun_task.teacher)) : "" %></td>
<td width="10%" class="edu-txt-left"><%= shixun_task.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : shixun_task.teacher.try(:user_extensions).try(:school) %></td>
<td width="5%"><%= shixun_task.student.count %></td>
<td width="5%"><%= shixun_task.students.count %></td>
<% homework_commons = shixun_task.homework_commons.where(:homework_type => 4).order("IF(ISNULL(publish_time),1,0),publish_time asc,created_at asc") %>
<td width="7%"><%= homework_commons.size %></td>
<td># 1</td>

@ -2,7 +2,8 @@
<% @tids.each do |tids| %>
<% Rails.logger.info("------------------------tid_id---#{tids.id}") %>
<div class="pl25 ridinglist edu-back-white">
<div class="ridinglist-sub clearfix df tiding_item" data-url="<%= tiding_url tids %>">
<!-- <div class="ridinglist-sub clearfix df tiding_item" data-url="<%#= tiding_url tids %>">-->
<div class="ridinglist-sub clearfix df tiding_item">
<% system = tids.tiding_type == "System" %>
<% trigger_user = tids.user %>
<% eval_user = (tids.container_type == "StudentWorksScore" && tids.extra == "3") || (tids.container_type == "StudentWorksScoresAppeal" && tids.parent_container_type == "StudentWork" && tids.tiding_type == "HomeworkCommon") || (tids.container_type == "JournalsForMessage" && tids.tiding_type != "Mentioned" && tids.parent_container_type == "StudentWorksScore" && tids.container.jour.try(:reviewer_role) == 3 && !trigger_user.allowed_to?(:as_teacher, tids.container.jour.student_work.homework_common.course)) %>
@ -27,7 +28,7 @@
<span class="edu-filter-btn ml20 <%= tids.status == 0 ? 'edu-filter-btn-red' : tids.status == 1 ? 'edu-filter-btn-green' : "" %>"><%= tids.status == 0 ? '待处理' : tids.status == 1 ? '已处理' : "" %></span>
<% end %>
</p>
<p class="color-grey-6 break_word_firefox" style="word-break: break-word;"><%= tids.container_type == "StudentJoinCourse" ? tids.user.try(:show_name) : "" %><%= message_content(tids.key_word).html_safe %></p>
<p class="color-grey-6 break_word_firefox" style="word-break: break-word;"><%= tids.container_type == "StudentJoinCourse" ? tids.user.try(:show_name) : "" %><%= message_content(tids.keyx_word).html_safe %></p>
</div>
<% if @onclick_time < tids.created_at %>
<span class="new-point fr mr40 mt22"></span>

@ -49,37 +49,37 @@
<div class="educontent mt10 clearfix edu-txt-center">
<div class="inline">
<span class="mypost fl mr10"><%= current_user ? @user.identity : (@user.identity == "学生" ? "" : @user.identity) %></span>
<% if current_user %>
<a href="<%= authentication_account_path %>" target="_blank" class="ringauto fl">
<% if @user.authentication %>
<img src="/images/educoder/icon/auto-identityed.svg" class="mt2" data-tip-down="已实名认证"><!--实名认证-->
<% else %>
<% apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 1).last %>
<img src="/images/educoder/icon/auto-identity.svg" class="mt2" data-tip-down="<%= apply_auth && apply_auth.status == 0 ? '实名认证中' : '未实名认证' %>">
<% end %>
</a>
<a href="<%= professional_certification_account_path %>" target="_blank" class="ringauto fl">
<% if @user.professional_certification %>
<img src="/images/educoder/icon/auto-posted.svg" class="mt2" data-tip-down="已职业认证">
<% else %>
<% apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 2).last %>
<img src="/images/educoder/icon/auto-post.svg" class="mt2" data-tip-down="<%= apply_auth && apply_auth.status == 0 ? '职业认证中' : '未职业认证' %>">
<% end %>
</a>
<% if @user.try(:phone).blank? %>
<a href="<%= change_or_bind_path(:type => 'phone') %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-phone.svg" class="mt2" data-tip-down="未绑定手机"></a><!--手机认证-->
<% else %>
<a href="<%= my_account_path %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-phoneed.svg" class="mt2" data-tip-down="已绑定手机"></a><!--手机认证-->
<% end %>
<% if @user.try(:mail).blank? %>
<a href="<%= change_or_bind_path(:type => 'mail') %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-email.svg" class="mt2" data-tip-down="未绑定邮箱"></a><!--邮箱认证-->
<% else %>
<a href="<%= my_account_path %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-emailed.svg" class="mt2" data-tip-down="已绑定邮箱"></a><!--邮箱认证-->
<% end %>
<% if @user.department_members.count > 0 %>
<a href="<%= statistics_college_path(@user.department_members.first.try(:department)) %>" target="_blank" class="ringauto fl"><i class="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i></a><!--学院管理员身份-->
<% end %>
<% else %>
<%# if current_user %>
<!-- <a href="<%#= authentication_account_path %>" target="_blank" class="ringauto fl">-->
<%# if @user.authentication %>
<!-- <img src="/images/educoder/icon/auto-identityed.svg" class="mt2" data-tip-down="已实名认证">-->
<%# else %>
<%# apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 1).last %>
<!-- <img src="/images/educoder/icon/auto-identity.svg" class="mt2" data-tip-down="<%#= apply_auth && apply_auth.status == 0 ? '实名认证中' : '未实名认证' %>">-->
<%# end %>
<!-- </a>-->
<!-- <a href="<%#= professional_certification_account_path %>" target="_blank" class="ringauto fl">-->
<%# if @user.professional_certification %>
<!-- <img src="/images/educoder/icon/auto-posted.svg" class="mt2" data-tip-down="已职业认证">-->
<%# else %>
<%# apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 2).last %>
<!-- <img src="/images/educoder/icon/auto-post.svg" class="mt2" data-tip-down="<%#= apply_auth && apply_auth.status == 0 ? '职业认证中' : '未职业认证' %>">-->
<%# end %>
<!-- </a>-->
<%# if @user.try(:phone).blank? %>
<!-- <a href="<%#= change_or_bind_path(:type => 'phone') %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-phone.svg" class="mt2" data-tip-down="未绑定手机"></a>-->
<%# else %>
<!-- <a href="<%#= my_account_path %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-phoneed.svg" class="mt2" data-tip-down="已绑定手机"></a>-->
<%# end %>
<%# if @user.try(:mail).blank? %>
<!-- <a href="<%#= change_or_bind_path(:type => 'mail') %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-email.svg" class="mt2" data-tip-down="未绑定邮箱"></a>-->
<%# else %>
<!-- <a href="<%#= my_account_path %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-emailed.svg" class="mt2" data-tip-down="已绑定邮箱"></a><-->
<%# end %>
<%# if @user.department_members.count > 0 %>
<!-- <a href="<%#= statistics_college_path(@user.department_members.first.try(:department)) %>" target="_blank" class="ringauto fl"><i class="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i></a>-->
<%# end %>
<%# else %>
<span class="ringauto fl">
<% if @user.authentication %>
<img src="/images/educoder/icon/auto-identityed.svg" class="mt2" data-tip-down="已实名认证"><!--实名认证-->
@ -106,10 +106,12 @@
<% else %>
<span class="ringauto fl"><img src="/images/educoder/icon/auto-emailed.svg" class="mt2" data-tip-down="已绑定邮箱"></span><!--邮箱认证-->
<% end %>
<% if @user.department_members.count > 0 %> <!--访问他人主页无连接 -->
<% if @user.department_members.count > 0 && current_user %> <!--访问他人主页无连接 -->
<a href="<%= statistics_college_path(@user.department_members.first.try(:department)) %>" target="_blank" class="ringauto fl"><i class="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i></a>
<% elsif @user.department_members.count > 0 %>
<a href="javascript:void(0)" class="ringauto fl"><i class="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i></a><!--学院管理员身份-->
<% end %>
<% end %>
<%# end %>
</div>
</div>
<div class="mt15 educontent clearfix edu-txt-center">

@ -265,6 +265,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'export_chart_score'
post 'competition_images'
post 'publish'
post 'join_course'
end
collection do
post 'new_competition'
@ -730,6 +731,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'graduation_standard'
post 'create_standard'
post 'create_competition_text'
post 'update_competition_text'
delete 'delete_competition_text'
post 'add_contents_for_school'
post 'add_course_info_for_school'

@ -0,0 +1,8 @@
class ChangeCompetitionTextConfigs < ActiveRecord::Migration
def up
change_column :competition_text_configs, :description, :text
end
def down
end
end

@ -405,7 +405,7 @@ function header_search(){
// $.get('/users/search_shixuns_or_course',
// { search: keyword,
// index: index});
window.location.href = "/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index;
window.location.href = "/search" + "?value=" + keyword;
//e.stopPropagation();//阻止冒泡
}

@ -5,10 +5,10 @@ $(function(){
$(".headphoto").find(".headphoto-black").hide();
});
$("#user_tiddings").on("click", ".tiding_item", function(e){
window.open($(this).attr("data-url"), "_blank");
e.stopPropagation();
});
// $("#user_tiddings").on("click", ".tiding_item", function(e){
// window.open($(this).attr("data-url"), "_blank");
// e.stopPropagation();
// });
$("#user_tiddings").on("click", ".tiding_user_a", function(e){
window.open($(this).attr("data-url"), "_blank");

@ -1,14 +1,23 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import { Spin } from 'antd';
class Loading extends Component {
render() {
// Loading
return (
<div className="App" style={{minHeight: '800px'}}>
</div>
<div className="App" style={{minHeight: '800px',width:"100%"}}>
<style>
{
`
.margintop{
margin-top:20%;
}
`
}
</style>
<Spin size="large" className={"margintop"}/>
</div>
);
}
}

@ -100,7 +100,7 @@ function header_search(){
// $.get('/users/search_shixuns_or_course',
// { search: keyword,
// index: index});
window.location.href = "/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index;
window.location.href = "/search" + "?value=" + keyword;
//e.stopPropagation();//阻止冒泡
}
//头部导航条的隐藏
@ -394,7 +394,7 @@ class NewHeader extends Component {
<li><a href="javascript:void(0)">用户</a></li>
</ul>
</div>
<input type="text" className="search-input fl" id="search-input" name="search_keyword" placeholder="搜索实训项目"/>
<input type="text" className="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" className="search-icon fl" id="header_keyword_search">
{/*<i className="fa fa-search font-16 mt23 color-grey-6"></i>*/}
<i className="iconfont icon-sousuo color-blue"></i>

@ -12,7 +12,7 @@ body>.-task-title {
}
/*<2A><><EFBFBD><EFBFBD><EFBFBD>Ŵ󾵵<C5B4><F3BEB5B5><EFBFBD><EFBFBD><EFBFBD>·Ŵ󾵵<C5B4>λ<EFBFBD><CEBB>*/
#root .search-all {
width: 219px;
/*width: 219px;*/
}
/*Header START*/

@ -36,16 +36,16 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.yellowBar{position: absolute;top: 0px;height: 8px;border-radius: 4px;left: 0px;background-color: #FFA800;display: block}
.ratePanelContent-left span{display: block;text-align: center}
/*----------------------------------首页查询输入框*/
.search-all{width: 216px;margin: 0px auto;position: relative;background-color: #24292D;}
.search-all{width: 296px;margin: 0px auto;position: relative;background-color: #24292D;}
.seperateLine { border-left: 1px solid #EAEAEA;float: left;height: 16px;margin-top: 22px; visibility: hidden;}
.search-all .search-input{ width: 181px; outline: none;border: none;height: 30px;margin-top: 15px;border-bottom: 1px solid #eee;background: none;padding-left: 10px;box-sizing: border-box;color: #fff}
.search-all .search-input{ width: 260px; outline: none;border: none;height: 30px;margin-top: 15px;border-bottom: 1px solid #eee;background: none;padding-left: 10px;box-sizing: border-box;color: #fff}
.search-all .search-clear{font-size: 14px;display: inline-block;width: 50px;text-align: center;color: #656565;line-height: 60px;cursor: pointer}
.search-icon{color: #656565;display: block;display: inline-block;height: 60px;width: 30px;cursor: pointer;}
.search-icon path{ fill: #4CACFF;}
/* 右侧内容宽度变化的话需要调整posi-search right的值*/
.posi-search{opacity: 1;position: absolute;top: -2px;background: #fff;z-index: 2; right: -241px;}
.posi-search.unlogin{right: -191px;}
.posi-search{opacity: 1;position: absolute;top: -2px;background: #fff;z-index: 2; right: -200px;}
.posi-search.unlogin{right: -161px;}
.search-content{box-sizing: border-box;position: absolute;height: 300px;background: #fff;border-radius: 0px 0px 5px 5px;width: 100%;left: 0px;top:58px;box-shadow: 0 4px 8px 0 rgba(0,0,0,.2);overflow-y: auto}
.search-title{height: 40px;line-height: 40px;padding-left: 20px;font-size: 12px;color: #bbb;text-align: left}
.search-content a{display: inline-block;width:100%;height: 30px;line-height: 30px;padding:0px 20px;box-sizing: border-box;text-align: left;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;}
@ -663,13 +663,16 @@ a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;
.second_code_7{min-height: 1116px;}
.second_code_8{min-height: 711px;}
/*开源创新竞赛*/
.openSource_1{min-height: 803px;}
.openSource_2{min-height: 427px;}
.openSource_3{min-height: 524px;padding-top: 190px;box-sizing: border-box;position: relative}
.openSource_4{min-height: 526px;padding-top: 190px;box-sizing: border-box;position: relative}
.openSource_5{min-height: 1061px;}
.openSource_6{min-height: 1090px;}
.openSource_7{min-height: 683px;}
.openSource_1{min-height: 659px;}
.openSource_2{min-height: 436px;}
.openSource_3{min-height: 539px;padding-top: 190px;box-sizing: border-box;position: relative}
.openSource_4{min-height: 282px;box-sizing: border-box;position: relative}
.openSource_5{min-height: 367px;}
.openSource_6{min-height: 689px;}
.openSource_7{min-height: 574px;}
.openSource_8{min-height: 632px;}
.desc_game{color: #0B8298;font-weight: 400;text-align: justify;font-size: 18px;white-space: pre-wrap;line-height:30px;}
.challenge_title{
color: #41ABEF;font-size: 30px;font-weight: bold;text-align: center;letter-spacing: 1px;line-height: 60px;margin-bottom: 20px;

@ -51,12 +51,12 @@ If you continue to experience problems please contact your Trustie administrator
<p>If you are the Trustie administrator, check your log files for details about the error.</p> -->
<div class="verticalCenter">
<div class="edu-txt-center">
<img src="/images/warn/update.jpeg" >
<img src="http://testbdweb.educoder.net/images/warn/update.jpeg" >
<p class="font-18 mt20">
温馨提示:为了给大家提供更优质的服务
</p>
<p class="font-18">
平台拟于<span style="color: red">2019年4月27日17:00--18:30</span>进行全面升级,带来不便,敬请谅解!
平台拟于<span style="color: red">2019年7月22日10:40--2019年7月22号11:00</span>进行全面升级,带来不便,敬请谅解!
</p>
</div>
</body>

@ -0,0 +1,5 @@
FactoryGirl.define do
factory :course_member do
end
end

@ -0,0 +1,5 @@
FactoryGirl.define do
factory :message_detail do
end
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe CourseMember, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe MessageDetail, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save