Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into dev_raining
This commit is contained in:
commit
a1fee68d8b
|
@ -847,6 +847,7 @@ class ProjectsController < ApplicationController
|
|||
params = {jobName: jobName, pipeLine: pipeLine}
|
||||
res = uri_exec uri, params
|
||||
training_project_notice res
|
||||
@project.update_attribute(:training_status, 1)
|
||||
end
|
||||
|
||||
def training_project_update
|
||||
|
@ -856,6 +857,7 @@ class ProjectsController < ApplicationController
|
|||
params = {jobName: jobName, pipeLine: pipeLine}
|
||||
res = uri_exec uri, params
|
||||
training_project_notice res
|
||||
@project.update_attribute(:training_status, 1)
|
||||
end
|
||||
|
||||
def training_project_notice res
|
||||
|
|
|
@ -3,7 +3,7 @@ class TrainingTasksController < ApplicationController
|
|||
|
||||
layout 'base_projects'
|
||||
before_filter :find_project, :only => [:index, :new, :create, :update_form, :issue_commits, :commit_for_issue, :issue_commit_delete, :destroy]
|
||||
before_filter :allow_manager, :only => []
|
||||
before_filter :allow_manager, :only => [:index, :show]
|
||||
before_filter :allow_members, :only => [:new, :create]
|
||||
before_filter :build_new_task_from_params, :only => [:new, :create, :update_form]
|
||||
before_filter :find_training_task, :only => [:show, :edit, :update, :add_journal, :complete_training_task]
|
||||
|
@ -318,6 +318,12 @@ class TrainingTasksController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def allow_manager
|
||||
if !(User.current.admin? || is_project_member?(User.current.id, @project.id))
|
||||
return render_403
|
||||
end
|
||||
end
|
||||
|
||||
def retrieve_previous_and_next_issue_ids
|
||||
retrieve_query_from_session
|
||||
if @query
|
||||
|
|
|
@ -1237,6 +1237,16 @@ class User < Principal
|
|||
Thread.current[:current_user] ||= User.anonymous
|
||||
end
|
||||
|
||||
def user_real_extension
|
||||
ue = self.user_extensions
|
||||
if ue.nil?
|
||||
ue = UserExtensions.new
|
||||
ue.user_id = self.id
|
||||
ue.save
|
||||
end
|
||||
ue
|
||||
end
|
||||
|
||||
# Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only
|
||||
# one anonymous user per database.
|
||||
def self.anonymous
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<%= link_to '管理员身份', switch_role_contest_path(@contest, :user_id => User.current.id, :curr_role => 14, :tar_role => 13), :class => "fr sy_btn_blue mt28 ml10", :title => "由评委身份切换至管理员身份" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% elsif User.current.logged? %>
|
||||
<%= link_to "加入竞赛",join_contest_contests_path(),:remote => true, :method => "get", :class => "fr sy_btn_blue mt28 ml10" %>
|
||||
<% end %>
|
||||
<span class="fr mt30 f16"> 邀请码:
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<%= link_to user.show_name, user_path(user), :class => 'fl sy_class_users_st_name' ,:title => "#{user.show_name}", :target => '_blank' %>
|
||||
</td>
|
||||
<td>
|
||||
<span class="sy_class_users_st_num" title="<%= user.user_extensions.student_id %>"><%= user.user_extensions.student_id %></span>
|
||||
<span class="sy_class_users_st_num" title="<%= user.user_real_extension.student_id %>"><%= user.user_real_extension.student_id %></span>
|
||||
</td>
|
||||
<td>
|
||||
<% if !is_teacher && User.current.id != member.user_id && course_has_score_open_common_homework(@course) %>
|
||||
|
|
|
@ -42,10 +42,12 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<!--实训任务-->
|
||||
<% unless @project.enabled_modules.where("name = 'training_tasks'").empty? %>
|
||||
<li id="project_menu_011">
|
||||
<%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k training_tasks_count}</span>".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project), :class => "pro_new_proname", :title => "#{training_tasks_count}" %>
|
||||
</li>
|
||||
<% if !@project.enabled_modules.where("name = 'training_tasks'").empty? %>
|
||||
<% if User.current.admin? || is_project_member?(User.current.id, @project.id) %>
|
||||
<li id="project_menu_011">
|
||||
<%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k training_tasks_count}</span>".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project), :class => "pro_new_proname", :title => "#{training_tasks_count}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--讨论区-->
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
|
|
|
@ -116,6 +116,7 @@
|
|||
$("#navHomepageSearchType").hide();
|
||||
});
|
||||
|
||||
<% unless @force %>
|
||||
$("#user_messages").mouseenter(function(){
|
||||
onNotice = true;
|
||||
$("#user_messages_list").show();
|
||||
|
@ -134,6 +135,7 @@
|
|||
obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
|
||||
} }, 500);
|
||||
});
|
||||
<% end %>
|
||||
$("#message_list_detail").mouseenter(function(event){
|
||||
event.stopPropagation();
|
||||
onUserMessages = true;
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
role_str = "参赛者"
|
||||
end
|
||||
end %>
|
||||
<li><a href="<%=contest_path(ma.contest_id) %>" target="_blank" title='<%= user.show_name%> <%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"," %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%>'><span class="shadowbox_news_user"><%= user.show_name%> </span><%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"," %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%></a></li>
|
||||
<li><a href="<%=contest_path(ma.contest_id) %>" target="_blank" title='<%= user.show_name%> <%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"," %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%>'><span class="shadowbox_news_user"><%= user.show_name%> </span><%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"," %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%></a></li>
|
||||
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 0 %>
|
||||
<li><a href="<%=contest_path(ma.contest) %>" target="_blank" title="<%=User.find(ma.contest_message_id).show_name %> 将您加入了竞赛:<%= ma.contest.name%>"><span class="shadowbox_news_user"><%=User.find(ma.contest_message_id).show_name %> </span>将您加入了竞赛:<%= ma.contest.name%></a></li>
|
||||
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 1 %>
|
||||
|
@ -177,8 +177,8 @@
|
|||
<% applied_contest = ma.applied %>
|
||||
<% contest = Contest.find applied_contest.contest_id %>
|
||||
<% message_user = User.find(applied_contest.user_id) %>
|
||||
<% content = '<span class="shadowbox_news_user">'+message_user.show_name+' </span>'+(message_user.user_extensions.school_id.blank? ? "" : "来自")+message_user.user_extensions.school.name+","+'申请以"'+ get_role_str(ma.role) + '"的身份加入竞赛:' + contest.name%>
|
||||
<%= link_to content.html_safe, contest_path(contest.id), :title => "#{message_user.show_name} #{message_user.user_extensions.school_id.blank? ? '' : '来自'+message_user.user_extensions.school.name},申请以'#{get_role_str(ma.role)}'的身份加入竞赛:#{contest.name}", :target => '_blank' %>
|
||||
<% content = '<span class="shadowbox_news_user">'+message_user.show_name+' </span>'+(message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? "" : "来自"+message_user.user_extensions.school.name+",")+'申请以"'+ get_role_str(ma.role) + '"的身份加入竞赛:' + contest.name%>
|
||||
<%= link_to content.html_safe, contest_path(contest.id), :title => "#{message_user.show_name} #{message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? '' : '来自'+message_user.user_extensions.school.name+","}申请以'#{get_role_str(ma.role)}'的身份加入竞赛:#{contest.name}", :target => '_blank' %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% elsif ma.class == ForgeMessage %>
|
||||
|
|
|
@ -41,8 +41,10 @@
|
|||
<% when "Issue" %>
|
||||
<%= render :partial => 'projects/act_issues', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
|
||||
<% when "TrainingTask" %>
|
||||
<%= render :partial => 'projects/act_training_tasks', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
|
||||
<!--message -->
|
||||
<% if User.current.admin? || is_project_member?(User.current.id, @project.id) %>
|
||||
<%= render :partial => 'projects/act_training_tasks', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
|
||||
<% end %>
|
||||
<!--message-->
|
||||
<% when "Message" %>
|
||||
<%= render :partial => 'projects/act_messages', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %>
|
||||
<!--Attachment -->
|
||||
|
|
|
@ -24,16 +24,15 @@
|
|||
<!--<li><%#= link_to "作业动态", {:controller => "courses", :action => "show", :type => "homework"}, :class => "homepagePostTypeAssignment postTypeGrey" %></li>-->
|
||||
<li><%= link_to "资源库动态", {:controller => "projects", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey" %></li>
|
||||
<li><%= link_to "讨论区动态", {:controller => "projects", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey" %></li>
|
||||
<li><%= link_to "实训任务动态", {:controller => "projects", :action => "show", :type => "training_task"}, :class => "homepagePostTypeForum postTypeGrey" %></li>
|
||||
<!--<li><%#= link_to "问卷动态", {:controller => "courses", :action => "show", :type => "poll"}, :class => "homepagePostTypeQuiz postTypeGrey" %></li>-->
|
||||
<% if @project.is_training_project? && is_project_member?(User.current.id, @project.id) %>
|
||||
<li><%= link_to "实训任务动态", {:controller => "projects", :action => "show", :type => "training_task"}, :class => "homepagePostTypeForum postTypeGrey" %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<!--CONTENT LIST-->
|
||||
|
||||
</div>
|
||||
|
||||
<%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
</span>
|
||||
<span class="homepageNewsType fl">
|
||||
<%= message_user.user_extensions.school_id.blank? ? "" : "来自"+message_user.user_extensions.school.name+"," %>
|
||||
<%= message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? "" : "来自"+message_user.user_extensions.school.name+"," %>
|
||||
申请以"<%= get_role_str ma.role %>"的身份加入竞赛:
|
||||
</span>
|
||||
</li>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<%=link_to user.show_name, user_path(user),
|
||||
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %></span>
|
||||
<span class="homepageNewsType fl">
|
||||
<%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"," %>
|
||||
<%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"," %>
|
||||
申请以"<%= role_str%>"的身份加入竞赛:
|
||||
</span>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue