Skip to content

Commit 3e7c7ce

Browse files
Added missing strings and behat
1 parent 45bb24b commit 3e7c7ce

File tree

4 files changed

+56
-12
lines changed

4 files changed

+56
-12
lines changed

block_dash.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function get_content() {
183183

184184
$datasource = $bb->get_configuration()->get_data_source();
185185
// Conditionally hide the block when empty.
186-
if (isset($this->config->hide_when_empty) && $this->config->hide_when_empty
186+
if ($datasource && isset($this->config->hide_when_empty) && $this->config->hide_when_empty
187187
&& (($datasource->is_widget() && $datasource->is_empty())
188188
|| (!$datasource->is_widget() && $datasource->get_data()->is_empty()))
189189
&& !$this->page->user_is_editing()) {

lang/en/block_dash.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@
700700
$string['learningpath:infoarea'] = 'Info area content';
701701

702702
$string['widget:learningpath'] = 'Learning Path';
703-
$string['widget:learningpath_help'] = 'Display the levels associated with the selected skill as images.';
703+
$string['widget:learningpath_help'] = 'List of courses available in the learning path.';
704704

705705
$string['dot'] = "Dot";
706706
$string['tinyimage'] = "Tiny image";
@@ -742,8 +742,10 @@
742742
$string['field:orderdirection_help'] = "Order direction";
743743
$string['field:limit'] = "Limit";
744744
$string['field:limit_help'] = "Limit";
745-
$string['field:learningpathtype'] = "Path";
746-
$string['leanringpath_infocontent'] = 'You have completed {$a->completed} out of {$a->total} courses. The next course in this learning path is: <b> {$a->nextcourse}</b>';
745+
$string['field:learningpathdesktop'] = "Path for Desktop";
746+
$string['field:learningpathtablet'] = "Path for Tablet";
747+
$string['field:learningpathmobile'] = "Path for Mobile";
748+
$string['leanringpath_infocontent'] = 'You have completed <b>{$a->completed}</b> out of <b> {$a->total} </b> courses. The next course in this learning path is: <b> {$a->nextcourse}</b>';
747749
$string['trialpath'] = "Trial";
748750
$string['anothertrailpath'] = "Another trial";
749751
$string['circlepath'] = "Circle";
@@ -759,12 +761,12 @@
759761

760762
$string['resumecourse'] = "Resume course";
761763
$string['completedcourse'] = "Completed course";
764+
$string['startcourse'] = "Start course";
762765

763766
$string['restrictcurrentsection'] = "Automatically restrict to current section";
764767
$string['restrictcurrentsection_desc'] = "If a dash block with the content addon is added to a single-section page, it shall be automatically restricted to that section.";
765768

766769
$string['learningpathstart'] = 'Start';
767770
$string['learningpathfinish'] = 'Finish';
771+
$string['nocourselearnigpath'] = "No courses have been added to the learning path yet.";
768772

769-
$string['restrictcurrentsection'] = "Automatically restrict to current section";
770-
$string['restrictcurrentsection_desc'] = "If a dash block with the content addon is added to a single-section page, it shall be automatically restricted to that section.";

tests/behat/behat_block_dash.php

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class behat_block_dash extends behat_base {
3535

3636
/**
3737
* Turns block editing mode on.
38-
* @Given I switch block editing mode on
39-
* @Given I turn block editing mode on
38+
*
39+
* @Give I turn dash block editing mode on
4040
*/
41-
public function i_turn_block_editing_mode_on() {
41+
public function i_turn_dash_block_editing_mode_on() {
4242
global $CFG;
4343

4444
if ($CFG->branch >= "400") {
@@ -70,15 +70,57 @@ public function i_follow_badge_recipients() {
7070

7171
/**
7272
* I follow dashboard
73-
* @Given I follow dashboard
73+
* @Give I follow dashboard
7474
*/
75-
public function i_follow_dashboard() {
75+
/* public function i_follow_dashboard() {
7676
global $CFG;
7777
7878
if ($CFG->branch >= "400") {
7979
$this->execute('behat_general::i_click_on', ["Dashboard", 'link']);
8080
} else {
8181
$this->execute('behat_navigation::i_follow_in_the_user_menu', ["Dashboard"]);
8282
}
83+
} */
84+
85+
/**
86+
* Creates a datasource for dash block.
87+
*
88+
** @Given /^I create dash "(?P<datasource>(?:[^"]|\\")*)" datasource $/
89+
* @Given I create dash :arg1 datasource
90+
*
91+
* @throws ElementNotFoundException Thrown by behat_base::find
92+
* @param string $datasource
93+
* @param TableNode $data
94+
*/
95+
public function i_create_dash_datasource($datasource) {
96+
global $CFG;
97+
98+
$this->execute('behat_navigation::i_navigate_to_in_site_administration',
99+
['Appearance > Default Dashboard page']);
100+
$this->execute('behat_block_dash::i_turn_dash_block_editing_mode_on', []);
101+
$this->execute('behat_blocks::i_add_the_block', ["Dash"]);
102+
$this->execute('behat_general::i_click_on_in_the', [$datasource, 'text', 'New Dash', 'block']);
103+
104+
// $this->execute('behat_general::i_click_on', ['Add menu item', 'button']);
105+
// $this->execute('behat_forms::i_set_the_following_fields_to_these_values', [$data]);
106+
// $this->execute('behat_general::i_click_on', ['Save changes', 'button']);
83107
}
108+
109+
/**
110+
* Clicks on preference of the dash for specified block. Page must be in editing mode.
111+
*
112+
* Argument block_name may be either the name of the block or CSS class of the block.
113+
*
114+
* @Given /^I open the "(?P<block_name_string>(?:[^"]|\\")*)" block preference$/
115+
* @param string $blockname
116+
*/
117+
public function i_open_the_dash_block($blockname) {
118+
// Note that since $blockname may be either block name or CSS class, we can not use the exact label of "Configure" link.
119+
$this->execute("behat_blocks::i_open_the_blocks_action_menu", $this->escape($blockname));
120+
121+
$this->execute('behat_general::i_click_on_in_the',
122+
array("Preference", "link", $this->escape($blockname), "block")
123+
);
124+
}
125+
84126
}

version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
defined('MOODLE_INTERNAL') || die();
2626

27-
$plugin->version = 2024030402; // The current plugin version (Date: YYYYMMDDXX).
27+
$plugin->version = 2024030403; // The current plugin version (Date: YYYYMMDDXX).
2828
$plugin->requires = 2021051700; // Requires this Moodle version.
2929
$plugin->component = 'block_dash'; // Full name of the plugin (used for diagnostics).
3030
$plugin->maturity = MATURITY_STABLE;

0 commit comments

Comments
 (0)