From 832a5b427ba0688919fd946a242a99180acda63a Mon Sep 17 00:00:00 2001 From: Nico Date: Wed, 13 Feb 2013 23:35:53 +0100 Subject: [PATCH] new --- app/helpers/icon_helper.rb | 4 ++-- app/views/layouts/application.html.haml | 2 +- app/views/portfolios/_portfolio.haml | 6 +++--- config/routes.rb | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/helpers/icon_helper.rb b/app/helpers/icon_helper.rb index 188e50d..a30a500 100644 --- a/app/helpers/icon_helper.rb +++ b/app/helpers/icon_helper.rb @@ -2,9 +2,9 @@ module IconHelper - def i(name,color=:gray_dark, size=16,options = nil) + def i(name,color=:gray_dark, size=16,style = "") - image_tag(i_path(name,color,size), options) + image_tag(i_path(name,color,size), :style => style) end def i_path(name,color=:gray_dark, size=16) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index e249f69..64a5568 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -34,7 +34,7 @@ %h4 Portfolios - =link_to i(:plus,:white,32, :style => "width:10px;"), new_portfolio_path, :remote => true if current_admin + =link_to i(:plus,:white,32, "width:10px;"), new_portfolio_path, :remote => true if current_admin %ul.portfolios_links =render Portfolio.order(:title) diff --git a/app/views/portfolios/_portfolio.haml b/app/views/portfolios/_portfolio.haml index 2ee02ca..c8e1fa5 100644 --- a/app/views/portfolios/_portfolio.haml +++ b/app/views/portfolios/_portfolio.haml @@ -1,6 +1,6 @@ %li#portfolio_line{:id => portfolio.id} - =link_to portfolio.title, portfolio_path(portfolio.slug, :format => :html) + =link_to portfolio.title, public_portfolio_path(portfolio.slug, :format => :html) -if current_admin - =link_to i(:pen_alt_fill,:white,32, :style => "width:10px;"), edit_portfolio_path(portfolio, :format => "js"), :remote => true - =link_to i(:x_alt,:white,32, :style => "width:10px;"), portfolio_path(portfolio, :format => "js"), :method => :delete, :confirm => "Voulez-vous vraiment supprimer cette portfolio ?", :remote => true \ No newline at end of file + =link_to i(:pen_alt_fill,:white,32, "width:10px;"), edit_portfolio_path(:format => "js", :id => portfolio.id), :remote => true + =link_to i(:x_alt,:white,32, "width:10px;"), portfolio_path(portfolio, :format => "js"), :method => :delete, :confirm => "Voulez-vous vraiment supprimer ce portfolio ?", :remote => true \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 42e0a9d..5364bec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,10 +4,12 @@ SitePerso::Application.routes.draw do match ":id.:format" => 'pages#show', :as => :page, :format => "html" - match "portfolio/:id/:page.:format" => 'portfolios#show',:page => "1", :as => :portfolio, :format => "html" + resources :portfolios + match "portfolio/:id/:page.:format" => 'portfolios#show',:page => "1", :as => :public_portfolio, :format => "html" + namespace :admin do