Merge pull request #162 from creative-commoners/pulls/2.0/update-to-ss4

Check module for SS4 compatibility
This commit is contained in:
Robbie Averill 2017-12-19 16:01:49 +13:00 committed by GitHub
commit a0b1f9b1cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 85 additions and 83 deletions

1
.gitattributes vendored
View File

@ -4,3 +4,4 @@
/.gitignore export-ignore
/.travis.yml export-ignore
/.scrutinizer.yml export-ignore
/codecov.yml export-ignore

View File

@ -2,7 +2,7 @@ language: php
env:
global:
- COMPOSER_ROOT_VERSION="4.0.x-dev"
- COMPOSER_ROOT_VERSION="2.x-dev"
matrix:
include:

View File

@ -1,10 +1,8 @@
# Widgets Module
[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-widgets.svg?style=flat-square)](https://travis-ci.org/silverstripe/silverstripe-widgets)
[![Code Quality](http://img.shields.io/scrutinizer/g/silverstripe/silverstripe-widgets.svg?style=flat-square)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-widgets)
[![Code Coverage](https://codecov.io/gh/silverstripe/silverstripe-widgets/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-widgets)
[![Version](http://img.shields.io/packagist/v/silverstripe/widgets.svg?style=flat-square)](https://packagist.org/packages/silverstripe/widgets)
[![License](http://img.shields.io/packagist/l/silverstripe/widgets.svg?style=flat-square)](LICENSE.md)
[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-widgets.svg)](https://travis-ci.org/silverstripe/silverstripe-widgets)
[![Code Quality](http://img.shields.io/scrutinizer/g/silverstripe/silverstripe-widgets.svg)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-widgets)
[![Code Coverage](https://img.shields.io/codecov/c/github/silverstripe/silverstripe-widgets.svg)](https://codecov.io/gh/silverstripe/silverstripe-widgets)
## Overview
@ -13,8 +11,9 @@ the sidebar of your website.
## Requirements
* SilverStripe 4.0
* SilverStripe 4.0
**Note:** this version is compatible with SilverStripe 4. For SilverStripe 3, please see [the 1.x release line](https://github.com/silverstripe/silverstripe-widgets/tree/1.3).
### Installation

View File

@ -1,7 +1,7 @@
{
"name": "silverstripe/widgets",
"description": "Widgets are small pieces of functionality such as showing the latest Comments or Flickr Photos. They normally display on the sidebar of your website.",
"type": "silverstripe-module",
"type": "silverstripe-vendormodule",
"keywords": ["silverstripe", "widgets", "blog"],
"authors": [
{

View File

@ -1,11 +1,11 @@
ar:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: 'تطبيقات مصغرة'
SINGULARNAME: 'تطبيق مصغر'
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'مساحات التطبيقات المصغرة'
SINGULARNAME: 'مساحة التطبيقات المصغرة'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'التطبيقات المصغرة المتاحة'
AVAILWIDGETS: 'اضغط على عنوان تطبيق مصغر بالأسفل لاستخدامه بهذه الصفحة.'
INUSE: 'التطبيقات المصغرة المستخدمة حاليا'

View File

@ -1,11 +1,11 @@
de:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Widgets
SINGULARNAME: Widget
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: Widgetbereiche
SINGULARNAME: Widgetbereich
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Vorhandene Widgets'
AVAILWIDGETS: 'Klicke den Widget Titel, um es zu benutzen.'
INUSE: 'Benutzte Widgets'

View File

@ -1,19 +1,25 @@
en:
Widget:
PLURALNAME: Widgets
SINGULARNAME: Widget
WidgetArea:
PLURALNAME: 'Widget Areas'
SINGULARNAME: 'Widget Area'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Extensions\WidgetPageExtension:
INHERITSIDEBAR: 'Inherit Sidebar From Parent'
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Available Widgets'
AVAILWIDGETS: 'Click a widget title below to use it on this page.'
INUSE: 'Widgets currently used'
NOAVAIL: 'There are currently no widgets available.'
TOSORT: 'To sort currently used widgets on this page, drag them up and down.'
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Widgets
PLURALS:
one: 'A Widget'
other: '{count} Widgets'
SINGULARNAME: Widget
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'Widget Areas'
PLURALS:
one: 'A Widget Area'
other: '{count} Widget Areas'
SINGULARNAME: 'Widget Area'
WidgetDescription_ss:
CLICKTOADDWIDGET: 'Click to add this widget'
WidgetEditor_ss:
DELETE: Delete
WidgetPageExtension:
INHERITSIDEBAR: 'Inherit Sidebar From Parent'

View File

@ -1,11 +1,11 @@
eo:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Fenestraĵoj
SINGULARNAME: Fenestraĵo
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'Fenestraĵaj zonoj'
SINGULARNAME: 'Fenestraĵa zono'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Disponeblaj fenestraĵoj'
AVAILWIDGETS: 'Alklaku sube titolon de fenestraĵo por uzi ĝin en ĉi tiu paĝo.'
INUSE: 'Fenestraĵoj aktuale uzataj'

View File

@ -1,11 +1,11 @@
fa_IR:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: 'ویجت ها'
SINGULARNAME: ویجت
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'محیط ویجت ها'
SINGULARNAME: 'محیط ویجت'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'ویجت های موجود'
AVAILWIDGETS: 'بر روی عنوان یک ویجت در پایین کلیک کنید تا آن را در این صفحه بکار بگیرید.'
INUSE: 'ویجت هایی که در حال حاضر استفاده می شوند'

View File

@ -1,11 +1,11 @@
fi:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Vimpaimet
SINGULARNAME: Vimpain
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'Vimpain alueet'
SINGULARNAME: 'Vimpain alue'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Käytettävissä olevat vimpaimet'
AVAILWIDGETS: 'Napsauta vimpaimen otsikkoa alla ottaaksesi se käyttöön tällä sivulla.'
INUSE: 'Käytössä olevat vimpaimet'

View File

@ -1,11 +1,11 @@
hr:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Widgeti
SINGULARNAME: Widget
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'Zone widgeta'
SINGULARNAME: 'Zona widgeta'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Dostupni widgeti'
AVAILWIDGETS: 'Kliknite na naziv widgeta ispod za korištenje na ovoj stranici'
INUSE: 'Trenutno korišteni widgeti'

View File

@ -1,11 +1,11 @@
it_IT:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Widgets
SINGULARNAME: Widget
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'Aree Widget'
SINGULARNAME: 'Area Widget'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Widgets disponibili'
AVAILWIDGETS: 'Clicca sul titolo di un widget qui sotto per usarlo in questa pagina'
INUSE: 'Widgets attualmente utilizzati'

View File

@ -1,5 +1,5 @@
nl:
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Beschikbare Widgets'
AVAILWIDGETS: 'Klik op een widget titel hieronder, om de widget te gebruiken op deze pagina.'
INUSE: 'Huidige gebruikte Widgets'

View File

@ -1,5 +1,5 @@
pl_PL:
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Dostępne widżety'
AVAILWIDGETS: 'Kliknij w tytuł widżetu, aby używać go na tej stronie.'
INUSE: 'Obecnie stosowane widżety'

View File

@ -1,5 +1,5 @@
ro_RO:
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Widget-uri disponibile'
AVAILWIDGETS: 'Faceți clic pe un titlu widget de mai jos pentru a-l folosi pe aceasta pagina.'
INUSE: 'Widget-uri utilizate în prezent'

View File

@ -1,11 +1,11 @@
ru:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Виджеты
SINGULARNAME: Виджет
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'Области виджетов'
SINGULARNAME: 'Область виджета'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Доступные виджеты'
AVAILWIDGETS: 'Щелкните заголовок виджета ниже, чтобы использовать его на этой странице.'
INUSE: 'Используемые виджеты'

View File

@ -1,11 +1,11 @@
sk:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Widgety
SINGULARNAME: Widget
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 'Oblasti widgetu'
SINGULARNAME: 'Oblasť widgetu'
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Dostupné widgety'
AVAILWIDGETS: 'Kliknite na názov widgetu pre jeho použitie na tejto stránke.'
INUSE: 'Momentálne používané widgety.'

View File

@ -1,11 +1,11 @@
sv:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: Widgets
SINGULARNAME: Widget
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: Widgetområden
SINGULARNAME: Widgetområde
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 'Tillgängliga widgets'
AVAILWIDGETS: 'Klicka på en widget nedan för att använda den på sidan.'
INUSE: 'Använda widgets'

View File

@ -1,11 +1,11 @@
zh:
Widget:
SilverStripe\Widgets\Model\Widget:
PLURALNAME: 小工具
SINGULARNAME: 小工具
WidgetArea:
SilverStripe\Widgets\Model\WidgetArea:
PLURALNAME: 小工具区域
SINGULARNAME: 小工具区域
WidgetAreaEditor_ss:
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
AVAILABLE: 可用的小工具
AVAILWIDGETS: 点击下方的小工具名称即可在此页上使用。
INUSE: 当前使用的小工具

View File

@ -1,4 +1,4 @@
Copyright (c) 2016, SilverStripe Limited
Copyright (c) 2017, SilverStripe Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

9
phpcs.xml.dist Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
<rule ref="PSR2">
<!-- Current exclusions -->
<exclude name="PSR1.Methods.CamelCapsMethodName"/>
</rule>
</ruleset>

View File

@ -6,8 +6,6 @@ use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
use SilverStripe\i18n\i18n;
use SilverStripe\Security\Member;
use SilverStripe\Widgets\Model\Widget;
/**

View File

@ -10,7 +10,6 @@ use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\TextField;
use SilverStripe\ORM\DataObject;
use SilverStripe\Widgets\Model\WidgetArea;
/**
* Widgets let CMS authors drag and drop small pieces of functionality into

View File

@ -4,7 +4,6 @@ namespace SilverStripe\Widgets\Model;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject;
use SilverStripe\Widgets\Model\Widget;
/**
* Represents a set of widgets shown on a page.

View File

@ -1,8 +1,8 @@
<div class="WidgetAreaEditor field" id="WidgetAreaEditor-$Name" name="$Name"<% if MaxWidgets %> maxwidgets="$MaxWidgets"<% end_if %>>
<div class="WidgetAreaEditor field" id="WidgetAreaEditor-$Name" name="$Name"<% if $MaxWidgets %> maxwidgets="$MaxWidgets"<% end_if %>>
<input type="hidden" id="$Name" name="$IdxField" value="$Value" />
<div class="availableWidgetsHolder">
<h2><% _t('WidgetAreaEditor_ss.AVAILABLE', 'Available Widgets') %></h2>
<p class="message"><% _t('WidgetAreaEditor_ss.AVAILWIDGETS', 'Click a widget title below to use it on this page.') %></p>
<h2><%t SilverStripe\\Widgets\\Forms\\WidgetAreaEditor_ss.AVAILABLE 'Available Widgets' %></h2>
<p class="message"><%t SilverStripe\\Widgets\\Forms\\WidgetAreaEditor_ss.AVAILWIDGETS 'Click a widget title below to use it on this page.' %></p>
<div class="availableWidgets" id="availableWidgets-$Name">
<% if $AvailableWidgets %>
<% loop $AvailableWidgets %>
@ -10,14 +10,14 @@
<% end_loop %>
<% else %>
<div class="NoWidgets" id="NoWidgets-$Name">
<p><% _t('WidgetAreaEditor_ss.NOAVAIL', 'There are currently no widgets available.') %></p>
<p><%t SilverStripe\\Widgets\\Forms\\WidgetAreaEditor_ss.NOAVAIL 'There are currently no widgets available.' %></p>
</div>
<% end_if %>
</div>
</div>
<div class="usedWidgetsHolder">
<h2><% _t('WidgetAreaEditor_ss.INUSE', 'Widgets currently used') %></h2>
<p class="message"><% _t('WidgetAreaEditor_ss.TOSORT', 'To sort currently used widgets on this page, drag them up and down.') %></p>
<h2><%t SilverStripe\\Widgets\\Forms\\WidgetAreaEditor_ss.INUSE 'Widgets currently used' %></h2>
<p class="message"><%t SilverStripe\\Widgets\\Forms\\WidgetAreaEditor_ss.TOSORT 'To sort currently used widgets on this page, drag them up and down.' %></p>
<div class="usedWidgets" id="usedWidgets-$Name">
<% if $UsedWidgets %>

View File

@ -1,3 +1,3 @@
<% loop WidgetControllers %>
<% loop $WidgetControllers %>
$WidgetHolder
<% end_loop %>
<% end_loop %>

View File

@ -1,5 +1,5 @@
<div class="Widget" id="$ClassName">
<h3 title="<% _t('WidgetDescription_ss.CLICKTOADDWIDGET', 'Click to add this widget') %>">$CMSTitle</h3>
<h3 title="<%t WidgetDescription_ss.CLICKTOADDWIDGET 'Click to add this widget' %>">$CMSTitle</h3>
<div class="widgetDescription">
<p>$Description</p>
</div>

View File

@ -10,5 +10,5 @@
<% end_if %>
<input type="hidden" name="$Name[Type]" value="$ClassName" />
<input type="hidden" name="$Name[Sort]" value="$Sort" />
<p class="deleteWidget"><span class="widgetDelete btn btn-danger"><% _t('WidgetEditor_ss.DELETE', 'Delete') %></span></p>
<p class="deleteWidget"><span class="widgetDelete btn btn-danger"><%t WidgetEditor_ss.DELETE 'Delete' %></span></p>
</div>

View File

@ -1,4 +1,4 @@
<div class="WidgetHolder $ClassName<% if FirstLast %> $FirstLast<% end_if %>">
<% if Title %><h3>$Title</h3><% end_if %>
<div class="WidgetHolder $ClassName<% if $FirstLast %> $FirstLast<% end_if %>">
<% if $Title %><h3>$Title</h3><% end_if %>
$Content
</div>

View File

@ -2,17 +2,14 @@
namespace SilverStripe\Widgets\Tests;
use Page;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Widgets\Extensions\WidgetPageExtension;
use SilverStripe\Widgets\Forms\WidgetAreaEditor;
use SilverStripe\Widgets\Model\Widget;
use SilverStripe\Widgets\Tests\WidgetAreaEditorTest\FakePage;
use SilverStripe\Widgets\Tests\WidgetAreaEditorTest\TestWidget;

View File

@ -3,13 +3,7 @@
namespace SilverStripe\Widgets\Tests;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Widgets\Model\Widget;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\Form;
use SilverStripe\Widgets\Controllers\WidgetController;
use SilverStripe\Widgets\Tests\WidgetControllerTest\TestPage;
use SilverStripe\Widgets\Tests\WidgetControllerTest\TestWidget;
@ -35,7 +29,7 @@ class WidgetControllerTest extends FunctionalTest
$response = $this->get($page->URLSegment);
$formAction = sprintf('%s/widget/%d/Form', $page->URLSegment, $widget->ID);
$formAction = sprintf('%s/widget/%d/%s', $page->URLSegment, $widget->ID, 'Form');
$this->assertContains(
$formAction,
$response->getBody(),

View File

@ -23,7 +23,7 @@ class TestWidgetController extends WidgetController implements TestOnly
{
$widgetform = new Form(
$this,
'Form',
__FUNCTION__,
new FieldList(
new TextField('TestValue')
),