Commit 77ecb35f authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1844470: Move "Display page" and "Return to pages and collections"...

Merge "Bug 1844470: Move "Display page" and "Return to pages and collections" to right-hand side on "Edit" screen"
parents 7ef3b81d 466b4a8a
......@@ -7309,6 +7309,42 @@ class View {
return get_records_select_assoc('block_instance', 'blocktype = ? AND view = ?', array('peerassessment', $this->get('id')));
}
/**
* Returns an array of the url for the "Return to..." button and button title
*@return array of url, title
*/
public function get_return_to_url_and_title() {
$group = $this->get('group');
$institution = $this->get('institution');
if (!$group && !$institution) {
return array(
'url' => get_config('wwwroot') . "view/index.php",
'title' => get_string('returntoviews', 'view'),
);
}
else if ($group) {
return array(
'url' => get_config('wwwroot') . 'view/groupviews.php?group=' . $group,
'title' => get_string('returntogroupportfolios', 'group'),
);
}
else if ($institution) {
if ($institution == 'mahara') {
return array(
'url' => get_config('wwwroot') . 'admin/site/views.php',
'title' => get_string('returntositeportfolios', 'view'),
);
}
else {
return array(
'url' => get_config('wwwroot') . 'view/institutionviews.php?institution=' . $institution,
'title' => get_string('returntoinstitutionportfolios', 'view'),
);
}
}
}
/**
* Fetch a list of versions for the particular view
*
......
......@@ -1484,7 +1484,7 @@ EOF;
*
*/
public function i_display_page() {
$this->getSession()->executeScript('jQuery("div.with-heading a:contains(\'Display page\')")[0].click();');
$this->getSession()->executeScript('jQuery("#displaypagebtn:contains(\'Display page\')")[0].click();');
}
/**
......
......@@ -128,17 +128,6 @@ A group of buttons aligned at the top. Note: The box around the buttons is only
```
</section>
<section data-markdown data-category="buttons">
### Display page
This button is used to display a page you have just edited.
```
<button class="btn-secondary button btn">
{str tag=displayview section=view}
<span class="icon icon-arrow-circle-right right" role="presentation"></span>
</button>
```
</section>
<section data-markdown data-category="buttons">
### Text link
This type of button is normally used in lists. An example can be found when you view the "Image" block. It takes you to the artefact page.
......
{include file="header.tpl"}
{include file="view/editviewtabs.tpl" issiteview=$issiteview}
{include file="view/editviewpageactions.tpl" selected='share'}
<div id="accessurl-container">
......
{include file="header.tpl"}
{include file="view/editviewtabs.tpl" issiteview=$issiteview}
<div class="view-instructions">
<form action="{$formurl}" method="post" class="row">
<input type="submit" name="{$action_name}" id="action-dummy" class="d-none">
......@@ -51,38 +50,6 @@
</div>
</div>
</form>
<div id="view-return-controls">
{if !$issitetemplate}
<a class="btn btn-secondary" href="{$displaylink}">
{str tag=displayview section=view}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
{if !$groupid && !$institution}
<a class="btn btn-secondary" href="{$WWWROOT}view/index.php">
{str tag=returntoviews section=view}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
{if $groupid}
<a class="btn btn-secondary" href="{$WWWROOT}view/groupviews.php?group={$groupid}">
{str tag=returntogroupportfolios section=group}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
{if $institution}
{if $institution == 'mahara'}
<a class="btn btn-secondary" href="{$WWWROOT}admin/site/views.php">
{str tag=returntositeportfolios section=view}
{else}
<a class="btn btn-secondary" href="{$WWWROOT}view/institutionviews.php?institution={$institution}">
{str tag=returntoinstitutionportfolios section=view}
{/if}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
</div>
</div>
<div class="modal" id="addblock" role="dialog">
......
{include file="header.tpl"}
{include file="view/editviewtabs.tpl" issiteview=$issiteview}
{include file="view/editviewpageactions.tpl" selected='title'}
{if $ADMIN || $INSTITUTIONALADMIN}
......
{include file="header.tpl"}
{include file="view/editviewtabs.tpl"issiteview=$issiteview}
{include file="view/editviewpageactions.tpl" selected='editlayout'}
<!-- Layout -->
......
......@@ -10,15 +10,30 @@
<span class="icon icon-lg icon-cogs"></span>
<span class="btn-title sr-only">{if ($edittitle || $canuseskins) }{str tag=settings section=view}{else}{str tag=editlayout section=view}{/if}</span>
</a>
<a class="btn btn-secondary editviews editcontent {if $selected == 'content'}active{/if}" href="{$WWWROOT}view/blocks.php?id={$viewid}" title="{str tag=editcontent1 section=view}">
<span class="icon icon-lg icon-pencil-alt" aria-hidden="true" role="presentation"></span>
<span class="btn-title sr-only">{str tag=editcontent1 section=view}</span>
</a>
{if $selected == 'content'}
<a id='displaypagebtn' class="btn btn-secondary editviews displaycontent active" href="{$WWWROOT}view/view.php?id={$viewid}" title="{str tag=displayview section=view}">
<span class="icon icon-lg icon-tv" aria-hidden="true" role="presentation"></span>
<span class="btn-title sr-only">{str tag=displayview section=view}</span>
</a>
{else}
<a class="btn btn-secondary editviews editcontent {if $selected == 'content'}active{/if}" href="{$WWWROOT}view/blocks.php?id={$viewid}" title="{str tag=editcontent1 section=view}">
<span class="icon icon-lg icon-pencil-alt" aria-hidden="true" role="presentation"></span>
<span class="btn-title sr-only">{str tag=editcontent1 section=view}</span>
</a>
{/if}
{if !$accesssuspended && ($edittitle || $viewtype == 'share') && !$issitetemplate}
<a class="btn btn-secondary editviews editshare {if $selected == 'share'}active{/if}" href="{$WWWROOT}view/accessurl.php?id={$viewid}{if $collectionid}&collection={$collectionid}{/if}" title="{str tag=shareview1 section=view}">
<span class="icon icon-lg icon-unlock" aria-hidden="true" role="presentation"></span>
<span class="btn-title sr-only">{str tag=shareview1 section=view}</span>
</a>
{/if}
<a class="btn btn-secondary editviews returntolocation"
href={$url}
title="{$title}">
<span class="icon icon-lg icon-step-backward" aria-hidden="true" role="presentation"></span>
<span class="btn-title sr-only">{$title}</span>
</a>
</div>
</div>
\ No newline at end of file
</div>
{if !$issitetemplate}
<div id="view-wizard-controls" class="with-heading">
<a href="{$displaylink}" id="display_page" class="">
{str tag=displayview section=view}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
</div>
{else}
&nbsp;
{/if}
{include file="header.tpl"}
{include file="view/editviewtabs.tpl" issiteview=$issiteview}
{include file="view/editviewpageactions.tpl" selected='layout'}
{$form|safe}
......
{include file="header.tpl"}
<div id="view-wizard-controls" class="with-heading">
<a href="{$viewurl}" id="display_page">
{str tag=displayview section=view}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
<div class="pageactions" id="toolbar-buttons">
<div class="btn-group-vertical in-editor">
<a class="btn btn-secondary editviews" href="{$viewurl}" title="{str tag=displayview section=view}">
<span class="icon icon-lg icon-tv" aria-hidden="true" role="presentation"></span>
<span class="btn-title sr-only">{str tag=displayview section=view}</span>
</a>
</div>
</div>
<div class="grouppageswrap view-container">
......
......@@ -818,4 +818,7 @@ $smarty->assign('allownew', $allownew);
$smarty->assign('onprobation', $onprobation);
$smarty->assign('newform', $newform);
// end
$returnto = $view->get_return_to_url_and_title();
$smarty->assign('url', $returnto['url']);
$smarty->assign('title', $returnto['title']);
$smarty->display('view/accessurl.tpl');
......@@ -288,4 +288,8 @@ $smarty->assign('issitetemplate', $view->is_site_template());
$smarty->assign('PAGEHEADING', $state);
$smarty->assign('instructions', $view->get('instructions'));
$smarty->assign('instructionscollapsed', $view->get('instructionscollapsed'));
$returnto = $view->get_return_to_url_and_title();
$smarty->assign('url', $returnto['url']);
$smarty->assign('title', $returnto['title']);
$smarty->display('view/blocks.tpl');
......@@ -121,6 +121,10 @@ $smarty->assign('displaylink', $view->get_url());
$smarty->assign('issiteview', $issiteview);
$smarty->assign('issitetemplate', $issitetemplate);
$smarty->assign('PAGEHEADING', $state);
$returnto = $view->get_return_to_url_and_title();
$smarty->assign('url', $returnto['url']);
$smarty->assign('title', $returnto['title']);
$smarty->display('view/editlayout.tpl');
function create_settings_pieform() {
......
......@@ -26,9 +26,6 @@ Scenario: Creating a page with content in it (Bug 1426983)
| Page title | Test view |
And I fill in "First description" in first editor
And I press "Save"
# verify page elements are displayed Display page and Return to pages and collections buttons
And I should see "Display page" in the "Display page button" property
And I should see "Return to pages and collections" in the "Return to pages and collections button" property
# Editing the pages
And I follow "Settings" in the "Toolbar buttons" property
#Change the Page title
......@@ -49,8 +46,9 @@ Scenario: Creating a page with content in it (Bug 1426983)
And I should see "This is the edited page title" in the "h1 heading" property
# confirm settings, edit and share buttons displayed
And I should see "Settings" in the ".editlayout .btn-title" element
And I should see "Edit" in the ".editcontent .btn-title" element
And I should see "Display page" in the ".displaycontent .btn-title" element
And I should see "Share" in the ".editshare .btn-title" element
And I should see "Return to pages and collections" in the ".returntolocation .btn-title" element
# Adding media block
When I follow "Add a new block" in the "blocktype sidebar" property
And I press "Add"
......@@ -79,9 +77,6 @@ Scenario: Creating a page with content in it (Bug 1426983)
And I click on "External media" in the "Content types" property
And I press "Remove"
# verify page elements are displayed Display page and Return to pages and collections buttons
And I should see "Display page" in the "Display page button" property
And I should see "Return to pages and collections" in the "Return to pages and collections button" property
And I display the page
# Show last updated date and time when seeing a portfolio page (Bug 1634591)
And I should see "Updated on" in the ".text-right" element
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment