Fix for upload image component in announcement

This commit is contained in:
Christophe Vilayphiou 2012-04-24 12:41:28 +08:00
parent 8bf55a184e
commit c856b4cdce
4 changed files with 35 additions and 25 deletions

View File

@ -75,27 +75,24 @@
</div>
<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3>
<div class="widget-content clear">
<div class="control-group">
<div class="upload-picture">
<!--請程式務必將圖片尺寸加入到行內裡-->
<%= image_tag @ad_image.file rescue ''%>
</div>
<span class="alert widgetInfo">此區塊圖片尺寸請使用580px × 225px</span>
<div class="controls file-upload input-prepend">
<label class="control-label add-on btn" for="input-upload">
Choose file
<%= f.file_field :file,:id=>"input-upload",:class => "upload", :onchange=> "document.getElementById('fu1').innerHTML = this.form.fu1.value = this.value;" %>
</label>
<span id="fu1" class="file-name"></span>
<br>
<input name="fu1" class="input-medium" type="text">
</div>
<div class="control-group">
<div class="upload-picture">
<!--請程式務必將圖片尺寸加入到行內裡-->
<%= image_tag @ad_image.file rescue ''%>
</div>
<span class="alert widgetInfo">此區塊圖片尺寸請使用580px × 225px</span>
<div class="controls file-upload input-prepend">
<label class="control-label add-on btn" for="input-upload">
Choose file
<%= f.file_field :file,:id=>"input-upload",:class => "upload", :onchange=> "document.getElementById('fu1').innerHTML = this.form.fu1.value = this.value;" %>
</label>
<span id="fu1" class="file-name"></span>
<br>
<input name="fu1" class="input-medium" type="text">
</div>
</div>
</div>
</div>
<div id="widget-type" class="widget-box">
<div class="widget-action clear">

View File

@ -9,6 +9,7 @@ en:
account_settings: Account settings
add: Add
back: Back
browse: Browse
cancel: Cancel
create: Create
delete: Delete

View File

@ -6,6 +6,7 @@ zh_tw:
account_settings: 帳號設定
add: 新增
back: 回上一步
browse: 選擇檔案
cancel: 取消
create: 創建
delete: 刪除

View File

@ -4,23 +4,31 @@
<%= f.error_messages %>
<div id="sub-wiget">
<div id="widget-picture" class="widget-box widget-size-300">
<div id="widget-picture" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3>
<div class="widget-content clear">
<div class="control-group">
<img class="pull-left upload-picture" src="/assets/default-img.png" />
<div class="controls file-upload">
<label class="control-label btn" for="input-upload">
Browse/選擇檔案
<!-- <img class="pull-left upload-picture" src="/assets/default-img.png" /> -->
<div class="upload-picture">
<!--請程式務必將圖片尺寸加入到行內裡-->
<% if @bulletin.image %>
<%= image_tag @bulletin.image, :width=> "456", :height=>'700' rescue ''%>
<% else %>
<img class="pull-left upload-picture" src="/assets/default-img.png" />
<% end %>
</div>
<div class="controls file-upload input-prepend">
<label class="control-label add-on btn" for="input-upload">
<%= t(:browse) %>
<%= f.file_field :image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
</label>
<span id='fu' class="file-name"></span>
<br>
<input name='fu' class="input-large" type="text">
<input name='fu' class="input-medium" type="text">
<br>
<% if @bulletin.image.file %>
<%= f.check_box :remove_image %>
@ -31,6 +39,8 @@
</div>
</div>
<div id="widget-date" class="widget-box widget-size-300">
<div class="widget-action clear">
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
@ -281,6 +291,7 @@
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %>
<%= javascript_include_tag "inc/jquery.imagesloaded" %>
<script>
$('#add_bulletin_link a.add').live('click', function(){
var new_id = $(this).prev().attr('value');