Merge branch 'develop' into dev_hjq

This commit is contained in:
huang 2015-12-07 14:40:25 +08:00
commit 9ff41c214b
13 changed files with 47 additions and 19 deletions

View File

@ -262,6 +262,7 @@ class HomeworkCommonController < ApplicationController
@user_activity_id = -1
end
@is_in_course = params[:is_in_course]
@course_activity = params[:course_activity].to_i
end
private

View File

@ -31,7 +31,7 @@ class RepositoriesController < ApplicationController
default_search_scope :changesets
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo]
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers, :forked]
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo,:to_gitlab]
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked]
@ -69,9 +69,11 @@ class RepositoriesController < ApplicationController
project = project_from_current_project(@project.id, User.current.id)
redirect_to project_path(project)
else
# 单个用户只能拥有一个名字一样的版本库否则不能fork
# if is_sigle_identifier?(User.current, @repository.identifier)
# REDO: 那些人有权限forked项目
# 自己不能fork自己的项目
if User.current.id == @project.user_id
flash[:notice] = l(:project_gitlab_fork_own)
redirect_to repository_url(@repository)
else
g = Gitlab.client
gproject = g.fork(@project.gpid, User.current.gid)
if gproject
@ -79,10 +81,7 @@ class RepositoriesController < ApplicationController
forked_count = @project.forked_count.to_i + 1
@project.update_attributes(:forked_count => forked_count)
end
# else
# flash[:notice] = l(:project_gitlab_fork_double_message)
# redirect_to settings_project_url(@project, :tab => 'repositories')
# end
end
end
end

View File

@ -500,8 +500,9 @@ class StudentWorkController < ApplicationController
if params[:student_path]
redirect_to student_work_index_url(:homework => @homework.id)
else
@user_activity_id = params[:user_activity_id]
@is_in_course = params[:is_in_course]
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format|
format.js
end

View File

@ -104,6 +104,15 @@ class WordsController < ApplicationController
@user = User.find(@journal_destroyed.jour_id)
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
@is_user = true
elsif @journal_destroyed.jour_type == 'HomeworkCommon'
@homework = HomeworkCommon.find @journal_destroyed.jour_id
if params[:user_activity_id]
@user_activity_id = params[:user_activity_id]
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
end
respond_to do |format|
format.js

View File

@ -2443,7 +2443,7 @@ module ApplicationHelper
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:remote=>true}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity =>@course_activity,:remote=>true}) %>');
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

View File

@ -26,8 +26,9 @@
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
<!--<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_fork"></span>Fork</a> <span href="javascript:void(0);" class="vl_btn_2 fb">0</span> </div>-->
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%>
<% unless User.current.id == @project.user_id %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%>
<% end %>
<%#= link_to "<span id='span'>My span&nbsp;</span>#{@user.profile.my_data}".html_safe, "#", class: 'button white' %>
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span> </div>

View File

@ -3,7 +3,7 @@
<% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%>
<% end%>
<% else %>
<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course},:method => "post",:remote => true) do |f|%>
<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity},:method => "post",:remote => true) do |f|%>
<% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%>
<% end%>
<% end %>

View File

@ -1,6 +1,6 @@
clickCanel();
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id}) %>");
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% else %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");

View File

@ -90,7 +90,7 @@
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
<li>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => 0),:class => "postOptionLink", :remote => true) %>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true) %>
</li>
<% if activity.anonymous_comment == 0 %>
<li>
@ -154,6 +154,10 @@
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(comment.created_on) %>
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
<% end %>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div>

View File

@ -95,7 +95,7 @@
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
<li>
<%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course),:class => "postOptionLink", :remote => true) %>
<%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %>
</li>
<% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
<li>
@ -161,6 +161,10 @@
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(comment.created_on) %>
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course,:course_activity=>-1},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
<% end %>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div>

View File

@ -1,6 +1,6 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%>
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%>
<% if @is_user%>
var destroyedItem = $('#<%=@journal_destroyed.id%>');
destroyedItem.fadeOut(600,function(){
@ -13,6 +13,14 @@
$('#course_jour_count').html("(<%= @jours_count %>)");
<% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%>
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% end %>
<% end %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){

View File

@ -91,6 +91,7 @@ zh:
project_gitlab_create_repository: 新版本库
project_gitlab_create_double_message: 亲,您已经创建了一个同名的版本库,换个特别点的名字同名的概率就会变小哦~
project_gitlab_fork_double_message: 您已经有了一个相同名字的版本库所以不能fork改版本库~
project_gitlab_fork_own: 您好您当前所fork的项目为您自己创建的项目平台暂时不提供fork自己项目的功能敬请谅解
label_project_more: 更多