Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
c01466b419
|
@ -113,12 +113,8 @@ class IssuesController < ApplicationController
|
|||
|
||||
def show
|
||||
# 当前用户查看指派给他的缺陷消息,则设置消息为已读
|
||||
query = @issue.forge_messages
|
||||
query.each do |m|
|
||||
if m.user_id == User.current.id
|
||||
m.update_attribute(:viewed, true)
|
||||
end
|
||||
end
|
||||
query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
|
||||
query.update_attribute(:viewed, true) unless query.nil?
|
||||
# 缺陷状态更新
|
||||
query_journals = @issue.journals
|
||||
query_journals.each do |query_journal|
|
||||
|
|
|
@ -382,7 +382,10 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
else
|
||||
email = params[:mail]
|
||||
Mailer.send_invite_in_project(email, @project, User.current).deliver
|
||||
first_name = params[:first_name]
|
||||
last_name = params[:last_name]
|
||||
gender = params[:gender]
|
||||
Mailer.send_invite_in_project(email, @project, User.current, first_name, last_name, gender).deliver
|
||||
@is_zhuce = false
|
||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||
end
|
||||
|
|
|
@ -112,7 +112,7 @@ class UsersController < ApplicationController
|
|||
case params[:type]
|
||||
when nil
|
||||
@message_alls = []
|
||||
messages = MessageAll.where("user_id =?" ,@user).order("created_at desc")
|
||||
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user, "SystemMessage", "SystemMessage").order("created_at desc")
|
||||
messages.each do |message_all|
|
||||
@message_alls << message_all.message
|
||||
end
|
||||
|
@ -187,12 +187,8 @@ class UsersController < ApplicationController
|
|||
message_new_time.onclick_time = Time.now
|
||||
message_new_time.save
|
||||
else
|
||||
# 24小时内显示
|
||||
contrast_time = Time.now - 86400
|
||||
message_time.update_attributes(:onclick_time => Time.now)
|
||||
end
|
||||
# 24小时内显示系统消息
|
||||
@user_system_messages = SystemMessage.where("created_at >?", contrast_time).order("created_at desc")
|
||||
end
|
||||
|
||||
# 消息设置为已读
|
||||
|
|
|
@ -107,7 +107,7 @@ class Mailer < ActionMailer::Base
|
|||
# author: alan
|
||||
# 邀请未注册用户加入项目
|
||||
# 功能: 在加入项目的同时自动注册用户
|
||||
def send_invite_in_project(email, project, invitor)
|
||||
def send_invite_in_project(email, project, invitor, first_name, last_name, gender)
|
||||
@email = email
|
||||
@subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
||||
@password = newpass(6)
|
||||
|
@ -116,7 +116,7 @@ class Mailer < ActionMailer::Base
|
|||
login = login.sub(/%40/,'@')
|
||||
us = UsersService.new
|
||||
# 自动激活用户
|
||||
user = us.register_auto(login, email, @password)
|
||||
user = us.register_auto(login, email, @password, first_name, last_name, gender)
|
||||
InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email)
|
||||
User.current = user unless User.current.nil?
|
||||
@user = user
|
||||
|
|
|
@ -5,4 +5,15 @@ class SystemMessage < ActiveRecord::Base
|
|||
validates :subject, presence: true
|
||||
# validates :description, presence: true
|
||||
validates_length_of :description, maximum: 10000
|
||||
|
||||
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
||||
|
||||
# 系统消息放置总消息列表
|
||||
after_create :add_system_message
|
||||
|
||||
def add_system_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
|
||||
|
|
|
@ -47,12 +47,16 @@ class UsersService
|
|||
end
|
||||
|
||||
# 自动注册功能 FOR:邮件邀请
|
||||
def register_auto(login,mail,password)
|
||||
def register_auto(login, mail, password, first_name, last_name, gender)
|
||||
mail_notification = "day"
|
||||
@user = User.new
|
||||
@user.admin = false
|
||||
@user.register
|
||||
@user.login = login
|
||||
@user.mail = mail
|
||||
@user.firstname = first_name
|
||||
@user.lastname = last_name
|
||||
@user.mail_notification = mail_notification
|
||||
password_confirmation = password
|
||||
should_confirmation_password = true
|
||||
if !password.blank? && !password_confirmation.blank? && should_confirmation_password
|
||||
|
@ -65,6 +69,7 @@ class UsersService
|
|||
@user = automatically_register_lock(@user)
|
||||
if @user.id != nil
|
||||
ue = @user.user_extensions ||= UserExtensions.new
|
||||
ue.gender = gender
|
||||
ue.user_id = @user.id
|
||||
ue.save
|
||||
end
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<div class="postDetailReply">
|
||||
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
|
||||
<%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
|
||||
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10 mt20" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
$("#navHomepageSearchType").hide();
|
||||
});
|
||||
|
||||
$("#user_avatar img").mouseenter(function(){
|
||||
$("#navHomepageProfile").mouseenter(function(){
|
||||
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
|
||||
$("#topnav_login_list").show();
|
||||
});
|
||||
|
|
|
@ -44,9 +44,39 @@
|
|||
|
||||
}
|
||||
|
||||
function verifyLastName() {
|
||||
var last_name = $.trim($('#last_name').val());
|
||||
if(last_name.length > 30)
|
||||
{
|
||||
$("#valid_email").text("用户姓氏过长,最长为30个字符");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#valid_email").text("");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function verifyFirstName() {
|
||||
var first_name = $.trim($('#first_name').val());
|
||||
if(first_name.length > 30)
|
||||
{
|
||||
$("#valid_email").text("用户名字过长,最长为30个字符");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#valid_email").text("");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function senderEmail(obj)
|
||||
{
|
||||
if(verifyAddress())
|
||||
if(verifyAddress() && verifyFirstName() && verifyLastName() )
|
||||
{
|
||||
obj.parent().submit();
|
||||
}
|
||||
|
@ -79,6 +109,15 @@
|
|||
<li>
|
||||
<%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyAddress(this);" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= text_field_tag 'last_name', '', :class => "fb_item_first_name fl", :placeholder => l(:label_input_email_lastname), :onkeyup => "this.value=this.value.replace(' ','')", :onblur => "verifyLastName(this);" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= text_field_tag 'first_name', '', :class => "fb_item_last_name fl", :placeholder => l(:label_input_email_firstname), :onkeyup => "this.value=this.value.replace(' ','')", :onblur => "verifyFirstName(this);" %>
|
||||
</li>
|
||||
<li>
|
||||
<select class="fb_item_gender fl" id="gender" name="gender"><option value="">性别</option><option value="0">男</option><option value="1">女</option></select>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="#" class="btn_free" onclick="senderEmail($(this));">
|
||||
|
|
|
@ -191,8 +191,10 @@
|
|||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<p>
|
||||
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
|
||||
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败,作业详情如下:
|
||||
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败,
|
||||
失败原因:提交作品的人数低于2人
|
||||
</p>
|
||||
<p>作业详情如下:</p>
|
||||
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
|
||||
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<% if ma.class == SystemMessage %>
|
||||
<%# @user_system_messages.each do |usm| %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/logo.png", width: "30px", height: "30px", class: "mt3") %></div></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">Trustie平台</span><span class="homepageNewsType fl">发布新消息:</span>
|
||||
</li>
|
||||
<span style="color: red;float: left">【系统消息】</span>
|
||||
<li class="homepageSystenMessageContent fl">
|
||||
|
||||
<%= link_to ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject, user_system_messages_path(User.current),
|
||||
:id => "content_link_#{ma.id}",
|
||||
:onmouseover =>"message_titile_show($(this),event);",
|
||||
:onmouseout => "message_titile_hide($(this));"
|
||||
%>
|
||||
</li>
|
||||
<div style="display:none;" class="message_title_red system_message_style">
|
||||
<% unless ma.subject.blank? %>
|
||||
<p><strong>标题:</strong><%= ma.subject %></p>
|
||||
<% end %>
|
||||
<% if (!ma.description.blank?) || (!ma.content.blank?) %>
|
||||
<div class="fl"><strong>内容:</strong></div><div class="ml36"><%= ma.description.nil? ? ma.content.html_safe : ma.description.html_safe %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<%# end %>
|
||||
<% end %>
|
|
@ -41,40 +41,13 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# 系统消息 %>
|
||||
<% if params[:type] != 'system_messages' %>
|
||||
<% @user_system_messages.each do |usm| %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/logo.png", width: "30px", height: "30px", class: "mt3") %></div></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">Trustie平台</span><span class="homepageNewsType fl">发布新消息:</span>
|
||||
</li>
|
||||
<span style="color: red;float: left">【系统消息】</span>
|
||||
<li class="homepageSystenMessageContent fl">
|
||||
|
||||
<%= link_to usm.subject.blank? ? (usm.content.nil? ? usm.description.html_safe : usm.content.html_safe) : usm.subject, user_system_messages_path(User.current),
|
||||
:id => "content_link_#{usm.id}",
|
||||
:onmouseover =>"message_titile_show($(this),event);",
|
||||
:onmouseout => "message_titile_hide($(this));"
|
||||
%>
|
||||
</li>
|
||||
<div style="display:none;" class="message_title_red system_message_style">
|
||||
<% unless usm.subject.blank? %>
|
||||
<p><strong>标题:</strong><%= usm.subject %></p>
|
||||
<% end %>
|
||||
<% if (!usm.description.blank?) || (!usm.content.blank?) %>
|
||||
<div class="fl"><strong>内容:</strong></div><div class="ml36"><%= usm.description.nil? ? usm.content.html_safe : usm.description.html_safe %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--总消息列表-->
|
||||
<% unless @message_alls.nil? %>
|
||||
<% @message_alls.each do |ma| %>
|
||||
<%# 系统消息 %>
|
||||
<%= render :partial => 'users/user_message_system', :locals => {:ma => ma} %>
|
||||
|
||||
<%# 课程消息 %>
|
||||
<%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %>
|
||||
|
||||
|
|
|
@ -2024,7 +2024,11 @@ zh:
|
|||
|
||||
label_end_time: 截止时间
|
||||
label_send_email: 确定发送
|
||||
label_input_email: 请输入邮箱地址
|
||||
label_input_email: 请输入邮箱地址(必填)
|
||||
label_input_email_firstname: 请输入用户名字(可选)
|
||||
label_input_email_lastname: 请输入用户姓氏(可选)
|
||||
label_input_email_gender: 请输入用户性别
|
||||
|
||||
#api end
|
||||
project_module_files: 资源库
|
||||
|
||||
|
|
|
@ -802,7 +802,8 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re
|
|||
.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;}
|
||||
.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;}
|
||||
.postDetailReply { margin-top:28px; color:#888888; float:right;display: inline}
|
||||
.disablePostLikeIcon {background:url(images/post_image_list.png) 0px -42px no-repeat ;float:right; padding-left:18px; padding-right: 5px; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
|
||||
a.postReplyIcon {background:url(images/post_image_list.png) -40px 2px no-repeat; width:18px; height:18px; float:left; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
|
||||
a.postReplyIcon:hover {background:url(images/post_image_list.png) -40px -29px no-repeat; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
|
||||
.postDetailInput {width:713px; height:28px; border:1px solid #d9d9d9; outline:none !important;}
|
||||
|
|
|
@ -44,7 +44,10 @@ a:hover.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;}
|
|||
.box_main02{ width:390px; margin:15px auto;}
|
||||
.box_h3{ color:#15bccf; font-size:16px;}
|
||||
.box_p{ color:#404040; margin-bottom:5px;}
|
||||
.fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:290px;}
|
||||
.fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:200px;}
|
||||
.fb_item_first_name{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:150px;margin-left: 10px;}
|
||||
.fb_item_last_name{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:150px;margin-left: 10px;}
|
||||
.fb_item_gender{ color:#919191; border:1px solid #919191; height:29px; margin-bottom:5px; padding-left:5px; width:58px;margin-left: 10px;}
|
||||
a.icon_addm{ background:url(../images/img_floatbox.png) 0 -33px no-repeat; width:16px; height:16px; display:block; margin:5px 0 0 5px;}
|
||||
a:hover.icon_addm{background:url(../images/img_floatbox.png) 0 -61px no-repeat; }
|
||||
a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repeat;width:16px; height:16px; display:block; margin:5px 0 0 5px}
|
||||
|
|
Loading…
Reference in New Issue