Skip to content

Commit

Permalink
OSEP: Back to Blog button on mobile #135572
Browse files Browse the repository at this point in the history
  • Loading branch information
mkassaei authored and sammarshallou committed Jul 22, 2016
1 parent 2d21545 commit f4df577
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internaldoc/participation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ The participants to display is as follows:
| ''Own participation only''
|}

=== Back to blog link ===
A button (link) reading as "< [blog-name]", where [blog-name] is the name of
the oublog will redirect the user from participation-page or viewpost-page to
the main-blog-page

=== Grading ===

A user with the capability ''mod/oublog:grade'' in relation to the current blog has the ability to add grade values.
Expand Down
2 changes: 2 additions & 0 deletions participation.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@
$download, $page, $participation, $coursecontext, $viewfullnames,
$groupname);

echo $oublogoutput->get_link_back_to_oublog($cm->name, $cm->id);

if (empty($download)) {
echo $OUTPUT->footer();
}
3 changes: 3 additions & 0 deletions participationlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@
echo $oublogoutput->render_all_users_participation_table($cm, $course, $oublog,
$page, $limitnum, $participation, $getposts, $getcomments,
$start, $end, $pagingurl);

echo $oublogoutput->get_link_back_to_oublog($cm->name, $cm->id);

echo $OUTPUT->footer();

// Log visit list event.
Expand Down
18 changes: 18 additions & 0 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,24 @@ public function render_export_button_bottom($context, $oublog, $post, $oubloguse

return $output;
}

/**
* Return a button-like link which takes the user back to the main page.
*
* @param string $label, String.
* @param int $id, cmid or userid (if blog is global).
* @param bool $global, set to true when global blog.
* @return string
*/
public function get_link_back_to_oublog($label, $id, $global = false) {
$idstring = 'id';
if ($global) {
$idstring = 'user';
}
$url = new moodle_url('/mod/oublog/view.php', array($idstring => $id));
return html_writer::tag('div', link_arrow_left($label, $url), array('id' => 'oublog-arrowback'));
}

}

class oublog_statsinfo implements renderable {
Expand Down
3 changes: 3 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -713,3 +713,6 @@ div.tagselector_result .tagselector_result_info {
font-size: 0.8em;
margin-left: 5px;
}
#oublog-arrowback {
margin: 1em 0;
}
42 changes: 42 additions & 0 deletions tests/behat/basic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -608,3 +608,45 @@ Feature: Test Post and Comment on OUBlog entry
When I follow "Test oublog basics"
Then I should see "2 comments"
And I log out

Scenario: Check back to main page link
Given I log in as "teacher1"
And I am on homepage
And I follow "Course 1"
When I follow "Test oublog basics"
And I press "New blog post"
And I set the following fields to these values:
| Title | Teacher1 blog |
| Message | Teacher1 message |
And I press "Add post"
# Go to viewpost page and back to the main blog page
When I follow "Permalink"
Then "#oublog-arrowback" "css_element" should exist
And I should see "Test oublog basics" in the "#oublog-arrowback" "css_element"
Given I click on "#oublog-arrowback a" "css_element"
Then "#addpostbutton" "css_element" should exist
# Go to participation page and back to the main blog page
Given I press "Participation by user"
Then I should see "Participation - All time"
And "#oublog-arrowback" "css_element" should exist
And I should see "Test oublog basics" in the "#oublog-arrowback" "css_element"
Given I click on "#oublog-arrowback a" "css_element"
Then "#addpostbutton" "css_element" should exist
# Go to userparticipatiom page and back to the main blog page
When I expand "BLOG USAGE" node
And I expand "My participation summary" node
And I follow "View all participation"
Then I should see "Participation - All time"
And "#oublog-arrowback" "css_element" should exist
And I should see "Test oublog basics" in the "#oublog-arrowback" "css_element"
Given I click on "#oublog-arrowback a" "css_element"
Then "#addpostbutton" "css_element" should exist
# Go to participatiomlist page and back to the main blog page
When I expand "Participation" node
And I follow "View all participation"
Then I should see "Participation - All time"
And "#oublog-arrowback" "css_element" should exist
And I should see "Test oublog basics" in the "#oublog-arrowback" "css_element"
Given I click on "#oublog-arrowback a" "css_element"
Then "#addpostbutton" "css_element" should exist
And I log out
22 changes: 22 additions & 0 deletions tests/behat/personalblog.feature
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,25 @@ Feature: Test Post and Comment on Personal OUBlog
And "div.share-button:nth-child(3)" "css_element" should exist
And I should not see "SC02 Personal OUBlog post01"
And I should not see "SC02 Admin Persblog post01 content Private"

Scenario: Admin follows the link to the main page and back
Given I log in as "admin"
And I am on homepage
And I follow "Personal Blogs"
And I follow "Blog options"
Then I should see "Blog name"
And I should see "Summary"
And I set the following fields to these values:
| Blog name| Admin User's blog follow the link to the main page |
When I press "Save changes"
Then I should see "Admin User's blog follow the link to the main page"
Given I press "New blog post"
And I set the following fields to these values:
| Title | Personal OUBlog post01 |
| Message | Admin Persblog post01 content |
When I press "Add post"
And I follow "Permalink"
Then "#oublog-arrowback" "css_element" should exist
And I should see "Admin User's blog follow the link to the main page" in the "#oublog-arrowback" "css_element"
Given I click on "#oublog-arrowback a" "css_element"
Then "#addpostbutton" "css_element" should exist
2 changes: 2 additions & 0 deletions userparticipation.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@
$oublogoutput->render_user_participation_list($cm, $course, $oublog, $participation,
$groupid, $download, $page, $coursecontext, $viewfullnames, $groupname, $start, $end);

echo $oublogoutput->get_link_back_to_oublog($cm->name, $cm->id);

if (empty($download)) {
echo $pag;
echo $OUTPUT->footer();
Expand Down
6 changes: 6 additions & 0 deletions viewpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@

echo '</div>';

if ($oublog->global) {
echo $oublogoutput->get_link_back_to_oublog($blogname, $oubloginstance->userid, true);
} else {
echo $oublogoutput->get_link_back_to_oublog($blogname, $cm->id);
}

// Finish the page.
echo '<div class="clearfix"></div>';
echo $OUTPUT->footer();

0 comments on commit f4df577

Please sign in to comment.