Skip to content

Commit

Permalink
Merge branch '4.6' into 4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jan 1, 2021
2 parents 0db4650 + 3bbc4aa commit babc8a4
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 48 deletions.
Binary file added client/dist/images/blue-folder-horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions client/src/legacy/CMSMain.Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,16 @@ $.entwine('ss.tree', function($) {
$('.cms-tree a.jstree-clicked').entwine({
onmatch: function() {
var self = this,
panel = self.parents('.cms-panel-content'),
scrollTo;
panel = self.parents('.cms-tree-view-sidebar');

if (self.offset().top < 0 ||
self.offset().top > panel.height() - self.height()) {
// Current scroll top + our current offset top is our
// position in the panel
scrollTo = panel.scrollTop() + self.offset().top +
(panel.height() / 2);

panel.animate({
scrollTop: scrollTo
}, 'slow');
var scrollToElement = self.parent();
// scroll to the list item above for some extra padding if possible
if (scrollToElement.prev().length) {
scrollToElement = scrollToElement.prev();
}
scrollToElement.get(0).scrollIntoView();
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion code/Controllers/CMSMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ public function savetreenode($request)
$virtualPages = VirtualPage::get()->filter("CopyContentFromID", $node->ID);
foreach ($virtualPages as $virtualPage) {
$statusUpdates['modified'][$virtualPage->ID] = [
'TreeTitle' => $virtualPage->TreeTitle()
'TreeTitle' => $virtualPage->TreeTitle
];
}

Expand Down
10 changes: 9 additions & 1 deletion code/Controllers/CMSPageAddController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use SilverStripe\ORM\ValidationResult;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig;

class CMSPageAddController extends CMSPageEditController
{
Expand Down Expand Up @@ -79,7 +80,7 @@ public function AddForm()
$parentModeField = new SelectionGroup(
"ParentModeField",
[
new SelectionGroup_Item(
$topField = new SelectionGroup_Item(
"top",
null,
$topTitle
Expand Down Expand Up @@ -146,6 +147,13 @@ public function AddForm()
$parentModeField->setValue('top');
}

// Check if the current user has enough permissions to create top level pages
// If not, then disable the option to do that
if (!SiteConfig::current_site_config()->canCreateTopLevel()) {
$topField->setDisabled(true);
$parentModeField->setValue('child');
}

$actions = new FieldList(
FormAction::create("doAdd", _t('SilverStripe\\CMS\\Controllers\\CMSMain.Create', "Create"))
->addExtraClass('btn-primary font-icon-plus-circled')
Expand Down
30 changes: 15 additions & 15 deletions lang/sl.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sl:
SilverStripe\CMS\BatchActions\CMSBatchAction_Archive:
RESULT: 'Umaknili iz objave in arhivirali smo %d stran/i.'
TITLE: Arhiviraj
TITLE: 'Arhiviraj'
SilverStripe\CMS\BatchActions\CMSBatchAction_Publish:
PUBLISHED_PAGES: 'Objavili smo %d stran/i, neuspešnih je bilo %d poskus/ov.'
PUBLISH_PAGES: Objavi
Expand All @@ -17,7 +17,7 @@ sl:
ARCHIVE: Arhiv
ARCHIVEDPAGE: 'Arhivirana stran ''{title}'''
AddNew: 'Dodaj novo stran'
AddNewButton: Dodaj
AddNewButton: 'Dodaj'
AddPageRestriction: 'Pozor: nekateri tipi strani niso dovoljeni za to izbiro'
ArchiveWarning: 'Stran bomo umaknili iz objave in arhivirali.\n\nŽelite nadaljevati?'
ArchiveWarningWithCampaigns: 'Stran bomo pred arhiviranjem odstranili iz vseh ({NumCampaigns}) kampanj.\n\nŽelite nadaljevati?'
Expand All @@ -33,7 +33,7 @@ sl:
EMAIL: E-pošta
NEWPAGE: 'Dodaj {pagetype}'
PAGENOTEXISTS: 'Stran na tem naslovu ne obstaja'
PAGES: Status
PAGES: 'Status'
PAGESALLOPT: 'Vse strani'
PAGETYPEANYOPT: Poljubna
PAGETYPEOPT: 'Tip strani'
Expand Down Expand Up @@ -83,7 +83,7 @@ sl:
MENUTITLE: Zgodovina
MULTISELECT: 'Paketno urejanje'
NOTPUBLISHED: 'Ni objavljeno'
PREVIEW: Predogled
PREVIEW: 'Predogled'
PUBLISHER: Objavljavec
REVERTTOTHISVERSION: 'Povrni v to različico'
SHOWUNPUBLISHED: 'Prikaži neobjavljeno različico'
Expand All @@ -96,9 +96,9 @@ sl:
MENUTITLE: 'Uredi stran'
SilverStripe\CMS\Controllers\CMSPagesController:
FILTER: Filter
ListView: Seznam
ListView: 'Seznam'
MENUTITLE: 'Seznam strani'
TreeView: Drevo
TreeView: 'Drevo'
SilverStripe\CMS\Controllers\CMSSiteTreeFilter_ChangedPages:
Title: 'Spremenjene strani'
SilverStripe\CMS\Controllers\CMSSiteTreeFilter_DeletedPages:
Expand All @@ -110,7 +110,7 @@ sl:
SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusDeletedPages:
Title: 'Arhivirane strani'
SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusDraftPages:
Title: Osnutki
Title: 'Osnutki'
SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusRemovedFromDraftPages:
Title: 'Objavljeno, vendar odstranjeno iz osnutka'
SilverStripe\CMS\Controllers\ContentController:
Expand All @@ -126,9 +126,9 @@ sl:
InstallSuccessCongratulations: 'Silverstripe je uspešno nameščen.'
LOGGEDINAS: 'Prijavljen-a kot'
LOGIN: Prijava
LOGOUT: Odjava
LOGOUT: 'Odjava'
NOTEWONTBESHOWN: 'Opomba: neprijavljeni obiskovalci spletnega mesta tega obvestila ne bodo videli.'
NOTLOGGEDIN: Neprijavljen-a
NOTLOGGEDIN: 'Neprijavljen'
PUBLISHED: Objavljeno
PUBLISHEDSITE: 'Objavljeno spletno mesto'
Password: Geslo
Expand Down Expand Up @@ -191,7 +191,7 @@ sl:
DEFAULTABOUTCONTENT: '<p>To stran lahko napolnite z lastno vsebino ali pa jo izbrišete in ustvarite novo.</p>'
DEFAULTABOUTTITLE: 'O nas'
DEFAULTCONTACTCONTENT: '<p>To stran lahko napolnite z lastno vsebino ali pa jo izbrišete in ustvarite novo.</p>'
DEFAULTCONTACTTITLE: Kontakt
DEFAULTCONTACTTITLE: 'Kontakt'
DEFAULTHOMECONTENT: '<p>Dobrodošli! To je privzeta vstopna stran sistema Silverstripe. Lahko jo začnete urejati tako, da se prijavite v <a href="admin/">sistem za upravljanje z vsebino</a>.</p><p>Vabimo vas tudi, da si preberete <a href="http://docs.silverstripe.org">dokumentacijo</a> ali katero od <a href="http://www.silverstripe.org/learn/lessons">lekcij</a>.</p>'
DEFAULTHOMETITLE: Domov
DEPENDENT_NOTE: 'Naslednje strani so odvisne od vsebine tukaj (vključuje navidezne strani, preusmerjevalne strani in strani s povezavami v vsebini)'
Expand All @@ -213,11 +213,11 @@ sl:
LINKCHANGENOTE: 'Sprememba URL-naslova te strani bo povzročila spremembo URL-naslovov do vseh podrejenih strani.'
LINKSALREADYUNIQUE: '{url} je že v uporabi'
LINKSCHANGEDTO: 'spremenba {url1} -> {url2}'
MENUTITLE: 'Naslov v navigaciji'
METADESC: Opis
MENUTITLE: 'Naziv v navigaciji'
METADESC: 'Opis'
METADESCHELP: 'Iskalniki to vsebino uporabljajo pri prikazu rezultatov. (Vsebina nima vpliva na vrstni red prikaza med zadetki v iskalniku.)'
METAEXTRA: 'Meta tagi po meri'
METAEXTRAHELP: 'HTML oznake za dodatne meta podatke. Primer: <meta name="customName" content="your custom content here" />'
METAEXTRAHELP: 'Dodatne meta (HTML) oznake. Na primer: <meta name="customName" content="your custom content here">'
MODIFIEDONDRAFTHELP: 'Stran vsebuje še neobjavljene spremembe.'
MODIFIEDONDRAFTSHORT: Spremenjeno
MetadataToggle: Metapodatki
Expand All @@ -237,7 +237,7 @@ sl:
PERMISSION_GRANTACCESS_HELP: 'Dovoli nastavitve pravic za dostop do izbrane strani v sklopu "Strani".'
PLURALNAME: Strani
PLURALS:
one: Stran
one: 'Stran'
two: '{count} strani'
few: '{count} strani'
other: '{count} strani'
Expand Down Expand Up @@ -335,7 +335,7 @@ sl:
ParameterLiveCheckbox: 'Preverite, kaj je objavljeno'
SilverStripe\CMS\Reports\EmptyPagesReport:
ContentGroupTitle: 'Poročila o stanju vsebine'
EMPTYPAGES: 'Strani brez vsebine'
EMPTYPAGES: 'Prazne strani'
SilverStripe\CMS\Reports\RecentlyEditedReport:
ContentGroupTitle: 'Poročila o stanju vsebine'
LAST2WEEKS: 'Strani, ki so bile spremenjene v zadnjih dveh tednih'
Expand Down
25 changes: 19 additions & 6 deletions tests/behat/features/create-a-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,38 @@ Feature: Create a page

Background:
Given a "page" "MyPage"
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
Then I should see "MyPage" in the tree
And I should see a "Add new" button in CMS Content Toolbar
And a "group" "AUTHOR group" has permissions "Access to 'Pages' section"
And I am logged in with "ADMIN" permissions

@javascript
Scenario: I can create a page from the pages section
Given I go to "/admin/pages"
When I go to "/admin/pages"
Then I should see "MyPage" in the tree
And I should see a "Add new" button in CMS Content Toolbar
When I press the "Add new" button
And I select the "Page" radio button
And I press the "Create" button
Then I should see an edit page form

@javascript
Scenario: I can create a page under another page
Given I go to "/admin/pages"
When I go to "/admin/pages"
Then I should see "MyPage" in the tree
And I should see a "Add new" button in CMS Content Toolbar
When I press the "Add new" button
And I select the "Under another page" radio button
And I select "MyPage" in the "#Form_AddForm_ParentID_Holder" tree dropdown
And I select the "Page" radio button
And I press the "Create" button
Then I should see an edit page form

Scenario: I cannot add root level pages without permission
When I go to "/admin/settings"
And I click the "Access" CMS tab
And I click the "#Form_EditForm_CanCreateTopLevelType_OnlyTheseUsers" element
And I press the "Save" button
And I click the ".cms-login-status__logout-link" element
When I am logged in with "AUTHOR" permissions
And I press the "Add new" button
Then I see the "Top level" radio button "disabled" attribute equals "1"
And I see the "Under another page" radio button "checked" attribute equals "1"
50 changes: 50 additions & 0 deletions tests/behat/src/FixtureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace SilverStripe\CMS\Tests\Behaviour;

use Behat\Mink\Element\DocumentElement;
use Behat\Mink\Element\NodeElement;
use SilverStripe\BehatExtension\Context\FixtureContext as BehatFixtureContext;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\CMS\Model\SiteTree;
Expand Down Expand Up @@ -63,4 +65,52 @@ public function stepCreateRedirectorPage($type, $id, $targetType, $targetId)
$obj->write();
$obj->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
}

/**
* @When /^I click the "([^"]+)" element$/
* @param $selector
*/
public function iClickTheElement($selector)
{
/** @var DocumentElement $page */
$page = $this->getMainContext()->getSession()->getPage();
$element = $page->find('css', $selector);

assertNotNull($element, sprintf('Element %s not found', $selector));

$element->click();
}

/**
* @When /^I see the "([^"]+)" element$/
* @param $selector
*/
public function iSeeTheElement($selector)
{
/** @var DocumentElement $page */
$page = $this->getMainContext()->getSession()->getPage();
$element = $page->find('css', $selector);

assertNotNull($element, sprintf('Element %s not found', $selector));
}

/**
* Selects the specified radio button
*
* @Given /^I see the "([^"]*)" radio button "([^"]*)" attribute equals "([^"]*)"$/
* @param string $radioLabel
* @param string $attribute
* @param string $value
*/
public function iSeeTheRadioButtonAttributeEquals($radioLabel, $attribute, $value)
{
/** @var NodeElement $radioButton */
$session = $this->getMainContext()->getSession();
$radioButton = $session->getPage()->find('named', [
'radio',
$this->getMainContext()->getXpathEscaper()->escapeLiteral($radioLabel)
]);
assertNotNull($radioButton);
assertEquals($value, $radioButton->getAttribute($attribute));
}
}
Loading

0 comments on commit babc8a4

Please sign in to comment.