Skip to content

Commit

Permalink
Merge pull request #217 from deanblackborough/control-bar-action-helper
Browse files Browse the repository at this point in the history
Control bar action helper
  • Loading branch information
deanblackborough committed Feb 14, 2017
2 parents ab7ab96 + 1fd5372 commit adc4fe9
Show file tree
Hide file tree
Showing 29 changed files with 165 additions and 169 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ v1.12: In Progress
- The re-order code which runs after an element is deleted in the Form Builder was sorting incorrectly. [Bugfix]
- Added an admin controller to the Content Manager. [Refactoring]
- Added an admin controller to the default module. [Refactoring]
- Added the control bar to the Form Builder and Content Manager previews. There is a button to return to the Designer/Manager and in the Form Builder an option to set the width of the preview. [Feature]
- The Form Builder displays the assigned title and subtitle. [Bugfix]
- Model cleanup. [Refactoring]
- Minor fixes and improvements.

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Dlayer

Thank you for taking the time to look at Dlayer, I've been working on this project for many years including the inevitable restarts, it has taken an inordinate amount of work to finally get here, now that I have a stable base I'm hoping to grow the project.

Over the next few weeks, I am going to continue to polish the core of the Content manager, work on the set-up process and then start reintegrating the removed designers, first on the list is the Form builder.
I am working towards reinstating the Website Manager and the Media Library. As soon as they are back into the app, I can move towards making Dlayer create a website and then its main selling point, widgets.

Latest stable release
--------
v1.11 - Released 10th February 2017
v1.12 - Released 14th February 2017

Overview
--------
Expand All @@ -36,12 +36,12 @@ Requirements
Documentation
---------

Please check the documentation at http://www.dlayer.com/docs/ the documentation is currently a little sparse, I am in the progress of moving it to http://dlayer.github.io/dlayer/
Please check the documentation at http://www.dlayer.com/docs/ - the documentation is currently a little sparse, I am in the progress of moving it to http://dlayer.github.io/dlayer/

Setup
---------

I am working towards improving the set-up/reset process for Dlayer, until then please follow the steps below.
I am working towards improving the set-up/reset process for Dlayer, until then, please follow the steps below.

* Set-up your development environment. I have written a blog post on setting up a suitable environment on a Linux machine, http://www.deanblackborough.com/2016/04/30/ubuntu-install-apache-php-mysql-sass-bower-and-phpstorm-for-local-development/
* I will assume your local environment is at http://dlayer.dev
Expand Down
2 changes: 1 addition & 1 deletion application/configs/environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
// Version number for current release
$version_no = 'v1.12';
// Release date for current release
$version_release_date = 'In progress';
$version_release_date = '14th February 2017';
19 changes: 1 addition & 18 deletions application/modules/content/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private function controlBar($identity_id, $site_id)
)
);

$this->assignToControlBar($control_bar_buttons, $control_bar_drops);
$this->_helper->populateControlBar($control_bar_buttons, $control_bar_drops);
}

/**
Expand Down Expand Up @@ -194,21 +194,4 @@ private function handleEditPage()
}
}
}

/**
* Assign control bar buttons
*
* @param array $buttons
* @param array $drops
*
* @todo Move this into an action helper
* @return void
*/
private function assignToControlBar(array $buttons, array $drops)
{
$layout = Zend_Layout::getMvcInstance();
$layout->assign('show_control_bar', true);
$layout->assign('control_bar_buttons', $buttons);
$layout->assign('control_bar_drops', $drops);
}
}
10 changes: 10 additions & 0 deletions application/modules/content/controllers/DesignController.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,16 @@ private function pagePreview()
$this->view->styling_rows = $designer_page->rowStyles();
$this->view->styling_page = $designer_page->pageStyles();

$control_bar_buttons = array(
array(
'uri' => '/content/design/index',
'class' => 'primary',
'name' => 'Return to Content Manager'
)
);

$this->_helper->populateControlBar($control_bar_buttons, array());

return $this->view->render("design/page-preview.phtml");
}

Expand Down
19 changes: 1 addition & 18 deletions application/modules/content/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,7 @@ private function controlBar($identity_id, $site_id)
)
);

$this->assignToControlBar($control_bar_buttons, $control_bar_drops);
}

/**
* Assign control bar buttons
*
* @param array $buttons
* @param array $drops
*
* @todo Move this into an action helper
* @return void
*/
private function assignToControlBar(array $buttons, array $drops)
{
$layout = Zend_Layout::getMvcInstance();
$layout->assign('show_control_bar', true);
$layout->assign('control_bar_buttons', $buttons);
$layout->assign('control_bar_drops', $drops);
$this->_helper->populateControlBar($control_bar_buttons, $control_bar_drops);
}

/**
Expand Down
19 changes: 1 addition & 18 deletions application/modules/dlayer/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function controlBar($identity_id, $site_id)
)
);

$this->assignToControlBar($control_bar_buttons, $control_bar_drops);
$this->_helper->populateControlBar($control_bar_buttons, $control_bar_drops);
}

/**
Expand Down Expand Up @@ -180,21 +180,4 @@ private function handleEdit()
}
}
}

/**
* Assign control bar buttons
*
* @param array $buttons
* @param array $drops
*
* @todo Move this into an action helper
* @return void
*/
private function assignToControlBar(array $buttons, array $drops)
{
$layout = Zend_Layout::getMvcInstance();
$layout->assign('show_control_bar', true);
$layout->assign('control_bar_buttons', $buttons);
$layout->assign('control_bar_drops', $drops);
}
}
19 changes: 1 addition & 18 deletions application/modules/dlayer/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,24 +169,7 @@ private function controlBar($identity_id, $site_id)
)
);

$this->assignToControlBar($control_bar_buttons, $control_bar_drops);
}

/**
* Assign control bar buttons
*
* @param array $buttons
* @param array $drops
*
* @todo Move this into an action helper
* @return void
*/
private function assignToControlBar(array $buttons, array $drops)
{
$layout = Zend_Layout::getMvcInstance();
$layout->assign('show_control_bar', true);
$layout->assign('control_bar_buttons', $buttons);
$layout->assign('control_bar_drops', $drops);
$this->_helper->populateControlBar($control_bar_buttons, $control_bar_drops);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion application/modules/dlayer/views/scripts/index/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@
</div>

<div class="col-md-6 col-sm-6 col-xs-12">
<h3><span class="label label-success">v1.12</span> Not yet named <small class="text-muted">(In progress)</small></h3>
<h3><span class="label label-success">v1.12</span> Mixed bag <small class="text-muted">(14th February 2017)</small></h3>

<ul>
<li>Added a delete sub tool to each of the content items. [Feature]</li>
<li>The Content Manager does not display deleted content items; data remains pending feature to restore.</li>
<li>The re-order code which runs after an element is deleted in the Form Builder was sorting incorrectly. [Bugfix]</li>
<li>Added an admin controller to the Content Manager. [Refactoring]</li>
<li>Added an admin controller to the default module. [Refactoring]</li>
<li>Added the control bar to the Form Builder and Content Manager previews. There is a button to return to the Designer/Manager and in the Form Builder an option to set the width of the preview. [Feature]</li>
<li>The Form Builder displays the assigned title and subtitle. [Bugfix]</li>
<li>Model cleanup. [Refactoring]</li>
<li>Minor fixes and improvements.</li>
</ul>
Expand Down
19 changes: 1 addition & 18 deletions application/modules/form/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,6 @@ private function controlBar($identity_id, $site_id)
)
);

$this->assignToControlBar($control_bar_buttons, $control_bar_drops);
}

/**
* Assign control bar buttons
*
* @param array $buttons
* @param array $drops
*
* @todo Move this into an action helper
* @return void
*/
private function assignToControlBar(array $buttons, array $drops)
{
$layout = Zend_Layout::getMvcInstance();
$layout->assign('show_control_bar', true);
$layout->assign('control_bar_buttons', $buttons);
$layout->assign('control_bar_drops', $drops);
$this->_helper->populateControlBar($control_bar_buttons, $control_bar_drops);
}
}
26 changes: 22 additions & 4 deletions application/modules/form/controllers/DesignController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function indexAction()

$this->controlBar();

$this->view->form = $this->form();
$this->view->design_html = $this->form();
$this->view->ribbon = $this->ribbon();

$this->view->module = $this->getRequest()->getModuleName();
Expand Down Expand Up @@ -134,11 +134,15 @@ public function previewAction()
{
$this->_helper->setLayout('preview');

$this->view->form = $this->formPreview();
$this->view->html = $this->formPreview();

$layout = Zend_Layout::getMvcInstance();
$layout->assign('css_include', array('css/dlayer.css'));
$layout->assign('js_include', array());
$layout->assign('js_include',
array(
'scripts/form-builder.js'
)
);
$layout->assign('title', 'Dlayer.com - Form preview');
}

Expand Down Expand Up @@ -266,10 +270,24 @@ private function formPreview()
{
$form = new Dlayer_Designer_Form($this->site_id, $this->form_id);

$this->view->layout_options = $form->layoutOptions();
$this->view->form = $form->form();
$this->view->row_styling = $form->rowStyles();

return $this->view->render("design/preview.phtml");
$control_bar_buttons = array(
array(
'uri' => '/form/design/index',
'class' => 'primary',
'name' => 'Return to Form Builder'
)
);

$layout = Zend_Layout::getMvcInstance();
$layout->assign('preview_at', true);

$this->_helper->populateControlBar($control_bar_buttons, array());

return $this->view->render("design/form-preview.phtml");
}

/**
Expand Down
19 changes: 1 addition & 18 deletions application/modules/form/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,6 @@ private function controlBar($identity_id, $site_id)
)
);

$this->assignToControlBar($control_bar_buttons, $control_bar_drops);
}

/**
* Assign control bar buttons
*
* @param array $buttons
* @param array $drops
*
* @todo Move this into an action helper
* @return void
*/
private function assignToControlBar(array $buttons, array $drops)
{
$layout = Zend_Layout::getMvcInstance();
$layout->assign('show_control_bar', true);
$layout->assign('control_bar_buttons', $buttons);
$layout->assign('control_bar_drops', $drops);
$this->_helper->populateControlBar($control_bar_buttons, $control_bar_drops);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php /** @var $this Dlayer_View_Codehinting */?>

<h2><?php echo $this->escape($this->layout_options['title']); ?>
<?php if (strlen($this->layout_options['subtitle']) > 0) { echo ' <small>' . $this->escape($this->layout_options['subtitle']) . '</small>'; } ?></h2>
<?php echo $this->form; ?>
2 changes: 1 addition & 1 deletion application/modules/form/views/scripts/design/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div id="designer">
<div class="row">
<div class="col-lg-9 design">
<?php echo $this->form; ?>
<?php echo $this->design_html; ?>
</div>
<div class="col-lg-3">
<div class="row">
Expand Down
11 changes: 9 additions & 2 deletions application/modules/form/views/scripts/design/preview.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@

<div class="container">
<div class="row">
<div class="col-md-12">
<?php echo $this->form; ?>
<div class="col-md-12 preview-form">
<?php echo $this->html; ?>
</div>
</div>
</div>

<script>
$(document).ready(function()
{
formBuilder.setPreviewAtWidth();
});
</script>
2 changes: 1 addition & 1 deletion application/views/layouts/layout.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@
<?php } ?>
</div>
</nav>
<?php } ?>
<?php } ?>
</body>
</html>
32 changes: 32 additions & 0 deletions application/views/layouts/preview.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,37 @@
</head>
<body>
<?php echo $this->layout()->content; ?>
<?php if ($this->layout()->show_control_bar === true) { ?>
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
<?php foreach ($this->layout()->control_bar_buttons as $button) { ?>
<a href="<?php echo $this->escape($button['uri']); ?>" class="navbar-btn btn btn-<?php echo $this->escape($button['class']); ?>"><?php echo $this->escape($button['name']); ?></a>
<?php } ?>
<?php foreach ($this->layout()->control_bar_drops as $drop) { ?>
<div class="btn-group dropup">
<button type="button" class="btn btn-<?php echo $this->escape($drop['class']); ?> dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<?php echo $this->escape($drop['name']); ?> <span class="caret"></span></button>
<ul class="dropdown-menu">
<?php foreach ($drop['buttons'] as $button) { ?>
<li><a href="<?php echo $this->escape($button['uri']); ?>"><?php echo $this->escape($button['name']); ?></a></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<?php if ($this->layout()->preview_at === true) { ?>
<div class="btn-group dropup">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Preview @ <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="#" class="preview_at" data-cols="12">Full width</a></li>
<li><a href="#" class="preview_at" data-cols="9">Three quarter width</a></li>
<li><a href="#" class="preview_at" data-cols="6">Half width</a></li>
<li><a href="#" class="preview_at" data-cols="3">Quarter width</a></li>
</ul>
</div>
<?php } ?>
</div>
</nav>
<?php } ?>
</body>
</html>
11 changes: 11 additions & 0 deletions library/Dlayer/Action/CodeHinting.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,15 @@ public function setLayoutProperties(array $nav_bar_items, $active_nav_bar_uri, a
array $js_includes, $title, $preview_uri = '', $signed_in = TRUE)
{
}

/**
* Pass the control bar options to the layout
*
* @param array $buttons Buttons for control bar
* @param array $dropdowns Drop down data array for control bar
* @return Dlayer_Action_PopulateControlBar
*/
public function populateControlBar(array $buttons, array $dropdowns)
{
}
}
Loading

0 comments on commit adc4fe9

Please sign in to comment.