forked from OpenNeo/impress
pretty item urls
This commit is contained in:
parent
6940e098d3
commit
c18a333bd2
3 changed files with 12 additions and 0 deletions
|
@ -156,6 +156,14 @@ class Item < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def name_for_url
|
||||||
|
name.downcase.gsub(' ', '-')
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_param
|
||||||
|
"#{id}-#{name_for_url}"
|
||||||
|
end
|
||||||
|
|
||||||
before_create do
|
before_create do
|
||||||
self.sold_in_mall ||= false
|
self.sold_in_mall ||= false
|
||||||
true
|
true
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
- title @item.name
|
- title @item.name
|
||||||
|
- content_for :meta do
|
||||||
|
%link{:rel => 'canonical', :href => url_for(@item)}
|
||||||
|
|
||||||
%header
|
%header
|
||||||
= image_tag @item.thumbnail_url, :id => 'item-thumbnail'
|
= image_tag @item.thumbnail_url, :id => 'item-thumbnail'
|
||||||
%div
|
%div
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
/[if IE]
|
/[if IE]
|
||||||
= include_javascript_libraries :html5
|
= include_javascript_libraries :html5
|
||||||
= stylesheet_link_tag "compiled/screen"
|
= stylesheet_link_tag "compiled/screen"
|
||||||
|
= yield :meta
|
||||||
= csrf_meta_tag
|
= csrf_meta_tag
|
||||||
= signed_in_meta_tag
|
= signed_in_meta_tag
|
||||||
%body{:class => body_class}
|
%body{:class => body_class}
|
||||||
|
|
Loading…
Reference in a new issue