修复匿名用户创建项目的问题

This commit is contained in:
huang 2015-07-27 18:15:05 +08:00
parent 9beb8acb99
commit 0f82bbf797
2 changed files with 13 additions and 19 deletions

View File

@ -150,11 +150,15 @@ class ProjectsController < ApplicationController
end
def new
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
render :layout => 'base'
if User.current.login?
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
render :layout => 'base'
else
redirect_to signin_url
end
end
def share
@ -167,6 +171,10 @@ class ProjectsController < ApplicationController
end
def create
unless User.current.login?
redirect_to signin_url
return
end
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new

View File

@ -93,21 +93,7 @@
</div>
<div class="cl"></div>
</div>
<!--Document-->
<% elsif e.forge_act_type == "Document" %>
<div class="problem_main">
<a class="problem_pic fl"><%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %></a>
<div class="problem_txt fl mt5 break_word">
<a class="problem_name fl ">
<%= h(e.project) if @project.nil? || @project.id != e.project_id %>
<%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %></a><span class="fl"> <%= l(:label_new_activity) %> </span>
<%= link_to format_activity_title("#{l(:label_document)}: #{act.title}"), {:controller => 'documents', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %><br />
<p class="mt5 break_word"><%= textAreailizable act,:description %><br />
<%= l :label_create_time %> <%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
</div>
<div class="cl"></div>
</div>
<!--Attachment -->
<% elsif e.forge_act_type == "Attachment" %>
<div class="problem_main">