summaryrefslogtreecommitdiff
path: root/public/assets
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-06-01 03:33:18 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-06-01 03:33:18 +0300
commit864fbb806621c8167c49f7449486fbc3bdaca1a6 (patch)
tree1b5b5933dbb184b130c248d3281e709bd6286c5d /public/assets
parent950798a91c0bed3f2d6e53182b0cff49f07eff0c (diff)
downloadgyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.tar.gz
gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.tar.bz2
gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.zip
user update; user petitions copy; fixed docker performance issues
Diffstat (limited to 'public/assets')
-rw-r--r--public/assets/css/class.css17
-rw-r--r--public/assets/css/overides.css124
-rw-r--r--public/assets/js/DataTables/localization/Greek.json29
-rw-r--r--public/assets/js/panel/info.js1
-rw-r--r--public/assets/js/panel/own_petitions.js183
5 files changed, 282 insertions, 72 deletions
diff --git a/public/assets/css/class.css b/public/assets/css/class.css
index 7fe88c7..53602d3 100644
--- a/public/assets/css/class.css
+++ b/public/assets/css/class.css
@@ -22,7 +22,6 @@
:root {
--bs-heading-color: #458; /* header color */
-
--class-blue: #337ab7;
--class-blue-opaque: #337ab799;
--class-blue-dark: #082e44;
@@ -36,9 +35,10 @@
--form-content-font-size: .87rem;
--form-input-height: 31px;
--form-layer-bgr: #dddb; /* form layer background */
- --select2-arrow-top: -1px;
- --background-image: url(/assets/media/spring-04.jpg); /* main background */
- --menu-hover-bgr: #efefa6 /* <-- spring-04 ; default: #def */;
+ --select2-arrow-top: 8px;
+ --background-image: #fafafa; /* main background */
+ --menu-hover-bgr: #def /* <-- spring-04 ; default: #def */;
+ --info-text-color: #554e;
}
@@ -49,7 +49,12 @@ select, select option {
font-weight: 400;
font-size: 1rem;
}
-body { padding: 0; background: var(--background-image); background-size: cover; }
+body {
+ padding: 0;
+ background: var(--background-image);
+ background-size: cover;
+ background-position: center;
+}
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 { font-weight: 400; };
@@ -133,7 +138,7 @@ html, body {
.central-form .content .info { padding: 1.5em; font-size: .92em; }
.central-form .content .info p {
- color: #554e;
+ color: var(--info-text-color);
font-size: .9rem;
line-height: 150%;
}
diff --git a/public/assets/css/overides.css b/public/assets/css/overides.css
index 110b35b..19cd3ce 100644
--- a/public/assets/css/overides.css
+++ b/public/assets/css/overides.css
@@ -9,48 +9,47 @@ input.form-control-sm { height: var(--form-input-height); }
.form-control, .form-select { border: 1px solid #7777; }
.form-label { font-size: .72em; color: var(--bs-heading-color); }
-.footer__listLink { color: #bbb; }
-.footer__listLink:hover { color: #eee; }
-.footer__title { color: #bbb7; }
-
/* .user .dropdown button { min-width: 256px; } */
.user .dropdown ul.dropdown-menu {
- right: 0 !important;
- left: unset !important;
- transform: translate(0, 34px) !important;
+ right: 0 !important;
+ left: unset !important;
+ transform: translate(0, 34px) !important;
}
-.admin-container { font-size: .96em; }
-.admin-container .top-bar a:hover { background: #ddd; }
-.admin-container .manage { padding: 1em; }
+/*
+.footer__listLink { color: #bbb; }
+.footer__listLink:hover { color: #eee; }
+.footer__title { color: #bbb7; }
+.admin-container { font-size: .96em; }
+.admin-container .top-bar a:hover { background: #ddd; }
.admin-container .title-bar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5em 1em 1.5em 1em;
}
-
.admin-container .dt-table { font-size: 14px; }
-
.admin-container .dt-table .btn-sm {
--bs-btn-padding-y: .2rem;
--bs-btn-padding-x: .35rem;
--bs-btn-font-size: .65rem;
}
-
.admin-container .modal .form-group { padding: .35em 0;}
-/*.admin-container .modal .form-control { padding: 1px 8px; border-radius: 4px; font-size: 15px; } */
+
.admin-container .table > :not(caption) > * > * { padding: .35rem .35rem; }
.admin-container .table tbody tr:hover { background: #eee; }
+*/
+
ul.select2-results__options li {
font-size: var(--form-content-font-size);
padding: 4px 8px;
}
+/*
.admin-container .modal-footer .form-actions { display: flex; gap: 8px; }
.admin-container .title-bar h5 { margin-bottom: 0; color: #333; }
@@ -63,6 +62,7 @@ ul.select2-results__options li {
.admin-container form label { padding: 8px 1em 2px 1em; }
.admin-container .form-control { border-radius: 4px; }
+*/
/* hack select2 caret styling
@@ -71,21 +71,11 @@ ul.select2-results__options li {
*/
.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;
- background-size: contain;
- border: none !important;
- width: 12px !important;
- margin: auto !important;
- top: 12px !important;
- left: auto !important;
- height: 14px;
+ background-color: transparent; background-size: contain; border: none !important;
+ height: 14px; width: 12px;
+ margin: auto !important; top: var(--select2-arrow-top); left: auto !important;
}
-.select2-container--default .select2-selection--single .select2-selection__arrow { width: 24px; }
-.select2-container--default .select2-selection--single { height: var(--form-input-height); }
-/** select2|multiple overides
- * --- -- -- - - -
- */
input.select2-search__field { font-size: var(--form-content-font-size); }
.select2-selection__choice {
@@ -93,32 +83,36 @@ input.select2-search__field { font-size: var(--form-content-font-size); }
font-weight: 400;
}
-ul.select2-selection__rendered { margin-bottom: 0; } /* select2: ul */
+ul.select2-selection__rendered { margin-bottom: 0; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { padding: 2px; } /* select2: li */
-.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { /* select2: button */
+.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
border-right: none;
padding: 1px 4px;
}
.select2-container--default .select2-selection--multiple { font-size: 15px; }
-
-
-
-/* select2.min.css | https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css */
-
.select2-container--default .select2-selection--single .select2-selection__clear { margin-right: 32px; }
-
-.select2-container .select2-selection--single .select2-selection__rendered { font-size: 15px; padding: 2px 20px 2px 8px; }
+
+.select2-container .select2-selection--single .select2-selection__rendered {
+ font-size: var(--form-content-font-size);
+ padding: 2px 20px 2px 8px;
+}
.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
padding-left: 16px;
}
-.select2-container--default .select2-selection--single .select2-selection__arrow {
- top: var(--select2-arrow-top);
+.select2-container--default .select2-selection--single:focus-visible,
+.select2-container--focus .select2-selection--multiple {
+ border-color: #86b7fe;
+ box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
+ outline: none;
+ color: var(--bs-body-color);
+}
+.select2-container--default.select2-container--focus .select2-selection--multiple {
+ border: 1px solid #86b7fe;;
+ outline: 0;
}
-
-
@@ -131,37 +125,13 @@ ul.select2-selection__rendered { margin-bottom: 0; } /* select2: ul */
*/
-
-/* overides.css | http://localhost/assets/css/overides.css */
-
- .select2-container .select2-selection--single .select2-selection__rendered {
- font-size: var(--form-content-font-size);
- }
-
-
.central-form form label { font-size: 14px; color: #433; }
- /* bootstrap.min.css | https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/css/bootstrap.min.css */
-
-
-
-
-
+
- .select2-container--default .select2-selection--single:focus-visible,
- .select2-container--focus .select2-selection--multiple {
- border-color: #86b7fe;
- box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
- outline: none;
- color: var(--bs-body-color);
- }
- .select2-container--default.select2-container--focus .select2-selection--multiple {
- border: 1px solid #86b7fe;;
- outline: 0;
- }
@@ -203,7 +173,15 @@ ul.select2-selection__rendered { margin-bottom: 0; } /* select2: ul */
}
-.central-form .content .info p { color: #334; }
+
+.btn-xs { height: 24px; padding: 1px 8px; font-size: 14px; }
+
+.manage { padding: 1.5em; }
+.manage .title-bar h5 { margin-bottom: 1rem; }
+
+.manage tbody, td, tfoot, th, thead, tr { background: #ddd4; }
+.manage tbody, td, tfoot, th, thead, tr.odd { background: #fff4; }
+.manage tbody td { font-size: 14px; }
/** cc photo sources
@@ -284,3 +262,17 @@ https://www.flickr.com/photos/drtonygeorge/1474585836/ !
--- -- -- - - -
*/
+
+/* spring 04
+ --- -- -- - - -*/
+ :root {
+ --background-image: url(/assets/media/spring-04.jpg);
+ --bs-heading-color: #230;
+ --menu-hover-bgr: #efefa6;
+ --info-text-color: #334;
+ }
+ .central-form .content-form { background: #dddb; }
+ .central-form .content-form { border: 1px solid #dddb }
+ .info li.list-group-item:hover { background: #c9f490; }
+/* --- -- -- - - -
+*/ \ No newline at end of file
diff --git a/public/assets/js/DataTables/localization/Greek.json b/public/assets/js/DataTables/localization/Greek.json
new file mode 100644
index 0000000..a92f6cf
--- /dev/null
+++ b/public/assets/js/DataTables/localization/Greek.json
@@ -0,0 +1,29 @@
+
+
+{
+ "sDecimal": ",",
+ "sEmptyTable": "Δεν υπάρχουν δεδομένα στον πίνακα",
+ "sInfo": "Εμφανίζονται _START_ έως _END_ από _TOTAL_ εγγραφές",
+ "sInfoEmpty": "Εμφανίζονται 0 έως 0 από 0 εγγραφές",
+ "sInfoFiltered": "(φιλτραρισμένες από _MAX_ συνολικά εγγραφές)",
+ "sInfoPostFix": "",
+ "sInfoThousands": ".",
+ "sLengthMenu": "Εμφάνιση _MENU_ εγγραφών",
+ "sLoadingRecords": "Φόρτωση...",
+ "sProcessing": "Επεξεργασία...",
+ "sSearch": "Αναζήτηση:",
+ "sSearchPlaceholder": "Αναζήτηση",
+ "sThousands": ".",
+ "sUrl": "",
+ "sZeroRecords": "Δεν βρέθηκαν εγγραφές που να ταιριάζουν",
+ "oPaginate": {
+ "sFirst": "Πρώτη",
+ "sPrevious": "<",
+ "sNext": ">",
+ "sLast": "Τελευταία"
+ },
+ "oAria": {
+ "sSortAscending": ": ενεργοποιήστε για αύξουσα ταξινόμηση της στήλης",
+ "sSortDescending": ": ενεργοποιήστε για φθίνουσα ταξινόμηση της στήλης"
+ }
+}
diff --git a/public/assets/js/panel/info.js b/public/assets/js/panel/info.js
new file mode 100644
index 0000000..d046e1f
--- /dev/null
+++ b/public/assets/js/panel/info.js
@@ -0,0 +1 @@
+// null \ No newline at end of file
diff --git a/public/assets/js/panel/own_petitions.js b/public/assets/js/panel/own_petitions.js
new file mode 100644
index 0000000..84121e6
--- /dev/null
+++ b/public/assets/js/panel/own_petitions.js
@@ -0,0 +1,183 @@
+// Globals
+// -----------------------------------------------------------------------------
+var petitions = [];
+var table;
+
+
+
+// Supplamentary functions
+// -----------------------------------------------------------------------------
+
+// array.indexOf polyfill
+// --- -- -- - - -
+if (!Array.prototype.indexOf)
+{
+ Array.prototype.indexOf = function(elt /*, from*/)
+ {
+ var len = this.length >>> 0;
+
+ var from = Number(arguments[1]) || 0;
+ from = (from < 0)
+ ? Math.ceil(from)
+ : Math.floor(from);
+ if (from < 0)
+ from += len;
+
+ for (; from < len; from++)
+ {
+ if (from in this &&
+ this[from] === elt)
+ return from;
+ }
+ return -1;
+ };
+}
+
+
+// return petitions record by petition-id
+// --- -- -- - - -
+function petition_record(id) {
+ var record = false;
+ petitions.forEach(el => { if (el.id == id) record = el; });
+
+ return record;
+}
+
+
+// create actions html (edit and delete buttons)
+// --- -- -- - - -
+function create_actions_html(signature) {
+
+ var del, edit, show;
+
+ del = "";
+ edit = "";
+
+ show = [
+ '<a type="button" target="_blank" class="btn btn-xs btn-warning"',
+ 'href="/petition/signature/'+ signature +'">',
+ '<i class="fa-regular fa-circle-down"></i>',
+ '</a>'
+ ].join('\n');
+
+ return show +' '+ edit +' '+ del;
+}
+
+
+
+$(document).ready(function() {
+
+ // When document is ready
+ // -------------------------------------------------------------------------
+
+
+ /** init_table
+ * --- -- -- - - -
+ * get categories
+ * constuct categories array
+ * render dataTable
+ */
+ function init_table() {
+
+ // get all categories from server (ajax)
+ $.getJSON( "/user/get/petitions")
+ .done(function( json ) {
+ // then ...
+ console.log(json);
+
+ // reset categories
+ petitions.length = 0;
+
+ // construct petitions data
+ json.data.forEach( el => {
+ petitions.push({
+ id: parseInt(el.id),
+ subject: el.subject,
+ protocol: el.protocol,
+ signature: el.signature,
+ datepost: el.creation_date,
+ actions: create_actions_html(el.signature)
+ });
+ });
+
+
+ // destroy previous datatable table instances
+ $('#dt-petitions').dataTable().fnClearTable();
+ $('#dt-petitions').dataTable().fnDestroy();
+
+ // (re-)create categories datatable
+ table = $('#dt-petitions').DataTable({
+ language: { url: '/assets/js/DataTables/localization/Greek.json' },
+ data: petitions,
+ // ordering: false,
+ columns: [
+ { data: 'subject', width: '55%' },
+ { data: 'protocol' },
+ // { data: 'signature' },
+ { data: 'datepost' },
+ { data: 'actions' }
+ ]
+ });
+
+ })
+ .fail(function( jqxhr, textStatus, error ) {
+ console.log( "Request Failed (" + error +")" );
+ });
+
+ }
+ init_table(); // init table on first run
+
+
+
+ /** When modal show-up
+ * -------------------------------------------------------------------------
+ * ... prepare the manage-category form
+ * ... update select2 with possible parents
+ */
+ $('#manageCategory').on('show.bs.modal', event => {
+ var button = $(event.relatedTarget); // Button that triggered the modal
+ var id = parseInt( button.data('id') ); // category_id from data-id
+ // var modal = $(this); // modal object
+
+ // update modal literature
+ // ---
+ $('#manageCategory .modal-title').html( // modal title
+ (id) ? 'Ενημέρωση Κατηγορίας' : 'Δημιουργία Κατηγορίας'
+ );
+ $('#manageCategory form input[name=id]').val( id ); // category id (hidden)
+ $('#manageCategory form input[name=title]').val( // category title
+ (id) ? category_record(id).title : ""
+ );
+ prepare_parents_element(id); // prepare <select> for parents
+ })
+
+
+
+ // When form is submited
+ // -------------------------------------------------------------------------
+
+ $('#manageCategory form').submit( event => {
+ event.preventDefault();
+
+ // prepare data to POST
+ var data = {
+ id: parseInt($('#manageCategory form input[name=id]').val()),
+ title: $('#manageCategory form input[name=title]').val(),
+ parent_id: parseInt($('#parent_id').select2('data')[0].id)
+ };
+
+ // select action url (add or update)
+ var request = '/wiki/ajax?action=' + ((data.id == 0) ? 'add_category' : 'update_category');
+
+ // send POST request
+ $.post(request, data)
+ .done(function( data ) {
+
+ $('#manageCategory').modal('hide'); // when done, close modal
+
+ init_table(); // reload table of categories
+ });
+
+ });
+
+});