-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP trying to implement breadcrumbs * Added breadcrumbs model and breadcrumbs in project page * Rubocop fixes * Added stub test
- Loading branch information
Showing
8 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.breadcrumbs { | ||
|
||
list-style-type: none; | ||
padding: 0px; | ||
margin: 2em 0em; | ||
|
||
a { | ||
color: $black; | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
text-decoration: underline; | ||
color: $black; | ||
} | ||
|
||
li { | ||
display: inline-block; | ||
} | ||
|
||
.inactive { | ||
opacity: 0.4; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
class Breadcrumb | ||
attr_reader :name, :path | ||
def initialize(name, path) | ||
@name = name | ||
@path = path | ||
end | ||
|
||
def link? | ||
@path.present? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<nav> | ||
<ul class="breadcrumbs"> | ||
<% breadcrumbs.each do |crumb| %> | ||
<li> | ||
<% if crumb.link? %> | ||
<%= link_to crumb.name, crumb.path, class: "breadcrumb-link" %> | ||
<% else %> | ||
<span class="breadcrumb-page inactive"> | ||
<%= crumb.name %> | ||
</span> | ||
<% end %> | ||
|
||
<% unless crumb == breadcrumbs.last %> | ||
<span class="breadcrumb-separator">></span> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
require "rails_helper" | ||
|
||
RSpec.describe Breadcrumb, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |