From cf1b60e0cfa7d1a8f4a80d686649cc12e73a634e Mon Sep 17 00:00:00 2001 From: hukl Date: Fri, 24 Apr 2009 11:43:08 +0200 Subject: Integrated basic Asset upload functionality. You can upload files now and use their url in pages. --- app/views/assets/edit.html.erb | 12 ++++++++++++ app/views/assets/index.html.erb | 20 ++++++++++++++++++++ app/views/assets/new.html.erb | 17 +++++++++++++++++ app/views/assets/show.html.erb | 10 ++++++++++ 4 files changed, 59 insertions(+) create mode 100644 app/views/assets/edit.html.erb create mode 100644 app/views/assets/index.html.erb create mode 100644 app/views/assets/new.html.erb create mode 100644 app/views/assets/show.html.erb (limited to 'app/views/assets') diff --git a/app/views/assets/edit.html.erb b/app/views/assets/edit.html.erb new file mode 100644 index 0000000..d60db94 --- /dev/null +++ b/app/views/assets/edit.html.erb @@ -0,0 +1,12 @@ +

Editing asset

+ +<% form_for(@asset) do |f| %> + <%= f.error_messages %> + +

+ <%= f.submit 'Update' %> +

+<% end %> + +<%= link_to 'Show', @asset %> | +<%= link_to 'Back', assets_path %> \ No newline at end of file diff --git a/app/views/assets/index.html.erb b/app/views/assets/index.html.erb new file mode 100644 index 0000000..c9be684 --- /dev/null +++ b/app/views/assets/index.html.erb @@ -0,0 +1,20 @@ +<% content_for :subnavigation do %> + <%= link_to 'New asset', new_asset_path %> +<% end %> + + + + + + +<% @assets.each do |asset| %> + + + + + + + + +<% end %> +
<%= image_tag asset.upload.url(:thumb) %><%= link_to asset.name, asset.upload.url %><%= asset.upload.content_type %><%= link_to 'Show', asset %><%= link_to 'Edit', edit_asset_path(asset) %><%= link_to 'Destroy', asset, :confirm => 'Are you sure?', :method => :delete %>
\ No newline at end of file diff --git a/app/views/assets/new.html.erb b/app/views/assets/new.html.erb new file mode 100644 index 0000000..366488f --- /dev/null +++ b/app/views/assets/new.html.erb @@ -0,0 +1,17 @@ +

New asset

+ +<% form_for(@asset, :html => { :multipart => true }) do |f| %> + <%= f.error_messages %> + +

+ <%= f.label :name %>
+ <%= f.text_field :name %> +

+ +

+ <%= f.file_field :upload %> + <%= f.submit 'Create' %> +

+<% end %> + +<%= link_to 'Back', assets_path %> \ No newline at end of file diff --git a/app/views/assets/show.html.erb b/app/views/assets/show.html.erb new file mode 100644 index 0000000..dd657d3 --- /dev/null +++ b/app/views/assets/show.html.erb @@ -0,0 +1,10 @@ +<% content_for :subnavigation do %> + <%= link_to 'Edit', edit_asset_path(@asset) %> + <%= link_to 'Back', assets_path %> +<% end %> + + + +<%= image_tag @asset.upload.url(:medium) %>
+<%= @asset.upload.content_type %>
+<%= "#{@asset.upload.size/1024} KB" %>
\ No newline at end of file -- cgit v1.3