diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-04-25 16:45:03 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-04-25 16:45:03 +0300 |
| commit | b594effb847b86fc6b1dae49d7948c46bba35e58 (patch) | |
| tree | 8c5a090cf8746870521324797762bb0ff14c8ae5 /public/assets | |
| parent | 65d07ba64d45c77d2db16272710ec5702b34d641 (diff) | |
| download | classroom-b594effb847b86fc6b1dae49d7948c46bba35e58.tar.gz classroom-b594effb847b86fc6b1dae49d7948c46bba35e58.tar.bz2 classroom-b594effb847b86fc6b1dae49d7948c46bba35e58.zip | |
alfa version; uploaded into test server (coder)
Diffstat (limited to 'public/assets')
| -rw-r--r-- | public/assets/css/class.css | 15 | ||||
| -rw-r--r-- | public/assets/css/overides.css | 8 | ||||
| -rw-r--r-- | public/assets/js/admin/edit_lesson.js | 17 | ||||
| -rw-r--r-- | public/assets/js/lesson-features.js (renamed from public/assets/js/post-features.js) | 50 |
4 files changed, 59 insertions, 31 deletions
diff --git a/public/assets/css/class.css b/public/assets/css/class.css index a65bfa2..f132241 100644 --- a/public/assets/css/class.css +++ b/public/assets/css/class.css @@ -156,7 +156,7 @@ -.classroom .post img { max-width: 100%; } +.classroom .lesson-view img { max-width: 100%; } @@ -199,7 +199,7 @@ } /* --- post: medias -- */ - +/* DEPRICATED: not needed .classroom .content--wrapper .medias { padding: 2em 0 1em; border-top: 1px solid var(--class-grey-background); @@ -212,6 +212,7 @@ font-size: 12px; color: #999; } +*/ /* --- post: tags --- */ @@ -308,18 +309,20 @@ -.classroom .post h2 { padding-bottom: 0; } +.classroom .lesson-view h2 { padding-bottom: 0; font-size: 24px; } + +.classroom .lesson-view h2 span { float:right; margin-right: -3em;} -.classroom .post h2 span { float:right; margin-right: -3em;} +.classroom .lesson-view pre { padding: 1em; background: #f5f5f6;} -.classroom .post .intro { +.classroom .lesson-view .intro { font-style: italic; font-size: 18px; color: var(--class-blue-dark); padding-bottom: 1em; } -.classroom .post .post--date { +.classroom .lesson-view .post--date { padding: 0; color: var(--class-blue); } diff --git a/public/assets/css/overides.css b/public/assets/css/overides.css index e3d5e1b..c0f6bd9 100644 --- a/public/assets/css/overides.css +++ b/public/assets/css/overides.css @@ -128,4 +128,10 @@ ul.select2-results__options li { font-size: 14px; padding: 4px 8px; } .admin-container .edit-post .post-media ul li:last-child { border-bottom: none ;} .admin-container .edit-post .post-media ul li:hover { background: #eee; } -.edit-post .post-media li .btn-xs { font-size: 14px; width: 24px; height: 24px; padding:0; }
\ No newline at end of file +.edit-post .post-media li .btn-xs { font-size: 14px; width: 24px; height: 24px; padding:0; } + +.classroom .edit-post textarea[name=body] { + min-height:320px; + font-family: Consolas, 'Ubuntu Mono','Courier New', Courier, monospace; + color: #333; + }
\ No newline at end of file diff --git a/public/assets/js/admin/edit_lesson.js b/public/assets/js/admin/edit_lesson.js index 89e464f..fbcfabc 100644 --- a/public/assets/js/admin/edit_lesson.js +++ b/public/assets/js/admin/edit_lesson.js @@ -201,11 +201,14 @@ $(document).ready(function() { $('input[name=id]').val(lesson.id); // id $('input[name=title]').val(lesson.title); // title $('textarea[name=intro]').val(lesson.intro); // intro - $('textarea[name=body]').val(lesson.body); // body - $('input[name=status]').prop( // status - 'checked', - ((lesson.status==1)? true : false)) - .trigger('change'); + $('textarea[name=body]').val(lesson.body); // body + $('select[name=status]').val( + (lesson.status == 0) ? '0' : "one" + ).trigger('change'); + // $('input[name=status]').prop( // status + // 'checked', + // ((lesson.status==1)? true : false)) + // .trigger('change'); // $('#post-info').html('Δημιουργία: '+post.creation_date+'<br>Τελευταία Ενημέρωση: '+ post.update_date); @@ -408,8 +411,8 @@ $(document).ready(function() { // send POST (ajax) request $.post(request, data) .done(function( data ) { - console.log(data); - //window.location.href = '/admin/lessons'; // seems ok; bach to articles + // console.log(data); + window.location.href = '/admin/lessons'; // seems ok; bach to articles }); }); diff --git a/public/assets/js/post-features.js b/public/assets/js/lesson-features.js index ca2928c..369c8f7 100644 --- a/public/assets/js/post-features.js +++ b/public/assets/js/lesson-features.js @@ -1,6 +1,5 @@ -const valid_modals = [ // supported sort-code keys - 'product', - 'store' +const valid_codeblocks = [ // supported sort-code keys + 'youtube' ]; @@ -16,6 +15,20 @@ const symbol_escapes = [ ]; +var youtube_template = ( id => { + return '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/'+ id +'?rel=0&controls=0" title="YouTube video player" frameborder="0" allow="clipboard-write; encrypted-media; picture-in-picture; web-share" allowfullscreen></iframe>' +}); + +/* + + +<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/6EA-MIYY1bg?controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> + + + +*/ + + /** inject_codeblocks * --- -- -- - - - * @@ -43,17 +56,20 @@ function inject_codeblocks(code) { // parse (every) match // NOTE: // match array has 3 items; example: - // match[0] : `{{store=247; Pasalimani Market}}` - // match[1] : `store=247; Pasalimani Market` + // match[0] : `{{youtube=6EA-MIYY1bg}}` + // match[1] : `youtube=6EA-MIYY1bg` // match[3] : the (source) code string - let blockparts = unescaped_str( match[1] ).split(';'); - let main_unit = blockparts[0].replaceAll(' ','').split('='); - let target = main_unit[0].toLowerCase(); - let id = main_unit[1]; - let label = escaped_str(blockparts[1]); - if (valid_modals.includes(target)) { - let codeblock = `<a href="#" data-toggle="modal" data-target="#view-${target}" data-id="${id}" class="modal-toggler js-get_${target}">${label}</a>`; + let blockparts = unescaped_str( match[1] ).trim().split('='); + let target = blockparts[0].toLowerCase(); + let id = blockparts[1]; + // let label = escaped_str(blockparts[1]); + if (valid_codeblocks.includes(target)) { + + if (target == 'youtube') { + var codeblock = youtube_template(id); + } output = output.replaceAll(match[0], codeblock); + } }); @@ -80,15 +96,15 @@ $(document).ready(function() { /** translate short-codes to code-blocks * ------------------------------------------------------------------------- */ - var content = $('.content .article-body').html(); // get code with shorts - $('.content .article-body').html( inject_codeblocks(content) ); // put code with blocks + var content = $('.main-content .article-body').html(); // get code with shorts + $('.main-content .article-body').html( inject_codeblocks(content) ); // put code with blocks /** modal listeners * ------------------------------------------------------------------------- */ - +/* DEPRICATED: not needed // open store modal listener // --- -- -- - - - $(document).on('click', '.js-get_store', function (e) { @@ -144,5 +160,5 @@ $(document).ready(function() { }); }); - -});
\ No newline at end of file +*/ +}); |
