Skip to content

Commit

Permalink
FIX Update Requirements API, vendorise module, update i18n translations
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Oct 18, 2017
1 parent 1cf2947 commit d1e6a71
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 22 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ matrix:
before_script:
- phpenv rehash
- phpenv config-rm xdebug.ini

- composer validate
- composer require --prefer-dist --no-update silverstripe/recipe-cms:1.0.x-dev
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.0.x-dev; fi
- composer update
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile

script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=framework/phpcs.xml.dist src/ tests/ ; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src/ tests/ ; fi

after_success:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# SilverStripe Lumberjack

[![Build Status](https://travis-ci.org/silverstripe/silverstripe-lumberjack.svg?branch=1.1)](https://travis-ci.org/silverstripe/silverstripe-lumberjack) [![Latest Stable Version](https://poser.pugx.org/silverstripe/lumberjack/v/stable)](https://packagist.org/packages/silverstripe/lumberjack) [![Latest Unstable Version](https://poser.pugx.org/silverstripe/lumberjack/v/unstable)](https://packagist.org/packages/silverstripe/lumberjack) [![License](https://poser.pugx.org/silverstripe/lumberjack/license)](https://packagist.org/packages/silverstripe/lumberjack)
![helpfulrobot](https://helpfulrobot.io/silverstripe/lumberjack/badge)
[![Build Status](https://travis-ci.org/silverstripe/silverstripe-lumberjack.svg?branch=master)](https://travis-ci.org/silverstripe/silverstripe-lumberjack)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-lumberjack/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-lumberjack/?branch=master)
[![Code coverage](https://codecov.io/gh/silverstripe/silverstripe-lumberjack/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-lumberjack)
[![Latest Stable Version](https://poser.pugx.org/silverstripe/lumberjack/v/stable)](https://packagist.org/packages/silverstripe/lumberjack)
[![Latest Unstable Version](https://poser.pugx.org/silverstripe/lumberjack/v/unstable)](https://packagist.org/packages/silverstripe/lumberjack)
[![License](https://poser.pugx.org/silverstripe/lumberjack/license)](https://packagist.org/packages/silverstripe/lumberjack)

A module to make managing pages in a GridField easy without losing any of the functionality that you're used to in the CMS.

Expand Down
2 changes: 0 additions & 2 deletions _config.php
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<?php

define('LUMBERJACK_DIR', basename(dirname(__FILE__)));
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "silverstripe/lumberjack",
"description": "A module to make managing pages in a GridField easy without losing any of the functionality that you're used to in the CMS.",
"type": "silverstripe-module",
"type": "silverstripe-vendormodule",
"require": {
"silverstripe/framework": "^4.0",
"silverstripe/cms": "^4.0"
Expand All @@ -13,7 +13,11 @@
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"expose": [
"css",
"javascript"
]
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions lang/en.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
en:
GridFieldSiteTreeAddNewButton:
SilverStripe\Lumberjack\Forms\GridFieldSiteTreeAddNewButton:
Add: 'Add new {name}'
AddMultipleOptions: 'Add new'
GridFieldSiteTreeState:
SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState:
Draft: '<i class="btn-icon gridfield-icon btn-icon-pencil"></i> Saved as Draft on {date}'
Modified: Modified
Published: '<i class="btn-icon gridfield-icon btn-icon-accept"></i> Published on {date}'
StateTitle: State
Lumberjack:
SilverStripe\Lumberjack\Model\Lumberjack:
TabTitle: 'Child Pages'
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit bootstrap="cms/tests/bootstrap.php" colors="true">
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
Expand Down
10 changes: 5 additions & 5 deletions src/Forms/GridFieldSiteTreeAddNewButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getHTMLFragments($gridField)

if (!$this->buttonName) {
$this->buttonName = _t(
'GridFieldSiteTreeAddNewButton.AddMultipleOptions',
__CLASS__ . '.AddMultipleOptions',
'Add new',
'Add button text for multiple options.'
);
Expand All @@ -95,7 +95,7 @@ public function getHTMLFragments($gridField)

if (!$this->buttonName) {
$this->buttonName = _t(
'GridFieldSiteTreeAddNewButton.Add',
__CLASS__ . '.Add',
'Add new {name}',
'Add button text for a single option.',
['name' => $children[$keys[0]]]
Expand All @@ -108,13 +108,13 @@ public function getHTMLFragments($gridField)
->setAttribute('data-icon', 'add')
->addExtraClass('no-ajax btn btn-primary font-icon-plus');

$forTemplate = ArrayData::create([]);
$forTemplate = ArrayData::create();
$forTemplate->Fields = ArrayList::create();
$forTemplate->Fields->push($pageTypes);
$forTemplate->Fields->push($addAction);

Requirements::css(LUMBERJACK_DIR . '/css/lumberjack.css');
Requirements::javascript(LUMBERJACK_DIR . '/javascript/GridField.js');
Requirements::css('silverstripe/lumberjack:css/lumberjack.css');
Requirements::javascript('silverstripe/lumberjack:javascript/GridField.js');

return [$this->targetFragment => $forTemplate->renderWith(__CLASS__)];
}
Expand Down
8 changes: 4 additions & 4 deletions src/Forms/GridFieldSiteTreeState.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public function getColumnContent($gridField, $record, $columnName)
if ($record->hasMethod('isPublished')) {
$modifiedLabel = '';
if ($record->isModifiedOnStage) {
$modifiedLabel = "<span class='modified'>" . _t('GridFieldSiteTreeState.Modified', 'Modified') . '</span>';
$modifiedLabel = "<span class='modified'>" . _t(__CLASS__ . '.Modified', 'Modified') . '</span>';
}

$published = $record->isPublished();
if (!$published) {
return _t(
'GridFieldSiteTreeState.Draft',
__CLASS__ . '.Draft',
'<i class="btn-icon gridfield-icon btn-icon-pencil"></i> Saved as Draft on {date}',
'State for when a post is saved.',
array(
Expand All @@ -57,7 +57,7 @@ public function getColumnContent($gridField, $record, $columnName)
);
}
return _t(
'GridFieldSiteTreeState.Published',
__CLASS__ . '.Published',
'<i class="btn-icon gridfield-icon btn-icon-accept"></i> Published on {date}',
'State for when a post is published.',
array(
Expand Down Expand Up @@ -88,7 +88,7 @@ public function getColumnMetaData($gridField, $columnName)
{
switch ($columnName) {
case 'State':
return array('title' => _t('GridFieldSiteTreeState.StateTitle', 'State', 'Column title for state'));
return array('title' => _t(__CLASS__ . '.StateTitle', 'State', 'Column title for state'));
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Lumberjack.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ protected function getLumberjackTitle()
return $this->owner->getLumberjackTitle();
}

return _t('Lumberjack.TabTitle', 'Child Pages');
return _t(__CLASS__ . '.TabTitle', 'Child Pages');
}

/**
Expand Down

0 comments on commit d1e6a71

Please sign in to comment.