diff options
| author | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-04-20 17:10:06 +0300 |
|---|---|---|
| committer | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-04-20 17:10:06 +0300 |
| commit | d9bce23822117d03b1630f002d3ee0491ac83d4b (patch) | |
| tree | a7a2ac4864043f72ba1a54c2b98de5fd13daca67 /public | |
| parent | 423505cdf54c52947482509329c2a1c8ece97c39 (diff) | |
| download | classroom-d9bce23822117d03b1630f002d3ee0491ac83d4b.tar.gz classroom-d9bce23822117d03b1630f002d3ee0491ac83d4b.tar.bz2 classroom-d9bce23822117d03b1630f002d3ee0491ac83d4b.zip | |
hashing passwords; compatibility with dotNet
Diffstat (limited to 'public')
| -rw-r--r-- | public/app/routes/backend.php | 14 | ||||
| -rw-r--r-- | public/app/views/admin/admin-menu.php | 10 | ||||
| -rw-r--r-- | public/app/views/admin/edit_lesson.php (renamed from public/app/views/admin/new_lesson.php) | 16 | ||||
| -rw-r--r-- | public/app/views/admin/skeleton.php | 28 | ||||
| -rw-r--r-- | public/assets/css/overides.css | 13 | ||||
| -rw-r--r-- | public/assets/js/admin/edit_lesson.js | 0 |
6 files changed, 58 insertions, 23 deletions
diff --git a/public/app/routes/backend.php b/public/app/routes/backend.php index 5356407..88bf4b8 100644 --- a/public/app/routes/backend.php +++ b/public/app/routes/backend.php @@ -88,11 +88,21 @@ Route::add('/admin/api/privileges', function () { // new lesson // ----------------------------------------------------------------------------- -Route::add('/admin/new_lesson', function () { +Route::add('/admin/edit_lesson', function () { Auth::allowRoles([1, 2, 3]); // allow few admin-panel roles Render::view('admin/skeleton', [ 'title' => 'Νέο Μάθημα', - 'action' => 'new_lesson' + 'action' => 'edit_lesson', ]); }); +// new lesson +// ----------------------------------------------------------------------------- +Route::add('/admin/edit_lesson/([0-9]*)', function ($id) { + Auth::allowRoles([1, 2, 3]); // allow few admin-panel roles + Render::view('admin/skeleton', [ + 'title' => 'Νέο Μάθημα', + 'action' => 'edit_lesson', + 'id' => intval($id) + ]); +}); diff --git a/public/app/views/admin/admin-menu.php b/public/app/views/admin/admin-menu.php index d7e7b09..a06d2eb 100644 --- a/public/app/views/admin/admin-menu.php +++ b/public/app/views/admin/admin-menu.php @@ -4,26 +4,26 @@ * * imported variables: * --- - * @param $action (string) : array of articles + * @param $action (string): array of articles + * @param $id (int): id of entity (when editing entity) | 0: new entity * * example call: * --- * Render::template("sections/admin_panel.php",[ * 'action' => 'posts', + * 'id' => 4 * ]) * ----------------------------------------------------------------------------- */ - $admin_options = [ - 'new_lesson' => 'Νέο Μάθημα', + 'edit_lesson' => 'Νέο Μάθημα', 'lessons' => 'Μαθήματα', 'categories' => 'Κατηγορίες', 'pages' => 'Σελίδες', 'privileges' => 'Πρόσβαση', 'users' => 'Χρήστες' ]; - ?> <div class="top-bar"> @@ -32,7 +32,7 @@ $admin_options = [ <?php foreach($admin_options as $opt => $label) : ?> - <?php if ($opt == $action) : ?> + <?php if (($opt == $action) & (!$id)) : ?> <span class="btn btn-primary selected"><?=$label?></span> <?php else : ?> diff --git a/public/app/views/admin/new_lesson.php b/public/app/views/admin/edit_lesson.php index c48fc82..30dd42f 100644 --- a/public/app/views/admin/new_lesson.php +++ b/public/app/views/admin/edit_lesson.php @@ -1,11 +1,19 @@ <?php -// if no (lesson-)id is specified, then id=0 (new lesson) -if (!isset($id)) $id=0; + // some labels (if editing new or existing record) + // --- -- -- - - - + if ($id == 0) { + $action_title = "Δημιουργία Μαθήματος"; + $action_button = "Δημιουργία"; + + } else { + $action_title = "Επεξεργασία Μαθήματος"; + $action_button = "Αποθήκευση Αλλαγών"; + } ?> <!-- title bar --> <div class="title-bar"> - <div><h5>Επεξεργασία Μαθήματος</h5></div> + <div><h5><?=$action_title?></h5></div> <div> <button type="button" class="btn pull-right" data-toggle="modal" data-target="#editorModal" data-action="preview"> @@ -129,7 +137,7 @@ if (!isset($id)) $id=0; <div class="col-4"> <button class="btn btn-primary col-sm-12" type="submit"> - Καταχώριση + <?=$action_button?> </button> </div> diff --git a/public/app/views/admin/skeleton.php b/public/app/views/admin/skeleton.php index fea346f..927bd2d 100644 --- a/public/app/views/admin/skeleton.php +++ b/public/app/views/admin/skeleton.php @@ -7,7 +7,9 @@ <?php // header includes //////////////////////////////////////////////////////////////////////// - Render::view('components/header_includes', ['administration' => true]); + Render::view('components/header_includes', //////////////////////////// + ['administration' => true] + ); ?> @@ -17,16 +19,26 @@ <div class="classroom admin-container"> <?php - Render::view('admin/admin-menu',[ - 'action' => $action - ]) - ?> - - <?php - Render::view("admin/{$action}"); + // sometimes an ID (int) is needed + // ex. editing a page or a lesson we need page-ID or lesson-ID + // --- -- -- - - - + if (!isset($id)) $id=0; + + // render menu + //////////////////////////////////////////////////////////////////// + Render::view('admin/admin-menu',[ //////////////////////////// + 'action' => $action, + 'id' => $id + ]); + + // render main content + //////////////////////////////////////////////////////////////////// + Render::view("admin/{$action}",[ 'id' => $id ]); //////////////// ?> </div> + <!-- js admin script --> + <script>var entity_id = <?= $id ?>;</script> <script src="/assets/js/admin/<?= $action ?>.js"></script> </body> diff --git a/public/assets/css/overides.css b/public/assets/css/overides.css index 0709f4d..b217f65 100644 --- a/public/assets/css/overides.css +++ b/public/assets/css/overides.css @@ -85,9 +85,8 @@ ul.select2-results__options li { font-size: 14px; padding: 4px 8px; } /* hack select2 caret styling * (like bootstrap5 select caret) - * ----------------------------------------------------------------------------- + * ----------------------------------------------------------------------- start */ - .select2-container--default .select2-selection--single .select2-selection__arrow b { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-color: transparent; @@ -101,5 +100,11 @@ ul.select2-results__options li { font-size: 14px; padding: 4px 8px; } height: 14px; } .select2-container--default .select2-selection--single .select2-selection__arrow { width: 24px; } -.select2-container--default .select2-selection--single { height: 31px; } -
\ No newline at end of file +.select2-container--default .select2-selection--single { height: 31px; } +/* ------------------------------------------------------------------------- end +*/ + +.admin-container .edit-post textarea[name=body] { height: calc(100vh - 420px); } /* almost all avialable height */ +.admin-container .edit-post textarea[name=intro] { height: 73px ;} /* almost 3 (half-)lines */ + + diff --git a/public/assets/js/admin/edit_lesson.js b/public/assets/js/admin/edit_lesson.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/public/assets/js/admin/edit_lesson.js |
