Skip to content

Commit

Permalink
Category frontend path
Browse files Browse the repository at this point in the history
  • Loading branch information
janv committed Dec 9, 2009
1 parent 3777ebe commit b26297a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/models/category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ def backend_url_path
'/vrame/' + backend_url
end

def frontend_path
if self.url.blank?
self
elsif self.url =~ /^\//
self.url
else
"/#{self.url}"
end
end

def to_public_hash

# Convert category to hash, only accept some attributes
Expand Down
2 changes: 1 addition & 1 deletion app/views/vrame/categories/_category.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:id => "add-document-to-category-#{category.to_param}"
%>
<%= link_to '<img src="/vrame/images/admin/magnifier.png" alt="Vorschau" title="Vorschau" />',
category.url.empty? ? category : "/#{category.url}",
category.frontend_path,
:id => "preview-category-#{category.to_param}"
%>
</div>
Expand Down

0 comments on commit b26297a

Please sign in to comment.