-
Notifications
You must be signed in to change notification settings - Fork 3
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
Michel van der Steege
committed
Dec 8, 2017
0 parents
commit a89d3ef
Showing
14 changed files
with
306 additions
and
0 deletions.
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,17 @@ | ||
# For more information about the properties used in this file, | ||
# please see the EditorConfig documentation: | ||
# http://editorconfig.org | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[{*.yml,package.json,*.scss,*.js}] | ||
indent_size = 2 | ||
|
||
# The indent size used in the package.json file cannot be changed: | ||
# https://github.com/npm/npm/pull/3180#issuecomment-16336516 |
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 @@ | ||
/node_modules/ | ||
/**/*.js.map | ||
/**/*.css.map |
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,28 @@ | ||
Copyright (c) 2017, The Webmen | ||
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 the {organization} nor the names of its | ||
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 HOLDER 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,16 @@ | ||
# SilverStripe FAQ Page | ||
|
||
## Introduction | ||
|
||
FAQ Page with categories and questions | ||
|
||
## Requirements | ||
|
||
* SilverStripe CMS ^4.0 | ||
* GridFieldExtensions ^3.0 | ||
|
||
## Installation | ||
|
||
``` | ||
composer require "thewebmen/silverstripe-faq" "dev-master" | ||
``` |
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 @@ | ||
--- | ||
Name: faq | ||
--- |
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,40 @@ | ||
{ | ||
"name": "thewebmen/silverstripe-faq", | ||
"description": "Silverstripe faq page type", | ||
"type": "silverstripe-vendormodule", | ||
"keywords": [ | ||
"silverstripe", | ||
"faq", | ||
"page" | ||
], | ||
"license": "BSD-3-Clause", | ||
"authors": [{ | ||
"name": "Michel van der Steege", | ||
"email": "michel@thewebmen.com" | ||
}], | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"require": { | ||
"silverstripe/cms": "^4.0@dev", | ||
"silverstripe/vendor-plugin": "^1.0", | ||
"symbiote/silverstripe-gridfieldextensions": "3.0.x-dev" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^5.7", | ||
"squizlabs/php_codesniffer": "^3.0" | ||
}, | ||
"extra": { | ||
"installer-name": "silverstripe-faq", | ||
"branch-alias": { | ||
"dev-master": "2.x-dev" | ||
}, | ||
"expose": [ | ||
"resources" | ||
] | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"TheWebmen\\FAQ\\": "src/" | ||
} | ||
} | ||
} |
Empty 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,25 @@ | ||
en: | ||
TheWebmen\FAQ\Pages\FAQPage: | ||
PLURALNAME: 'FAQ pages' | ||
PLURALS: | ||
one: 'A FAQ page' | ||
other: '{count} FAQ pages' | ||
SINGULARNAME: 'FAQ page' | ||
CATEGORIES: 'Categories' | ||
TheWebmen\FAQ\Model\FAQCategorie: | ||
PLURALNAME: 'Categories' | ||
PLURALS: | ||
one: 'A category' | ||
other: '{count} categories' | ||
SINGULARNAME: 'Category' | ||
NUMBER_OF_QUESTIONS: 'Number of questions' | ||
QUESTIONS: 'Questions' | ||
db_Title: 'Title' | ||
TheWebmen\FAQ\Model\FAQQuestion: | ||
PLURALNAME: 'Questions' | ||
PLURALS: | ||
one: 'A question' | ||
other: '{count} questions' | ||
SINGULARNAME: 'Question' | ||
db_Question: 'Question' | ||
db_Answer: 'Answer' |
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,25 @@ | ||
nl: | ||
TheWebmen\FAQ\Pages\FAQPage: | ||
PLURALNAME: 'FAQ paginas' | ||
PLURALS: | ||
one: 'Een FAQ pagina' | ||
other: '{count} FAQ paginas' | ||
SINGULARNAME: 'FAQ pagina' | ||
CATEGORIES: 'Categorieen' | ||
TheWebmen\FAQ\Model\FAQCategorie: | ||
PLURALNAME: 'Categorieen' | ||
PLURALS: | ||
one: 'Een categorie' | ||
other: '{count} categorieen' | ||
SINGULARNAME: 'Categorie' | ||
NUMBER_OF_QUESTIONS: 'Aantal vragen' | ||
QUESTIONS: 'Vragen' | ||
db_Title: 'Titel' | ||
TheWebmen\FAQ\Model\FAQQuestion: | ||
PLURALNAME: 'Vragen' | ||
PLURALS: | ||
one: 'Een vraag' | ||
other: '{count} vragen' | ||
SINGULARNAME: 'Vragen' | ||
db_Question: 'Vraag' | ||
db_Answer: 'Antwoord' |
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,7 @@ | ||
<?php | ||
|
||
namespace TheWebmen\FAQ\Controllers; | ||
|
||
class FAQPageController extends \PageController { | ||
|
||
} |
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,59 @@ | ||
<?php | ||
|
||
namespace TheWebmen\FAQ\Model; | ||
|
||
use SilverStripe\ORM\DataObject; | ||
use TheWebmen\FAQ\Pages\FAQPage; | ||
use SilverStripe\Forms\GridField\GridField; | ||
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor; | ||
use Symbiote\GridFieldExtensions\GridFieldOrderableRows; | ||
|
||
class FAQCategorie extends DataObject { | ||
|
||
private static $singular_name = 'Categorie'; | ||
private static $plural_name = 'Categories'; | ||
|
||
private static $db = [ | ||
'Title' => 'Varchar(255)', | ||
'Sort' => 'Int' | ||
]; | ||
|
||
private static $has_one = [ | ||
'Page' => FAQPage::class | ||
]; | ||
|
||
private static $has_many = [ | ||
'Questions' => FAQQuestion::class | ||
]; | ||
|
||
private static $summary_fields = [ | ||
'Title', | ||
'Questions.Count', | ||
'Created' | ||
]; | ||
|
||
private static $default_sort = 'Sort'; | ||
|
||
public function summaryFields() | ||
{ | ||
$fields = parent::summaryFields(); | ||
$fields['Questions.Count'] = _t(self::class . '.NUMBER_OF_QUESTIONS', 'Number of questions'); | ||
return $fields; | ||
} | ||
|
||
public function getCMSFields() | ||
{ | ||
$fields = parent::getCMSFields(); | ||
|
||
$fields->removeByName('PageID'); | ||
$fields->removeByName('Questions'); | ||
$fields->removeByName('Sort'); | ||
|
||
$gridConfig = GridFieldConfig_RecordEditor::create(); | ||
$gridConfig->addComponent(new GridFieldOrderableRows()); | ||
$fields->addFieldToTab('Root.Main', new GridField('Questions', _t(self::class . '.QUESTIONS', 'Questions'), $this->Questions(), $gridConfig)); | ||
|
||
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,43 @@ | ||
<?php | ||
|
||
namespace TheWebmen\FAQ\Model; | ||
|
||
use SilverStripe\ORM\DataObject; | ||
|
||
class FAQQuestion extends DataObject { | ||
|
||
private static $singular_name = 'Question'; | ||
private static $plural_name = 'Questions'; | ||
|
||
private static $db = [ | ||
'Question' => 'Varchar(255)', | ||
'Answer' => 'HTMLText', | ||
'Sort' => 'Int' | ||
]; | ||
|
||
private static $has_one = [ | ||
'Category' => FAQCategorie::class | ||
]; | ||
|
||
private static $summary_fields = [ | ||
'Question', | ||
'Created' | ||
]; | ||
|
||
private static $default_sort = 'Sort'; | ||
|
||
public function getCMSFields() | ||
{ | ||
$fields = parent::getCMSFields(); | ||
|
||
$fields->removeByName('Sort'); | ||
$fields->removeByName('CategoryID'); | ||
|
||
return $fields; | ||
} | ||
|
||
public function getTitle(){ | ||
return $this->Question; | ||
} | ||
|
||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace TheWebmen\FAQ\Pages; | ||
|
||
use Symbiote\GridFieldExtensions\GridFieldOrderableRows; | ||
use TheWebmen\FAQ\Model\FAQCategorie; | ||
use SilverStripe\Forms\GridField\GridField; | ||
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor; | ||
|
||
class FAQPage extends \Page { | ||
|
||
private static $has_many = [ | ||
'Categories' => FAQCategorie::class | ||
]; | ||
|
||
public function getCMSFields() { | ||
$fields = parent::getCMSFields(); | ||
|
||
$gridConfig = GridFieldConfig_RecordEditor::create(); | ||
$gridConfig->addComponent(new GridFieldOrderableRows()); | ||
$fields->addFieldToTab('Root.Categories', new GridField('Categories', _t(self::class . '.CATEGORIES', 'Categories'), $this->Categories(), $gridConfig)); | ||
|
||
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,14 @@ | ||
<h1>$Title</h1> | ||
<% loop $Categories %> | ||
<h2>$Title</h2> | ||
<ul> | ||
<% loop $Questions %> | ||
<li> | ||
<h3>$Question</h3> | ||
<div> | ||
$Answer | ||
</div> | ||
</li> | ||
<% end_loop %> | ||
</ul> | ||
<% end_loop %> |