-
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.
* Fleshing out project show and contents page headers * Moved to partial * Restructuring HTML * Updated tests * Rubocop fixes * WIP show hide working but needs to be refactored * Moving Javascript to entrypoints * Execute the function defined in application.js * Addressed eslint errors Co-authored-by: Hector Correa <hectorcorrea@users.noreply.github.com> Co-authored-by: Jaymee Hyppolite <jaymeeh@users.noreply.github.com> * Updating status styles * Added netid badge styling * Updated tests, adjusted javascript more and less link --------- Co-authored-by: Hector Correa <hectorcorrea@users.noreply.github.com> Co-authored-by: Jaymee Hyppolite <jaymeeh@users.noreply.github.com>
- Loading branch information
1 parent
5297d89
commit dec6115
Showing
18 changed files
with
264 additions
and
37 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,94 @@ | ||
@import "variables"; | ||
@import "typography"; | ||
@import "bootstrap"; | ||
|
||
#project-details-heading { | ||
margin-bottom: 1.5em; | ||
|
||
.status { | ||
float: right; | ||
border-radius: 0.5em; | ||
padding: 0.5em 0.75em 0.5em 0.5em; | ||
text-transform: capitalize; | ||
font-weight: bold; | ||
} | ||
|
||
.status::before { | ||
content: ""; | ||
width: 20px; | ||
height: 20px; | ||
} | ||
|
||
.active { | ||
background: url("status_active.svg") no-repeat; | ||
background-color: $status-info; | ||
background-position: left; | ||
padding-left: 20px; | ||
color: $blue-dark; | ||
} | ||
|
||
.pending { | ||
background: url("status_pending.svg") no-repeat; | ||
background-color: $status-warning; | ||
background-position: left; | ||
padding-left: 20px; | ||
color: $yellow-dark; | ||
|
||
} | ||
|
||
.approved { | ||
background: url("status_approved.svg") no-repeat; | ||
background-color: $status-success; | ||
background-position: left; | ||
padding-left: 20px; | ||
color: $green-dark; | ||
} | ||
|
||
.rejected { | ||
background: url("status_rejected.svg") no-repeat; | ||
background-color: $status-error; | ||
background-position: left; | ||
padding-left: 20px; | ||
color: $red-darker; | ||
} | ||
|
||
#project-description { | ||
color: $black; | ||
font-family: "Libre Franklin"; | ||
font-size: 1em; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 1.5em; | ||
} | ||
|
||
.truncate { | ||
overflow: hidden; | ||
display: -webkit-box; | ||
-webkit-box-orient: vertical; | ||
-webkit-line-clamp: 2; | ||
} | ||
|
||
a#show-more-less-link { | ||
color: $gray-60; | ||
} | ||
|
||
.label { | ||
font-weight: bold; | ||
} | ||
|
||
.date-and-data-info ul { | ||
padding: 0; | ||
} | ||
|
||
.date-and-data-info li { | ||
float: left; | ||
list-style-type: none; | ||
line-height: 1em; | ||
} | ||
|
||
.date-and-data-info li:first-child:after { | ||
content: "|"; | ||
padding: 0 .5em; | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -24,4 +24,4 @@ h5 { | |
|
||
h6 { | ||
font-size: 1rem; | ||
} | ||
} |
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
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,23 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const showMoreLess = { | ||
// eslint-disable-next-line object-shorthand, func-names | ||
showMore: function (element, excerpt) { | ||
const textElement = element; | ||
|
||
textElement.addEventListener('click', (event) => { | ||
const linkText = event.target.textContent.toLowerCase(); | ||
event.preventDefault(); | ||
|
||
if (linkText === 'more...') { | ||
textElement.textContent = 'less...'; | ||
excerpt.classList.remove('truncate'); | ||
} else { | ||
textElement.textContent = 'more...'; | ||
excerpt.classList.add('truncate'); | ||
} | ||
}); | ||
}, | ||
}; | ||
/* | ||
Based on https://dev.to/justalever/how-to-code-a-show-more--show-less-toggle-with-javascript-3c7m | ||
*/ |
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,71 @@ | ||
<div id="project-details-heading"> | ||
|
||
<div class="row"> | ||
<div class="col-12 col-md-8"> | ||
<h1><%= @project.title %></h1> | ||
</div> | ||
<div class="col-6 col-md-4"> | ||
<div class="status <%= @project.status.downcase %>"> | ||
<%= @project.status %> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<div class="heading-decoration"></div> | ||
|
||
<div id="project-description"> | ||
<div id="description-text" class="truncate"> | ||
<%= @project.description %> | ||
</div> | ||
<a id="show-more-less-link" class="show-more" href="#"><span>more...</span></a> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-12"> | ||
<div class="date-and-data-info"> | ||
<ul> | ||
<li><span class="label">Date Created:</span> <%= @project.created %></li> | ||
<li><span class="label">Last updated:</span> <%= @project.updated %></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<div class="row"> | ||
<div class="col-12"> | ||
<div class="date-and-data-info"> | ||
<ul> | ||
<li><span class="label">Data Sponsor:</span> <span class="netid-large"><%= @project.data_sponsor %></span></li> | ||
<li><span class="label">Data Manager:</span> <span class="netid-large"><%= @project.data_manager %></span></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script type="module"> | ||
|
||
var $element = $('#description-text'); | ||
var $c = $element | ||
.clone() | ||
.css({display: 'inline', width: 'auto', visibility: 'hidden'}) | ||
.appendTo('body'); | ||
if( $c.width() > $element.width() ) { | ||
const ExcerptWidget = { | ||
showMore: function(showMoreLinksTarget, excerptTarget) { | ||
const showMoreLinks = document.querySelectorAll(showMoreLinksTarget); | ||
|
||
showMoreLinks.forEach(function(link) { | ||
const excerpt = document.querySelector(excerptTarget); | ||
showMoreLess.showMore(link, excerpt); | ||
}); | ||
} | ||
}; | ||
ExcerptWidget.showMore('.show-more', '#description-text'); | ||
} else { | ||
document.getElementById('show-more-less-link').style.display = 'none'; | ||
} | ||
$c.remove(); | ||
</script> |
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
Oops, something went wrong.