Merge branch 'develop' into gitlab_guange
This commit is contained in:
commit
353089af41
|
@ -107,7 +107,7 @@ class CoursesController < ApplicationController
|
|||
courses = Course.visible
|
||||
@courses = paginateHelper courses,10
|
||||
else
|
||||
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'")
|
||||
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc")
|
||||
@courses = paginateHelper courses,10
|
||||
end
|
||||
@name = params[:name]
|
||||
|
|
|
@ -615,6 +615,11 @@ module ApplicationHelper
|
|||
return rep.blank? ? true :false
|
||||
end
|
||||
|
||||
# 获取单一gitlab项目
|
||||
def gitlab_repository(project)
|
||||
rep = Repository.where("project_id =? and type =?", project.id,"Repository::Gitlab" ).first
|
||||
end
|
||||
|
||||
# 判断当前用户是否为项目管理员
|
||||
def is_project_manager?(user_id, project_id)
|
||||
@result = false
|
||||
|
|
|
@ -125,7 +125,7 @@ module ProjectsHelper
|
|||
# 获取新项目的版本库地址
|
||||
def rep_gitlab_url(project)
|
||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
url = gitlab_address.to_s+"/"+project.owner.to_s+"/"+project.identifier+"."+"git"
|
||||
url = gitlab_address.to_s+"/"+project.owner.to_s+"/"+ rep_gitlab(project).first.identifier+"."+"git"
|
||||
end
|
||||
|
||||
# # 获取Forge历史版本库
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
|
||||
<%elsif @course%>
|
||||
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>');
|
||||
$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>")
|
||||
$("#student_number").html("<%= studentCount(@course) %>");
|
||||
<%end%>
|
||||
hideOnLoad();
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<ul class="setting_left">
|
||||
<li>登录名 : <span style="color:red;">*</span></li>
|
||||
<li>邮箱 : <span style="color:red;">*</span></li>
|
||||
<li>身份 : </li>
|
||||
<li>身份 : <span style="color:red;">*</span></li>
|
||||
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓(First Name) : <span style="color:red;">*</span></li>
|
||||
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名(Last Name) : <span style="color:red;">*</span></li>
|
||||
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名 : <span style="color:red;">*</span></li>
|
||||
|
@ -34,7 +34,10 @@
|
|||
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
|
||||
|
||||
<li>
|
||||
<select onchange="showtechnical_title(this.value);" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
|
||||
<select onchange="showtechnical_title(this.value);" required = true, nh_required="1" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
|
||||
<option value="-1">
|
||||
<%= l(:label_account_identity_choose) %>
|
||||
</option>
|
||||
<option value="0">
|
||||
<%= l(:label_account_identity_teacher) %>
|
||||
</option>
|
||||
|
@ -61,6 +64,7 @@
|
|||
<%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID),:style=>"60px" %></span>
|
||||
<% end %>
|
||||
</span>
|
||||
<span id="identity_hint" style="display: none"></span>
|
||||
</li>
|
||||
|
||||
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= f.text_field :lastname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
|
||||
|
@ -701,6 +705,11 @@
|
|||
$("#users_tb_2").click();
|
||||
<% end %>
|
||||
$('#my_account_form_link').click(function(e){
|
||||
if($("#userIdentity").val() == -1 ) {
|
||||
$("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
|
||||
e.stopImmediatePropagation();
|
||||
return;
|
||||
}
|
||||
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
|
||||
$("#hint").html('<span style="color:red">学校必须是从下拉列表中选择的,不能手动修改</span>').show();
|
||||
e.stopImmediatePropagation();
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<% if rep_is_gitlab?(@project) %>
|
||||
<%= link_to l(:project_module_repository), {:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories'}, :class => "f14 c_blue02" %>
|
||||
<% else %>
|
||||
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id }, :class => "f14 c_blue02" %>
|
||||
<%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "f14 c_blue02" %>
|
||||
<% end %>
|
||||
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
|
||||
<% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %>
|
||||
|
|
|
@ -7,8 +7,16 @@
|
|||
<%= str = error_messages_for 'repository' %>
|
||||
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
|
||||
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
|
||||
<%# 提示 %>
|
||||
<% if @project.repositories.count>1 %>
|
||||
<div class="flash notice">
|
||||
项目管理员您好!近日平台完成了版本库升级,以后每个项目将唯一的对应一个版本库。请您按照以下步骤完成项目版本库的更新:
|
||||
<p>1. 点击下面的"创建版本库按钮",为本项目创建一个新的版本库;</p>
|
||||
<p>2. 从本项目的历史版本库中选择一个您将使用的版本库,将其完整的克隆(clone)到本地(需要提供您之前设置的版本库口令),然后推送(push)到新建的版本库(注意不能仅推送代码,否则之前各开发者的提交记录将丢失)。</p>
|
||||
<p>3. 本项目的历史版本库将在您新建版本库的一周内自动隐藏,如果您以后需要这些版本库,请与网站联系,我们将为您提供这些版本库的所有数据。</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# 新建版本库 %>
|
||||
|
||||
<% if @project.repositories.count == 0 || rep_is_gitlab?(@project) %>
|
||||
<div style="padding-bottom: 40px">
|
||||
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
|
||||
|
@ -36,7 +44,7 @@
|
|||
<li >
|
||||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%>:</label>
|
||||
<span class="f14"><span class="c_red">*</span><%=l(:label_repository_name)%>:</span>
|
||||
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
|
||||
<% unless @repository.identifier_frozen? %>
|
||||
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
|
||||
|
@ -44,8 +52,8 @@
|
|||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl ml38 "><%=l(:lable_project_rep_create) %></a>
|
||||
<a href="<%= settings_project_path(@project, :tab => 'repositories')%>" class="grey_btn fl ml38 "><%=l(:button_cancel)%></a>
|
||||
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl "><%=l(:lable_project_rep_create) %></a>
|
||||
<a href="<%= settings_project_path(@project, :tab => 'repositories')%>" class="grey_btn fl "><%=l(:button_cancel)%></a>
|
||||
</div><!--pro_st_edit_issues end-->
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -64,7 +72,7 @@
|
|||
<%= repository.identifier %></span></td>
|
||||
<td class="w150"><span class="rep_history_grey"><%=h repository.scm_name %></span></td>
|
||||
<%if repository.scm_name=="Git"%>
|
||||
<td class="w362" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
|
||||
<td class="w362 pl5" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis; text-align: left" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
|
||||
<%=h repository.url.slice(project_path_cut, repository.url.length) %>">
|
||||
<span class="rep_history_grey">
|
||||
<%=truncate( 'http://' << repository.login.to_s << '_'<< repository.identifier.to_s << '@'<< ip.to_s << h( repository.url.slice(project_path_cut, repository.url.length)),:length=>60) %>
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
<div class=" mt10">
|
||||
<%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%>
|
||||
<div class="calendar_div fl">
|
||||
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" placeholder="发布日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
|
||||
<%= calendar_for('homework_publish_time')%>
|
||||
</div>
|
||||
<div class="calendar_div fl ml10">
|
||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
|
||||
<%= calendar_for('homework_end_time')%>
|
||||
</div>
|
||||
<div class="calendar_div fl ml10">
|
||||
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" placeholder="发布日期(可选)" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
|
||||
<%= calendar_for('homework_publish_time')%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p id="homework_end_time_span" class="c_red mt5"></p>
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
var id; //资源id
|
||||
var sendType; //发送到课程 1 发送到项目 2
|
||||
var lastSendType; //保存上次发送的发送类型
|
||||
var last_op
|
||||
$("#resources_list").mousedown(function(e) {
|
||||
//如果是右键的话
|
||||
if (3 == e.which) {
|
||||
|
@ -179,6 +180,28 @@
|
|||
last_line = line;
|
||||
}
|
||||
});
|
||||
|
||||
//鼠标经过时,背景颜色设为灰色
|
||||
$("#resources_list").mouseover(function(e){
|
||||
pageX = e.clientX;
|
||||
pageY = e.clientY;
|
||||
var ele = document.elementFromPoint(pageX,pageY);
|
||||
line = $(ele).parent();
|
||||
if(last_op != null){
|
||||
last_op.children().css("background-color", 'white');
|
||||
restore();
|
||||
last_op == null;
|
||||
}
|
||||
//如果当前的tag是li,那么还要li的父级元素
|
||||
if(line.get(0).tagName === 'LI'){
|
||||
line = line.parent();
|
||||
}
|
||||
//将当前的元素的所有子元素的背景色改为蓝色
|
||||
line.children().css("background-color", '#e1e1e1');
|
||||
//将当前元素赋给 上一个对象 保存起来。
|
||||
last_op = line;
|
||||
});
|
||||
|
||||
//元素包含关系计算
|
||||
var contains = function(root, el) {
|
||||
if (root.compareDocumentPosition)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class DropOrganization < ActiveRecord::Migration
|
||||
def up
|
||||
drop_table :organizations
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
class CreateOrganization < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :organizations do |t|
|
||||
t.string :name
|
||||
t.text :description
|
||||
t.integer :creator_id
|
||||
t.integer :home_id
|
||||
t.string :domain
|
||||
t.boolean :is_public
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :organizations
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class CreateOrgMembers < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :org_members do |t|
|
||||
t.integer :user_id
|
||||
t.integer :organization_id
|
||||
t.string :role
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :org_members
|
||||
end
|
||||
end
|
|
@ -7,16 +7,17 @@ namespace :rep_fault do
|
|||
if project.repositories.count > 0
|
||||
unless Repository.where("project_id =? and type = ?",project, "Repository::Gitlab").blank?
|
||||
project.repositories.each do |repository|
|
||||
repository.update_attributes(:is_default => false)
|
||||
repository.is_default =1
|
||||
repository.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "update ossean's data"
|
||||
task :update_type => :environment do
|
||||
repository = Repository.find(400)
|
||||
repository.update_attributes(:type => "Repository::Git")
|
||||
end
|
||||
# desc "update ossean's data"
|
||||
# task :update_type => :environment do
|
||||
# repository = Repository.find(400)
|
||||
# repository.update_attributes(:type => "Repository::Git")
|
||||
# end
|
||||
end
|
|
@ -517,6 +517,11 @@ function jsCopy(){
|
|||
e.select();
|
||||
document.execCommand("Copy");
|
||||
}
|
||||
function jsCopy2(){
|
||||
var e=document.getElementById("copy_rep_content2");
|
||||
e.select();
|
||||
document.execCommand("Copy");
|
||||
}
|
||||
|
||||
function zip(){
|
||||
alert("该功能正在紧张的开发中,我们会争取在最短时间内上线,如若对您工作造成不便敬请谅解!")
|
||||
|
|
|
@ -117,6 +117,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
|||
.mb10{ margin-bottom:10px !important;}
|
||||
.mb20{ margin-bottom:20px;}
|
||||
.pl15{ padding-left:15px;}
|
||||
.pl5{ padding-left:5px;}
|
||||
.pt5{ padding-top:5px;}
|
||||
.pt10{ padding-top:10px;}
|
||||
.pb5{ padding-bottom: 5px;}
|
||||
|
|
Loading…
Reference in New Issue