Skip to content

Commit

Permalink
MDL-58855 mod_glossary: Add pending approval identifier glossary
Browse files Browse the repository at this point in the history
Add a new label to indicate whether a tagged glossary item is pending approval or not
  • Loading branch information
Peter committed Dec 19, 2018
1 parent 44890bd commit c8b67be
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions mod/glossary/lang/en/glossary.php
Expand Up @@ -260,6 +260,7 @@
$string['nopermissiontoviewresult'] = 'You can only look at results for your own entries';
$string['notcategorised'] = 'Not categorised';
$string['notapproved'] = 'glossary entry is not approved yet.';
$string['entrynotapproved'] = 'Entry not approved';
$string['numberofentries'] = 'Number of entries';
$string['onebyline'] = '(one per line)';
$string['page-mod-glossary-x'] = 'Any glossary module page';
Expand Down
7 changes: 6 additions & 1 deletion mod/glossary/locallib.php
Expand Up @@ -743,7 +743,12 @@ function mod_glossary_get_tagged_entries($tag, $exclusivemode = false, $fromctx
$coursename = format_string($item->fullname, true, array('context' => context_course::instance($item->courseid)));
$coursename = html_writer::link($courseurl, $coursename);
$icon = html_writer::link($pageurl, html_writer::empty_tag('img', array('src' => $cm->get_icon_url())));
$tagfeed->add($icon, $pagename, $cmname.'<br>'.$coursename);

$approved = "";
if (!$item->approved) {
$approved = '<br>'. html_writer::span(get_string('entrynotapproved', 'mod_glossary'), 'badge badge-warning');
}
$tagfeed->add($icon, $pagename, $cmname.'<br>'.$coursename.$approved);
}

$content = $OUTPUT->render_from_template('core_tag/tagfeed',
Expand Down
28 changes: 26 additions & 2 deletions mod/glossary/tests/behat/entries_require_approval.feature
Expand Up @@ -4,7 +4,7 @@ Feature: A teacher can choose whether glossary entries require approval
As a user
I need to enable entries requiring approval

Scenario: Approve and undo approve glossary entries
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
Expand All @@ -25,7 +25,9 @@ Feature: A teacher can choose whether glossary entries require approval
| Description | Test glossary entries require approval |
| Approved by default | No |
And I log out
And I log in as "student1"

Scenario: Approve and undo approve glossary entries
Given I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test glossary name"
When I add a glossary entry with the following data:
Expand Down Expand Up @@ -66,3 +68,25 @@ Feature: A teacher can choose whether glossary entries require approval
And I am on "Course 1" course homepage
And I follow "Test glossary name"
Then I should see "No entries found in this section"

@javascript
Scenario: View pending approval glossary items
Given I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test glossary name"
When I add a glossary entry with the following data:
| Concept | Just a test concept |
| Definition | Concept definition |
| Keyword(s) | Black |
| Tags | Test |
And I log out
And I log in as "teacher1"
And I press "Customise this page"
And I add the "Navigation" block if not present
And I expand "Site pages" node
And I click on "Tags" "link" in the "Navigation" "block"
And I follow "Test"
Then I should see "Glossary entries"
And I should see "Just a test concept"
And I should see "Entry not approved"
And I log out

0 comments on commit c8b67be

Please sign in to comment.