forked from Cyber-Duck/Silverstripe-Block-Page
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Mc Cormack
committed
Sep 22, 2016
1 parent
3038a5a
commit c22da59
Showing
10 changed files
with
207 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<FilesMatch "\.(php|php3|php4|php5|phtml|inc)$"> | ||
Deny from all | ||
</FilesMatch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Copyright (c) 2015, Andrew Mc Cormack <[email protected]>. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
|
||
Neither the name of Andrew Mc Cormack nor the names of his | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Silverstripe-Block-Page | ||
# Silverstripe Block Page | ||
A modular approach to building pages in Silverstripe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
if(!defined('BLOCK_PAGE_PATH')) define('BLOCK_PAGE_PATH', rtrim(basename(dirname(__FILE__)))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
class BlockPageAdmin extends ModelAdmin { | ||
|
||
//private static $menu_priority = 100; | ||
|
||
private static $managed_models = array('BlockPage'); | ||
|
||
private static $url_segment = 'blockpage-admin'; | ||
|
||
private static $menu_title = 'Page Blocks'; | ||
|
||
private static $menu_icon = 'framework/admin/images/menu-icons/16x16/community.png'; | ||
|
||
public function getEditForm($id = null, $fields = null) | ||
{ | ||
$form = parent::getEditForm($id, $fields); | ||
|
||
return $form; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* | ||
* @package silverstripe-block-page | ||
* @license MIT License https://github.com/cyber-duck/silverstripe-block-page/blob/master/LICENSE | ||
* @author <[email protected]> | ||
**/ | ||
class BlockPage_Extension extends DataExtension | ||
{ | ||
/** | ||
* @since version 1.0.0 | ||
* | ||
* @config array $db | ||
**/ | ||
|
||
private static $many_many = array( | ||
'ContentBlocks' => 'ContentBlock' | ||
); | ||
|
||
private static $many_many_extraFields = array( | ||
'ContentBlocks' => array( | ||
'BlockSort' => 'Int' | ||
) | ||
); | ||
|
||
/** | ||
* @since version 1.0.0 | ||
* | ||
* @config array $summary_fields | ||
**/ | ||
private static $summary_fields = array(); | ||
|
||
/** | ||
* | ||
* | ||
* @since version 1.0.0 | ||
* | ||
* @param string $fields The current FieldList object | ||
* | ||
* @return FieldList | ||
**/ | ||
public function updateCMSFields(FieldList $fields) | ||
{ | ||
$fields->addFieldToTab('Root.ContentBlocks', $grid); | ||
|
||
$blocks = $this->owner->ContentBlocks(); | ||
$editor = GridFieldConfig_RelationEditor::create()->addComponent(new GridFieldSortableRows('BlockSort')) | ||
$grid = new GridField('ContentBlocks', 'Content Blocks', $blocks, $editor); | ||
$fields->addFieldToTab('Root.ContentBlocks', $grid); | ||
|
||
return $fields; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* | ||
* @package silverstripe-block-page | ||
* @license MIT License https://github.com/cyber-duck/silverstripe-block-page/blob/master/LICENSE | ||
* @author <[email protected]> | ||
**/ | ||
class ContentBlock extends DataObject | ||
{ | ||
private static $db = array( | ||
'Name' => 'Varchar(512)', | ||
'CssSelector' => 'Varchar(512)' | ||
); | ||
|
||
private static $belongs_any_many = array( | ||
'Pages' => 'Page' | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "cyber-duck/silverstripe-block-page", | ||
"description": "A modular approach to building pages in SilverStripe", | ||
"type": "silverstripe-module", | ||
"homepage": "http://github.com/cyber-duck/silverstripe-block-page", | ||
"keywords": [ | ||
"silverstripe", | ||
"page" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Andrew Mc Cormack", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"support": { | ||
"issues": "http://github.com/cyber-duck/silverstripe-block-page/issues" | ||
}, | ||
"extra": { | ||
"installer-name": "block-page" | ||
}, | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# License | ||
|
||
Copyright (c) 2016, Andrew Mc Cormack <[email protected]>. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
|
||
Neither the name of Andrew Mc Cormack nor the names of his | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false"> | ||
<testsuites> | ||
<testsuite name="Block page Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |