Skip to content

Commit

Permalink
MDL-69630 format_social: Add ajax support
Browse files Browse the repository at this point in the history
  • Loading branch information
sbourget committed Sep 10, 2020
1 parent d4d798e commit 1a453e4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
9 changes: 3 additions & 6 deletions blocks/social_activities/tests/behat/edit_activities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Feature: Edit activities in social activities block
| user | course | role |
| user1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name |
| forum | C1 | forum | My forum name |

@javascript
Scenario: Edit name of acitivity in-place in social activities block
Given I log in as "user1"
And I am on "Course 1" course homepage with editing mode on
And I set the field "Add an activity to section 'section 0'" to "Forum"
And I set the field "Forum name" to "My forum name"
And I press "Save and return to course"
And I click on "Edit title" "link" in the "My forum name" activity in social activities block
And I set the field "New name for activity My forum name" to "New forum name"
And I press key "13" in the field "New name for activity My forum name"
Expand All @@ -42,9 +42,6 @@ Feature: Edit activities in social activities block
And I log in as "user1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Recent activity" block
And I set the field "Add an activity to section 'section 0'" to "Forum"
And I set the field "Forum name" to "My forum name"
And I press "Save and return to course"
And "My forum name" activity in social activities block should have "Hide" editing icon
And "My forum name" activity in social activities block should not have "Show" editing icon
And "My forum name" activity in social activities block should not have "Make available" editing icon
Expand Down
15 changes: 15 additions & 0 deletions course/format/social/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,19 @@ public function get_config_for_external() {
// Return everything (nothing to hide).
return $this->get_format_options();
}

/**
* Returns the information about the ajax support in the given source format.
*
* The returned object's property (boolean)capable indicates that
* the course format supports Moodle course ajax features.
*
* @return stdClass
*/
public function supports_ajax() {
$ajaxsupport = new stdClass();
$ajaxsupport->capable = true;
return $ajaxsupport;
}

}
3 changes: 3 additions & 0 deletions course/format/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ This files describes API changes for course formats

Overview of this plugin type at http://docs.moodle.org/dev/Course_formats

=== 3.10 ===
* Added the missing callback supports_ajax() to format_social.

=== 3.9 ===

* The following functions, previously used (exclusively) by upgrade steps are not available anymore because of the upgrade cleanup performed for this version. See MDL-65809 for more info:
Expand Down

0 comments on commit 1a453e4

Please sign in to comment.