Add asset model and controller
This commit is contained in:
1 parent
d5c5200b71
commit
a19e0dba6c
15 files changed
+290
-2
No files matched your search
@@ -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>
|
||||
@@ -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 %>
|
||||
@@ -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' %>
|
||||
@@ -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 %>
|
||||
@@ -22,6 +22,7 @@
|
||||
<li><%= link_to t(:home, :scope => :admin), root_path %></li>
|
||||
<li><%= link_to t(:item, :scope => :admin), admin_items_path %></li>
|
||||
<li><%= link_to t(:layout, :scope => :admin), admin_layouts_path %></li>
|
||||
<li><%= link_to t(:asset, :scope => :admin), admin_assets_path %></li>
|
||||
<li><%= link_to t(:announcement, :scope => :admin), panel_announcements_path( :entry_name => 'news' ) %></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user