diff options
Diffstat (limited to 'public/assets/js/admin/edit_lesson.js')
| -rw-r--r-- | public/assets/js/admin/edit_lesson.js | 149 |
1 files changed, 85 insertions, 64 deletions
diff --git a/public/assets/js/admin/edit_lesson.js b/public/assets/js/admin/edit_lesson.js index ee1b537..367c3b7 100644 --- a/public/assets/js/admin/edit_lesson.js +++ b/public/assets/js/admin/edit_lesson.js @@ -1,3 +1,9 @@ +/** NOTE: + * depricated code for tag-system is commented-out and kept in the source-code + * as case-study; the code is operational; + */ + + // Globals // ----------------------------------------------------------------------------- @@ -23,9 +29,6 @@ var files = []; // array of { id:.., title:.., type:.., path:.. } records // var tags = []; // array of integers -const files_root = '/media/'; // files root firectory - - // an alternative--id when a lesson_id not exists (needed for file-upload) // ... consist of a 6-digit date string + random number up to 999 const yymmdd = new Date().toISOString().slice(2, 10).replaceAll('-',''); @@ -166,22 +169,27 @@ $(document).ready(function() { }); - // // init tags (select2) - // // ... - // $('#tags').select2({ - // placeholder: 'Ετικέτες (tags/keywords)', - // width: '100%', - // tags: true - // }); - + /** DEPRICATED: (tag system) + * + * // init tags (select2) + * // ... + * $('#tags').select2({ + * placeholder: 'Ετικέτες (tags/keywords)', + * width: '100%', + * tags: true + * }); + */ - // init editor (tiny MCE) - // tinymce.init({ - // selector: 'form textarea[name=body]', - // language: 'el', - // menubar: true - // }); - // --- -- -- - - - + /** DEPRICATED: + * + * // TINY-MCE EDITOR + * init editor (tiny MCE) + * tinymce.init({ + * selector: 'form textarea[name=body]', + * language: 'el', + * menubar: true + * }); + */ /** preload content @@ -252,15 +260,18 @@ $(document).ready(function() { }); categories.sort( compare_label ); // sort categories by breadcrumb - // construct tags data - // --- - /// Object.keys(tags_response[0]).forEach( key => { - /// tag = tags_response[0][key]; - /// tags.push({ - /// id: tag.id, - /// label: tag.name - /// }); - /// }); + /** DEPRICATED: (tag system) + * + * // construct tags data + * // --- + * Object.keys(tags_response[0]).forEach( key => { + * tag = tags_response[0][key]; + * tags.push({ + * id: tag.id, + * label: tag.name + * }); + * }); + */ // construct provileges data // --- @@ -283,17 +294,21 @@ $(document).ready(function() { // setup category_id options; select post's chosen category-id set_parent_options( $('#course_id'), categories, lesson.course_id ); - // parse selected tags - // --- - /// var selected_tag_ids = []; - /// if (post.tags_json != null) { - /// var selected_tags = JSON.parse(post.tags_json); - /// selected_tags.forEach( itag => { selected_tag_ids.push(itag.id); }) - /// } + /*** DEPRICATED: (tag system) + * + * // parse selected tags + * // --- + * var selected_tag_ids = []; + * if (post.tags_json != null) { + * var selected_tags = JSON.parse(post.tags_json); + * selected_tags.forEach( itag => { selected_tag_ids.push(itag.id); }) + * } + */ + // setup tags options; select post's chosen tags set_parent_options( $('#privilege_id'), privileges, lesson.privilege_id ); - // ALSO: if tags selectd, show tags field + // DEPRICATED: ALSO: if tags selectd, show tags field // if (selected_tag_ids.length != 0) { $('.optional label[for=tags]').addClass('show'); } } @@ -374,16 +389,20 @@ $(document).ready(function() { $('.edit-post form').submit( event => { event.preventDefault(); - // // rearrange tags to old and new ones - // // --- - // var old_tags = []; - // var new_tags = []; - // var tags = $('#tags').select2('data'); - // tags.forEach( t => { - // if (!parseInt(t.id)) { - // new_tags.push(t.text); - // } else { old_tags.push(t.id); } - // }) + /** DEPRICATED: + * + ### TAG SYSTEM + # // rearrange tags to old and new ones + # // --- + # var old_tags = []; + # var new_tags = []; + # var tags = $('#tags').select2('data'); + # tags.forEach( t => { + # if (!parseInt(t.id)) { + # new_tags.push(t.text); + # } else { old_tags.push(t.id); } + # }) + */ var attachments = []; // attachments (array) of "`media_id`;`reference`" strings @@ -471,25 +490,27 @@ $(document).ready(function() { - - // show|hide file as referece button - // --- -- -- - - - - $('.admin-container').on('click', 'button.js-reference', function (e) { - var id = $(this).data('id'); - - // toggle reference attribute of item with `id` = id - // --- - var temp = []; - files.forEach( it => { - if (it.id == id) { - it.reference = (it.reference==0) ? 1 : 0; - } - temp.push(it) - }); - - files = temp; // re-define files - draw_files_list(); // then re-draw files list - }); + /** DEPRICATED: + * + # // show|hide file as referece button + # // --- -- -- - - - + # $('.admin-container').on('click', 'button.js-reference', function (e) { + # var id = $(this).data('id'); + # + # // toggle reference attribute of item with `id` = id + # // --- + # var temp = []; + # files.forEach( it => { + # if (it.id == id) { + # it.reference = (it.reference==0) ? 1 : 0; + # } + # temp.push(it) + # }); + # + # files = temp; // re-define files + # draw_files_list(); // then re-draw files list + # }); + */ |
