Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rbbrioso28 committed Mar 1, 2023
2 parents 72529d3 + aa6598f commit 9112d01
Show file tree
Hide file tree
Showing 21 changed files with 3,863 additions and 8 deletions.
7 changes: 7 additions & 0 deletions config/app.interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@
// Plugins Move css group
'/MelisCore/css/plugin.group.css',

//Bootstrap tags
'/MelisCore/css/bootstrap-tagsinput.css',

// MelisCore main CSS - should always be in bottom
'/MelisCore/css/styles.css',
// custom-style.css for the update on jquery 3.3.1 and bootstrap 4.3.1
Expand Down Expand Up @@ -259,6 +262,10 @@
//'/MelisCore/assets/components/modules/admin/forms/elements/bootstrap-timepicker/assets/lib/js/bootstrap-timerpicker.js',
'/MelisCore/assets/components/FileSaver/FileSaver.min.js',

//Bootstrap tags
'/MelisCore/js/library/bootstrap-tags/bootstrap-tagsinput.js',
'/MelisCore/js/library/bootstrap-tags/typeahead.bundle.js',

'/MelisCore/js/core/melisCore.js',
'/MelisCore/js/core/tabExpander.js',
'/MelisCore/js/rightsFancytree/rightsFancytreeInit.js',
Expand Down
28 changes: 28 additions & 0 deletions config/app.tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,20 @@
],
],
],
[
'spec' => [
'name' => 'usr_tags',
'type' => 'MelisText',
'options' => [
'label' => 'Tags',
'tooltip' => '',
],
'attributes' => [
'id' => 'id_n_usr_tags',
'required' => false,
],
],
],
], // end elements
'input_filter' => [
'usr_login' => [
Expand Down Expand Up @@ -882,6 +896,20 @@
],
],
],
[
'spec' => [
'name' => 'usr_tags',
'type' => 'MelisText',
'options' => [
'label' => 'Tags',
'tooltip' => '',
],
'attributes' => [
'id' => 'id_usr_tags',
'required' => false,
],
],
],
[
'spec' => array(
'name' => 'usr_image_remove',
Expand Down
2 changes: 2 additions & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@
'melis-core/dashboard-plugin/bubble-updates' => __DIR__ . '/../view/melis-core/dashboard-plugins/bubble-updates.phtml',
'melis-core/dashboard-plugin/bubble-notifications' => __DIR__ . '/../view/melis-core/dashboard-plugins/bubble-notifications.phtml',
'melis-core/dashboard-plugin/bubble-chat' => __DIR__ . '/../view/melis-core/dashboard-plugins/bubble-chat.phtml',

'melis-core/dashboard-plugin/noformtemplate' => __DIR__ . '/../view/melis-core/dashboard-plugins/noformtemplate.phtml',
],
'template_path_stack' => [
__DIR__ . '/../view',
Expand Down
1 change: 1 addition & 0 deletions install/dbdeploy/22121901_core_update_add_usr_tags.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `melis_core_user` ADD `usr_tags` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL AFTER `usr_image`;
7 changes: 7 additions & 0 deletions language/en_EN.interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,4 +809,11 @@
'tr_meliscore_dashboard_bubble_plugins_view_message' => 'View Messages',
'tr_meliscore_dashboard_bubble_plugins_view_messages' => 'View Messages',
'tr_meliscore_dashboard_bubble_plugins_wrote' => 'wrote',

'tr_meliscore_dashboard_plugin_common_tab_properties' => 'Properties',
'tr_meliscore_dashboard_plugin_common_no_param' => 'No parameters to edit',

'tr_meliscore_generate_error_No module or plugin or idpage parameters' => 'No module/pluginName/dashboardId parameters',
'tr_meliscore_generate_error_Plugin config not found' => 'Plugin config not found',
'tr_meliscore_generate_error_Plugin cant be created' => 'Plugin can\'t be created',
];
7 changes: 7 additions & 0 deletions language/fr_FR.interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -821,4 +821,11 @@
'tr_meliscore_dashboard_bubble_plugins_view_message' => 'Voir les messages',
'tr_meliscore_dashboard_bubble_plugins_view_messages' => 'Voir les messages',
'tr_meliscore_dashboard_bubble_plugins_wrote' => 'a écrit',

'tr_meliscore_dashboard_plugin_common_tab_properties' => 'Propriétés',
'tr_meliscore_dashboard_plugin_common_no_param' => 'Aucun paramètre à éditer',

'tr_meliscore_generate_error_No module or plugin or idpage parameters' => 'Pas de parametres module/pluginName/dashboardId',
'tr_meliscore_generate_error_Plugin config not found' => 'Configuration plugin non trouvée',
'tr_meliscore_generate_error_Plugin cant be created' => 'Plugin impossible à créer',
];
2 changes: 1 addition & 1 deletion public/build/css/bundle.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/js/bundle.js

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions public/css/bootstrap-tagsinput.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* bootstrap-tagsinput v0.8.0
*
*/

.bootstrap-tagsinput {
background-color: #fff;
border: 1px solid #ccc;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
display: inline-block;
padding: 4px 6px;
color: #555;
vertical-align: middle;
border-radius: 4px;
max-width: 100%;
line-height: 22px;
cursor: text;
}
.bootstrap-tagsinput input {
border: none;
box-shadow: none;
outline: none;
background-color: transparent;
padding: 0 6px;
margin: 0;
width: auto;
max-width: inherit;
}
.bootstrap-tagsinput.form-control input::-moz-placeholder {
color: #777;
opacity: 1;
}
.bootstrap-tagsinput.form-control input:-ms-input-placeholder {
color: #777;
}
.bootstrap-tagsinput.form-control input::-webkit-input-placeholder {
color: #777;
}
.bootstrap-tagsinput input:focus {
border: none;
box-shadow: none;
}
.bootstrap-tagsinput .tag {
margin-right: 2px;
color: white;
}
.bootstrap-tagsinput .tag [data-role="remove"] {
margin-left: 8px;
cursor: pointer;
}
.bootstrap-tagsinput .tag [data-role="remove"]:after {
content: "x";
padding: 0px 2px;
}
.bootstrap-tagsinput .tag [data-role="remove"]:hover {
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.bootstrap-tagsinput .tag [data-role="remove"]:hover:active {
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
188 changes: 187 additions & 1 deletion public/js/core/gridstack.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,105 @@ var melisDashBoardDragnDrop = {
});
}
},
// open properties modal for the dashboard plugin
createDashboardPluginModal: function (el) {
var $this = $(el);
var gridStackItem = $this.closest('.grid-stack-item');
var pluginId = gridStackItem.attr('data-gs-id');
var pluginName = gridStackItem.attr('data-gs-name');
var pluginModule = gridStackItem.attr('data-gs-module');

// initialation of local variable
zoneId = 'id_meliscms_plugin_modal_interface';
melisKey = 'meliscms_plugin_modal_interface';
modalUrl = '/melis/MelisCore/DashboardPlugins/renderDashboardPluginModal';

var modalParams = {
dashboardId : activeTabId,
pluginName: pluginName,
pluginId : pluginId,
pluginModule : pluginModule,
};

// requesitng to create modal and display after
window.parent.melisHelper.createModal(zoneId, melisKey, false, modalParams, modalUrl, function() {});
},
dashboardPluginModalSubmit: function (el) {
var self = this;
// var grid = $('#' + activeTabId + ' .grid-stack').data('gridstack');
// self.serializeWidgetMap(grid.container[0].children);

// Assign in function for bug issue in closing and opening tabs
var $this = $(el);
var melisPluginDashboardId = $this.closest("#id_meliscore_dashboard_plugin_modal_container").data("melis-plugin-dashboard-id");
var pluginModule = $this.closest("#id_meliscore_dashboard_plugin_modal_container").data("melis-plugin-module");
var pluginName = $this.closest("#id_meliscore_dashboard_plugin_modal_container").data("melis-plugin-name");
var pluginId = $this.closest("#id_meliscore_dashboard_plugin_modal_container").data("melis-plugin-id");
var dataString = $this.closest('.modal-content').find("form");

// Construct data string
var datastring = dataString.serializeArray();

//add to datastring the unchecked checkbox fields
$this.closest('.modal-content').find("form input:checkbox").each(function(){
if (!this.checked) {
datastring.push({name: this.name, value: 0});
}
});

datastring.push({name: "dashboardId", value: melisPluginDashboardId});
datastring.push({name: "pluginModule", value: pluginModule});
datastring.push({name: "pluginName", value: pluginName});
datastring.push({name: "pluginId", value: pluginId});

try {
self.validateDashboardPluginModal(pluginId, datastring);
} catch (e) {
console.log(e);
}
},
validateDashboardPluginModal: function (pluginId, datastring) {
var self = this;
$.ajax({
type: 'POST',
url: "/melis/MelisCore/DashboardPlugins/validateDashboardPluginModal?validate",
data: datastring,
dataType: 'json'
}).done(function(data) {
if (data.success) {
// update config for saving
self.updateDashboardPluginConfig(pluginId, datastring);
// save dashboard plugins
var grid = $('#' + activeTabId + ' .grid-stack').data('gridstack');
self.serializeWidgetMap(grid.container[0].children);
// close modal
$('#id_meliscore_dashboard_plugin_modal_container').modal('hide');
// refresh widget
$('.grid-stack-item[data-gs-id="' + pluginId + '"]').find('.dashboard-plugin-refresh').click();
} else {
dashboardPluginHelpepr.melisMultiKoNotification(data.errors);
}
}).fail(function(xhr, textStatus, errorThrown) {
alert( translations.tr_meliscore_error_message );
});
},
updateDashboardPluginConfig: function (pluginId, datastring) {
// get plugin config that is saved in the dom
var pluginConfig = $('.grid-stack-item[data-gs-id="' + pluginId + '"]').find('.dashboard-plugin-json-config').text();
pluginConfig = JSON.parse(pluginConfig);

// override config from plugin to the ones that we get from the modal form
$.each(pluginConfig.datas, function (index, value) {
var field = datastring.find(input => input.name == index);

if (typeof field != 'undefined') {
pluginConfig.datas[field.name] = field.value;
}
});

// update plugin config in dom
$('.grid-stack-item[data-gs-id="' + pluginId + '"]').find('.dashboard-plugin-json-config').text(JSON.stringify(pluginConfig));
},
// set current widget/plugin
setCurrentPlugin: function(widget) {
// set current plugin
Expand Down Expand Up @@ -1029,4 +1128,91 @@ var melisDashBoardDragnDrop = {
$body.on("click", ".dashboard-plugin-refresh", function() {
melisDashBoardDragnDrop.refreshWidget($(this));
});
})(jQuery);

$body.on("click", ".dashboard-plugin-properties", function() {
melisDashBoardDragnDrop.createDashboardPluginModal($(this));
});

$body.on("click", "#dashboard-plugin-properties-save", function() {
melisDashBoardDragnDrop.dashboardPluginModalSubmit($(this));
});
})(jQuery);

var dashboardPluginHelpepr = (function($, window) {
var $body = window.parent.$("body");
/**
* KO NOTIFICATION for Multiple Form
*/
function melisMultiKoNotification(errors, closeByButtonOnly) {
if (!closeByButtonOnly) closeByButtonOnly = true;

var closeByButtonOnly = ( closeByButtonOnly !== true ) ? 'overlay-hideonclick' : '',
errorTexts = '<div class="row">';

// remove red color for correctly inputted fields
$body.find("#id_meliscore_dashboard_plugin_modal .form-group label").css("color", "inherit");

$.each(errors, function(idx, errorData) {
if ( errorData['success'] === false ) {
errorTexts += '<h3>'+ (errorData['name']) +'</h3>';
if (errorData['message'] != "") {
errorTexts +='<h4>'+ (errorData['message']) +'</h4>';
}

// Highlighting errors fields
highlightMultiErrors(errorData['success'], errorData['errors']);

$.each( errorData['errors'], function( key, error ) {
if ( key !== 'label' ) {
errorTexts += '<div class="col-xs-12 col-sm-5">';
errorTexts += ' <b>'+ (( error['label'] == undefined ) ? ((error['label']== undefined) ? key : errors['label'] ) : error['label'] ) +'</b>';
errorTexts += '</div>';
errorTexts += '<div class="col-xs-12 col-sm-7">';
errorTexts += ' <div class="modal-error-container">';
// catch error level of object
try {
$.each( error, function( key, value ) {
if(key !== 'label' && key !== 'form'){
$errMsg = '';
if(value instanceof Object){
$errMsg = value[0];
}else{
$errMsg = value;
}
if($errMsg != '') {
errorTexts += '<span class="tets error-list"><i class="fa fa-circle"></i>'+ $errMsg + '</span><br/>';
}
}
});
} catch(e) {
if(key !== 'label' && key !== 'form') {
errorTexts += '<span class="hoy error-list"><i class="fa fa-circle"></i>'+ error + '</span>';
}
}
}
errorTexts += '</div></div>';
});
}
});

errorTexts += '</div>';
var div = '<div class="melis-modaloverlay '+ closeByButtonOnly +'"></div>';
div += '<div class="melis-modal-cont KOnotif page-edition-multi-ko"> <div class="modal-content error">'+ errorTexts +' <span class="btn btn-block btn-primary">' + translations.tr_meliscore_notification_modal_Close +'</span></div> </div>';

$body.append(div);
}

function highlightMultiErrors(success, errors){
// if all form fields are error color them red
if ( !success ) {
$.each( errors, function( key, error ) {
$body.find("#id_meliscore_dashboard_plugin_modal .form-control[name='"+key +"']").parents(".form-group").find("label").css("color","red");
});
}
}

return {
melisMultiKoNotification : melisMultiKoNotification
}

})(jQuery, window);

0 comments on commit 9112d01

Please sign in to comment.