增加其他角色新建课程权限

This commit is contained in:
moon 2014-11-17 16:13:40 +08:00
parent c086009313
commit f21767cb16
2 changed files with 5 additions and 7 deletions

View File

@ -271,8 +271,7 @@ class CoursesController < ApplicationController
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
if User.current.user_extensions.identity == 0
if @course.save
if @course.save
#unless User.current.admin?
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => User.current, :roles => [r])
@ -298,15 +297,13 @@ class CoursesController < ApplicationController
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
end
else
else
#@course.destroy
respond_to do |format|
format.html { render :action => 'new', :layout => 'base' } #Added by young
format.api { render_validation_errors(@course) }
end
end
end
end
end
def course

View File

@ -8,12 +8,13 @@
<p class="font_description">
<%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'courses',:action=>'index'}, :class => 'icon icon-add' %>
<%= link_to "#{l(:label_course_new)}", {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %>
</p>
<% end %>
<% else %>
<div class="user_course_list menu-div">
<div class="menu">
<%= link_to"#{l(:label_course_view_student)}",courses_path, :class => 'icon icon-add' %>
<%= link_to "#{l(:label_course_new)}", new_course_path, class: 'icon icon-add' if @user == User.current %>
<ul>
<li mode='doing' class="on">进行中</li>
<li mode='end'>已完结</li>