diff options
| author | hukl <contact@smyck.org> | 2009-04-24 11:43:08 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-04-25 14:55:27 +0200 |
| commit | cf1b60e0cfa7d1a8f4a80d686649cc12e73a634e (patch) | |
| tree | b68bd845d290ce968892c4532bcff52083925834 /app/views/assets | |
| parent | b2b78c06074046bd73cc3408a29386a976f0469c (diff) | |
Integrated basic Asset upload functionality. You can upload files now and use their url in pages.
Diffstat (limited to 'app/views/assets')
| -rw-r--r-- | app/views/assets/edit.html.erb | 12 | ||||
| -rw-r--r-- | app/views/assets/index.html.erb | 20 | ||||
| -rw-r--r-- | app/views/assets/new.html.erb | 17 | ||||
| -rw-r--r-- | app/views/assets/show.html.erb | 10 |
4 files changed, 59 insertions, 0 deletions
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 @@ | |||
| 1 | <h1>Editing asset</h1> | ||
| 2 | |||
| 3 | <% form_for(@asset) do |f| %> | ||
| 4 | <%= f.error_messages %> | ||
| 5 | |||
| 6 | <p> | ||
| 7 | <%= f.submit 'Update' %> | ||
| 8 | </p> | ||
| 9 | <% end %> | ||
| 10 | |||
| 11 | <%= link_to 'Show', @asset %> | | ||
| 12 | <%= 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 @@ | |||
| 1 | <% content_for :subnavigation do %> | ||
| 2 | <%= link_to 'New asset', new_asset_path %> | ||
| 3 | <% end %> | ||
| 4 | |||
| 5 | |||
| 6 | <table> | ||
| 7 | <tr> | ||
| 8 | </tr> | ||
| 9 | |||
| 10 | <% @assets.each do |asset| %> | ||
| 11 | <tr> | ||
| 12 | <td><%= image_tag asset.upload.url(:thumb) %></td> | ||
| 13 | <td><%= link_to asset.name, asset.upload.url %></td> | ||
| 14 | <td><%= asset.upload.content_type %></td> | ||
| 15 | <td><%= link_to 'Show', asset %></td> | ||
| 16 | <td><%= link_to 'Edit', edit_asset_path(asset) %></td> | ||
| 17 | <td><%= link_to 'Destroy', asset, :confirm => 'Are you sure?', :method => :delete %></td> | ||
| 18 | </tr> | ||
| 19 | <% end %> | ||
| 20 | </table> \ 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 @@ | |||
| 1 | <h1>New asset</h1> | ||
| 2 | |||
| 3 | <% form_for(@asset, :html => { :multipart => true }) do |f| %> | ||
| 4 | <%= f.error_messages %> | ||
| 5 | |||
| 6 | <p> | ||
| 7 | <%= f.label :name %><br /> | ||
| 8 | <%= f.text_field :name %> | ||
| 9 | </p> | ||
| 10 | |||
| 11 | <p> | ||
| 12 | <%= f.file_field :upload %> | ||
| 13 | <%= f.submit 'Create' %> | ||
| 14 | </p> | ||
| 15 | <% end %> | ||
| 16 | |||
| 17 | <%= 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 @@ | |||
| 1 | <% content_for :subnavigation do %> | ||
| 2 | <%= link_to 'Edit', edit_asset_path(@asset) %> | ||
| 3 | <%= link_to 'Back', assets_path %> | ||
| 4 | <% end %> | ||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | <%= image_tag @asset.upload.url(:medium) %><br /> | ||
| 9 | <%= @asset.upload.content_type %><br /> | ||
| 10 | <%= "#{@asset.upload.size/1024} KB" %><br /> \ No newline at end of file | ||
