From a29d11fbcd0a2c58789b623054e3543c5b0f78f6 Mon Sep 17 00:00:00 2001 From: Qais Yousuf Date: Sun, 21 Apr 2024 19:59:57 +0200 Subject: [PATCH] ranking question type completed --- .../DisplayQuestionnaire.cshtml | 175 +++++++++++++++--- 1 file changed, 148 insertions(+), 27 deletions(-) diff --git a/Web/Views/QuestionnaireResponse/DisplayQuestionnaire.cshtml b/Web/Views/QuestionnaireResponse/DisplayQuestionnaire.cshtml index 592f6fc..e6ae465 100644 --- a/Web/Views/QuestionnaireResponse/DisplayQuestionnaire.cshtml +++ b/Web/Views/QuestionnaireResponse/DisplayQuestionnaire.cshtml @@ -98,32 +98,59 @@ margin: 15px 0px 0px 0px; } - .rating { - display: inline-flex; - flex-direction: row-reverse; /* Set the direction to row-reverse */ -} - -.rating { - display: inline-block; -} - -.rating i { - font-size: 25px; - cursor: pointer; - -} -.rating i { - color: white; /* Set default color to white */ -} - -.rating i.selected { - color: orange; -} + .hidden-textarea { display: none; } + .rating .rating-item { + display: inline-block; /* Align items horizontally */ + text-align: center; /* Center-align the label and star */ + margin: 5px; /* Spacing between rating items */ + } + + .rating .rating-label { + display: block; /* Ensure the label is on a new line */ + margin-bottom: 2px; /* Space between label and star */ + font-size: 14px; /* Smaller font size for the label */ + color: white; + } + + /* Style the stars */ + .rating .rating-star { + font-size: 24px; /* Adjust size as needed */ + color: #ccc; /* Default color of stars */ + cursor: pointer; /* Change cursor to pointer on hover */ + transition: color 0.3s ease; /* Smooth transition for color change */ + } + + /* Style the stars when they are hovered over */ + .rating .rating-star:hover, + .rating .rating-star:hover ~ .rating-star { + color: #ffe350; /* Color when hovered */ + } + + /* Style the stars when they are selected */ + .rating .rating-star.selected { + color: #df9d01; /* Color of selected stars */ + } + + + + .rank-list { + list-style-type: none; + padding: 0; + } + + .rank-list li { + padding: 5px; + margin-bottom: 2px; + color:white + + } + + @@ -190,7 +217,7 @@ case QuestionType.Likert: case QuestionType.Matrix: case QuestionType.Demographic: - case QuestionType.Ranking: +
@foreach (var answer in question.Answers) @@ -256,12 +283,43 @@ break; case QuestionType.Rating: -
- @foreach (var answer in question.Answers) - { - - } +
+ + @foreach (var answer in question.Answers) + { +
+
@answer.Text
+ + +
+ }
+ + break; + case QuestionType.Ranking: +
+ +
    + @foreach (var answer in question.Answers) + { +
  • + @answer.Text + + + +
  • + } +
+
+ + + + break; default: