]> _ Git - fluidbook-toolbox.git/commitdiff
wait #4225 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 28 Jan 2021 12:15:00 +0000 (13:15 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 28 Jan 2021 12:15:00 +0000 (13:15 +0100)
app/Models/Quiz.php
resources/quiz/js/main.js
resources/quiz/style/030-quiz.less
resources/quiz/style/style.css

index d3e62f242dc46f1026dc34884fc6bd3a2cbd095c..5eae05606ce4633b99adf1ca492ca2095a0fc82c 100644 (file)
@@ -7,6 +7,7 @@ use App\Http\Controllers\Admin\Base\QuizController;
 use Cubist\Backpack\Magic\Models\CubistMagicAbstractModel;
 use Cubist\Util\Files\Files;
 use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Facades\App;
 use Spatie\MediaLibrary\MediaCollections\Models\Media;
 use Spatie\Image\Manipulations;
 use App\Fields\User;
@@ -298,6 +299,9 @@ class Quiz extends CubistMagicAbstractModel
             $d['translations'][$text] = $translation->getAttribute($text);
         }
 
+        // Countries
+        $d['countriesList'] = \Cubist\Locale\Country::getList($translation->getAttribute('locale'));
+
         // Fix boolean
         $booleans = ['multiple', 'required', 'count_for_score'];
         foreach ($d['questions'] as $qn => $q) {
index b5f17f34eda61162b7bafb19fcb12dd89598d8da..acfa2e6de9a680c26d01006ff154d4c02ff86f03 100644 (file)
                 } else if (question.type === 'textarea') {
                     $(holder).append('<textarea ' + required + ' name="answer" class="focusme" placeholder="' + question.placeholder + '"></textarea>')
                 } else if (question.type === 'country') {
-                    var select = '<select name="answer" class="focusme"></select>';
+                    var select = '<div class="select-holder"><select name="answer" class="focusme"><option value="">--</option>';
+                    $.each(DATA.countriesList, function (code, name) {
+                        select += '<option value="' + code + '">' + name + '</option>';
+                    });
+                    select += '</select></div>';
                     $(holder).append(select);
                 }
 
index f433b3fd54e54cc13fc36d549d664890c23f4814..70454a2d297c031b7c62f2698668c5977f69be61 100644 (file)
@@ -60,7 +60,29 @@ section {
     .answers {
         margin-top: 30px;
 
-        input[type="text"], input[type="email"], textarea {
+        .select-holder {
+            position: relative;
+
+            &:after {
+                display: block;
+                content: "";
+                position: absolute;
+                right: 0rem;
+                bottom: 1.2rem;
+                width: 3rem;
+                height: 0.5rem;
+                background-image: url("data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FscXVlXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMjguMiAxNS4xIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyOC4yIDE1LjE7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5bGluZSBzdHlsZT0iZmlsbDpub25lO3N0cm9rZTojRkZGRkZGO3N0cm9rZS13aWR0aDozO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDsiIHBvaW50cz0iMjYuNywxLjUgMTQuMSwxMy42IDEuNSwxLjUgIi8+DQo8L3N2Zz4=");
+                background-size: 100% 100%;
+                background-repeat: no-repeat;
+                pointer-events: none;
+            }
+        }
+
+        select {
+            appearance: none;
+        }
+
+        input[type="text"], input[type="email"], textarea, select {
             border: 0px;
             .border-radius(5px);
             padding: 15px;
index c3fc74203647c67e34ee474f71f9858fdec69535..e490d175fef39ff8802314339ae09613318aa39a 100644 (file)
@@ -334,9 +334,29 @@ section {
 .question .answers {
   margin-top: 30px;
 }
+.question .answers .select-holder {
+  position: relative;
+}
+.question .answers .select-holder:after {
+  display: block;
+  content: "";
+  position: absolute;
+  right: 0rem;
+  bottom: 1.2rem;
+  width: 3rem;
+  height: 0.5rem;
+  background-image: url("data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FscXVlXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMjguMiAxNS4xIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyOC4yIDE1LjE7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5bGluZSBzdHlsZT0iZmlsbDpub25lO3N0cm9rZTojRkZGRkZGO3N0cm9rZS13aWR0aDozO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDsiIHBvaW50cz0iMjYuNywxLjUgMTQuMSwxMy42IDEuNSwxLjUgIi8+DQo8L3N2Zz4=");
+  background-size: 100% 100%;
+  background-repeat: no-repeat;
+  pointer-events: none;
+}
+.question .answers select {
+  appearance: none;
+}
 .question .answers input[type="text"],
 .question .answers input[type="email"],
-.question .answers textarea {
+.question .answers textarea,
+.question .answers select {
   border: 0px;
   border-radius: 5px;
   background-clip: padding-box;