Skip to content

Commit

Permalink
Merge pull request #221 from deanblackborough/heading-date-sub-tools
Browse files Browse the repository at this point in the history
Heading date sub tools
  • Loading branch information
deanblackborough committed Feb 18, 2017
2 parents 90f0158 + 990b84c commit de95772
Show file tree
Hide file tree
Showing 24 changed files with 647 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ v1.13: In Progress
- Switching to a new sub tool clears any unsaved changes displaying in the designer. [Bugfix]
- Select parent row code looks at whether a content item is selected and returns the column that is relevant to the current environment status. [Bugfix]
- Added a Date Element tool to the Form Builder along with the Styling and Delete sub tools. [Feature]
- Added a Heading & Date content item to the Content Manager. [Feature]
- Added a Heading & Date content item to the Content Manager along with the Styling, Typography and Delete sub tools. [Feature]
- Clear the selected tool for the Form Builder upon logout. [Bugfix]
- Refactoring

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ I am working towards reinstating the Website Manager and the Media Library. As s

Latest stable release
--------
v1.12 - Released 14th February 2017
v1.13 - Released 18th February 2017

Overview
--------
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.13';
// Release date for current release
$version_release_date = 'In progress';
$version_release_date = '18th February 2017';
19 changes: 9 additions & 10 deletions application/modules/dlayer/views/scripts/index/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,19 @@
</div>

<div class="col-md-6 col-sm-6 col-xs-12">
<h3><span class="label label-success">v1.12</span> Mixed bag <small class="text-muted">(14th February 2017)</small></h3>
<h3><span class="label label-success">v1.13</span> Bugs & Date <small class="text-muted">(18th 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>
<li>Switching to a new sub tool clears any unsaved changes displaying in the designer. [Bugfix]</li>
<li>Select parent row code looks at whether a content item is selected and returns the column that is relevant to the current environment status. [Bugfix]</li>
<li>Added a Date Element tool to the Form Builder along with the Styling and Delete sub tools. [Feature]</li>
<li>Added a Heading & Date content item to the Content Manager along with the Styling, Typography and Delete sub tools. [Feature]</li>
<li>Clear the selected tool for the Form Builder upon logout. [Bugfix]</li>
<li>Refactoring.</li>
</ul>

<h3><span class="label label-default">v1.12</span> Mixed bag <small class="text-muted">(14th February 2017)</small></h3>

<h3><span class="label label-default">v1.11</span> Form Builder part 5 <small class="text-muted">(10th February 2017)</small></h3>

<h3><span class="label label-default">v1.10</span> Form Builder part 4 <small class="text-muted">(4th February 2017)</small></h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ protected function previewData()

$this->contentData();

$this->preview_data = array();
$this->preview_data = array(
'heading' => $this->content_data['heading'],
'date' => date($this->content_data['format'], strtotime($this->content_data['date']))
);

$this->preview_data_fetched = true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* Delete sub tool for heading & date content items
*
* @author Dean Blackborough
* @copyright G3D Development Limited
* @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
*/
class Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Delete_Form extends
Dlayer_DesignerTool_ContentManager_Shared_Form_Delete
{
/**
* Set the properties for the form
*
* @param array $tool Tool and environment data array
* @param array $data Current data for content item
* @param integer $instances Instances of content data on web site
* @param array $element_data
* @param array|NULL $options Zend form options
*/
public function __construct(array $tool, array $data, $instances, array $element_data, $options = null)
{
$this->content_type = 'heading-date';
$this->sub_tool_model = 'Delete';

parent::__construct($tool, $data, $instances, $element_data, $options);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/**
* Data model for the heading & date delete sub tool
*
* @author Dean Blackborough <dean@g3d-development.com>
* @copyright G3D Development Limited
* @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
*/
class Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Delete_Model extends
Dlayer_DesignerTool_ContentManager_Shared_Model_Delete
{
// No custom logic required
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

/**
* Heading & Date ribbon data class for delete sub tool
*
* @author Dean Blackborough <dean@g3d-development.com>
* @copyright G3D Development Limited
* @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
*/
class Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Delete_Ribbon extends Dlayer_Ribbon_Content
{
/**
* Fetch the view data for the current tool tab, typically the returned array will have at least two indexes,
* one for the form and another with the data required by the preview functions
*
* @param array $tool Tool and environment data
*
* @return array
*/
public function viewData(array $tool)
{
$this->tool = $tool;

return array(
'form' => new Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Delete_Form(
$tool,
array(),
0,
array()
)
);
}

/**
* Fetch the data array for the content item, if in edit mode mode populate the values otherwise every value is
* set to FALSE, the tool form can simply check to see if the value is FALSe or not and then set the existing value
*
* @return array
*/
protected function contentData()
{
// TODO: Implement contentData() method.
}

/**
* Fetch the number of instances for the content items data
*
* @return integer
*/
protected function instancesOfData()
{
// TODO: Implement instancesOfData() method.
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/**
* Heading & date delete sub tool
*
* @author Dean Blackborough <dean@g3d-development.com>
* @copyright G3D Development Limited
* @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
*/
class Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Delete_Tool extends
Dlayer_DesignerTool_ContentManager_Shared_Tool_Delete
{
// No custom logic required
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php /** @var $this Dlayer_View_Codehinting */ ?>

<div class="col-md-12 col-sm-12 small">
<?php
if ($this->data != false) {
echo $this->data['form'];
}
?>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* Styling sub tools for the heading & date content item
*
* @author Dean Blackborough
* @copyright G3D Development Limited
* @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
*/
class Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Styling_Form extends
Dlayer_DesignerTool_ContentManager_Shared_Form_Styling
{
/**
* Set the properties for the form
*
* @param array $tool Tool and environment data array
* @param array $data Current data for content item
* @param integer $instances Instances of content data on web site
* @param array $element_data
* @param array|NULL $options Zend form options
*/
public function __construct(array $tool, array $data, $instances, array $element_data, $options = null)
{
$this->content_type = 'heading-date';
$this->sub_tool_model = 'Styling';

parent::__construct($tool, $data, $instances, $element_data, $options);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/**
* Data model for styling sub tool
*
* @author Dean Blackborough <dean@g3d-development.com>
* @copyright G3D Development Limited
* @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
*/
class Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Styling_Model extends
Dlayer_DesignerTool_ContentManager_Shared_Model_Styling
{
// No custom logic, here if required
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

/**
* Heading & Date content item ribbon data class
*
* @author Dean Blackborough <dean@g3d-development.com>
* @copyright G3D Development Limited
* @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
*/
class Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Styling_Ribbon extends Dlayer_Ribbon_Content
{
/**
* Fetch the view data for the current tool tab, typically the returned array will have at least two indexes,
* one for the form and another with the data required by the preview functions
*
* @param array $tool Tool and environment data
*
* @return array
*/
public function viewData(array $tool)
{
$this->tool = $tool;

$this->contentData();
$this->previewData();

return array(
'form' => new Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Styling_Form(
$tool,
$this->content_data,
$this->instancesOfData(),
array()
),
'preview' => $this->preview_data
);
}

/**
* Fetch the data array for the content item, if in edit mode mode populate the values otherwise every value is
* set to FALSE, the tool form can simply check to see if the value is FALSe or not and then set the existing value
*
* @return void Write to $this->content_data
*/
protected function contentData()
{
if ($this->content_fetched === false) {
$this->content_data = array(
'content_background_color' => false,
);

if ($this->tool['content_id'] !== null) {
$model_styling = new Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Styling_Model();
$content_background_color = $model_styling->backgroundColor(
$this->tool['site_id'],
$this->tool['page_id'],
$this->tool['content_id']
);

if ($content_background_color !== false) {
$this->content_data['content_background_color'] = $content_background_color;
}
}

$this->content_fetched = true;
}
}

/**
* Fetch the data required by the preview functions
*
* @return void
*/
protected function previewData()
{
if ($this->preview_data_fetched === false) {

$this->contentData();

$this->preview_data = array(
'id' => $this->tool['content_id'],
'background_color' => $this->content_data['content_background_color']
);

$this->preview_data_fetched = true;
}
}

/**
* Fetch the number of instances for the content items data
*
* @return integer
*/
protected function instancesOfData()
{
return 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/**
* Styling sub tool
*
* @author Dean Blackborough <dean@g3d-development.com>
* @copyright G3D Development Limited
* @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
*/
class Dlayer_DesignerTool_ContentManager_HeadingDate_SubTool_Styling_Tool extends
Dlayer_DesignerTool_ContentManager_Shared_Tool_Styling
{
/**
* Generate the return ids array
*
* @return array
*/
protected function returnIds()
{
return array(
array(
'type' => 'page_id',
'id' => $this->page_id,
),
array(
'type' => 'row_id',
'id' => $this->row_id,
),
array(
'type' => 'column_id',
'id' => $this->column_id,
),
array(
'type' => 'tool',
'id' => 'HeadingDate',
),
array(
'type' => 'tab',
'id' => 'styling',
'sub_tool' => 'Styling'
),
array(
'type' => 'content_id',
'id' => $this->content_id,
'content_type' => 'heading-date'
)
);
}
}
Loading

0 comments on commit de95772

Please sign in to comment.