Skip to content

Commit

Permalink
Replaced inline styles
Browse files Browse the repository at this point in the history
  • Loading branch information
execut committed Jul 5, 2018
1 parent 594b614 commit d5d43fe
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
15 changes: 10 additions & 5 deletions widgets/DetailView.php
Expand Up @@ -29,6 +29,7 @@ class DetailView extends \kartik\detail\DetailView
public $applyButton = '<input type="submit" name="apply" value="Применить" class="btn btn-primary" href="" title="Сохранить изменения">';
public $cancelButton = '<a class="btn btn-default" href="{backUrl}">Вернуться к списку</a>';
public $backUrl = null;
public $alertBlockAddon = null;

public function __construct($config = [])
{
Expand All @@ -47,10 +48,9 @@ public function __construct($config = [])
// ],
'buttons1' => '',
'buttonContainer' => [
'class' => 'pull-right',
'style' => 'margin-right: 8px;margin-top: -9px;',
'class' => 'buttons-container',
],
'mainTemplate' => $this->renderAlertBlock() . '{detail}<div style="height:28px;width:0px;display: inline-block"></div>{buttons}',
'mainTemplate' => $this->renderAlertBlock() . '{detail}{buttons}',
'bordered' => true,
'striped' => true,
'condensed' => true,
Expand Down Expand Up @@ -89,7 +89,6 @@ public function run() {

public function init()
{
$this->buttons2 = $this->renderSubmitButtons();
$this->attributes = $this->model->getFormFields();
$this->formOptions['action'] = $this->getAction();
$this->deleteOptions = [
Expand All @@ -115,6 +114,12 @@ protected function getAction() {
]);
}

public function runWidget()
{
$this->buttons2 = $this->renderSubmitButtons();
parent::runWidget(); // TODO: Change the autogenerated stub
}

/**
* Initializes and renders alert container block
*/
Expand Down Expand Up @@ -146,7 +151,7 @@ protected function renderAlertBlock()

$out .= "\n</div>";

return $out;
return $this->alertBlockAddon . $out;
}

/**
Expand Down
17 changes: 17 additions & 0 deletions widgets/assets/DetailView.css
@@ -0,0 +1,17 @@
.kv-edit-mode .buttons-container {
margin-left: 10px;
margin-right: 8px;
margin-top: -9px;
text-align: right;
}
.kv-edit-mode .buttons-container .alert {
margin-bottom: 0;
}
.kv-edit-mode .buttons-container .kv-buttons-1,
.kv-edit-mode .buttons-container .kv-buttons-2 {
display: inline-block;
text-align: left;
}
.kv-edit-mode .buttons-container .kv-buttons-2 {
margin-bottom: 8px;
}
17 changes: 17 additions & 0 deletions widgets/assets/DetailView.less
@@ -0,0 +1,17 @@
.kv-edit-mode .buttons-container {
margin-left: 10px;
margin-right: 8px;
margin-top: -9px;
text-align: right;
.alert {
margin-bottom: 0;
}
.kv-buttons-1, .kv-buttons-2 {
display: inline-block;
text-align: left;
}

.kv-buttons-2 {
margin-bottom: 8px;
}
}

0 comments on commit d5d43fe

Please sign in to comment.