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 { ...@@ -7309,6 +7309,42 @@ class View {
return get_records_select_assoc('block_instance', 'blocktype = ? AND view = ?', array('peerassessment', $this->get('id'))); 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 * Fetch a list of versions for the particular view
* *
......
...@@ -1484,7 +1484,7 @@ EOF; ...@@ -1484,7 +1484,7 @@ EOF;
* *
*/ */
public function i_display_page() { 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 ...@@ -128,17 +128,6 @@ A group of buttons aligned at the top. Note: The box around the buttons is only
``` ```
</section> </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"> <section data-markdown data-category="buttons">
### Text link ### 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. 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="header.tpl"}
{include file="view/editviewtabs.tpl" issiteview=$issiteview}
{include file="view/editviewpageactions.tpl" selected='share'} {include file="view/editviewpageactions.tpl" selected='share'}
<div id="accessurl-container"> <div id="accessurl-container">
......
{include file="header.tpl"} {include file="header.tpl"}
{include file="view/editviewtabs.tpl" issiteview=$issiteview}
<div class="view-instructions"> <div class="view-instructions">
<form action="{$formurl}" method="post" class="row"> <form action="{$formurl}" method="post" class="row">
<input type="submit" name="{$action_name}" id="action-dummy" class="d-none"> <input type="submit" name="{$action_name}" id="action-dummy" class="d-none">
...@@ -51,38 +50,6 @@ ...@@ -51,38 +50,6 @@
</div> </div>
</div> </div>
</form> </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>
<div class="modal" id="addblock" role="dialog"> <div class="modal" id="addblock" role="dialog">
......
{include file="header.tpl"} {include file="header.tpl"}
{include file="view/editviewtabs.tpl" issiteview=$issiteview}
{include file="view/editviewpageactions.tpl" selected='title'} {include file="view/editviewpageactions.tpl" selected='title'}
{if $ADMIN || $INSTITUTIONALADMIN} {if $ADMIN || $INSTITUTIONALADMIN}
......
{include file="header.tpl"} {include file="header.tpl"}
{include file="view/editviewtabs.tpl"issiteview=$issiteview}
{include file="view/editviewpageactions.tpl" selected='editlayout'} {include file="view/editviewpageactions.tpl" selected='editlayout'}
<!-- Layout --> <!-- Layout -->
......
...@@ -10,15 +10,30 @@ ...@@ -10,15 +10,30 @@
<span class="icon icon-lg icon-cogs"></span> <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> <span class="btn-title sr-only">{if ($edittitle || $canuseskins) }{str tag=settings section=view}{else}{str tag=editlayout section=view}{/if}</span>
</a> </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}"> {if $selected == 'content'}
<span class="icon icon-lg icon-pencil-alt" aria-hidden="true" role="presentation"></span> <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="btn-title sr-only">{str tag=editcontent1 section=view}</span> <span class="icon icon-lg icon-tv" aria-hidden="true" role="presentation"></span>
</a> <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} {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}"> <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="icon icon-lg icon-unlock" aria-hidden="true" role="presentation"></span>
<span class="btn-title sr-only">{str tag=shareview1 section=view}</span> <span class="btn-title sr-only">{str tag=shareview1 section=view}</span>
</a> </a>
{/if} {/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>
</div> </div>
\ No newline at end of file
{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="header.tpl"}
{include file="view/editviewtabs.tpl" issiteview=$issiteview}
{include file="view/editviewpageactions.tpl" selected='layout'} {include file="view/editviewpageactions.tpl" selected='layout'}
{$form|safe} {$form|safe}
......
{include file="header.tpl"} {include file="header.tpl"}
<div id="view-wizard-controls" class="with-heading"> <div class="pageactions" id="toolbar-buttons">
<a href="{$viewurl}" id="display_page"> <div class="btn-group-vertical in-editor">
{str tag=displayview section=view} <a class="btn btn-secondary editviews" href="{$viewurl}" title="{str tag=displayview section=view}">
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span> <span class="icon icon-lg icon-tv" aria-hidden="true" role="presentation"></span>
</a> <span class="btn-title sr-only">{str tag=displayview section=view}</span>
</a>
</div>
</div> </div>
<div class="grouppageswrap view-container"> <div class="grouppageswrap view-container">
......
...@@ -818,4 +818,7 @@ $smarty->assign('allownew', $allownew); ...@@ -818,4 +818,7 @@ $smarty->assign('allownew', $allownew);
$smarty->assign('onprobation', $onprobation); $smarty->assign('onprobation', $onprobation);
$smarty->assign('newform', $newform); $smarty->assign('newform', $newform);
// end // end
$returnto = $view->get_return_to_url_and_title();
$smarty->assign('url', $returnto['url']);
$smarty->assign('title', $returnto['title']);
$smarty->display('view/accessurl.tpl'); $smarty->display('view/accessurl.tpl');
...@@ -288,4 +288,8 @@ $smarty->assign('issitetemplate', $view->is_site_template()); ...@@ -288,4 +288,8 @@ $smarty->assign('issitetemplate', $view->is_site_template());
$smarty->assign('PAGEHEADING', $state); $smarty->assign('PAGEHEADING', $state);
$smarty->assign('instructions', $view->get('instructions')); $smarty->assign('instructions', $view->get('instructions'));
$smarty->assign('instructionscollapsed', $view->get('instructionscollapsed')); $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'); $smarty->display('view/blocks.tpl');
...@@ -121,6 +121,10 @@ $smarty->assign('displaylink', $view->get_url()); ...@@ -121,6 +121,10 @@ $smarty->assign('displaylink', $view->get_url());
$smarty->assign('issiteview', $issiteview); $smarty->assign('issiteview', $issiteview);
$smarty->assign('issitetemplate', $issitetemplate); $smarty->assign('issitetemplate', $issitetemplate);
$smarty->assign('PAGEHEADING', $state); $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'); $smarty->display('view/editlayout.tpl');
function create_settings_pieform() { function create_settings_pieform() {
......
...@@ -26,9 +26,6 @@ Scenario: Creating a page with content in it (Bug 1426983) ...@@ -26,9 +26,6 @@ Scenario: Creating a page with content in it (Bug 1426983)
| Page title | Test view | | Page title | Test view |
And I fill in "First description" in first editor And I fill in "First description" in first editor
And I press "Save" 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 # Editing the pages
And I follow "Settings" in the "Toolbar buttons" property And I follow "Settings" in the "Toolbar buttons" property
#Change the Page title #Change the Page title
...@@ -49,8 +46,9 @@ Scenario: Creating a page with content in it (Bug 1426983) ...@@ -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 And I should see "This is the edited page title" in the "h1 heading" property
# confirm settings, edit and share buttons displayed # confirm settings, edit and share buttons displayed
And I should see "Settings" in the ".editlayout .btn-title" element 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 "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 # Adding media block
When I follow "Add a new block" in the "blocktype sidebar" property When I follow "Add a new block" in the "blocktype sidebar" property
And I press "Add" And I press "Add"
...@@ -79,9 +77,6 @@ Scenario: Creating a page with content in it (Bug 1426983) ...@@ -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 click on "External media" in the "Content types" property
And I press "Remove" 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 And I display the page
# Show last updated date and time when seeing a portfolio page (Bug 1634591) # Show last updated date and time when seeing a portfolio page (Bug 1634591)
And I should see "Updated on" in the ".text-right" element 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