diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/pages_controller.rb | 14 | ||||
| -rw-r--r-- | app/views/nodes/edit.html.erb | 23 | ||||
| -rw-r--r-- | app/views/nodes/show.html.erb | 2 |
3 files changed, 34 insertions, 5 deletions
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index e298265..4b3b541 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb | |||
| @@ -12,4 +12,18 @@ class PagesController < ApplicationController | |||
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | end | 14 | end |
| 15 | |||
| 16 | |||
| 17 | def sort_images | ||
| 18 | page = Page.find(params[:id]) | ||
| 19 | |||
| 20 | page.related_assets.destroy_all | ||
| 21 | |||
| 22 | params[:images].each_with_index do |id, index| | ||
| 23 | asset = Asset.find(id) | ||
| 24 | page.related_assets.create(:asset_id => asset.id, :position => index+1) | ||
| 25 | end | ||
| 26 | |||
| 27 | render :nothing => true, :status => 200 | ||
| 28 | end | ||
| 15 | end | 29 | end |
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 00815b7..a8138c2 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -36,10 +36,15 @@ | |||
| 36 | </tr> | 36 | </tr> |
| 37 | <tr> | 37 | <tr> |
| 38 | <td class="description">Images</td> | 38 | <td class="description">Images</td> |
| 39 | <td style="height: 200px"> | 39 | <td> |
| 40 | <% @draft.assets.images.each do |image| %> | 40 | <ul id="image_box" rel="<%= @draft.id %>"> |
| 41 | <%= image_tag(image.upload.url(:thumb)) %> | 41 | <% @draft.assets.images.each do |image| %> |
| 42 | <% end %> | 42 | <li rel="images_<%= image.id %>"> |
| 43 | <%= image_tag(image.upload.url(:thumb)) %> | ||
| 44 | </li> | ||
| 45 | <% end %> | ||
| 46 | </ul> | ||
| 47 | add image | ||
| 43 | </td> | 48 | </td> |
| 44 | </tr> | 49 | </tr> |
| 45 | </table> | 50 | </table> |
| @@ -69,4 +74,14 @@ | |||
| 69 | </table> | 74 | </table> |
| 70 | <% end %> | 75 | <% end %> |
| 71 | <% end %> | 76 | <% end %> |
| 77 | </div> | ||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | <div id="asset_toolbox"> | ||
| 82 | <ul> | ||
| 83 | <% Asset.images.each do |image| %> | ||
| 84 | <li rel="images_<%= image.id %>"><%= image_tag(image.upload.url(:thumb)) %></li> | ||
| 85 | <% end %> | ||
| 86 | </ul> | ||
| 72 | </div> \ No newline at end of file | 87 | </div> \ No newline at end of file |
diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index 8aaedc5..15547f9 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | <% content_for :subnavigation do %> | 1 | <% content_for :subnavigation do %> |
| 2 | <%= link_to 'Edit', edit_node_path(@node), :id => 'button', :class => "unselected" %> | 2 | <%= link_to 'Edit', edit_node_path(@node), :class => "unselected" %> |
| 3 | <%= link_to 'Preview', preview_page_path(@page) %> | 3 | <%= link_to 'Preview', preview_page_path(@page) %> |
| 4 | <%= link_to 'Revisions', revision_path(params[:id]) %> | 4 | <%= link_to 'Revisions', revision_path(params[:id]) %> |
| 5 | <% end %> | 5 | <% end %> |
