Commit 8df87b1d authored by Naomi Guyer's avatar Naomi Guyer Committed by Robert Lyon
Browse files

More bootstrap tidy up fixes (BUG 1465107)

Change-Id: I6bbd0edde9b09c7a01cc0e36fa5bfe55972a14e8
parent 3586cf12
......@@ -181,7 +181,7 @@ if ($membership) {
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => $forum->subscribed ? '<span class="icon icon-lg icon-times prs text-danger"></span> ' . get_string('unsubscribefromforum', 'interaction.forum') : '<span class="icon icon-lg icon-star prs text-success"></span> ' . get_string('subscribetoforum', 'interaction.forum'),
'help' => false
),
......
......@@ -47,7 +47,7 @@ function get_string_ajax(str, section) {
}
var rnd = randString(10);
var placeholder = '<span id="str_' + rnd + '">' + str + '</span>';
var placeholder = '<span id="str_' + rnd + '"></span>';
get_string_ajax_call.apply(this, arguments).done(function(r) {
// need to find the random string in the text and replace it with our lang string
jQuery('#str_' + rnd).replaceWith(r.message.data.string);
......
......@@ -132,11 +132,10 @@ var Paginator = function(id, list, heading, script, extradata) {
};
this.updateResults = function (data, params, changedPage) {
var container = self.isTable ? getFirstElementByTagAndClassName('tbody', null, self.list) : self.list
listdata = data.data.html ? data.data.html : data.data.tablerows,
var container = self.isTable ? getFirstElementByTagAndClassName('tbody', null, self.list) : self.list,
listdata = self.isTable || data.data.tablerows.length ? data.data.tablerows : data.data.html,
paginationdata = data.data.pagination;
if (listdata === undefined || listdata.length === 0) {
listdata = '<p class="no-results">' + get_string_ajax('noresultsfound', 'mahara') + '</p>';
}
......
......@@ -387,3 +387,5 @@ $string['membercommenters'] = "Members involved";
$string['extcommenters'] = "Non-members involved";
$string['groupparticipationreports'] = "Participation report";
$string['groupparticipationreportsdesc1'] = "Group administrators can access a report displaying all group and shared pages and who has commented on them.";
$string['returntogrouppages'] = "Rreturn to group pages";
\ No newline at end of file
......@@ -6,7 +6,7 @@
<span class="mrs icon-long-arrow-down icon-rotate-45 icon icon-sm"></span>
<span class="icon-plus icon icon-sm"></span>
</span> and
<span title="Remove this column" class="text-center btn btn-primary btn-xs">
<span title="Remove this column" class="text-center btn btn-default btn-xs">
<span class="icon-times-circle icon icon-sm"></span>
</span>
in the page editor. These buttons add and remove columns from that page when you click on them.</p>
......
......@@ -6,7 +6,7 @@
<span class="mrs icon-long-arrow-down icon-rotate-45 icon icon-sm"></span>
<span class="icon-plus icon icon-sm"></span>
</span> and
<span title="Remove this column" class="text-center btn btn-primary btn-xs">
<span title="Remove this column" class="text-center btn btn-default btn-xs">
<span class="icon-times-circle icon icon-sm"></span>
</span>
in the page editor. These buttons add and remove columns from that page.</p>
......
......@@ -5,7 +5,7 @@
<span class="mrs icon-long-arrow-down icon-rotate-45 icon icon-sm"></span>
<span class="icon-plus icon icon-sm"></span>
</span> and
<span title="Remove this column" class="text-center btn btn-primary btn-xs">
<span title="Remove this column" class="text-center btn btn-default btn-xs">
<span class="icon-times-circle icon icon-sm"></span>
</span> in the page editor. These buttons add and remove columns from that page when you click on them.</p>
<p>Even if not enabled, the users can change the number of columns in their page in the page layout section.</p>
......@@ -1092,7 +1092,7 @@ function group_get_join_form($name, $groupid, $returnto='view') {
'join' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => '<span class="icon icon-lg icon-plus text-success prs"></span> ' . get_string('joingroup', 'group')
)
)
......@@ -1126,13 +1126,13 @@ function group_get_accept_form($name, $groupid, $returnto) {
'accept' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => '<span class="icon icon-lg icon-check text-success prs"></span> ' . get_string('acceptinvitegroup', 'group')
),
'decline' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default text-danger',
'class' => 'btn-default text-danger',
'value' => '<span class="icon icon-lg icon-ban text-danger prs"></span> ' . get_string('declineinvitegroup', 'group')
)
),
......@@ -1170,7 +1170,7 @@ function group_get_adduser_form($userid, $groupid) {
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => '<span class="prs icon icon-lg icon-check text-success"></span> ' .get_string('add'),
),
),
......@@ -1200,7 +1200,7 @@ function group_get_removeuser_form($userid, $groupid) {
'removeuser' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => '<span class="icon icon-times icon-lg text-danger prm"></span>' . get_string('removefromgroup', 'group'),
),
),
......@@ -1229,7 +1229,7 @@ function group_get_denyuser_form($userid, $groupid) {
'denyuser' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => '<span class="icon icon-ban icon-lg text-danger prs"></span>' . get_string('declinerequest', 'group'),
),
),
......@@ -1402,7 +1402,7 @@ function group_view_submission_form($groupid) {
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-primary input-group-btn ',
'class' => 'btn-primary input-group-btn ',
'value' => get_string('submit')
),
),
......
......@@ -217,7 +217,7 @@ class ImageBrowser {
// goto should not be used by those with javascript - cancel is handled by js function which simply removes the image browser
$elements['action_submitimage'] = array(
'type' => 'submitcancel',
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => array(get_string('submit'), get_string('cancel')),
'goto' => $goto,
);
......
......@@ -37,7 +37,7 @@ function objection_form() {
$form['elements']['submit'] = array(
'type' => 'submitcancel',
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => array(get_string('notifyadministrator'), get_string('cancel')),
'confirm' => array(get_string('notifyadministratorconfirm')),
);
......@@ -154,7 +154,7 @@ function notrude_form() {
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => '<span class="icon icon-lg icon-times text-danger prs"></span> '.get_string('notobjectionable'),
),
),
......
......@@ -43,8 +43,9 @@ function pieform_element_button(Pieform $form, $element) {/*{{{*/
$element['data-confirm'] = Pieform::hsc($element['confirm']);
}
if (isset($element['usebuttontag']) && $element['usebuttontag'] === true) {
$element['class'] .= ' btn';
if (isset($element['usebuttontag']) && $element['usebuttontag'] === true) {
$value = '';
$action = '';
$type = 'type="submit" ';
......@@ -75,4 +76,3 @@ function pieform_element_button(Pieform $form, $element) {/*{{{*/
return $button;
}/*}}}*/
......@@ -36,6 +36,8 @@ function pieform_element_submit(Pieform $form, $element) {/*{{{*/
$element['onclick'] = 'return confirm(' . json_encode($element['confirm']) . ');';
}
$element['class'] .= ' btn';
return '<input type="submit"'
. $form->element_attributes($element)
. ' value="' . Pieform::hsc($form->get_value($element)) . '">';
......
......@@ -36,18 +36,20 @@ function pieform_element_submitcancel(Pieform $form, $element) {/*{{{*/
throw new PieformException('The submitcancel element "' . $element['name']
. '" must have a two element array for its value');
}
$form->include_plugin('element', 'submit');
$form->include_plugin('element', 'button');
$form->include_plugin('element', 'cancel');
// first try for string indices
$plugins = array('submit', 'cancel');
$plugins = array('button', 'cancel');
$elems = '';
foreach ($element['value'] as $key => $value) {
if (!is_numeric($key) && in_array($key, $plugins)) {
$function = 'pieform_element_' . $key;
if (function_exists($function)) {
$item = $element;
$item['class'] = isset($element['class']) ? $element['class'] . ' ' . $key : $key;
$item['usebuttontag'] = ($key == 'button') ? true : false;
$item['value'] = $element['value'][$key];
if (isset($element['confirm']) && isset($element['confirm'][$key])) {
$item['confirm'] = $element['confirm'][$key];
......@@ -68,6 +70,7 @@ function pieform_element_submitcancel(Pieform $form, $element) {/*{{{*/
$submitelement = $element;
$submitelement['class'] = (isset($submitelement['class'])) ? $submitelement['class'] . ' submit' : 'submit';
$submitelement['value'] = $element['value'][0];
$submitelement['usebuttontag'] = true;
$cancelelement = $element;
$cancelelement['class'] = (isset($cancelelement['class'])) ? $cancelelement['class'] . ' cancel' : 'cancel';
$cancelelement['value'] = $element['value'][1];
......@@ -83,7 +86,7 @@ function pieform_element_submitcancel(Pieform $form, $element) {/*{{{*/
else {
unset($cancelelement['confirm']);
}
return pieform_element_submit($form, $submitelement) . ' ' . pieform_element_cancel($form, $cancelelement);
return pieform_element_button($form, $submitelement) . ' ' . pieform_element_cancel($form, $cancelelement);
}
}/*}}}*/
......@@ -94,8 +97,8 @@ function pieform_element_submitcancel_set_attributes($element) {/*{{{*/
function pieform_element_submitcancel_get_value(Pieform $form, $element) {/*{{{*/
if (is_array($element['value'])) {
if (isset($element['value']['submit'])) {
return $element['value']['submit'];
if (isset($element['value']['button'])) {
return $element['value']['button'];
}
else {
return $element['value'][0];
......
......@@ -47,10 +47,13 @@ function pieform_renderer_div(Pieform $form, $element) {/*{{{*/
$prefix .= ' id="' . $formname . '_' . Pieform::hsc($element['name']) . '_container"';
}
// all elements should be form groups by default
// all elements should be form groups by default except button
if (!isset($element['isformgroup'])) {
$element['isformgroup'] = true;
}
if (isset($element['type'])) {
$element['isformgroup'] = $element['type'] === 'button' ? false : $element['isformgroup'];
}
// add form-group classes to all real form fields
$formgroupclass = $element['isformgroup'] ? 'form-group' : '';
......@@ -58,7 +61,6 @@ function pieform_renderer_div(Pieform $form, $element) {/*{{{*/
if(isset($element['class'])){
// remove form-control class and btn class (these should be on the element only)
$element['class'] = str_replace(" btn ", " ", $element['class']);
$element['class'] = str_replace("btn-", " ", $element['class']);
$element['class'] = str_replace("form-control ", "", $element['class']);
......
......@@ -62,7 +62,7 @@ EOF;
),
'register' => array(
'type' => 'submit',
'class' => 'btn btn-success',
'class' => 'btn-success',
'value' => get_string('Register', 'admin'),
),
)
......
......@@ -1437,7 +1437,7 @@ function activate_plugin_form($plugintype, $plugin) {
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'title' => ($plugin->active ? get_string('hide') : get_string('show')) . ' ' . $plugintype . ' ' . $plugin->name,
'hiddenlabel' => true,
'value' => $plugin->active ? get_string('hide') : get_string('show')
......
......@@ -2135,7 +2135,7 @@ function friends_control_sideblock($returnto='myfriends') {
),
'submit' => array(
'type' => 'submit',
'class' => 'btn btn-success mts pull-right',
'class' => 'btn-success mts pull-right',
'value' => get_string('save')
),
'returnto' => array(
......@@ -2169,8 +2169,9 @@ function acceptfriend_form($friendid) {
'autofocus' => 'false',
'elements' => array(
'acceptfriend_submit' => array(
'type' => 'submit',
'class' => 'btn btn-link btn-text',
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn-link btn-text',
'value' => get_string('approverequest', 'group'),
),
'id' => array(
......@@ -2247,12 +2248,13 @@ function addfriend_form($friendid) {
'successcallback' => 'addfriend_submit',
'renderer' => 'div',
'autofocus' => 'false',
'class' => 'form-as-button',
'class' => 'form-as-button pull-right',
'elements' => array(
'addfriend_submit' => array(
'type' => 'submit',
'class' => 'btn btn-default form-button-group',
'value' => get_string('addtofriendslist', 'group'),
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn-default last',
'value' => '<span class="icon icon-user-plus icon-lg prs"></span>' . get_string('addtofriendslist', 'group'),
),
'id' => array(
'type' => 'hidden',
......
......@@ -3751,7 +3751,7 @@ class View {
'submit' => array(
'type' => 'button',
'usebuttonclass' => true,
'class' => 'btn btn-primary input-group-btn no-label',
'class' => 'btn-primary input-group-btn no-label',
'value' => get_string('search')
)
)
......@@ -6094,7 +6094,7 @@ function create_view_form($group=null, $institution=null, $template=null, $colle
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'class' => 'btn-default',
'value' => '<span class="icon icon-plus icon-lg text-success prs"></span>' . get_string('createview', 'view'),
),
'submitcollection' => array(
......@@ -6331,7 +6331,7 @@ function view_group_submission_form($view, $tutorgroupdata, $returnto=null) {
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-primary input-group-btn',
'class' => 'btn-primary input-group-btn',
'value' => get_string('submit')
)
),
......
......@@ -95,13 +95,13 @@ class PluginModuleMultirecipientnotification extends PluginModule {
public static function submenu_items() {
$tabs = array(
'inbox' => array(
'iconclass' => 'icon icon-inbox',
'iconclass' => 'icon icon-inbox icon-lg',
'url' => 'module/multirecipientnotification/inbox.php',
'title' => get_string('labelinbox', 'module.multirecipientnotification'),
'tooltip' => get_string('inboxdesc1', 'module.multirecipientnotification'),
),
'outbox' => array(
'iconclass' => 'icon icon-paper-plane',
'iconclass' => 'icon icon-paper-plane icon-lg',
'url' => 'module/multirecipientnotification/outbox.php',
'title' => get_string('labeloutbox1', 'module.multirecipientnotification'),
'tooltip' => get_string('outboxdesc', 'module.multirecipientnotification'),
......
......@@ -219,7 +219,7 @@ $form = pieform(array(
),
'submit' => array(
'type' => 'submitcancel',
'class' => 'btn btn-success',
'class' => 'btn-success',
'value' => array($messages ? get_string('Reply', 'group') : get_string('sendmessage', 'group'), get_string('cancel')),
'goto' => get_config('wwwroot') . $goto,
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment