navigate through workshops courses back and forth
This commit is contained in:
@@ -79,6 +79,7 @@ class CATC extends Main
|
|||||||
'success' => self::SUCCESS,
|
'success' => self::SUCCESS,
|
||||||
'context' => $this->asContext,
|
'context' => $this->asContext,
|
||||||
'cookie' => Auth::USER_COOKIE_PASS,
|
'cookie' => Auth::USER_COOKIE_PASS,
|
||||||
|
'workshops' => (new Course($this->oDb))->getWorkshops(),
|
||||||
'courses' => (new Course($this->oDb))->getCourses()
|
'courses' => (new Course($this->oDb))->getCourses()
|
||||||
),
|
),
|
||||||
'vars' => $this->getVars()
|
'vars' => $this->getVars()
|
||||||
@@ -117,12 +118,6 @@ class CATC extends Main
|
|||||||
return $this->oAuth->checkApiKey($sApiKey);
|
return $this->oAuth->checkApiKey($sApiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Workshops / Courses */
|
|
||||||
|
|
||||||
public function getWorkshops() {
|
|
||||||
return self::getJsonResult(true, '', (new Course($this->oDb))->getWorkshops());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Notes*/
|
/* Notes*/
|
||||||
|
|
||||||
public function getNote($iCourseId) {
|
public function getNote($iCourseId) {
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ elseif($sAction!='' && $bLoggedIn)
|
|||||||
{
|
{
|
||||||
switch ($sAction)
|
switch ($sAction)
|
||||||
{
|
{
|
||||||
case 'workshops':
|
|
||||||
$sResult = $oCATC->getWorkshops();
|
|
||||||
break;
|
|
||||||
case 'get_note':
|
case 'get_note':
|
||||||
$sResult = $oCATC->getNote($iId);
|
$sResult = $oCATC->getNote($iId);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div id="feedback"></div>
|
<div id="feedback"></div>
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<div id="logo_box"></div>
|
|
||||||
<div id="desc_box"><div class="desc">Collège des <span>arts thérapeutiques chinois</span></div></div>
|
<div id="desc_box"><div class="desc">Collège des <span>arts thérapeutiques chinois</span></div></div>
|
||||||
|
<div id="logo_box"><a href="#workshops"></a></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
<ul>
|
<ul>
|
||||||
@@ -16,4 +16,3 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<span>Designed and powered by Franzz & Clarita - CATC Notes Project under <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GPLv3</a> License</span>
|
<span>Designed and powered by Franzz & Clarita - CATC Notes Project under <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GPLv3</a> License</span>
|
||||||
</footer>
|
</footer>
|
||||||
#errors#
|
|
||||||
24
masks/workshop.html
Normal file
24
masks/workshop.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<div id="workshop" class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-1"><button type="button" class="back btn btn-primary"><i class="fal fa-previous"></i></button></div>
|
||||||
|
<div class="col-8"><div id="course-list" class="list-group"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
oCATC.pageInit = function(asHash, bFirstPage) {
|
||||||
|
self.tmp('id_workshop', asHash.items[0]);
|
||||||
|
|
||||||
|
//Setup layout
|
||||||
|
self.setPageTitle('Workshop: '+self.consts.workshops[self.tmp('id_workshop')].dates);
|
||||||
|
|
||||||
|
var $CourseList = $('#course-list');
|
||||||
|
$.each(self.consts.workshops[self.tmp('id_workshop')].courses, function(iCourseId, asCourse){
|
||||||
|
$CourseList.append($('<a>', {'href':'#course-'+iCourseId, 'class':'list-group-item d-flex justify-content-between align-items-center list-group-item-primary list-group-item-action'})
|
||||||
|
.append(asCourse.description)
|
||||||
|
.append($('<span>', {'class':'badge badge-primary badge-pill'}).text(asCourse.timeslot))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.back').click(function(){self.setHash('workshops')});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="workshops">
|
<div id="workshops">
|
||||||
<div class="ws_title"><h1>Workshops</h1></div>
|
<div class="ws_title"><h1>Workshops</h1></div>
|
||||||
<div id="ws_data"></div>
|
<div id="ws_data"><div class="ws_list"></div></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
oCATC.pageInit = function(asHash, bFirstPage)
|
oCATC.pageInit = function(asHash, bFirstPage)
|
||||||
@@ -8,43 +8,20 @@ oCATC.pageInit = function(asHash, bFirstPage)
|
|||||||
self.setPageTitle('');
|
self.setPageTitle('');
|
||||||
|
|
||||||
//Workshops list
|
//Workshops list
|
||||||
var $Workshops = $('<div>', {'class':'ws_list'});
|
var $Workshops = $('#workshops').find('.ws_list');
|
||||||
Tools.ajax('workshops', function(asData){
|
|
||||||
$.each(asData, function(iWsId, asWorkshop){
|
|
||||||
var $Workshop = $('<div>', {'class':'ws_item clickable transition'})
|
|
||||||
.click(openCourses)
|
|
||||||
.append($('<span>', {'class':'title'}).text('WS '+iWsId))
|
|
||||||
.append($('<span>', {'class':'previous fa-fw clickable'})
|
|
||||||
.click(closeCourses)
|
|
||||||
.appendIcon('previous'))
|
|
||||||
.append($('<span>', {'class':'dates'}).text(asWorkshop.dates));
|
|
||||||
|
|
||||||
var $Courses = $('<div>', {'class':'courses'}).appendTo($Workshop);
|
$.each(self.consts.workshops, function(iWsId, asWorkshop){
|
||||||
$.each(asWorkshop.courses, function(iCourseId, asCourse){
|
var $Workshop = $('<div>', {'class':'ws_item clickable transition'})
|
||||||
var $Course = $('<div>', {'class':'course clickable transition'})
|
.data('id', iWsId)
|
||||||
.click(function(){oCATC.setHash('course', iCourseId)})
|
.click(openCourses)
|
||||||
.text(asCourse.description);
|
.append($('<span>', {'class':'title'}).text('WS '+iWsId))
|
||||||
|
.append($('<span>', {'class':'dates'}).text(asWorkshop.dates));
|
||||||
|
|
||||||
$Courses.append($Course);
|
$Workshops.append($Workshop);
|
||||||
});
|
|
||||||
|
|
||||||
$Workshops.append($Workshop);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
$('#ws_data').append($Workshops);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openCourses() {
|
function openCourses() {
|
||||||
var $This = $(this);
|
oCATC.setHash('workshop', $(this).data('id'));
|
||||||
$('.ws_list').find('.ws_item').not($This).hide();
|
|
||||||
$This
|
|
||||||
.addClass('opened')
|
|
||||||
.removeClass('clickable');
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeCourses(e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
console.log('sdqsdf');
|
|
||||||
$('.ws_list').find('.ws_item').removeClass('opened').addClass('clickable').show();
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -35,10 +35,6 @@
|
|||||||
border-bottom: 1px solid $gray-300;
|
border-bottom: 1px solid $gray-300;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.previous {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.courses {
|
.courses {
|
||||||
@@ -46,51 +42,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.opened {
|
|
||||||
width: auto;
|
|
||||||
height: auto;
|
|
||||||
|
|
||||||
span.title {
|
|
||||||
color: $gray-300;
|
|
||||||
background: $col_main_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.previous {
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 5px;
|
|
||||||
width: auto;
|
|
||||||
color: $gray-300;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: $col_main_2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
span.dates {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.courses {
|
|
||||||
display: inline-block;
|
|
||||||
|
|
||||||
.course {
|
|
||||||
border-bottom: 1px solid $gray-300;
|
|
||||||
padding: 1em;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: $col_main_2;
|
|
||||||
color: $gray-300;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,6 +103,12 @@ a.button:active {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: url('../images/logo.png') 0 0 no-repeat;
|
background: url('../images/logo.png') 0 0 no-repeat;
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
width: 116px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#desc_box {
|
#desc_box {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user