Fix for upload image component in announcement
This commit is contained in:
		
							parent
							
								
									8bf55a184e
								
							
						
					
					
						commit
						c856b4cdce
					
				|  | @ -84,13 +84,10 @@ | ||||||
|             <div class="controls file-upload input-prepend"> |             <div class="controls file-upload input-prepend"> | ||||||
|               <label class="control-label add-on btn" for="input-upload"> |               <label class="control-label add-on btn" for="input-upload"> | ||||||
| 								Choose file | 								Choose file | ||||||
| 									 |  | ||||||
| 								<%= f.file_field :file,:id=>"input-upload",:class => "upload", :onchange=> "document.getElementById('fu1').innerHTML = this.form.fu1.value = this.value;" %> | 								<%= f.file_field :file,:id=>"input-upload",:class => "upload", :onchange=> "document.getElementById('fu1').innerHTML = this.form.fu1.value = this.value;" %> | ||||||
| 							</label> | 							</label> | ||||||
| 							<span id="fu1" class="file-name"></span> | 							<span id="fu1" class="file-name"></span> | ||||||
| 							<br> | 							<br> | ||||||
| 
 |  | ||||||
| 								 |  | ||||||
| 							<input name="fu1" class="input-medium" type="text"> | 							<input name="fu1" class="input-medium" type="text"> | ||||||
| 						</div> | 						</div> | ||||||
| 					</div> | 					</div> | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ en: | ||||||
|   account_settings: Account settings |   account_settings: Account settings | ||||||
|   add: Add |   add: Add | ||||||
|   back: Back |   back: Back | ||||||
|  |   browse: Browse | ||||||
|   cancel: Cancel |   cancel: Cancel | ||||||
|   create: Create |   create: Create | ||||||
|   delete: Delete |   delete: Delete | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ zh_tw: | ||||||
|   account_settings: 帳號設定 |   account_settings: 帳號設定 | ||||||
|   add: 新增 |   add: 新增 | ||||||
|   back: 回上一步 |   back: 回上一步 | ||||||
|  |   browse: 選擇檔案 | ||||||
|   cancel: 取消 |   cancel: 取消 | ||||||
|   create: 創建 |   create: 創建 | ||||||
|   delete: 刪除 |   delete: 刪除 | ||||||
|  |  | ||||||
|  | @ -4,23 +4,31 @@ | ||||||
| 	<%= f.error_messages %> | 	<%= f.error_messages %> | ||||||
| 	 | 	 | ||||||
| 	<div id="sub-wiget"> | 	<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"> | 			<div class="widget-action clear"> | ||||||
| 				<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a> | 				<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a> | ||||||
| 			</div> | 			</div> | ||||||
| 			<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3> | 			<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3> | ||||||
| 			<div class="widget-content clear"> | 			<div class="widget-content clear"> | ||||||
| 				<div class="control-group"> | 				<div class="control-group"> | ||||||
|  |            <!-- <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" /> |               	<img class="pull-left upload-picture" src="/assets/default-img.png" /> | ||||||
|  |               <% end %> | ||||||
| 
 | 
 | ||||||
| 					<div class="controls file-upload"> |           </div> | ||||||
| 					<label class="control-label btn" for="input-upload"> | 					<div class="controls file-upload input-prepend"> | ||||||
| 						Browse/選擇檔案 | 					<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;" %> | 						<%= f.file_field :image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %> | ||||||
| 					</label> | 					</label> | ||||||
| 					<span id='fu' class="file-name"></span> | 					<span id='fu' class="file-name"></span> | ||||||
| 					<br> | 					<br> | ||||||
| 					<input name='fu' class="input-large" type="text"> | 					<input name='fu' class="input-medium" type="text"> | ||||||
| 					<br> | 					<br> | ||||||
| 					<% if @bulletin.image.file %> | 					<% if @bulletin.image.file %> | ||||||
| 					  <%= f.check_box :remove_image %> | 					  <%= f.check_box :remove_image %> | ||||||
|  | @ -31,6 +39,8 @@ | ||||||
| 			</div> | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 		<div id="widget-date" class="widget-box widget-size-300"> | 		<div id="widget-date" class="widget-box widget-size-300"> | ||||||
| 			<div class="widget-action clear"> | 			<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> | 				<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 %> | <% content_for :page_specific_javascript do %> | ||||||
| 	<%= javascript_include_tag "bulletin_form" %> | 	<%= javascript_include_tag "bulletin_form" %> | ||||||
|  | 	<%= javascript_include_tag "inc/jquery.imagesloaded" %> | ||||||
| 	<script> | 	<script> | ||||||
| 		$('#add_bulletin_link a.add').live('click', function(){ | 		$('#add_bulletin_link a.add').live('click', function(){ | ||||||
| 			var new_id = $(this).prev().attr('value'); | 			var new_id = $(this).prev().attr('value'); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue