You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:19:32 UTC
svn commit: r962051 - in /incubator/deltacloud/trunk/framework:
app/helpers/application_helper.rb app/views/layouts/application.html.erb
public/stylesheets/application.css
Author: lutter
Date: Thu Jul 8 23:19:32 2010
New Revision: 962051
URL: http://svn.apache.org/viewvc?rev=962051&view=rev
Log:
I love breadcrumbs.
Modified:
incubator/deltacloud/trunk/framework/app/helpers/application_helper.rb
incubator/deltacloud/trunk/framework/app/views/layouts/application.html.erb
incubator/deltacloud/trunk/framework/public/stylesheets/application.css
Modified: incubator/deltacloud/trunk/framework/app/helpers/application_helper.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/helpers/application_helper.rb?rev=962051&r1=962050&r2=962051&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/helpers/application_helper.rb (original)
+++ incubator/deltacloud/trunk/framework/app/helpers/application_helper.rb Thu Jul 8 23:19:32 2010
@@ -1,4 +1,26 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
+ def bread_crumb
+ s = "<ul class='breadcrumb'><li class='first'><a href='/'>dCloud</a></li>"
+ url = request.path.split('?') #remove extra query string parameters
+ levels = url[0].split('/') #break up url into different levels
+ levels.each_with_index do |level, index|
+ unless level.blank?
+ if index == levels.size-1 ||
+ (level == levels[levels.size-2] && levels[levels.size-1].to_i > 0)
+ s += "<li class='subsequent'>#{level.gsub(/_/, ' ')}</li>\n" unless level.to_i > 0
+ else
+ link = "/"
+ i = 1
+ while i <= index
+ link += "#{levels[i]}/"
+ i+=1
+ end
+ s += "<li class='subsequent'><a href=\"#{link}\">#{level.gsub(/_/, ' ')}</a></li>\n"
+ end
+ end
+ end
+ s+="</ul>"
+ end
end
Modified: incubator/deltacloud/trunk/framework/app/views/layouts/application.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/layouts/application.html.erb?rev=962051&r1=962050&r2=962051&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/layouts/application.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/layouts/application.html.erb Thu Jul 8 23:19:32 2010
@@ -7,10 +7,11 @@
<%= stylesheet_link_tag '/yui/reset-fonts-grids/reset-fonts-grids.css' %>
<%= stylesheet_link_tag 'application.css' %>
</head>
-
+
<body>
<div id="doc" class="yui-t2">
<div id="hd">
+ <%= bread_crumb -%>
</div>
<div id="bd">
<div id="yui-main">
@@ -28,4 +29,3 @@
</div>
</body>
</html>
-
Modified: incubator/deltacloud/trunk/framework/public/stylesheets/application.css
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/public/stylesheets/application.css?rev=962051&r1=962050&r2=962051&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/public/stylesheets/application.css (original)
+++ incubator/deltacloud/trunk/framework/public/stylesheets/application.css Thu Jul 8 23:19:32 2010
@@ -69,3 +69,10 @@ input[type='radio'] {
margin-top: 1ex;
margin-left: 1ex;
margin-bottom: 1ex; }
+
+ul.breadcrumb li {
+ display:inline;
+}
+ul.breadcrumb li.subsequent:before {
+ content: ">> "
+}