MDL-62746 tag: Make forms in tag modals use proper BS classes
authorJun Pataleta <jun@moodle.com>
Tue, 19 Jun 2018 07:26:36 +0000 (15:26 +0800)
committerJun Pataleta <jun@moodle.com>
Fri, 6 Jul 2018 02:14:04 +0000 (10:14 +0800)
lib/amd/build/tag.min.js
lib/amd/src/tag.js

index fd51f0b..ba25521 100644 (file)
Binary files a/lib/amd/build/tag.min.js and b/lib/amd/build/tag.min.js differ
index 1609564..730e5cf 100644 (file)
@@ -148,10 +148,12 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
                     {key: 'continue'},
                     {key: 'cancel'},
                 ]).done(function(s) {
                     {key: 'continue'},
                     {key: 'cancel'},
                 ]).done(function(s) {
-                    var el = $('<div><form id="combinetags_form" class="form-inline">' +
-                        '<p class="description"></p><p class="options"></p>' +
-                        '<p class="mdl-align"><input type="submit" class="btn btn-primary" id="combinetags_submit"/>' +
-                        '<input type="button" class="btn btn-secondary" id="combinetags_cancel"/></p>' +
+                    var el = $('<div><form id="combinetags_form">' +
+                        '<div class="description"></div><div class="form-group options"></div>' +
+                        '<div class="form-group">' +
+                        '   <input type="submit" class="btn btn-primary" id="combinetags_submit"/>' +
+                        '   <input type="button" class="btn btn-secondary" id="combinetags_cancel"/>' +
+                        '</div>' +
                         '</form></div>');
                     el.find('.description').html(s[1]);
                     el.find('#combinetags_submit').attr('value', s[2]);
                         '</form></div>');
                     el.find('.description').html(s[1]);
                     el.find('#combinetags_submit').attr('value', s[2]);
@@ -160,8 +162,12 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
                     tags.each(function() {
                         var tagid = $(this).val(),
                             tagname = $('.inplaceeditable[data-itemtype=tagname][data-itemid=' + tagid + ']').attr('data-value');
                     tags.each(function() {
                         var tagid = $(this).val(),
                             tagname = $('.inplaceeditable[data-itemtype=tagname][data-itemid=' + tagid + ']').attr('data-value');
-                        fldset.append($('<input type="radio" name="maintag" id="combinetags_maintag_' + tagid + '" value="' +
-                            tagid + '"/><label for="combinetags_maintag_' + tagid + '">' + tagname + '</label><br>'));
+                        var option = '<div class="form-check">' +
+                            '   <input type="radio" class="form-check-input" name="maintag" ' +
+                            '       id="combinetags_maintag_' + tagid + '" value="' + tagid + '"/>' +
+                            '   <label class="form-check-label" for="combinetags_maintag_' + tagid + '">' + tagname + '</label>' +
+                            '</div>';
+                        fldset.append($(option));
                     });
                     // TODO: MDL-57778 Convert to core/modal.
                     Y.use('moodle-core-notification-dialogue', function() {
                     });
                     // TODO: MDL-57778 Convert to core/modal.
                     Y.use('moodle-core-notification-dialogue', function() {
@@ -218,13 +224,17 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
                     {key: 'continue'},
                     {key: 'cancel'},
                 ]).done(function(s) {
                     {key: 'continue'},
                     {key: 'cancel'},
                 ]).done(function(s) {
-                    var el = $('<div><form id="addtags_form" class="form-inline" method="POST">' +
+                    var el = $('<div><form id="addtags_form" method="POST">' +
                         '<input type="hidden" name="action" value="addstandardtag"/>' +
                         '<input type="hidden" name="sesskey" value="' + M.cfg.sesskey + '"/>' +
                         '<input type="hidden" name="action" value="addstandardtag"/>' +
                         '<input type="hidden" name="sesskey" value="' + M.cfg.sesskey + '"/>' +
-                        '<p><label for="id_tagslist">' + s[1] + '</label>' +
-                        '<input type="text" id="id_tagslist" name="tagslist"/></p>' +
-                        '<p class="mdl-align"><input type="submit" class="btn btn-primary" id="addtags_submit"/>' +
-                        '<input type="button" class="btn btn-secondary" id="addtags_cancel"/></p>' +
+                        '<div class="form-group">' +
+                        '   <label for="id_tagslist">' + s[1] + '</label>' +
+                        '   <input type="text" id="id_tagslist" class="form-control" name="tagslist"/>' +
+                        '</div>' +
+                        '<div class="form-group">' +
+                        '   <input type="submit" class="btn btn-primary" id="addtags_submit"/>' +
+                        '   <input type="button" class="btn btn-secondary" id="addtags_cancel"/>' +
+                        '</div>' +
                         '</form></div>');
                     el.find('#addtags_form').attr('action', window.location.href);
                     el.find('#addtags_submit').attr('value', s[2]);
                         '</form></div>');
                     el.find('#addtags_form').attr('action', window.location.href);
                     el.find('#addtags_submit').attr('value', s[2]);
@@ -290,13 +300,19 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
                         {key: 'create'},
                         {key: 'cancel'},
                     ]).done(function(s) {
                         {key: 'create'},
                         {key: 'cancel'},
                     ]).done(function(s) {
-                        var el = $('<div><form id="addtagcoll_form" class="form-inline">' +
-                            '<p><label for="addtagcoll_name"></label>: ' +
-                            '<input id="addtagcoll_name" type="text"/></p>' +
-                            '<p><label for="addtagcoll_searchable"></label>: ' +
-                            '<input id="addtagcoll_searchable" type="checkbox" value="1" checked/></p>' +
-                            '<p class="mdl-align"><input type="submit" class="btn btn-primary" id="addtagcoll_submit"/>' +
-                            '<input type="button" class="btn btn-secondary" id="addtagcoll_cancel"/></p>' +
+                        var el = $('<div><form id="addtagcoll_form">' +
+                            '<div class="form-group">' +
+                            '   <label for="addtagcoll_name"></label> ' +
+                            '   <input id="addtagcoll_name" type="text" class="form-control"/>  ' +
+                            '</div>' +
+                            '<div class="form-group form-check">' +
+                            '   <input id="addtagcoll_searchable" type="checkbox" value="1" checked class="form-check-input"/>' +
+                            '   <label for="addtagcoll_searchable" class="form-check-label"></label>' +
+                            '</div>' +
+                            '<div class="form-group">' +
+                            '   <input type="submit" class="btn btn-primary" id="addtagcoll_submit"/>' +
+                            '   <input type="button" class="btn btn-secondary" id="addtagcoll_cancel"/>' +
+                            '</div>' +
                             '</form></div>');
                         el.find('label[for="addtagcoll_name"]').html(s[1]);
                         el.find('label[for="addtagcoll_searchable"]').html(s[2]);
                             '</form></div>');
                         el.find('label[for="addtagcoll_name"]').html(s[1]);
                         el.find('label[for="addtagcoll_searchable"]').html(s[2]);