tags: image and css - show ID in assets/index
This commit is contained in:
		
							parent
							
								
									49e6509a51
								
							
						
					
					
						commit
						25752b7065
					
				|  | @ -54,6 +54,24 @@ module Parser | ||||||
|             tag.attr[I18n.locale.to_s] rescue nil |             tag.attr[I18n.locale.to_s] rescue nil | ||||||
|         end |         end | ||||||
|       end |       end | ||||||
|  |       c.define_tag 'css' do |tag| | ||||||
|  |         assets = Asset.any_in(:filename => tag.attr['name'].split(',').map(&:strip)) | ||||||
|  |         res = '' | ||||||
|  |         assets.each do |asset| | ||||||
|  |           res << "<link href='#{asset.data.file.url}' rel='stylesheet' type='text/css' /> " if asset.data.file.content_type.eql?('text/css') | ||||||
|  |         end | ||||||
|  |         res | ||||||
|  |       end | ||||||
|  |       c.define_tag 'image' do |tag| | ||||||
|  |         asset = Asset.find(tag.attr['id']) | ||||||
|  |         if asset | ||||||
|  |           res = "<img src=#{asset.data.file.url} " | ||||||
|  |           tag.attr.each do |l| | ||||||
|  |             res << "#{l[0]}=#{l[1]} " | ||||||
|  |           end | ||||||
|  |           res << '>' | ||||||
|  |         end | ||||||
|  |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|    |    | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ | ||||||
| 
 | 
 | ||||||
| <table> | <table> | ||||||
|   <tr> |   <tr> | ||||||
|  |       <th><%= t('admin.id') %></th> | ||||||
|       <th><%= t('admin.file_name') %></th> |       <th><%= t('admin.file_name') %></th> | ||||||
|       <th><%= t('admin.description') %></th> |       <th><%= t('admin.description') %></th> | ||||||
|       <th><%= t('admin.format') %></th> |       <th><%= t('admin.format') %></th> | ||||||
|  | @ -18,6 +19,7 @@ | ||||||
| 
 | 
 | ||||||
| <% @assets.each do |asset| %> | <% @assets.each do |asset| %> | ||||||
|   <tr> |   <tr> | ||||||
|  |     <td><%= asset.id %></td> | ||||||
|     <td><%= link_to asset.filename, asset.data.url, :target => '_blank' %></td> |     <td><%= link_to asset.filename, asset.data.url, :target => '_blank' %></td> | ||||||
|     <td><%= asset.description %></td> |     <td><%= asset.description %></td> | ||||||
|     <td><%= asset.data.file.content_type %></td> |     <td><%= asset.data.file.content_type %></td> | ||||||
|  |  | ||||||
|  | @ -50,6 +50,7 @@ en: | ||||||
|     file_name: Filename |     file_name: Filename | ||||||
|     file_size: File size |     file_size: File size | ||||||
|     format: Format |     format: Format | ||||||
|  |     id: ID | ||||||
|     is_published: Is published |     is_published: Is published | ||||||
|     item: Item |     item: Item | ||||||
|     key: Key |     key: Key | ||||||
|  |  | ||||||
|  | @ -47,6 +47,7 @@ zh_tw: | ||||||
|     file_name: 檔名 |     file_name: 檔名 | ||||||
|     file_size: 檔案大小 |     file_size: 檔案大小 | ||||||
|     format: 格式 |     format: 格式 | ||||||
|  |     id: ID | ||||||
|     is_published: 被出版 |     is_published: 被出版 | ||||||
|     item: 項目 |     item: 項目 | ||||||
|     key: 關鍵 |     key: 關鍵 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue