Skip to content

Commit

Permalink
MDL-69054 core_badges: allow editing OBv1.0 backpacks
Browse files Browse the repository at this point in the history
  • Loading branch information
sarjona committed Aug 14, 2020
1 parent a0fc902 commit 705c94a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
5 changes: 0 additions & 5 deletions badges/classes/output/external_backpacks_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ public function export_for_template(\renderer_base $output) {
foreach ($this->backpacks as $backpack) {
$exporter = new backpack_exporter($backpack);
$backpack = $exporter->export($output);
if ($backpack->apiversion == OPEN_BADGES_V2 || $backpack->apiversion == OPEN_BADGES_V2P1) {
$backpack->canedit = true;
} else {
$backpack->canedit = false;
}
$backpack->cantest = ($backpack->apiversion == OPEN_BADGES_V2);
$backpack->iscurrent = ($backpack->id == $CFG->badges_site_backpack);

Expand Down
4 changes: 1 addition & 3 deletions badges/templates/external_backpacks_page.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Example context (json):
{
"backpacks": [
{"backpackweburl": "http://localhost/", "sitebackpack": true, "canedit": false, "cantest": true}
{"backpackweburl": "http://localhost/", "sitebackpack": true, "cantest": true}
]
}
}}
Expand All @@ -50,9 +50,7 @@
<td> {{{backpackweburl}}} </td>
<td> {{#sitebackpack}}Yes{{/sitebackpack}} </td>
<td>
{{#canedit}}
<a href="{{baseurl}}?id={{id}}&action=edit">{{#pix}}t/edit, core,{{#str}}editsettings{{/str}}{{/pix}}</a>
{{/canedit}}
{{^iscurrent}}
<a href="{{baseurl}}?id={{id}}&action=delete" role="button" data-action="deletebackpack">
{{#pix}}t/delete, core,{{#str}}delete{{/str}}{{/pix}}
Expand Down
3 changes: 2 additions & 1 deletion badges/tests/behat/backpack.feature
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ Feature: Backpack badges
And I set the field "backpackweburl" to "http://backpackweburl.cat"
And I press "Save changes"
Then I should see "http://backpackweburl.cat"
And "Delete" "button" should exist
And "Delete" "icon" should exist in the "http://backpackweburl.cat" "table_row"
And "Edit settings" "icon" should exist in the "http://backpackweburl.cat" "table_row"

@javascript
Scenario: Remove a site backpack
Expand Down

0 comments on commit 705c94a

Please sign in to comment.