Merge branch 'guange_dev' into szzh
This commit is contained in:
commit
2a558c924f
|
@ -125,9 +125,9 @@
|
|||
:file_count => l(:label_file_count),
|
||||
:delete_all_files => l(:text_are_you_sure_all)
|
||||
} %>
|
||||
<% if container.nil? %>
|
||||
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
||||
<% end %>
|
||||
<% if defined?(container) %>
|
||||
<span id="upload_file_count" class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
||||
<% end %>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
|
||||
</div>
|
||||
</span>
|
||||
<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
|
||||
<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
|
||||
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
|
||||
<span><%= l(:button_upload_photo) %></span>
|
||||
</a>
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
:size => "1",
|
||||
:multiple => true,
|
||||
: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_file_size => Setting.upload_avatar_max_size,
|
||||
:max_file_size_message => l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:file_type => Redmine::Configuration['pic_types'].to_s,
|
||||
:type_support_message => l(:error_pic_type),
|
||||
|
|
|
@ -1520,3 +1520,5 @@ en:
|
|||
label_no_courses: You do not participate in any course, please search the curriculum, course, or create a course!
|
||||
label_commit_failed: commit failed
|
||||
#api end
|
||||
error_upload_avatar_to_large: "too big (%{max_size})"
|
||||
|
||||
|
|
|
@ -1983,3 +1983,4 @@ zh:
|
|||
label_media: 媒体
|
||||
label_code: 代码
|
||||
|
||||
error_upload_avatar_to_large: "超过大小限制 (%{max_size})"
|
||||
|
|
|
@ -60,7 +60,9 @@ per_page_options:
|
|||
default: '25,50,100'
|
||||
mail_from:
|
||||
default: trustieforge@gmail.com
|
||||
|
||||
upload_avatar_max_size:
|
||||
format: int
|
||||
default: 5242880
|
||||
### delayjob for send email.
|
||||
delayjob_enabled:
|
||||
default: 1
|
||||
|
|
|
@ -1,28 +1,44 @@
|
|||
$(function() {
|
||||
var $upload_file = $('.upload_file');
|
||||
var validateImage = function(file){
|
||||
if(!/^image\//.test(file.type)){
|
||||
alert($upload_file.attr("data-type-support-message") + $upload_file.attr("data-file-type"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
function endsWith(str, suffix) {
|
||||
return str.indexOf(suffix, str.length - suffix.length) !== -1;
|
||||
}
|
||||
var validateImage = function(file) {
|
||||
var types = $upload_file.attr('data-file-type').split(",");
|
||||
var check = false;
|
||||
$.each(types, function(n, e) {
|
||||
if (endsWith(file.name, e)) {
|
||||
check = true;
|
||||
}
|
||||
});
|
||||
if (!check) {
|
||||
alert($upload_file.attr("data-type-support-message") + $upload_file.attr("data-file-type"));
|
||||
return false;
|
||||
}
|
||||
if (file.size && file.size > parseInt($upload_file.attr('data-max-file-size'))) {
|
||||
alert($upload_file.attr("data-max-file-size-message"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
$('.upload_file').fileupload({
|
||||
url: '/upload_avatar.json?source_type=' + $('.upload_file').attr('data-source-type') +
|
||||
'&source_id=' + $('.upload_file').attr('data-source-id'),
|
||||
add: function(e,data){
|
||||
if(!validateImage(data.files[0])){
|
||||
return false;
|
||||
}
|
||||
data.submit();
|
||||
add: function(e, data) {
|
||||
if (!validateImage(data.files[0])) {
|
||||
return false;
|
||||
}
|
||||
data.submit();
|
||||
},
|
||||
formData: function(form) {
|
||||
var data = form.serializeArray();
|
||||
var auth = null;
|
||||
for(var key in data){
|
||||
if(data[key].name == "authenticity_token"){
|
||||
auth = data[key];break;
|
||||
}
|
||||
for (var key in data) {
|
||||
if (data[key].name == "authenticity_token") {
|
||||
auth = data[key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return [auth];
|
||||
},
|
||||
|
|
|
@ -1598,7 +1598,8 @@ blockquote {
|
|||
margin-right: 0.4em;
|
||||
border-radius: 4px;
|
||||
font-family: "Microsoft YaHei";
|
||||
background: url('../images/requirements/reference.jpg')
|
||||
background: url('../images/requirements/reference.jpg');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
blockquote blockquote { margin-left: 0;}
|
||||
|
@ -2780,4 +2781,4 @@ div.repos_explain{
|
|||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.upload_img img{max-width: 580px;width: 100%;}
|
||||
.upload_img img{max-width: 100%;}
|
||||
|
|
|
@ -487,6 +487,7 @@ blockquote {
|
|||
border-radius: 4px;
|
||||
font-family: "Microsoft YaHei";
|
||||
background: url('../images/requirements/reference.jpg');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
a.member_search_edit {width: 43px;background: #15bccf;color: #fff;text-align: center;text-decoration: none;padding: 2px;}
|
||||
.min_search_edit {width: 150px;height: 20px;border: 1px solid #d0d0d0 !important;color: #666;}
|
||||
|
|
|
@ -388,6 +388,7 @@ blockquote {
|
|||
border-radius: 4px;
|
||||
font-family: "Microsoft YaHei";
|
||||
background: url(http://test.forge.trustie.net/images/requirements/xreference.jpg.pagespeed.ic.h4inUJNyH0.jpg);
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
/*上传项目图片*/
|
||||
.upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer}
|
||||
|
|
Loading…
Reference in New Issue