dev_home
daiao 5 years ago
commit 427624c8be

@ -467,7 +467,8 @@ class CoursesController < ApplicationController
# user_ids_of_course_members = @course.course_members.where(role: [1,2,3]).pluck(:user_id)
# @users = User.where.not(id: user_ids_of_course_members)
@users = User.where(status: User::STATUS_ACTIVE, laboratory_id: @course.laboratory_id)
@users = User.where(status: User::STATUS_ACTIVE)
@users = @users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present?
# REDO:Extension
@users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present?
@ -1083,7 +1084,8 @@ class CoursesController < ApplicationController
school_name = params[:school_name]
# REDO:Extension
@users = User.where(status: User::STATUS_ACTIVE, laboratory_id: @course.laboratory_id)
@users = User.where(status: User::STATUS_ACTIVE)
@users = @users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present?
# REDO:Extension
@users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present?

@ -919,6 +919,7 @@ class ShixunsController < ApplicationController
else
@users = User.none
end
@users = @users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
page = params[:page] || 1
limit = params[:limit] || 20
@user_count = @users.count

@ -302,6 +302,7 @@ class SubjectsController < ApplicationController
member_ids = @subject.subject_members.map(&:user_id).join(',')
condition = "%#{params[:search].strip}%".gsub(" ","")
@users = User.where("id not in (?) and status = 1 and LOWER(concat(lastname, ifnull(firstname, ''), login)) LIKE ?", member_ids, "#{condition}")
@users = @users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@users = @users.page(page).per(10)
@users = @users.includes(:user_extension)

@ -3,6 +3,7 @@ class Users::RecentContactsController < Users::BaseController
def index
contacts = observed_user.recent_contacts.distinct
contacts = contacts.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@contacts = contacts.order('private_messages.created_at DESC').limit(10).includes(:user_extension)
end
end

@ -2,7 +2,8 @@ class UsersForPrivateMessagesController < ApplicationController
before_action :require_login, :check_auth
def index
users = User.active.where.not(id: current_user.id).where(laboratory_id: current_laboratory.id)
users = User.active.where.not(id: current_user.id)
users = users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
keyword = params[:keyword].to_s.strip
if keyword.blank?

@ -695,6 +695,10 @@ class User < ApplicationRecord
LimitForbidControl::UserLogin.new(self).clear
end
def from_sub_site?
laboratory_id.present? && laboratory_id != 1
end
protected
def validate_password_length
# 管理员的初始密码是5位

@ -43,6 +43,9 @@
<%= link_to "/users/#{user.login}", class: 'identity-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
<img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
<% end %>
<% if user.from_sub_site? %>
<span class="badge badge-pill badge-info">合作</span>
<% end %>
</td>
<td><%= user.real_name %></td>
<td><%= user.ID_number %></td>

@ -41,6 +41,9 @@
<%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
<img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
<% end %>
<% if user.from_sub_site? %>
<span class="badge badge-pill badge-info">合作</span>
<% end %>
</td>
<td><%= user.real_name %></td>
<td><%= raw [user.school_name.presence, user.department_name.presence].compact.join('<br/>') %></td>

@ -235,7 +235,7 @@ class ShixunsHome extends Component {
</div>
{/*实训路径*/}
{pathstype===true?"":<div className="clearfix pt20 educontent pr pb20">
{pathstype===true||homedatalist===undefined?"":homedatalist.subjects.length===0?"":<div className="clearfix pt20 educontent pr pb20">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实践课程</p>
<p className="color-grey-cd font-12">TRAINING COURSE</p>
@ -314,7 +314,7 @@ class ShixunsHome extends Component {
</div>}
{/*精选实训 改为 开发社区*/}
{shixuntype===true?"":<div className="clearfix pt20 educontent pr pb20">
{shixuntype===true||homedatalist===undefined?"":homedatalist.shixuns.length===0?"":<div className="clearfix pt20 educontent pr pb20">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实训项目</p>
<p className="color-grey-cd font-12">DEVELOPMENT COMMUNITY</p>

@ -604,7 +604,7 @@ class LoginDialog extends Component {
setNotcompleteds={()=>{this.setNotcompleteds()}}
/>
{this.state.isphone===false?<style>
{this.state.isphone===false||this.props.user&&this.props.user.main_site===false?<style>
{
`
#DialogID .dialogBox {

@ -1283,7 +1283,7 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className="fl with50 edu-txt-center pr ul-leftline">
<ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===true?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===true?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建翻转课堂</a></li>}
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"":
@ -1291,7 +1291,7 @@ submittojoinclass=(value)=>{
}
{this.props.user&&this.props.user.main_site===true?<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>:""}
</ul>
<ul className="fl with50 edu-txt-center">
{coursestypes===true&&this.props.user&&this.props.user.main_site===true?"":<ul className="fl with50 edu-txt-center">
{coursestypes===true?"":<li>
<a onClick={this.tojoinclass}>加入翻转课堂</a>
@ -1356,7 +1356,7 @@ submittojoinclass=(value)=>{
</div>
</div>
</Modal>:""}
</ul>
</ul>}
</div>
</div>

@ -218,4 +218,8 @@ body>.-task-title {
float: left;
min-width: 40px;
height:40px;
}
.headwith100b{
width: 100%;
}
Loading…
Cancel
Save