Commit 6cd4de6a authored by Naomi Guyer's avatar Naomi Guyer Committed by Aaron Wells

User search (bootstrap)

Bug 1465107: Use Bootstrap CSS Framework

Change-Id: I4703db38c49d2fe9c60fbecce49be91b2d92ea27
parent a17bbc39
......@@ -73,10 +73,14 @@ $calendarform = new Pieform(array(
'loggedindate' => $calendar,
),
));
$calendarform->include_plugin('element', 'calendar');
$loggedindate = pieform_element_calendar($calendarform, $calendar);
list($html, $columns, $pagination, $search) = build_admin_user_search_results($search, $offset, $limit);
$searchParams = $search; //store search as it's about to change
list($html, $columns, $pagination, $search) = build_admin_user_search_results($search, $offset, $limit, $search);
$js = <<<EOF
addLoadEvent(function() {
......@@ -87,7 +91,7 @@ addLoadEvent(function() {
EOF;
$smarty = smarty(array('adminusersearch', 'paginator'), array(), array('ascending' => 'mahara', 'descending' => 'mahara'));
$smarty->assign('search', $search);
$smarty->assign('search', $searchParams);
$smarty->assign('limit', $limit);
$smarty->assign('loggedintypes', $loggedintypes);
$smarty->assign('loggedindate', $loggedindate);
......@@ -101,4 +105,5 @@ $smarty->assign('sortby', $search['sortby']);
$smarty->assign('sortdir', $search['sortdir']);
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('PAGEICON', 'fa fa-search');
$smarty->display('admin/users/search.tpl');
......@@ -125,11 +125,20 @@ function UserSearch(pager) {
var value = $j(this).val();
$j(this).change(function() {
if ($j(this).prop('checked')) {
$j(this).closest('tr').addClass('warning'); // visual selected indicator
self.selectusers[value] = 1;
}
else {
$j(this).closest('tr').removeClass('warning'); // visual selected indicator
delete self.selectusers[value];
}
//update button state
if($j('#searchresults input.selectusers:checked').length > 0){
$j('.withselectedusers button').removeClass('disabled');
}
else {
$j('.withselectedusers button').addClass('disabled');
}
});
if (self.selectusers[value]) {
$j(this).prop('checked', true);
......@@ -137,16 +146,24 @@ function UserSearch(pager) {
});
if ($j('#selectall')) {
$j('#selectall').click(function() {
$j(this).addClass('active');
$j(this).siblings().removeClass('active');
$j('.withselectedusers button').removeClass('disabled');
$j('#searchresults input.selectusers').each(function() {
self.selectusers[$j(this).val()] = 1;
$j(this).prop('checked', true);
$j(this).closest('tr').addClass('warning'); // visual selected indicator
});
return false;
});
$j('#selectnone').click(function() {
$j(this).addClass('active');
$j(this).siblings().removeClass('active');
$j('.withselectedusers button').addClass('disabled');
$j('#searchresults input.selectusers').each(function() {
delete self.selectusers[$j(this).val()];
$j(this).prop('checked', false);
$j(this).closest('tr').removeClass('warning'); // visual selected indicator
});
return false;
});
......@@ -184,7 +201,7 @@ function UserSearch(pager) {
};
this.connectSelectedUsersForm = function(i, formid) {
$j('#' + formid + ' input.button').click(function() {
$j('#' + formid + ' button').click(function() {
// Some of the selected users aren't on the page, so just add them all to the
// form now.
var count = 0;
......
......@@ -1140,7 +1140,7 @@ $string['usershaveloggedinsince'] = 'Users have logged in since';
$string['usershavenotloggedinsince'] = 'Users have not logged in since';
// Admin user search duplicate email filter
$string['duplicateemailfilter'] = 'Filter by duplicate email addresses:';
$string['duplicateemailfilter'] = 'Duplicate email addresses';
$string['lastlogin'] = 'Last login';
......
......@@ -414,10 +414,19 @@ function build_admin_user_search_results($search, $offset, $limit) {
'jsonscript' => 'admin/users/search.json.php',
));
$cols = array(
'select' => array(
'mergefirst' => true,
'headhtml' => '<div class="btn-group" role="group"><a class="btn btn-xs btn-default" href="" id="selectall">' . get_string('All') . '</a>&nbsp;<a class="btn active btn-xs btn-default" href="" id="selectnone">' . get_string('none') . '</a></div>',
'template' => 'admin/users/searchselectcolumn.tpl',
'class' => 'nojs-hidden with-checkbox',
'accessible' => get_string('bulkselect'),
),
'icon' => array(
'mergelast' => true,
'template' => 'admin/users/searchiconcolumn.tpl',
'class' => 'center',
'accessible' => get_string('profileicon'),
),
'firstname' => array(
......@@ -475,12 +484,7 @@ function build_admin_user_search_results($search, $offset, $limit) {
'template' => 'strftimedatetime.tpl',
);
$cols['select'] = array(
'headhtml' => '<a href="" id="selectall">' . get_string('All') . '</a>&nbsp;<a href="" id="selectnone">' . get_string('none') . '</a>',
'template' => 'admin/users/searchselectcolumn.tpl',
'class' => 'center nojs-hidden-table-cell',
'accessible' => get_string('bulkselect'),
);
if (!$USER->get('admin') && !$USER->is_institutional_admin()) {
unset($cols['email']);
......
......@@ -16,4 +16,8 @@
background-color: rgba(#fff, 0.4);
border: 1px solid darken($brand-default, 5%);
color: #555;
}
.fullwidth {
width: 100%;
}
\ No newline at end of file
.pseudolabel {
font-weight: bold;
vertical-align: top;
width: 200px;
margin: 10px 0;
padding-right: 10px;
display: inline-block;
}
.message {
font-size: 0.9em;
......@@ -24,24 +17,34 @@ label.sr-only + div.mce-tinymce {
width: 100%;
}
.main form .form-group {
label,
.pseudolabel {
@extend .control-label;
min-width: 200px;
padding-right: 10px;
font-weight:normal;
font-size: 1.1em;
.pseudolabel {
vertical-align: top;
padding-right: 10px;
display: inline-block;
}
label,
.pseudolabel {
@extend .control-label;
min-width: 200px;
max-width: 100%;
padding-right: 10px;
font-weight:normal;
font-size: 1.1em;
.col-md-2 & {
min-width:0;
}
}
.stacked-label {
display: inline-block;
@media (min-width: $screen-sm-min) {
width:200px;
}
.stacked-label {
display: inline-block;
@media (min-width: $screen-sm-min) {
width:200px;
}
}
.as-panel form {
margin-top:0;
}
......@@ -362,3 +365,14 @@ select {
}
}
.inline {
label {
line-height: 33px;
max-width: 30%;
}
label, input, select {
display:inline-block;
max-width: 200px;
min-width:0;
}
}
\ No newline at end of file
.label {
&.label-default {
color: #333;
&:hover,
&:focus {
background-color:$mahara-green-bright;
}
}
}
\ No newline at end of file
......@@ -106,4 +106,45 @@ blockquote {
&.small {
font-size: $font-size-base;
}
}
.table-small{
font-size: 0.8em;
th {
font-size: 0.8em;
}
>thead>tr>th,
>thead>tr>td,
>tbody>tr>th,
>tbody>tr>td,
>tfoot>tr>th,
>tfoot>tr>td {
padding: 5px 3px;
&:first-child {
padding-left:8px;
}
&:last-child {
padding-right: 8px;
}
}
> thead>tr> th {
padding: 10px 3px;
}
.btn-xs {
font-size: 10px;
}
}
table.table tr {
.with-checkbox {
min-width: 74px;
input {
margin-top:12px;
margin-right:3px;
float:left;
}
}
}
\ No newline at end of file
......@@ -82,6 +82,7 @@
// General customisation and component files go here...
@import "utilities/classes"; // Custom utility classes
@import "utilities/whitespace"; // Custom utility classes
@import "components/label";
@import "components/typography";
@import "components/forms";
@import "components/collapse";
......
......@@ -60,6 +60,7 @@
padding-right: 30px;
}
//
// Margin
//
......@@ -117,3 +118,128 @@
.mrxl {
margin-right: 30px;
}
// Desktop only whitespace
@media (min-width: $screen-md-min) {
//
// Padding
//
// Padding Top
.pts-md {
padding-top: 5px;
}
.ptm-md {
padding-top: 10px;
}
.ptl-md {
padding-top: 20px;
}
.ptxl-md {
padding-top: 30px;
}
// Padding bottom
.pbs-md {
padding-bottom: 5px;
}
.pbm-md {
padding-bottom: 10px;
}
.pbl-md {
padding-bottom: 20px;
}
.pbxl-md {
padding-bottom: 30px;
}
// Padding left
.pls-md {
padding-left: 5px;
}
.plm-md {
padding-left: 10px;
}
.pll-md {
padding-left: 20px;
}
.plxl-md {
padding-left: 30px;
}
// Padding right
.prs-md {
padding-right: 5px;
}
.prm-md {
padding-right: 10px;
}
.prl-md {
padding-right: 20px;
}
.prxl-md {
padding-right: 30px;
}
//
// Margin
//
//margin top
.mts-md {
margin-top: 5px;
}
.mtm-md {
margin-top: 10px;
}
.mtl-md {
margin-top: 20px;
}
.mtxl-md {
margin-top: 30px;
}
//margin bottom
.mbs-md {
margin-bottom: 5px;
}
.mbm-md {
margin-bottom: 10px;
}
.mbl-md {
margin-bottom: 20px;
}
.mbxl-md {
margin-bottom: 30px;
}
//margin left
.mls-md {
margin-left: 5px;
}
.mlm-md {
margin-left: 10px;
}
.mll-md {
margin-left: 20px;
}
.mlxl-md {
margin-left: 30px;
}
//margin right
.mrs-md {
margin-right: 5px;
}
.mrm-md {
margin-right: 10px;
}
.mrl-md {
margin-right: 20px;
}
.mrxl-md {
margin-right: 30px;
}
}
......@@ -178,8 +178,8 @@ $table-border-color: #ddd !default;
$btn-font-weight: normal !default;
$btn-default-color: #333 !default;
$btn-default-bg: #ccc !default;
$btn-default-border: #555 !default;
$btn-default-bg: #ddd !default;
$btn-default-border: #ccc !default;
$btn-primary-color: #fff !default;
$btn-primary-bg: $brand-primary !default;
......@@ -568,7 +568,7 @@ $popover-arrow-outer-fallback-color: darken($popover-fallback-border-color, 20%
//##
//** Default label background color
$label-default-bg: $gray-light !default;
$label-default-bg: $brand-default !default;
//** Primary label background color
$label-primary-bg: $brand-primary !default;
//** Success label background color
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{foreach from=$results.data item=r}
<tr class="{cycle values='r0,r1'}">
{foreach from=$cols key=f item=c}{strip}
<td{if $c.class} class="{$c.class}"{/if}>
{if !$c.template}
{$r[$f]}
{else}
{include file=$c.template r=$r f=$f}
{/if}
</td>{/strip}
{/foreach}
{foreach from=$cols key=f item=c}
{strip}
{if !$c.mergelast}
<td{if $c.class} class="{$c.class}"{/if}>
{/if}
{if !$c.template}
{$r[$f]}
{else}
{include file=$c.template r=$r f=$f}
{/if}
{if !$c.mergefirst}
</td>
{/if}
{/strip}
{/foreach}
</tr>
{/foreach}
\ No newline at end of file
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