Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
aed305f5bf
|
@ -607,6 +607,13 @@ class ProjectsController < ApplicationController
|
|||
@project.organization_id = params[:organization_id]
|
||||
params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0
|
||||
params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0
|
||||
# 更新公开私有时同步gitlab公开私有
|
||||
unless @project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
gproject = g.project(@project.gpid)
|
||||
params[:project][:is_public] ? g.edit_project(gproject.id, 20) : g.edit_project(gproject.id, 0)
|
||||
end
|
||||
# end
|
||||
if validate_parent_id && @project.save
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
if params[:project][:is_public] == '0'
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
:id => '_file',
|
||||
:class => ie8? ? '':'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFilesCourseSource(this,"'+ checkBox.to_s+'");',
|
||||
:onchange => 'addInputFilesCourseSource(this,"'+ checkBox.to_s+'","'+'submit_resource'+'");',
|
||||
:style => ie8? ? '': 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
:id => "_file#{container.id}",
|
||||
:class => ie8? ? '':'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => "addInputFiles_board(this, '#{container.id}');",
|
||||
:onchange => "addInputFiles_board(this, '#{container.id}','"+"submit_resource"+"');",
|
||||
:style => ie8? ? '': 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
|
|
|
@ -22,9 +22,10 @@
|
|||
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<%= render :partial => 'attachement_list',:locals => {:course => course} %>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
:id => '_file',
|
||||
:class => ie8? ? '':'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this);',
|
||||
:onchange => 'addInputFiles(this,"'+'upload_files_submit_btn'+'");',
|
||||
:style => ie8? ? '': 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<div class="mt10">
|
||||
<span id="attachments_fields" class="attachments_fields">
|
||||
<% if defined?(container) && container && container.saved_attachments %>
|
||||
<% container.attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>">
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% container.saved_attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>">
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => ie8? ? '' : 'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this,"'+'upload_files_submit_btn'+'");',
|
||||
:style => ie8? ? '' : 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js',:project =>nil),
|
||||
:description_placeholder => l(:label_optional_description),
|
||||
:field_is_public => l(:field_is_public),
|
||||
:are_you_sure => l(:text_are_you_sure),
|
||||
:file_count => l(:label_file_count),
|
||||
:lebel_file_uploding => l(:lebel_file_uploding),
|
||||
:delete_all_files => l(:text_are_you_sure_all)
|
||||
} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="mt5 fl">
|
||||
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
|
||||
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr20" onclick="$('#_file').click();">上传附件</a>
|
||||
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr20",:remote => true%>
|
||||
<% if defined?(has_program) && has_program %>
|
||||
<a href="javascript:void(0);" class="ProBtn fl mt3">编程</a>
|
||||
<span class="fl C_lgrey mt3 program_detail_info"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<% end %>
|
|
@ -45,9 +45,9 @@
|
|||
<div style="margin-top: 10px" >
|
||||
<div class="courseSendSubmit">
|
||||
<!--<a href="javascript:void(0);" class="sendSourceText" onclick="">确定</a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:class=>'sendSourceText' %>
|
||||
<%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
|
||||
</div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="closeModal();">取消</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" id="upload_files_cancle_btn" class="sendSourceText" onclick="closeModal();">取消</a></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -72,6 +72,23 @@ class Gitlab::Client
|
|||
post(url, :body => {:name => name}.merge(options))
|
||||
end
|
||||
|
||||
# Updates a project team member to a specified access level.
|
||||
# id (required) - The ID of a project
|
||||
# name (optional) - project name
|
||||
# path (optional) - repository name for project
|
||||
# description (optional) - short project description
|
||||
# default_branch (optional)
|
||||
# issues_enabled (optional)
|
||||
# merge_requests_enabled (optional)
|
||||
# wiki_enabled (optional)
|
||||
# snippets_enabled (optional)
|
||||
# public (optional) - if true same as setting visibility_level = 20
|
||||
# visibility_level (optional)
|
||||
|
||||
def edit_project(id, visibility_level)
|
||||
put("/projects/#{id}", :body => {:visibility_level => visibility_level})
|
||||
end
|
||||
|
||||
# Deletes a project.
|
||||
#
|
||||
# @example
|
||||
|
|
|
@ -10,6 +10,9 @@ module Trustie
|
|||
DEVELOPER = 30
|
||||
MASTER = 40
|
||||
OWNER = 50
|
||||
# 项目公开和私有
|
||||
PUBLIC = 20
|
||||
PRIVATE = 0
|
||||
end
|
||||
|
||||
class Sync
|
||||
|
@ -45,7 +48,8 @@ module Trustie
|
|||
issues_enabled: false,
|
||||
snippets_enabled: false,
|
||||
public: false,
|
||||
user_id: gid
|
||||
user_id: gid,
|
||||
visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE
|
||||
)
|
||||
project.gpid = gproject.id
|
||||
project.save!
|
||||
|
@ -84,7 +88,8 @@ module Trustie
|
|||
merge_requests_enabled: true,
|
||||
public: false,
|
||||
user_id: gid,
|
||||
import_url: import_url
|
||||
import_url: import_url,
|
||||
visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE
|
||||
)
|
||||
puts "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
project.gpid = gproject.id
|
||||
|
|
|
@ -22,7 +22,7 @@ function reload(fileSpan) {
|
|||
|
||||
}
|
||||
|
||||
function addFile_board(inputEl, file, eagerUpload, id) {
|
||||
function addFile_board(inputEl, file, eagerUpload, id,btnId) {
|
||||
|
||||
var attachments_frame = '#attachments_fields' + id;
|
||||
if ($(attachments_frame).children().length < 30) {
|
||||
|
@ -80,7 +80,7 @@ function addFile_board(inputEl, file, eagerUpload, id) {
|
|||
).appendTo(attachments_frame);
|
||||
|
||||
if (eagerUpload) {
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId);
|
||||
|
||||
}
|
||||
return attachmentId;
|
||||
|
@ -88,7 +88,7 @@ function addFile_board(inputEl, file, eagerUpload, id) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function addFile(inputEl, file, eagerUpload) {
|
||||
function addFile(inputEl, file, eagerUpload,btnId) {
|
||||
|
||||
var attachments_frame = '#attachments_fields';
|
||||
if ($(attachments_frame).children().length < 30) {
|
||||
|
@ -145,7 +145,7 @@ function addFile(inputEl, file, eagerUpload) {
|
|||
).appendTo('#attachments_fields');
|
||||
|
||||
if (eagerUpload) {
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId);
|
||||
|
||||
}
|
||||
return attachmentId;
|
||||
|
@ -154,7 +154,7 @@ function addFile(inputEl, file, eagerUpload) {
|
|||
}
|
||||
addFile.nextAttachmentId = 1;
|
||||
|
||||
function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
||||
function ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId) {
|
||||
|
||||
function onLoadstart(e) {
|
||||
fileSpan.removeClass('ajax-waiting');
|
||||
|
@ -168,7 +168,7 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
|||
}
|
||||
}
|
||||
|
||||
function actualUpload(file, attachmentId, fileSpan, inputEl) {
|
||||
function actualUpload(file, attachmentId, fileSpan, inputEl,btnId) {
|
||||
|
||||
ajaxUpload.uploading++;
|
||||
|
||||
|
@ -182,9 +182,15 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
|||
console.log($(inputEl))
|
||||
if(containerid == undefined ){
|
||||
var count = $('#attachments_fields>span').length;
|
||||
$('#'+btnId).removeAttr("disabled");
|
||||
$('#'+btnId).val('确定')
|
||||
$('#'+btnId).css('background-color','#269ac9')
|
||||
$('#upload_file_count').html("<span id=\"count\">" + count + "</span>" + $(inputEl).data('fileCount'));
|
||||
}
|
||||
else{
|
||||
$('#'+btnId).removeAttr("disabled");
|
||||
$('#'+btnId).val('确定')
|
||||
$('#'+btnId).css('background-color','#269ac9')
|
||||
var count = $('#attachments_fields' + containerid + '>span').length;
|
||||
$('#upload_file_count' + containerid).html("<span id=\"count\">" + count + "</span>" + $(inputEl).data('fileCount'));
|
||||
}
|
||||
|
@ -213,6 +219,9 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
|||
var containerid = $(inputEl).data('containerid');
|
||||
if (containerid == undefined) {
|
||||
var count = $('#attachments_fields>span').length;
|
||||
$('#'+btnId).attr("disabled",true);
|
||||
$('#'+btnId).val('提交中');
|
||||
$('#'+btnId).css('background-color','#c1c1c1')
|
||||
$('#upload_file_count').html("<span id=\"count\">" + count + "</span>" + $(inputEl).data('lebelFileUploding'));
|
||||
if (count >= 1) {
|
||||
var add_attachs = $('.add_attachment');
|
||||
|
@ -227,6 +236,9 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
|||
}
|
||||
} else {
|
||||
var count = $('#attachments_fields' + containerid + '>span').length;
|
||||
$('#'+btnId).attr("disabled",true);
|
||||
$('#'+btnId).val('提交中');
|
||||
$('#'+btnId).css('background-color','#c1c1c1')
|
||||
$('#upload_file_count' + containerid).html("<span id=\"count\">" + count + "</span>" + $(inputEl).data('lebelFileUploding'));
|
||||
if (count >= 1) {
|
||||
var add_attachs = $('.add_attachment').filter(function(index) {
|
||||
|
@ -258,7 +270,7 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
|||
var maxSyncUpload = $(inputEl).data('max-concurrent-uploads');
|
||||
|
||||
if (maxSyncUpload == null || maxSyncUpload <= 0 || ajaxUpload.uploading < maxSyncUpload)
|
||||
actualUpload(file, attachmentId, fileSpan, inputEl);
|
||||
actualUpload(file, attachmentId, fileSpan, inputEl,btnId);
|
||||
else
|
||||
$(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, attachmentId, fileSpan, inputEl));
|
||||
}
|
||||
|
@ -323,11 +335,11 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
|
|||
});
|
||||
}
|
||||
|
||||
function addInputFiles(inputEl) {
|
||||
function addInputFiles(inputEl,btnId) {
|
||||
// var clearedFileInput = $(inputEl).clone().val('');
|
||||
if (inputEl.files) {
|
||||
// upload files using ajax
|
||||
uploadAndAttachFiles(inputEl.files, inputEl);
|
||||
uploadAndAttachFiles(inputEl.files, inputEl,btnId);
|
||||
// $(inputEl).remove();
|
||||
} else {
|
||||
// browser not supporting the file API, upload on form submission
|
||||
|
@ -349,12 +361,12 @@ function addInputFiles(inputEl) {
|
|||
//clearedFileInput.insertAfter('#attachments_fields');
|
||||
}
|
||||
|
||||
function addInputFiles_board(inputEl, id) {
|
||||
function addInputFiles_board(inputEl, id,btnId) {
|
||||
// var clearedFileInput = $(inputEl).clone().val('');
|
||||
|
||||
if (inputEl.files) {
|
||||
// upload files using ajax
|
||||
uploadAndAttachFiles_board(inputEl.files, inputEl, id);
|
||||
uploadAndAttachFiles_board(inputEl.files, inputEl, id,btnId);
|
||||
// $(inputEl).remove();
|
||||
} else {
|
||||
// browser not supporting the file API, upload on form submission
|
||||
|
@ -374,7 +386,7 @@ function addInputFiles_board(inputEl, id) {
|
|||
//clearedFileInput.insertAfter('#attachments_fields');
|
||||
}
|
||||
|
||||
function uploadAndAttachFiles(files, inputEl) {
|
||||
function uploadAndAttachFiles(files, inputEl,btnId) {
|
||||
|
||||
var maxFileSize = $(inputEl).data('max-file-size');
|
||||
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
|
||||
|
@ -389,12 +401,12 @@ function uploadAndAttachFiles(files, inputEl) {
|
|||
window.alert(maxFileSizeExceeded);
|
||||
} else {
|
||||
$.each(files, function() {
|
||||
addFile(inputEl, this, true);
|
||||
addFile(inputEl, this, true,btnId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function uploadAndAttachFiles_board(files, inputEl, id) {
|
||||
function uploadAndAttachFiles_board(files, inputEl, id,btnId) {
|
||||
|
||||
var maxFileSize = $(inputEl).data('max-file-size');
|
||||
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
|
||||
|
@ -409,7 +421,7 @@ function uploadAndAttachFiles_board(files, inputEl, id) {
|
|||
window.alert(maxFileSizeExceeded);
|
||||
} else {
|
||||
$.each(files, function() {
|
||||
addFile_board(inputEl, this, true, id);
|
||||
addFile_board(inputEl, this, true, id,btnId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -482,10 +494,11 @@ $(function() {
|
|||
//课程课件
|
||||
function addInputFilesCourseSource(inputEl) {
|
||||
checkBox = arguments[1] == 'public' ? false : true;
|
||||
btnId = arguments[2];
|
||||
// var clearedFileInput = $(inputEl).clone().val('');
|
||||
if (inputEl.files) {
|
||||
// upload files using ajax
|
||||
uploadAndAttachFilesCourseSource(inputEl.files, inputEl,checkBox);
|
||||
uploadAndAttachFilesCourseSource(inputEl.files, inputEl,checkBox,btnId);
|
||||
// $(inputEl).remove();
|
||||
} else {
|
||||
// browser not supporting the file API, upload on form submission
|
||||
|
@ -507,7 +520,7 @@ function addInputFilesCourseSource(inputEl) {
|
|||
//clearedFileInput.insertAfter('#attachments_fields');
|
||||
}
|
||||
|
||||
function uploadAndAttachFilesCourseSource(files, inputEl,checkBox) {
|
||||
function uploadAndAttachFilesCourseSource(files, inputEl,checkBox,btnId) {
|
||||
|
||||
var maxFileSize = $(inputEl).data('max-file-size');
|
||||
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
|
||||
|
@ -522,12 +535,12 @@ function uploadAndAttachFilesCourseSource(files, inputEl,checkBox) {
|
|||
window.alert(maxFileSizeExceeded);
|
||||
} else {
|
||||
$.each(files, function() {
|
||||
addFileCourseSource(inputEl, this, true,checkBox);
|
||||
addFileCourseSource(inputEl, this, true,checkBox,btnId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function addFileCourseSource(inputEl, file, eagerUpload,checkBox) {
|
||||
function addFileCourseSource(inputEl, file, eagerUpload,checkBox,btnId) {
|
||||
|
||||
var attachments_frame = '#attachments_fields';
|
||||
if ($(attachments_frame).children().length < 30) {
|
||||
|
@ -606,7 +619,7 @@ function addFileCourseSource(inputEl, file, eagerUpload,checkBox) {
|
|||
}
|
||||
|
||||
if (eagerUpload) {
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId);
|
||||
|
||||
}
|
||||
return attachmentId;
|
||||
|
|
|
@ -1128,3 +1128,15 @@ a.postRouteLink:hover {text-decoration:underline;}
|
|||
.syllabusSettingIcon:hover {cursor: pointer}
|
||||
|
||||
.pic_files{display:block; background:url(../images/public_icon.png) 0px -578px no-repeat; width:20px; height:15px;}
|
||||
|
||||
/*确定按钮*/
|
||||
input.sendSourceText {
|
||||
font-size: 14px;
|
||||
color: #ffffff;
|
||||
background-color: #269ac9;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
border: none;
|
||||
width: 50px;
|
||||
height: 25px;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue