Skip to content

Commit

Permalink
DASH-295 implement drag and drop field sorting for totara
Browse files Browse the repository at this point in the history
  • Loading branch information
moodledev committed Feb 17, 2021
1 parent 0f30744 commit 1be9b95
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ function block_dash_output_fragment_block_preferences_form($args) {

return $OUTPUT->render_from_template('block_dash/preferences_form', [
'formhtml' => $formhtml,
'tabs' => $tabs
'tabs' => $tabs,
'istotara' => block_dash_is_totara()
]);
}

Expand Down
4 changes: 4 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ body#page-blocks-dash-data-source .ui-sortable-helper {
width: 100%;
justify-content: left;
}
/** Fix fields for totara **/
.dash-preferences-form #fgroup_id_available_fields .felement > span {
display: block;
}

.block_dash .dash-table th {
white-space: nowrap;
Expand Down
14 changes: 13 additions & 1 deletion templates/preferences_form.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,16 @@
{{/tabs}}
</ul>

{{{formhtml}}}
{{{formhtml}}}

{{#istotara}}
{{! Initialize sortable field list for Totara (due to insufficient modal events) }}
{{#js}}
require(["jquery", "jqueryui"], function($, jqueryui) {
$("#fgroup_id_available_fields fieldset.fgroup div.felement").sortable({
handle: ".drag-handle",
axis: "y"
});
});
{{/js}}
{{/istotara}}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

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

$plugin->version = 2021011202; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2021021700; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2017051509; // Requires this Moodle version.
$plugin->component = 'block_dash'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_BETA;
Expand Down

0 comments on commit 1be9b95

Please sign in to comment.