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);
Example context (json):
{
"backpacks": [
- {"backpackweburl": "http://localhost/", "sitebackpack": true, "canedit": false, "cantest": true}
+ {"backpackweburl": "http://localhost/", "sitebackpack": true, "cantest": true}
]
}
}}
<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}}
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