Skip to content

Commit

Permalink
MDL-56724 boost: Update mod_choice to use bootstrap classes for styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Damyon Wiese committed Nov 14, 2016
1 parent 0b8e0c3 commit eaf45bc
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 200 deletions.
23 changes: 13 additions & 10 deletions mod/choice/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function display_options($options, $coursemoduleid, $vertical = false, $m
$disabled = empty($options['previewonly']) ? array() : array('disabled' => 'disabled');

$html = html_writer::start_tag('form', $attributes);
$html .= html_writer::start_tag('ul', array('class'=>'choices' ));
$html .= html_writer::start_tag('ul', array('class'=>'choices list-unstyled unstyled' ));

$availableoption = count($options['options']);
$choicecount = 0;
Expand All @@ -59,6 +59,7 @@ public function display_options($options, $coursemoduleid, $vertical = false, $m
$option->attributes->type = 'radio';
}
$option->attributes->id = 'choice_'.$choicecount;
$option->attributes->class = 'm-x-1';

$labeltext = $option->text;
if (!empty($option->attributes->disabled)) {
Expand All @@ -83,7 +84,7 @@ public function display_options($options, $coursemoduleid, $vertical = false, $m
$html .= html_writer::tag('label', get_string('choicefull', 'choice'));
} else {
$html .= html_writer::empty_tag('input',
array('type' => 'submit', 'value' => get_string('savemychoice', 'choice'), 'class' => 'button'));
array('type' => 'submit', 'value' => get_string('savemychoice', 'choice'), 'class' => 'btn btn-primary'));
}

if (!empty($options['allowupdate']) && ($options['allowupdate'])) {
Expand Down Expand Up @@ -147,7 +148,7 @@ public function display_publish_name_vertical($choices) {
$table = new html_table();
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->attributes['class'] = 'results names ';
$table->attributes['class'] = 'results names table table-bordered';
$table->tablealign = 'center';
$table->summary = get_string('responsesto', 'choice', format_string($choices->name));
$table->data = array();
Expand Down Expand Up @@ -223,6 +224,7 @@ public function display_publish_name_vertical($choices) {
}

$userfullname = fullname($user, $choices->fullnamecapability);
$mediabody = '';
if ($choices->viewresponsecapability && $choices->deleterepsonsecapability) {
$checkboxid = 'attempt-user'.$user->id.'-option'.$optionid;
$attemptaction = html_writer::label($userfullname . ' ' . $optionsnames[$optionid],
Expand All @@ -234,16 +236,17 @@ public function display_publish_name_vertical($choices) {
$attemptaction .= html_writer::checkbox('userid[]', $user->id, '', null,
array('id' => $checkboxid));
}
$data .= html_writer::tag('div', $attemptaction, array('class'=>'attemptaction'));
$mediabody .= html_writer::tag('div', $attemptaction, array('class'=>'media-left p-t-1'));
}
$userimage = $this->output->user_picture($user, array('courseid'=>$choices->courseid));
$data .= html_writer::tag('div', $userimage, array('class'=>'image'));
$mediabody .= html_writer::tag('div', $userimage, array('class'=>'media-left'));

$userlink = new moodle_url('/user/view.php', array('id'=>$user->id,'course'=>$choices->courseid));
$name = html_writer::tag('a', $userfullname, array('href'=>$userlink, 'class'=>'username'));
$data .= html_writer::tag('div', $name, array('class'=>'fullname'));
$data .= html_writer::tag('div','', array('class'=>'clearfloat'));
$optionusers .= html_writer::tag('div', $data, array('class'=>'user'));
$userlink = new moodle_url('/user/view.php', array('id'=>$user->id,'course' => $choices->courseid));
$name = html_writer::tag('a', $userfullname, array('href' => $userlink));
$mediabody .= html_writer::tag('div', $name, array('class' => 'media-body'));
$data .= html_writer::tag('div', $mediabody, array('class' => 'media m-b-1'));

$optionusers .= $data;
}
$cell->text = $optionusers;
}
Expand Down
10 changes: 5 additions & 5 deletions mod/choice/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,19 @@
$options["id"] = "$cm->id";
$options["download"] = "ods";
$button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadods"));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption'));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption list-inline-item'));

$options["download"] = "xls";
$button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadexcel"));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption'));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption list-inline-item'));

$options["download"] = "txt";
$button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadtext"));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption'));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption list-inline-item'));

$downloadlist = html_writer::tag('ul', implode('', $downloadoptions));
$downloadlist = html_writer::tag('ul', implode('', $downloadoptions), array('class' => 'list-inline inline'));
$downloadlist .= html_writer::tag('div', '', array('class'=>'clearfloat'));
echo html_writer::tag('div',$downloadlist, array('class'=>'downloadreport'));
echo html_writer::tag('div',$downloadlist, array('class'=>'downloadreport m-t-1'));
}
echo $OUTPUT->footer();

152 changes: 0 additions & 152 deletions mod/choice/styles.css

This file was deleted.

15 changes: 0 additions & 15 deletions theme/boost/scss/moodle/modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,6 @@ div#dock {

// Choice module

.path-mod-choice {
.horizontal .choices {
margin: 0;

.option {
display: inline-block;
padding: 10px;
}
}

.results .data {
white-space: normal;
}
}

// Lesson module

/** General styles (scope: all of lesson) **/
Expand Down
12 changes: 3 additions & 9 deletions theme/bootstrapbase/less/moodle/modules.less
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,9 @@ div#dock {
// Choice module

.path-mod-choice {
.horizontal .choices {
margin: 0;
.option {
display: inline-block;
padding: 10px;
}
}
.results .data {
white-space: normal;
.media-left {
float: left;
padding-right: 1em;
}
}

Expand Down
12 changes: 3 additions & 9 deletions theme/bootstrapbase/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -14704,15 +14704,9 @@ canvas {
div#dock {
display: none;
}
.path-mod-choice .horizontal .choices {
margin: 0;
}
.path-mod-choice .horizontal .choices .option {
display: inline-block;
padding: 10px;
}
.path-mod-choice .results .data {
white-space: normal;
.path-mod-choice .media-left {
float: left;
padding-right: 1em;
}
.path-mod-lesson .firstpageoptions {
margin: auto;
Expand Down

0 comments on commit eaf45bc

Please sign in to comment.