Skip to content

Commit

Permalink
Merge pull request #883 from abhishek-webkul/gli-1671
Browse files Browse the repository at this point in the history
Added: 'Save and stay' button on missing pages at back office
  • Loading branch information
rohit053 authored Mar 14, 2024
2 parents ee3d783 + 849d2fb commit b146659
Show file tree
Hide file tree
Showing 26 changed files with 323 additions and 32 deletions.
12 changes: 12 additions & 0 deletions controllers/admin/AdminAddressesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ public function renderForm()
)
);

if (!Tools::getValue('liteDisplaying')) {
$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);
}

$this->fields_value['address_type'] = (int)Tools::getValue('address_type', 1);

$id_customer = (int)Tools::getValue('id_customer');
Expand Down
25 changes: 23 additions & 2 deletions controllers/admin/AdminCmsCategoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,19 @@ public function postProcess()
$object = parent::postProcess();
$this->updateAssoShop((int)Tools::getValue('id_cms_category'));
if ($object !== false) {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
if ($this->id_object) {
Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&conf=4&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
} else {
Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
}
} else {
if ($this->id_object) {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
}
}
}
return $object;
}
Expand Down Expand Up @@ -289,7 +301,16 @@ public function renderForm()
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

if (Shop::isFeatureActive()) {
Expand Down
7 changes: 7 additions & 0 deletions controllers/admin/AdminCmsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ public function renderForm()
'title' => $this->l('Save'),
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
'save_and_preview' => array(
'name' => 'viewcms',
'type' => 'submit',
Expand Down
11 changes: 10 additions & 1 deletion controllers/admin/AdminContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,16 @@ public function renderForm()
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

if (Shop::isFeatureActive()) {
Expand Down
10 changes: 10 additions & 0 deletions controllers/admin/AdminCountriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,16 @@ public function renderForm()
'title' => $this->l('Save')
);

$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);

return parent::renderForm();
}

Expand Down
10 changes: 10 additions & 0 deletions controllers/admin/AdminCurrenciesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ public function renderForm()
'title' => $this->l('Save'),
);

$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);

return parent::renderForm();
}

Expand Down
12 changes: 12 additions & 0 deletions controllers/admin/AdminCustomersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,18 @@ public function renderForm()
'title' => $this->l('Save'),
);

if (!Tools::getValue('liteDisplaying')) {
$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);
}

$birthday = explode('-', $this->getFieldValue($obj, 'birthday'));

$this->fields_value = array(
Expand Down
10 changes: 10 additions & 0 deletions controllers/admin/AdminEmployeesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,16 @@ public function renderForm()
'title' => $this->l('Save'),
);

$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);

$this->fields_value['passwd'] = false;
$this->fields_value['bo_theme_css'] = $obj->bo_theme.'|'.$obj->bo_css;

Expand Down
16 changes: 13 additions & 3 deletions controllers/admin/AdminFeaturesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ public function renderForm()
'title' => $this->l('Save'),
);

$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);

return parent::renderForm();
}

Expand Down Expand Up @@ -544,9 +554,9 @@ public function processAdd()
if ($this->table == 'feature_value' && ($this->display == 'edit' || $this->display == 'add')) {
$this->redirect_after = self::$currentIndex.'&addfeature_value&id_feature='.(int)Tools::getValue('id_feature').'&token='.$this->token;
} else {
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token;
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.(int) $object->id.'&conf=3&update'.$this->table.'&token='.$this->token;
}
} elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && count($this->errors)) {
} elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && count($this->errors) && $this->table == 'feature_value') { // enter only if feature is submitted
$this->display = 'editFeatureValue';
}

Expand All @@ -562,7 +572,7 @@ public function processUpdate()
$object = parent::processUpdate();

if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) {
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token;
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.(int) Tools::getValue('id_feature').'&conf=4&update'.$this->table.'&token='.$this->token;
}

return $object;
Expand Down
11 changes: 10 additions & 1 deletion controllers/admin/AdminGendersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,16 @@ public function renderForm()
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

/** @var Gender $obj */
Expand Down
9 changes: 9 additions & 0 deletions controllers/admin/AdminGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ public function renderForm()
'submit' => array(
'title' => $this->l('Save'),
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
'input' => array(
array(
'type' => 'text',
Expand Down
11 changes: 10 additions & 1 deletion controllers/admin/AdminImagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,16 @@ public function __construct()
),
'submit' => array(
'title' => $this->l('Save')
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

parent::__construct();
Expand Down
10 changes: 10 additions & 0 deletions controllers/admin/AdminLanguagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,16 @@ public function renderForm()
'title' => $this->l('Save'),
);

$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
);

/** @var Language $obj */
if (!($obj = $this->loadObject(true))) {
return;
Expand Down
11 changes: 10 additions & 1 deletion controllers/admin/AdminMetaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,16 @@ public function renderForm()
),
'submit' => array(
'title' => $this->l('Save')
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
return parent::renderForm();
}
Expand Down
11 changes: 10 additions & 1 deletion controllers/admin/AdminOrderMessageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,16 @@ public function __construct()
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

parent::__construct();
Expand Down
11 changes: 10 additions & 1 deletion controllers/admin/AdminProfilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ public function __construct()
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

$list_profile = array();
Expand Down
11 changes: 10 additions & 1 deletion controllers/admin/AdminQuickAccessesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,16 @@ public function __construct()
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

parent::__construct();
Expand Down
9 changes: 9 additions & 0 deletions controllers/admin/AdminSpecificPriceRuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,15 @@ public function renderForm()
'submit' => array(
'title' => $this->l('Save')
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

$price = $this->getFieldValue($this->object, 'price');
Expand Down
11 changes: 10 additions & 1 deletion controllers/admin/AdminStatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,16 @@ public function renderForm()
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);

return parent::renderForm();
Expand Down
Loading

0 comments on commit b146659

Please sign in to comment.