Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Farben der #jumpToQuestionNrX in default.css definieren #48

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ var separator = ";";
Please find some examples above.
*/

var design = ["default.css","buttons-colors-on.css", "progressbar.css"];
var design = ["default.css","buttons-colors-on.css", "progressbar.css", "navigation.css"];


/*
Expand Down
27 changes: 27 additions & 0 deletions styles/navigation.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* JumpToQuestion-table custom classes, which can override default bg-classes */

.td-jump-to-question-decline {
background-color: #d9534f !important;
}

.td-jump-to-question-neutral {
background-color: #f0ad4e !important;
}

.td-jump-to-question-approve {
background-color: #5cb85c !important;
}

.td-jump-to-question-skip {
color: #c0c0c0;
background-color: #c0c0c0;
}

.td-jump-to-question-voting-double {
font-weight: bold;
}

.td-jump-to-question-current {
border-color: #0050A0 !important;
background-color: #c0c0c0;
}
30 changes: 13 additions & 17 deletions system/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ function fnSendResults(arResults, arPersonalPositions)
{
// Korrektur der Parteiposition (-1,0,1) mit den Informationen aus der doppelten Wertung (-2,-1,0,1,2)
// Marius Nisslmueller, Bad Honnef, Juni 2020
// Bedingung für übersprungene Frage hinzugefügt
arPersonalPositionsForStats = arPersonalPositions.slice(); // Damit arPersonalPositions nicht verändert wird
for(let i=0; i<arPersonalPositionsForStats.length; i++){
if(arVotingDouble[i] && arPersonalPositionsForStats[i] < 99){
Expand Down Expand Up @@ -316,22 +315,19 @@ function fnTransformPositionToIcon(position)
return positionIcon;
}

// ersetzt die Partei-Position (-1, 0, 1) mit der passenden Farbe
function fnTransformPositionToColor(position)
{
// red, yellow, green - "#ff0000","#ffff00","#00ff00"
// Bootstrap-colors: https://github.com/twbs/bootstrap/blob/master/dist/css/bootstrap.css
var arColors = new Array("#d9534f","#f0ad4e","#5cb85c")
var positionColor = "#c0c0c0";
for (z = -1; z <= 1; z++)
{
if (z == position)
{
positionColor = arColors[(z+1)];
}
}
return positionColor;

// Gibt die entsprechenden css-Klassen für Partei-Position (-1, 0, 1) und default zurück.
function fnGetJumpToQuestionColorForPosition(position) {
console.log("position", position);
switch (position) {
case -1:
return "bg-danger td-jump-to-question-decline";
case 0:
return "bg-warning td-jump-to-question-neutral";
case 1:
return "bg-success td-jump-to-question-approve";
default:
return "td-jump-to-question-skip";
}
}


Expand Down
27 changes: 4 additions & 23 deletions system/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,38 +302,19 @@ function fnJumpToQuestionNumber(questionNumber)
var tableContent = "<table width='100%' class='table table-bordered table-striped table-hover' aria-role='presentation'>";
for (i = 1; i <= arQuestionsLong.length; i++)
{
let jumpToQuestionClass = i-1 === questionNumber ? "td-jump-to-question-current" : fnGetJumpToQuestionColorForPosition(arPersonalPositions[(i-1)]);
const votingDoubleClass = arVotingDouble[(i-1)] ? " td-jump-to-question-voting-double" : "";
jumpToQuestionClass = jumpToQuestionClass + votingDoubleClass;
var modulo = i % questionsPerLine;
// neue Zeile
if (modulo == 1) { tableContent += "<tr>"; }
tableContent += "<td align='center' id='jumpToQuestionNr"+i+"' title='"+arQuestionsShort[(i-1)]+" - "+arQuestionsLong[(i-1)]+"'>";
tableContent += "<td align='center' id='jumpToQuestionNr"+i+"' title='"+arQuestionsShort[(i-1)]+" - "+arQuestionsLong[(i-1)]+"' class='"+jumpToQuestionClass+"'>";
tableContent += "<a href='javascript:fnShowQuestionNumber("+(i-2)+")' style='display:block;'>"+i+" </a>";
tableContent += "</td>";
if (modulo == 0) { tableContent += "</tr>"; }
}
tableContent += "</table>";
$("#navigationJumpToQuestion").append(tableContent).fadeIn(500);

// alte Meinungen farblich hervorheben und aktuelle Frage markieren
for (i = 1; i <= arQuestionsLong.length; i++)
{
// beantwortete Fragen farblich markieren
var positionColor = fnTransformPositionToColor(arPersonalPositions[(i-1)]);
$("#jumpToQuestionNr"+i+"").css("border-color", positionColor);

// aktuelle Frage markieren
if ((i-1) <= questionNumber)
{
// $("#jumpToQuestionNr"+i+"").css("background-color", middleColor); // alt: graue "Mittelfarbe" als Hintergrund
$("#jumpToQuestionNr"+i+"").css("background-color", positionColor); // neu (0.2.3.2) Farbe der Auswahl (rot/gruen/...)
}

if (arVotingDouble[(i-1)])
{
$("#jumpToQuestionNr"+i+"").css("font-weight","bold");
}

}

}

// Anzeige der Ergebnisse - zusammengefasst (Prozentwerte) - nur Parteien
Expand Down