Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Improving row selection in Joomla! Admin #14913

Merged
merged 8 commits into from
Apr 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions administrator/templates/atum/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -10253,6 +10253,9 @@ iframe {
border-radius: 0.25rem;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.075); }

.row-selected {
background-color: #d9edf7; }

.chzn-container-single {
width: auto !important; }

Expand Down
2 changes: 1 addition & 1 deletion administrator/templates/atum/css/template.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion administrator/templates/atum/css/template.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions administrator/templates/atum/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ $fa-font-path: "../../../../media/vendor/font-awesome/fonts"
// Tables
$table-bg: transparent !default;
$table-bg-accent: rgba(0,0,0,.03) !default;
$table-row-selected: #d9edf7;

// Tabs
$atum-tabs-header-bg: $atum-block-header-bg;
Expand Down
3 changes: 3 additions & 0 deletions administrator/templates/atum/scss/template.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
box-shadow: 0 0 3px rgba(0,0,0,.075);
}

.row-selected {
background-color: $table-row-selected;
}

// Chosen (TEMPORARY)
.chzn-container-single {
Expand Down
42 changes: 42 additions & 0 deletions media/system/js/multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,45 @@ Joomla.JMultiSelect = function(table) {
};
initialize(table);
};

document.addEventListener('DOMContentLoaded', function(event) {
'use strict';
var rows = document.querySelectorAll('tr[class^="row"]');

// Changes the background-color on every <td> inside a <tr>
function changeBg(item, checkall) {
// Check if it should add or remove the background colour
if (checkall.checked) {
item.querySelectorAll('td').forEach (function(td) {
td.classList.add('row-selected');
});
}
else {
item.querySelectorAll('td').forEach (function(td) {
td.classList.remove('row-selected');
});
}
}

document.getElementsByName('checkall-toggle')[0].addEventListener('click', function(event) {
var checkall = this;

rows.forEach(function(row, index) {
changeBg(row, checkall);
});
});

rows.forEach(function(row, index) {
row.addEventListener('click', function(event) {
var clicked = 'cb' + index, cbClicked = document.getElementById(clicked);

if (!(event.target.id == clicked)) {
cbClicked.checked = !cbClicked.checked;
Joomla.isChecked(cbClicked.checked);
}

changeBg(this, cbClicked);
});
});
});

2 changes: 1 addition & 1 deletion media/system/js/multiselect.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.