Skip to content

Commit

Permalink
tab sorting. tag fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Mar 8, 2020
1 parent 540c65c commit 07ee661
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "oneplace/oneplace-core",
"description": "onePlace Core Application",
"type": "project",
"version": "1.0.26",
"version": "1.0.27",
"license": "BSD-3-Clause",
"keywords": [
"laminas",
Expand Down
10 changes: 10 additions & 0 deletions module/Application/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@
],
],
],
'form-updatetabsort' => [
'type' => Literal::class,
'options' => [
'route' => '/application/updatetabsort',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'updatetabsort',
],
],
],
'uppy-updatesort' => [
'type' => Literal::class,
'options' => [
Expand Down
3 changes: 2 additions & 1 deletion module/Application/data/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ INSERT INTO `permission` (`permission_key`, `module`, `label`, `nav_label`, `nav
('quicksearch', 'Application\\Controller\\IndexController', 'Quick Search', '', '', 0, 0),
('updatefieldsort', 'Application\\Controller\\IndexController', 'Update Form Field Sorting', '', '', 0, 0),
('selectbool', 'Application\\Controller\\IndexController', 'Select Yes/No', '', '', 0, 0),
('checkforupdates', 'Application\\Controller\\IndexController', 'Check for Updates', '', '', 0, 1);
('checkforupdates', 'Application\\Controller\\IndexController', 'Check for Updates', '', '', 0, 1),
('updatetabsort', 'Application\\Controller\\IndexController', 'Update Tab Order', '', '', 0, 0);

--
-- Default Widgets
Expand Down
23 changes: 23 additions & 0 deletions module/Application/src/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,4 +660,27 @@ public function checkforupdatesAction()
'aModulesInstalled' => $aModulesInstalled
]);
}

public function updatetabsortAction()
{
$this->layout('layout/json');

$sForm = $_REQUEST['form'];
$aTabs = $_REQUEST['tabs'];

$iSortID = 0;
foreach($aTabs as $sTab) {
$sTab = substr($sTab,strlen('tab-'));
echo $sTab;
CoreController::$aCoreTables['form-tab']->update([
'sort_id' => $iSortID,
],[
'tab_idfs' => $sTab,
'user_idfs' => CoreController::$oSession->oUser->getID(),
]);
$iSortID++;
}

return false;
}
}
2 changes: 1 addition & 1 deletion module/Application/src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Module {
*
* @since 1.0.0
*/
const VERSION = '1.0.26';
const VERSION = '1.0.27';

public function getConfig() : array
{
Expand Down
2 changes: 1 addition & 1 deletion module/Application/view/partial/basictabs.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if(count($this->layout()->aTabs) > 0) {
$iTabCount = 1;
foreach($this->layout()->aTabs as $oTab) { ?>
<li class="nav-item">
<li class="nav-item" id="tab-<?=$oTab->Tab_ID?>">
<a class="nav-link<?=($iTabCount == 1) ? ' active' : ''?>" id="<?=$oTab->Tab_ID?>-tab" data-toggle="tab" href="#<?=$oTab->Tab_ID?>" role="tab" aria-controls="<?=$oTab->Tab_ID?>" aria-selected="<?=($iTabCount == 1) ? 'true' : 'false'?>">
<i class="<?=$oTab->icon?>"></i> <?=$this->translate($oTab->title)?><br /><small><?=$this->translate($oTab->subtitle)?></small>
</a>
Expand Down
6 changes: 5 additions & 1 deletion module/Application/view/partial/viewform.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@
axis:'x',
containment:'parent',
update: function( event, ui ) {
var sortedIDs = $( '#'+listID ).sortable( "toArray" );
var sortedIDs = $( '#<?=$this->sFormName?>Form' ).sortable( "toArray" );
console.log(sortedIDs);
$.post('/application/updatetabsort',{form:"<?=$this->sFormName?>",tabs:sortedIDs},function () {

});
}
});

Expand Down

0 comments on commit 07ee661

Please sign in to comment.