修改头像、logo上传进度条显示

This commit is contained in:
wanglinchun 2013-08-12 22:05:27 +08:00
parent 62ff95c4af
commit 9bb6f648e5
3 changed files with 14 additions and 14 deletions

View File

@ -3,7 +3,7 @@
.btn_addPic
{
position: relative;
left: 85px;
left: 15px;
height: 17px;
width: 50px;
overflow: hidden;
@ -31,22 +31,21 @@
.file_selector
{
position: relative;
padding-left:13px;
opacity: 0;
filter: alpha(opacity:0);
}
</style>
<span id="avatar_fields">
<%= image_tag(url_to_avatar(source), id: "avatar_image", size: AvatarHelper::AVATAR_SIZE)%>
<span id="avatar_file">
</span>
<div>
<span id="attachments_fields">
<%= image_tag(url_to_avatar(source), id: "avatar_image", size: AvatarHelper::AVATAR_SIZE,:class=>"avatar")%>
<div id="avatar_file" style="width: 100px">
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
</div>
</span>
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
<span><%= l(:button_upload_photo) %></span>
</a>
<span class="add_avatar" style="width:20px;">
<span class="add_avatar" style="margin-left: -55px;width: 70px">
<%= file_field_tag 'avatar[image]',
:id => nil,
:class => 'file_selector',
@ -64,7 +63,7 @@
:source_id => source.id.to_s
} %>
</span>
</div>
<% content_for :header_tags do %>
<%= javascript_include_tag 'avatars' %>
<% end %>

View File

@ -1,5 +1,5 @@
<div class="box tabular" style="margin-right:10px;" >
<p><%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %></p>
<div style="padding-left: 100px"><%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %></div>
<%= labelled_form_for @project do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %>

View File

@ -41,7 +41,8 @@ function ajaxUpload(file, fileSpan, inputEl) {
progressEventHandler: onProgress.bind(progressSpan)
})
.done(function(result) {
progressSpan.progressbar( 'value', 100 ).remove();
progressSpan.progressbar( 'value', 100 );
progressSpan.progressbar( 'destroy');
fileSpan.find('input.description, a').css('display', 'inline-block');
})
.fail(function(result) {
@ -57,7 +58,7 @@ function ajaxUpload(file, fileSpan, inputEl) {
});
}
var progressSpan = fileSpan.append('<div>');
var progressSpan = $('#upload_progressbar');
progressSpan.progressbar();
fileSpan.addClass('ajax-waiting');