Merge branch 'dev_hjq' into szzh
This commit is contained in:
commit
c87a74a1c4
|
@ -243,14 +243,7 @@ class ProjectsController < ApplicationController
|
|||
# Author lizanle
|
||||
# Description 项目动态展示方法,删除了不必要的代码
|
||||
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])
|
||||
return
|
||||
end
|
||||
|
@ -399,6 +392,26 @@ class ProjectsController < ApplicationController
|
|||
# by young
|
||||
# include CoursesHelper
|
||||
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'
|
||||
# 判断是否课程
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class WelcomeController < ApplicationController
|
||||
# layout "base_welcome"
|
||||
include ApplicationHelper
|
||||
include WelcomeHelper
|
||||
helper :project_score
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class InviteList < ActiveRecord::Base
|
||||
attr_accessible :project_id, :user_id
|
||||
# belongs_to :user
|
||||
# belongs_to :project
|
||||
end
|
|
@ -60,8 +60,8 @@ class Mailer < ActionMailer::Base
|
|||
user = us.register_auto(login, @email, @password)
|
||||
User.current = user unless User.current.nil?
|
||||
@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
|
||||
end
|
||||
|
||||
|
@ -72,8 +72,9 @@ class Mailer < ActionMailer::Base
|
|||
@invitor_name = "#{invitor.name}"
|
||||
@project_name = "#{project.name}"
|
||||
@user = user
|
||||
@project = project
|
||||
@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
|
||||
end
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class Project < ActiveRecord::Base
|
|||
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_many :applied_projects
|
||||
|
||||
# has_many :invite_lists
|
||||
|
||||
# end
|
||||
#ADDED BY NIE
|
||||
|
|
|
@ -125,6 +125,10 @@ class User < Principal
|
|||
has_many :documents # 项目中关联的文档再次与人关联
|
||||
# end
|
||||
|
||||
# 邮件邀请状态
|
||||
# has_many :invite_lists
|
||||
# end
|
||||
|
||||
######added by nie
|
||||
has_many :project_infos, :dependent => :destroy
|
||||
has_one :user_status, :dependent => :destroy
|
||||
|
|
|
@ -62,7 +62,7 @@ class UsersService
|
|||
else
|
||||
@user.password = ""
|
||||
end
|
||||
@user = automatically_register(@user)
|
||||
@user = automatically_register_lock(@user)
|
||||
if @user.id != nil
|
||||
ue = @user.user_extensions ||= UserExtensions.new
|
||||
ue.user_id = @user.id
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= 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 %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
|
@ -31,7 +31,7 @@
|
|||
<div style="clear:both;"></div>
|
||||
<%=render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
<title><%=h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= stylesheet_link_tag 'public', 'pleft', 'project', :media => 'all' %>
|
||||
|
||||
<%= javascript_include_tag "jquery.leanModal.min" %>
|
||||
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
||||
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
|
@ -18,32 +17,26 @@
|
|||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%=h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<body id="Container">
|
||||
<div id="Container">
|
||||
<%= render :partial => 'layouts/new_header' %>
|
||||
<div class="cl"></div>
|
||||
<div id="main" class="nosidebar">
|
||||
<div id="content_">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
<%=render :partial => 'layouts/base_footer'%>
|
||||
<%=render :partial => 'layouts/new_footer'%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span>
|
||||
<%= l(:label_loading) %>
|
||||
</span>
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
$(document).ready(function($) {
|
||||
$("#loggedas").find("a").attr("target", "_blank");
|
||||
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class='top_bar'>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<% if @organization.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>,
|
||||
<span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= l(:label_welcome_trustie_project_description)%></span></span>
|
||||
|
|
|
@ -342,6 +342,7 @@ zh:
|
|||
label_invite_trustie_user_tips: "输入姓名、邮箱、昵称"
|
||||
label_user_role_null: 用户和角色不能留空!
|
||||
label_invite_project: 邀请您加入项目
|
||||
label_mail_invite_success: 您已成功加入项目!
|
||||
label_invite_success: 邀请成功
|
||||
label_invite_members: 邀请用户
|
||||
#
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,7 @@
|
|||
FactoryGirl.define do
|
||||
factory :invite_list do
|
||||
project_id 1
|
||||
user_id 1
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe InviteList, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue