Merge branch 'dev_hjq' into szzh

This commit is contained in:
huang 2015-05-29 16:09:17 +08:00
commit c87a74a1c4
14 changed files with 72 additions and 32 deletions

View File

@ -243,14 +243,7 @@ class ProjectsController < ApplicationController
# Author lizanle # Author lizanle
# Description 项目动态展示方法,删除了不必要的代码 # Description 项目动态展示方法,删除了不必要的代码
def show def show
# params[:login]为邮箱邀请用户加入,主要功能:
# 1、自动注册
# 2、加入项目、创建角色
# 3、用户得分
if params[:mail]
Member.create(:role_ids => [4], :user_id => params[:user],:project_id => params[:id])
UserGrade.create(:user_id =>params[:user], :project_id => params[:id])
end
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return return
end end
@ -399,6 +392,26 @@ class ProjectsController < ApplicationController
# by young # by young
# include CoursesHelper # include CoursesHelper
def member def member
# params[:login]为邮箱邀请用户加入,主要功能:
# 1、自动注册
# 2、加入项目、创建角色
# 3、用户得分
if params[:mail]
user = User.find(params[:user_id])
user.activate!
Member.create(:role_ids => [4], :user_id => params[:user_id],:project_id => params[:id])
UserGrade.create(:user_id => params[:user_id], :project_id => params[:id])
token = Token.get_token_from_user(user, 'autologin')
#user = User.try_to_autologin(token.value)
if user
start_user_session(user)
user.save
redirect_to project_member_path(params[:id])
return
# account_ project_member_path(params[:id])
flash[:notice] = l(:label_mail_invite_success)
end
end
## 有角色参数的才是课程,没有的就是项目 ## 有角色参数的才是课程,没有的就是项目
@render_file = 'project_member_list' @render_file = 'project_member_list'
# 判断是否课程 # 判断是否课程

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WelcomeController < ApplicationController class WelcomeController < ApplicationController
# layout "base_welcome"
include ApplicationHelper include ApplicationHelper
include WelcomeHelper include WelcomeHelper
helper :project_score helper :project_score

View File

@ -0,0 +1,5 @@
class InviteList < ActiveRecord::Base
attr_accessible :project_id, :user_id
# belongs_to :user
# belongs_to :project
end

View File

@ -60,8 +60,8 @@ class Mailer < ActionMailer::Base
user = us.register_auto(login, @email, @password) user = us.register_auto(login, @email, @password)
User.current = user unless User.current.nil? User.current = user unless User.current.nil?
@user = user @user = user
@token = Token.get_token_from_user(user, 'autologin')
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true)
mail :to => email, :subject => @subject mail :to => email, :subject => @subject
end end
@ -72,8 +72,9 @@ class Mailer < ActionMailer::Base
@invitor_name = "#{invitor.name}" @invitor_name = "#{invitor.name}"
@project_name = "#{project.name}" @project_name = "#{project.name}"
@user = user @user = user
@project = project
@token = Token.get_token_from_user(user, 'autologin') @token = Token.get_token_from_user(user, 'autologin')
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
mail :to => email, :subject => @subject mail :to => email, :subject => @subject
end end

View File

@ -67,7 +67,7 @@ class Project < ActiveRecord::Base
has_many :student, :through => :students_for_courses, :source => :user has_many :student, :through => :students_for_courses, :source => :user
has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy
has_many :applied_projects has_many :applied_projects
# has_many :invite_lists
# end # end
#ADDED BY NIE #ADDED BY NIE

View File

@ -125,6 +125,10 @@ class User < Principal
has_many :documents # 项目中关联的文档再次与人关联 has_many :documents # 项目中关联的文档再次与人关联
# end # end
# 邮件邀请状态
# has_many :invite_lists
# end
######added by nie ######added by nie
has_many :project_infos, :dependent => :destroy has_many :project_infos, :dependent => :destroy
has_one :user_status, :dependent => :destroy has_one :user_status, :dependent => :destroy

View File

@ -62,7 +62,7 @@ class UsersService
else else
@user.password = "" @user.password = ""
end end
@user = automatically_register(@user) @user = automatically_register_lock(@user)
if @user.id != nil if @user.id != nil
ue = @user.user_extensions ||= UserExtensions.new ue = @user.user_extensions ||= UserExtensions.new
ue.user_id = @user.id ue.user_id = @user.id

View File

@ -12,7 +12,7 @@
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %> <%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
@ -31,7 +31,7 @@
<div style="clear:both;"></div> <div style="clear:both;"></div>
<%=render :partial => 'layouts/base_footer'%> <%=render :partial => 'layouts/base_footer'%>
</div> </div>
</div> </div>
</div> </div>

View File

@ -5,10 +5,9 @@
<title><%=h html_title %></title> <title><%=h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" /> <meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'public', 'pleft', 'project', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_include_tag "jquery.leanModal.min" %> <%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
@ -18,32 +17,26 @@
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>
<body class="<%=h body_css_classes %>"> <body id="Container">
<div id="wrapper"> <div id="Container">
<div id="wrapper2"> <%= render :partial => 'layouts/new_header' %>
<div id="wrapper3"> <div class="cl"></div>
<%=render :partial => 'layouts/base_header'%>
<div id="main" class="nosidebar"> <div id="main" class="nosidebar">
<div id="content_"> <div id="content_">
<%= render_flash_messages %> <%= render_flash_messages %>
<%= yield %> <%= yield %>
<%= call_hook :view_layouts_base_content %> <%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div> <div style="clear:both;"></div>
<%=render :partial => 'layouts/base_footer'%> <%=render :partial => 'layouts/new_footer'%>
</div> </div>
</div> </div>
</div> </div>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span> <span><%= l(:label_loading) %></span>
<%= l(:label_loading) %>
</span>
</div> </div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>

View File

@ -23,7 +23,7 @@
$(document).ready(function($) { $(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank"); $("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); //$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
}); });
</script> </script>
<div class='top_bar'> <div class='top_bar'>
@ -45,7 +45,7 @@
<% if @organization.nil? %> <% if @organization.nil? %>
<% unless @first_page.nil? %> <% unless @first_page.nil? %>
<!-- 改为国际化后无法通过后台配置 <!-- 改为国际化后无法通过后台配置
<%= @first_page.description.html_safe %> <%= @first_page.description.html_safe %>
--> -->
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie_project)%></span>,&nbsp; <span class="font_welcome_trustie"><%= l(:label_welcome_trustie_project)%></span>,&nbsp;
<span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= l(:label_welcome_trustie_project_description)%></span></span> <span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= l(:label_welcome_trustie_project_description)%></span></span>

View File

@ -342,6 +342,7 @@ zh:
label_invite_trustie_user_tips: "输入姓名、邮箱、昵称" label_invite_trustie_user_tips: "输入姓名、邮箱、昵称"
label_user_role_null: 用户和角色不能留空! label_user_role_null: 用户和角色不能留空!
label_invite_project: 邀请您加入项目 label_invite_project: 邀请您加入项目
label_mail_invite_success: 您已成功加入项目!
label_invite_success: 邀请成功 label_invite_success: 邀请成功
label_invite_members: 邀请用户 label_invite_members: 邀请用户
# #

View File

@ -0,0 +1,10 @@
class CreateInviteLists < ActiveRecord::Migration
def change
create_table :invite_lists do |t|
t.integer :project_id
t.integer :user_id
t.timestamps
end
end
end

View File

@ -0,0 +1,7 @@
FactoryGirl.define do
factory :invite_list do
project_id 1
user_id 1
end
end

View File

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