Skip to content

Commit

Permalink
Planning Twig UI
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 committed Apr 19, 2024
1 parent a878926 commit 12ffdfd
Show file tree
Hide file tree
Showing 15 changed files with 983 additions and 910 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -266,6 +266,7 @@ The present file will list all changes made to the project; according to the
- `NetworkPort::getNetworkPortInstantiationsWithNames()`
- `NetworkPort::resetConnections()`
- `PlanningExternalEvent::addVisibilityRestrict()`
- `PlanningRecall::specificForm()`
- `Plugin::migrateItemType()`
- `ProfileRight::updateProfileRightAsOtherRight()`
- `ProfileRight::updateProfileRightsAsOtherRights()`
Expand Down Expand Up @@ -316,6 +317,7 @@ The present file will list all changes made to the project; according to the
- `$CFG_GLPI['debug_sql']` and `$CFG_GLPI['debug_vars']` configuration options.
- `DropdownTranslation::getTranslationByName()`
- `addgroup` and `deletegroup` actions in `front/user.form.php`.
- AJAX file `ajax/planningcheck.php` (Replaced with `Planning::showPlanningCheck`).


## [10.0.15] unreleased
Expand Down
80 changes: 0 additions & 80 deletions ajax/planningcheck.php

This file was deleted.

7 changes: 0 additions & 7 deletions css/legacy/includes/_planning.scss
Expand Up @@ -93,13 +93,6 @@
flex-wrap: wrap;
align-items: center;

.actor_icon {
padding-bottom: 2px;
vertical-align: top;
font-size: 14px;
margin-left: 5px;
}

label {
padding-left: 5px;
line-height: 16px;
Expand Down
34 changes: 19 additions & 15 deletions js/planning.js
Expand Up @@ -726,21 +726,7 @@ var GLPIPlanning = {
});

$('#planning_filter .delete_planning').on( 'click', function() {
var deleted = $(this);
var li = deleted.closest('ul.filters > li');
$.ajax({
url: CFG_GLPI.root_doc+"/ajax/planning.php",
type: 'POST',
data: {
action: 'delete_filter',
filter: deleted.attr('value'),
type: li.attr('event_type')
},
success: function() {
li.remove();
GLPIPlanning.refresh();
}
});
GLPIPlanning.deletePlanning(this);
});

var sendDisplayEvent = function(current_checkbox, refresh_planning) {
Expand Down Expand Up @@ -841,6 +827,24 @@ var GLPIPlanning = {
});
},

deletePlanning: (trigger_element) => {
const deleted = $(trigger_element);
const li = deleted.closest('ul.filters > li');
$.ajax({
url: CFG_GLPI.root_doc+"/ajax/planning.php",
type: 'POST',
data: {
action: 'delete_filter',
filter: deleted.attr('value'),
type: li.attr('event_type')
},
success: function() {
li.remove();
GLPIPlanning.refresh();
}
});
},

// send ajax for event storage (on event drag/resize)
editEventTimes: function(info, move_instance) {
move_instance = move_instance || false;
Expand Down
8 changes: 8 additions & 0 deletions src/Application/View/Extension/DataHelpersExtension.php
Expand Up @@ -41,6 +41,7 @@
use Toolbox;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigTest;

/**
* @since 10.0.0
Expand All @@ -67,6 +68,13 @@ public function getFilters(): array
];
}

public function getTests(): array
{
return [
new TwigTest('url_safe', \Toolbox::isUrlSafe(...)),
];
}

/**
* Return date formatted to user preferred format.
*
Expand Down
6 changes: 5 additions & 1 deletion src/Application/View/Extension/ItemtypeExtension.php
Expand Up @@ -266,7 +266,11 @@ private function getItemInstance($item, ?int $id = null): ?CommonDBTM
return $instance ?: null;
}

public function getItemtypeForeignKey(string $itemtype): ?string
/**
* @param class-string|object $itemtype The itemtype or an item instance.
* @return string|null The foreign key field name of the itemtype or null if not found.
*/
public function getItemtypeForeignKey(string|object $itemtype): ?string
{
if (is_a($itemtype, CommonDBTM::class, true)) {
return $itemtype::getForeignKeyField();
Expand Down

0 comments on commit 12ffdfd

Please sign in to comment.