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

View File

@ -1,5 +1,5 @@
<div class="box tabular" style="margin-right:10px;" > <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| %> <%= labelled_form_for @project do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>

View File

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