Skip to content

Commit

Permalink
wb_faq changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cbadusch committed Nov 4, 2024
1 parent 9461c89 commit 092c9cb
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 2 deletions.
1 change: 1 addition & 0 deletions lang/de/theme_lexa.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@
$string['privacy:request:preference:draweropenblock'] = 'The user preference "{$a->name}" has the value "{$a->value}" which represents "{$a->decoded}" for the state of the block drawer.';

$string['communities'] = 'Communities';
$string['searchfaq'] = "Wie können wir Ihnen helfen? Suchen Sie nach einer Antwort oder einem Thema...";
$string['support'] = 'Support';
$string['sortby'] = 'Sortieren nach';
1 change: 1 addition & 0 deletions lang/en/theme_lexa.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@
$string['privacy:request:preference:draweropenblock'] = 'The user preference "{$a->name}" has the value "{$a->value}" which represents "{$a->decoded}" for the state of the block drawer.';

$string['communities'] = 'Communities';
$string['searchfaq'] = "How can we help you? Are you looking for an answer or a topic...";
$string['support'] = 'Support';
$string['sortby'] = 'Sort by';
57 changes: 57 additions & 0 deletions scss/lexa.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2561,4 +2561,61 @@ text-align: start;

.hidefaq {
display: inline-block !important;
}

.backgroundfaq {
background: linear-gradient(77.48deg, #001F33 -5.09%, #0063A6 98.91%);
}

.wbfaqinput {
width: 600px;
}

.wbfaqbreadcrumb[data-catvalue="FAQ"] {
display: none !important;
}

.wbfaqcollapsebutton:focus,
.wbfaqcollapsebutton:hover
{
box-shadow: none !important;
text-decoration: none !important;
}

@include media-breakpoint-down(sm) {
.wbfaqinput {
width: 100%;
}
}

.wbfaqaccordion {
border-radius: 20px;
box-shadow: -5px 0px 10px 0px #00000005;

box-shadow: 5px 0px 10px 0px #00000005;

box-shadow: 0px 12px 30px 0px #0000000D;
}

.wbfaqaccordion .card, .wbfaqaccordion .card-header {
background: transparent;
border: none;
}

.wbfaqaccordion .card {
padding: 50px !important;

}

.wbfaqaccordion .accordion-body {
border-top: none
}

.wbfaqaccordion
.accordion-item {
border-bottom: 1px solid #D9DBE9
}

.wbfaqaccordion .accordion-item:last-child {
border-bottom: none;
}
4 changes: 2 additions & 2 deletions templates/local_wb_faq/display_search.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
}
}}

<div class="row mb-2 w-100 d-flex justify-content-center flex-column background">
<div class="row mb-2 w-100 d-flex justify-content-center flex-column background backgroundfaq">
<div class="container mw-90 d-flex justify-content-center">
<div class="row mb-2 w-100 d-flex justify-content-center flex-column">
<h1 class="lexa-h1 text-center mb-4 text-light">
FAQ
</h1>
<div class="urise text-center align-bottom d-flex justify-content-center" style="display:flex;">
<input class='my-2 w-auto form-control searchfaq-{{uid}}' type='text' id='searchfaq-{{uid}}' placeholder='{{#str}} searchfaq, local_wb_faq {{/str}}'>
<input class='my-2 wbfaqinput form-control searchfaq-{{uid}}' type='text' id='searchfaq-{{uid}}' placeholder='{{#str}} searchfaq, theme_lexa {{/str}}'>
</div>
</div>
</div>
Expand Down
74 changes: 74 additions & 0 deletions templates/local_wb_faq/entry.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template mod_mooduell/viewpage
Template which defines a mooduell view page.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
Example context (json):
{
"categories" : [
[
{
"catid":"7",
"contextid":"1",
"catname":"MooDuell Pr\u00e4sentation",
"courseid":"50"
}
]
]
}
}}

<li class="accordion-item" data-id="{{id}}" data-sortorder="{{sortorder}}">
{{#canedit}}
<span tabindex="0" role="button" aria-haspopup="true" data-drag-type="move" title="{{title}}">
<i class="fa fa-arrows"></i>
</span>
{{/canedit}}
<div class="card">
<div class="card-header p-0 border-0">
<h5 class="accordion-header m-0" id="heading-{{id}}-{{uid}}">
<button class="btn btn-link btn-block text-left collapsed wbfaqcollapsebutton" type="button" data-toggle="faqcollapse" data-target="#collapse-{{id}}-{{uid}}" aria-expanded="{{#open}}true{{/open}}{{^open}}false{{/open}}" aria-controls="collapse-{{id}}-{{uid}}">
<span class="lexa-h4 text-dark">{{title}}</span>
{{#canedit}}
<span class="wb_faq_edit_entry_elements">
{{#enabled}}
<a class="local_wb_faq_toggle_entry_visibility" data-id="{{id}}"><i class="toggle-visibility fa fa-eye
mr-3"></i></a>
{{/enabled}}
{{^enabled}}
<a class="local_wb_faq_toggle_entry_visibility" data-id="{{id}}"><i class="toggle-visibility fa fa-eye-slash
mr-3"></i></a>
{{/enabled}}
<a class="local_wb_faq_edit_question" data-id="{{id}}"><i class="fa fa-pencil mr-3"></i></a>
<a class="local_wb_faq_delete_question" data-id="{{id}}"><i class="fa fa-trash-o mr-3"></i></a>
</span>
{{/canedit}}
</button>
</h5>
</div>
<div id="collapse-{{id}}-{{uid}}" class="accordion-collapse collapse {{#open}}show{{/open}}" aria-labelledby="heading-{{id}}-{{uid}}">
<div class="accordion-body p-3">
<span class="lexa-input">{{{content}}}</span>
</div>
</div>
</div>
</li>



79 changes: 79 additions & 0 deletions templates/local_wb_faq/faq.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template mod_mooduell/viewpage
Template which defines a mooduell view page.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
Example context (json):
{
"categories" : [
[
{
"catid":"7",
"contextid":"1",
"catname":"MooDuell Pr\u00e4sentation",
"courseid":"50"
}
]
]
}
}}

<div class="current-faq wb-breadcrumb">
{{#canedit}}
<span>
<a class="local_wb_faq_edit_button local_wb_faq_edit_category btn btn-secondary" data-faqroot="{{root}}" data-uid="{{uid}}">{{#str}} addcategory, local_wb_faq {{/str}} <i class="fa fa-plus"></i></a>
<a class="local_wb_faq_edit_button local_wb_faq_edit_question btn btn-secondary" data-faqroot="{{root}}" data-uid="{{uid}}">{{#str}} addquestion, local_wb_faq {{/str}} <i class="fa fa-plus"></i></a>
</span>
{{/canedit}}

<!-- Existing code for displaying breadcrumbs -->
<div class="d-flex mt-2">
{{#breadcrumbs}}
<div class="btn btn-primary mb-2 px-4 mr-2 wbfaqbreadcrumb" data-catvalue="{{datacat}}" data-action="goto" data-targetid='{{id}}'>{{name}}</div>
{{/breadcrumbs}}
</div>
</div>

<ul class="draggable-cat list-unstyled">
{{#categories}}
{{>local_wb_faq/category}}
{{/categories}}
</ul>

{{#entries.0}}
{{#headertitle}}
<h2 class="lexa-h2">{{name}}</h2>
{{/headertitle}}
{{/entries.0}}



<ul class="accordion draggable list-unstyled wbfaqaccordion" id="wb-faq-accordion">
{{#entries}}
{{>local_wb_faq/entry}}
{{/entries}}
</ul>


{{#js}}
require(['local_wb_faq/reordering'], function(reordering) {
reordering.init('.draggable');
reordering.init('.draggable-cat');
});
{{/js}}
59 changes: 59 additions & 0 deletions templates/local_wb_faq/faq_list.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template mod_mooduell/viewpage
Template which defines a mooduell view page.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
Example context (json):
{
"categories" : [
[
{
"catid":"7",
"contextid":"1",
"catname":"MooDuell Pr\u00e4sentation",
"courseid":"50"
}
]
]
}
}}

<div class="local_wb_faq_container local_wb_faq_container-{{uid}}">
<div class="col-md-6 m-auto">
<div class="local_wb_faq-{{uid}}"></div>
</div>
</div>

{{! Has to be included this way to make it work when lazy loaded via ajax }}
<script>
if (typeof require == 'function') {
require(['local_wb_faq/faq', 'local_wb_faq/searchinput'], function(faq,search) {
faq.init({{{json}}}, {{{root}}}, '{{{uid}}}');
});
}
</script>

{{#js}}
require(['local_wb_faq/faq', 'local_wb_faq/searchinput'], function(faq,search) {
faq.init({{{json}}}, {{{root}}}, '{{{uid}}}');
});
require(['local_wb_faq/edit'], function(edit) {
edit.init();
});
{{/js}}

0 comments on commit 092c9cb

Please sign in to comment.