Add asset model and controller

This commit is contained in:
Wen-Tien Chang committed 2010-02-01 17:24:28 +08:00
1 parent d5c5200b71
commit a19e0dba6c
15 files changed
+290 -2

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
<%= f.error_messages %>
<p>
<%= f.label :filename, "FileName" %>
<%= f.text_field :filename, :class => 'text' %>
</p>
<p>
<%= f.label :description, "Description" %>
<%= f.text_field :description, :class => 'text' %>
</p>
<p>
<%= f.label :data, "Data" %>
<%= f.file_field :data %>
</p>
+12
View File
@@ -0,0 +1,12 @@
<h1>Editing assets</h1>
<% form_for @asset, :url => admin_asset_path(@asset), :html => { :multipart => true } do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Back', admin_assets_path %>
+29
View File
@@ -0,0 +1,29 @@
<h1>Listing assets</h1>
<table>
<tr>
<th>檔案</th>
<th>描述</th>
<th>格式</th>
<th>原上傳檔名</th>
<th>檔案大小</th>
<th></th>
<th></th>
</tr>
<% @assets.each do |asset| %>
<tr>
<td><%= link_to asset.filename, admin_asset_path(asset) %></td>
<td><%= asset.description %></td>
<td><%= asset.data.content_type %></td>
<td><%= asset.data.file_name %></td>
<td><%= number_to_human_size(asset.data.file_size) %></td>
<td><%= link_to t(:edit), edit_admin_asset_path(asset) %></td>
<td><%= link_to t(:delete), admin_asset_path(asset), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to t(:new_asset, :scope => :admin), new_admin_asset_path, :class => 'button positive' %>
+11
View File
@@ -0,0 +1,11 @@
<h1>New Asset</h1>
<% form_for :asset, :url => admin_assets_path, :html => { :multipart => true } do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>