diff options
Diffstat (limited to 'app/views/assets')
| -rw-r--r-- | app/views/assets/edit.html.erb | 20 | ||||
| -rw-r--r-- | app/views/assets/index.html.erb | 6 | ||||
| -rw-r--r-- | app/views/assets/new.html.erb | 6 | ||||
| -rw-r--r-- | app/views/assets/show.html.erb | 4 |
4 files changed, 24 insertions, 12 deletions
diff --git a/app/views/assets/edit.html.erb b/app/views/assets/edit.html.erb index d60db94..f198600 100644 --- a/app/views/assets/edit.html.erb +++ b/app/views/assets/edit.html.erb | |||
| @@ -1,12 +1,24 @@ | |||
| 1 | <h1>Editing asset</h1> | 1 | <h1>Editing asset</h1> |
| 2 | 2 | ||
| 3 | <% form_for(@asset) do |f| %> | 3 | <%= form_for(@asset, html: { multipart: true }) do |f| %> |
| 4 | <%= f.error_messages %> | 4 | <%= form_error_messages(f) %> |
| 5 | |||
| 6 | <% if @asset.upload.present? %> | ||
| 7 | <p> | ||
| 8 | <strong>Current file:</strong> | ||
| 9 | <%= @asset.upload.url %> | ||
| 10 | (<%= number_to_human_size(@asset.upload.size) %>) | ||
| 11 | </p> | ||
| 12 | <% end %> | ||
| 13 | |||
| 14 | <p> | ||
| 15 | <label>Replace file:</label><br> | ||
| 16 | <%= f.file_field :upload %> | ||
| 17 | </p> | ||
| 5 | 18 | ||
| 6 | <p> | 19 | <p> |
| 7 | <%= f.submit 'Update' %> | 20 | <%= f.submit 'Update' %> |
| 8 | </p> | 21 | </p> |
| 9 | <% end %> | 22 | <% end %> |
| 10 | 23 | ||
| 11 | <%= link_to 'Show', @asset %> | | 24 | <%= link_to 'Show', @asset %> | <%= link_to 'Back', assets_path %> |
| 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 index fc7c029..51fc486 100644 --- a/app/views/assets/index.html.erb +++ b/app/views/assets/index.html.erb | |||
| @@ -10,12 +10,12 @@ | |||
| 10 | </tr> | 10 | </tr> |
| 11 | <% @assets.each do |asset| %> | 11 | <% @assets.each do |asset| %> |
| 12 | <tr> | 12 | <tr> |
| 13 | <td><%= image_tag asset.upload.url(:thumb) %></td> | 13 | <td><%= image_tag asset.upload.url(:thumb), style: "max-width: 100px; max-height: 100px;" %></td> |
| 14 | <td><%= link_to asset.name, asset.upload.url %></td> | 14 | <td><%= link_to asset.name, asset.upload.url %></td> |
| 15 | <td><%= asset.upload.content_type %></td> | 15 | <td><%= asset.upload.content_type %></td> |
| 16 | <td><%= link_to 'Show', asset %></td> | 16 | <td><%= link_to 'Show', asset %></td> |
| 17 | <td><%= link_to 'Edit', edit_asset_path(asset) %></td> | 17 | <td><%= link_to 'Edit', edit_asset_path(asset) %></td> |
| 18 | <td><%= link_to 'Destroy', asset, :confirm => 'Are you sure?', :method => :delete %></td> | 18 | <td><%= button_to 'Destroy', asset, method: :delete, form: { data: { confirm: 'Are you sure?' } } %></td> |
| 19 | </tr> | 19 | </tr> |
| 20 | <% end %> | 20 | <% end %> |
| 21 | </table> \ No newline at end of file | 21 | </table> |
diff --git a/app/views/assets/new.html.erb b/app/views/assets/new.html.erb index 366488f..6c1310a 100644 --- a/app/views/assets/new.html.erb +++ b/app/views/assets/new.html.erb | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | <h1>New asset</h1> | 1 | <h1>New asset</h1> |
| 2 | 2 | ||
| 3 | <% form_for(@asset, :html => { :multipart => true }) do |f| %> | 3 | <%= form_for(@asset, :html => { :multipart => true }) do |f| %> |
| 4 | <%= f.error_messages %> | 4 | <%= form_error_messages(f) %> |
| 5 | 5 | ||
| 6 | <p> | 6 | <p> |
| 7 | <%= f.label :name %><br /> | 7 | <%= f.label :name %><br /> |
| @@ -14,4 +14,4 @@ | |||
| 14 | </p> | 14 | </p> |
| 15 | <% end %> | 15 | <% end %> |
| 16 | 16 | ||
| 17 | <%= link_to 'Back', assets_path %> \ No newline at end of file | 17 | <%= link_to 'Back', assets_path %> |
diff --git a/app/views/assets/show.html.erb b/app/views/assets/show.html.erb index a64987c..694be5a 100644 --- a/app/views/assets/show.html.erb +++ b/app/views/assets/show.html.erb | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | <table> | 6 | <table> |
| 7 | <tr> | 7 | <tr> |
| 8 | <td>Thumbnail</td> | 8 | <td>Thumbnail</td> |
| 9 | <td><%= image_tag @asset.upload.url(:medium) %></td> | 9 | <td><%= image_tag @asset.upload.url(:medium), style: "max-width: 300px; max-height: 300px;" %></td> |
| 10 | </tr> | 10 | </tr> |
| 11 | <tr> | 11 | <tr> |
| 12 | <td>Public Path</td> | 12 | <td>Public Path</td> |
| @@ -20,4 +20,4 @@ | |||
| 20 | <td>Size</td> | 20 | <td>Size</td> |
| 21 | <td><%= "#{@asset.upload.size/1024} KB" %></td> | 21 | <td><%= "#{@asset.upload.size/1024} KB" %></td> |
| 22 | </tr> | 22 | </tr> |
| 23 | </table> \ No newline at end of file | 23 | </table> |
