-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from DealerDirect/docs/developer-pain
Adds developer pain.
- Loading branch information
Showing
16 changed files
with
3,296 additions
and
19 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
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,28 @@ | ||
{% comment %} | ||
Include a JS file for the given URL | ||
{% endcomment %} | ||
{% capture cache %} | ||
{% assign parts = include.url | remove: ".html" |remove_first: '/' | split: "/" %} | ||
{% assign slug = '' %} | ||
{% assign tags = '' %} | ||
|
||
{% for part in parts %} | ||
{% assign part = part | slugify %} | ||
|
||
{% if forloop.first == true %} | ||
{% assign slug = slug | append: part %} | ||
{% else %} | ||
{% assign slug = slug | append: '-' | append: part %} | ||
{% endif %} | ||
|
||
{% assign filePath = slug | prepend: '/assets/js/' | append: '.js' %} | ||
|
||
{% for static_file in site.static_files %} | ||
{% if static_file.path == filePath %} | ||
{% capture output %} | ||
<script src="{{ filePath | prepend:site.baseurl }}"></script>{% endcapture %} | ||
{% assign tags = tags | strip_newlines | append: output %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endcapture %}{% assign cache = nil %}{{ tags }} |
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
41 changes: 41 additions & 0 deletions
41
assets/css/protocols-estimating-developer-pain-criteria.css
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,41 @@ | ||
.criteria__help { | ||
background: #ADF; | ||
border: 1px solid #69B; | ||
display: block; | ||
padding: 1em; | ||
text-align: center; | ||
} | ||
|
||
.criteria__help-icon { | ||
background: #FFF; | ||
border-radius: 100%; | ||
color: #69b; | ||
font-size: 1.5em; | ||
line-height: 0.8em; | ||
margin: 0 0.5em 0 0; | ||
vertical-align: bottom; | ||
width: 0.8em; | ||
} | ||
|
||
.criteria__selector { | ||
cursor: pointer; | ||
} | ||
|
||
.criteria__selector:hover { | ||
background-color: lightyellow; | ||
} | ||
|
||
.criteria__selector--selected, | ||
.criteria__selector--selected:hover { | ||
border-color: #69B; | ||
background-color: #ADF; | ||
} | ||
|
||
/* Adding <input> selector to overwrite `.markdown-body input` from the GH style */ | ||
input.criteria__score { | ||
font-size: 10em; | ||
max-width: 100%; | ||
text-align: center; | ||
} | ||
|
||
/*EOF*/ |
102 changes: 102 additions & 0 deletions
102
assets/js/protocols-estimating-developer-pain-criteria.js
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,102 @@ | ||
(function (Root, $) { | ||
|
||
'use strict'; | ||
|
||
function addEventHandler(p_sSubject, p_oPoints, p_oCriteria, p_iCriteriaIndex) { | ||
var sOpposite; | ||
|
||
switch (p_sSubject) { | ||
case 'upper': | ||
sOpposite = 'lower'; | ||
break; | ||
case 'lower': | ||
sOpposite = 'upper'; | ||
break; | ||
} | ||
|
||
p_oCriteria[p_sSubject].addClass('criteria__selector criteria__selector--' + p_sSubject); | ||
|
||
p_oCriteria[p_sSubject].on('click', function (/*p_oEvent*/) { | ||
var iScoreIndex, iTotalScore, oScores, sScoreJson; | ||
|
||
p_oCriteria[p_sSubject].addClass('criteria__selector--selected'); | ||
p_oCriteria[sOpposite].removeClass('criteria__selector--selected'); | ||
|
||
sScoreJson = $Score.attr('data-score'); | ||
oScores = JSON.parse(sScoreJson); | ||
|
||
oScores[p_iCriteriaIndex] = p_oPoints[p_sSubject]; | ||
|
||
$Score.attr('data-score', JSON.stringify(oScores)); | ||
|
||
iTotalScore = 0; | ||
|
||
for (iScoreIndex in oScores) { | ||
if( oScores.hasOwnProperty(iScoreIndex)) { | ||
iTotalScore += oScores[iScoreIndex]; | ||
} | ||
} | ||
|
||
$Score.val(Math.floor(iTotalScore) + '%'); | ||
}); | ||
} | ||
|
||
function retrieveRows(p_iRowIndex, p_oRowElement) { | ||
|
||
var oCriteria = {}; | ||
|
||
$(p_oRowElement).find('td').each(function (p_iCellIndex, p_oCellElement) { | ||
|
||
var sKey; | ||
|
||
switch (p_iCellIndex) { | ||
case 0: | ||
sKey = 'lower'; | ||
break; | ||
case 1: | ||
sKey = 'upper'; | ||
break; | ||
case 2: | ||
sKey = 'info'; | ||
break; | ||
} | ||
|
||
oCriteria[sKey] = $(p_oCellElement); | ||
}); | ||
|
||
aCriteria.push(oCriteria); | ||
} | ||
|
||
function main (p_sTableSelector) { | ||
var aCriteria = [], oPoints, $Help, $Score, $Table; | ||
|
||
$Table = $(p_sTableSelector); | ||
|
||
$Table.find('tbody tr').each(retrieveRows); | ||
|
||
$Score = $('<input type="text" class="criteria__score" data-score="{}" readonly />'); | ||
|
||
$Help = $('<p class="criteria__help">' + | ||
'<span class="octicon octicon-info criteria__help-icon"></span>' + | ||
'To calculate the developer pain for a given issue, ' + | ||
'please select the most appropriate cells in the table below.' + | ||
'</p>' | ||
); | ||
|
||
$Score.insertBefore($Table.parent()); | ||
$Help.insertAfter($Score); | ||
|
||
oPoints = {'lower': 10 / aCriteria.length, 'upper': 100 / aCriteria.length}; | ||
|
||
$.each(aCriteria, function (p_iCriteriaIndex, p_oCriteria) { | ||
addEventHandler('lower', oPoints, p_oCriteria, p_iCriteriaIndex); | ||
addEventHandler('upper', oPoints, p_oCriteria, p_iCriteriaIndex); | ||
|
||
}); | ||
} | ||
|
||
$('.criteria sup').addClass('hidden'); | ||
|
||
main('.protocols-estimating-developer-pain-criteria table'); | ||
|
||
})(document, jQuery); |
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.