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/admin/_menu.html.erb | 1 + 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 ++++++++++ app/views/layouts/assets.html.erb | 17 +++++++++++++++++ 6 files changed, 77 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 create mode 100644 app/views/layouts/assets.html.erb (limited to 'app/views') diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index 8f48822..5ae4307 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -2,4 +2,5 @@ <%= link_to 'Overview', :controller => :admin, :action => 'index' %> <%= link_to 'Nodes', nodes_path, selected?('nodes') %> +<%= link_to 'Assets', assets_path, selected?('assets') %> <%= link_to 'User', users_path, selected?('users') %> > \ No newline at end of file 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 diff --git a/app/views/layouts/assets.html.erb b/app/views/layouts/assets.html.erb new file mode 100644 index 0000000..9d629c8 --- /dev/null +++ b/app/views/layouts/assets.html.erb @@ -0,0 +1,17 @@ + + + + + + Assets: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + + + +

<%= flash[:notice] %>

+ +<%= yield %> + + + -- cgit v1.3