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

Illustration picker #18565

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = {
"color-function-notation": null, // DISABLE: Expected modern color-function notation
"declaration-block-no-redundant-longhand-properties": null, // DISABLE Expected shorthand property "flex-flow"
"media-feature-range-notation": "prefix",
"selector-not-notation": "simple", //DISABLE Expected complex :not() pseudo-class notation
Copy link
Contributor Author

@AdrienClairembault AdrienClairembault Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need a complex selector for a case that do not seems possible with simple selectors.

I've removed this rule, but it requires us to remove usages of simple selectors so I've had to fix a few existing css rules using the automated --fix command.

See https://stylelint.io/user-guide/rules/selector-not-notation/.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to be an issue. All officially supported browsers support selector lists.
https://caniuse.com/css-not-sel-list

"scss/at-rule-conditional-no-parentheses": null,
"scss/no-global-function-names": null, // scssphp do not support usage of SASS modules

Expand Down
2 changes: 2 additions & 0 deletions css/includes/_includes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ $is-dark: false !default;
@import "components/form/form-destination";
@import "components/fuzzy";
@import "components/global-menu";
@import "components/illustration-picker";
@import "components/log_viewer";
@import "components/browser_tree";
@import "components/mini-tabs";
Expand All @@ -66,6 +67,7 @@ $is-dark: false !default;
@import "components/sortable";
@import "components/tabs";
@import "components/tinymce";
@import "components/utils";
@import "components/creator_badge";
@import "components/itilobject/footer";
@import "components/itilobject/layout";
Expand Down
45 changes: 45 additions & 0 deletions css/includes/components/_illustration-picker.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*!
* ---------------------------------------------------------------------
*
* GLPI - Gestionnaire Libre de Parc Informatique
*
* http://glpi-project.org
*
* @copyright 2015-2024 Teclib' and contributors.
* @licence https://www.gnu.org/licenses/gpl-3.0.html
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* ---------------------------------------------------------------------
*/

.illustration-selector {
padding-bottom: 7px;
border-color: var(--tblr-card-border-color);
box-shadow: var(--tblr-box-shadow-input) !important;
border-radius: 10px !important; // Must match border radius used for tinymce

&:hover {
border-color: var(--tblr-secondary);
cursor: pointer;
}

transition: border-color 0.3s;
}
5 changes: 3 additions & 2 deletions css/includes/components/_richtext.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ body.mce-content-body {
justify-content: flex-end;
}

.tox.tox-tinymce {
border: var(--tblr-border-width) solid var(--tblr-border-color);
.tox.tox-tinymce:not(.content-editable-tinymce .tox.tox-tinymce) {
border: var(--tblr-border-width) solid var(--tblr-border-color) !important;
Copy link
Contributor Author

@AdrienClairembault AdrienClairembault Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat unrelated, I've noticed that some of tiynmce styles were not applied correctly (since I was trying to display a form field next to a tinymce field, the differences were very noticeable).

Fixed it and made the selector more precise as we don't want to impact the special .content-editable-tinymce class.

border-radius: var(--tblr-border-radius);
box-shadow: var(--tblr-box-shadow-input) !important;
}

.rich_text_container {
Expand Down
56 changes: 56 additions & 0 deletions css/includes/components/_utils.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*!
* ---------------------------------------------------------------------
*
* GLPI - Gestionnaire Libre de Parc Informatique
*
* http://glpi-project.org
*
* @copyright 2015-2024 Teclib' and contributors.
* @licence https://www.gnu.org/licenses/gpl-3.0.html
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* ---------------------------------------------------------------------
*/

.aspect-ratio-1 {
aspect-ratio: 1;
}

.border-secondary-hover {
border-color: transparent;

&:hover {
border-color: var(--tblr-secondary);
}

transition: border-color 0.3s;
}

// Apply the same font-size and line-height as btn-text.
// Useful when replacing a btn-text content by a loading icon.
.btn-text-loading {
font-size: var(--tblr-btn-font-size) !important;
line-height: var(--tblr-btn-line-height) !important;
}

.w-fit-content {
width: fit-content !important;
}
2 changes: 1 addition & 1 deletion css/includes/pages/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ table.search-results {
vertical-align: bottom !important;// Fix alignment for when no sorting indicator element is present
}

thead th[data-searchopt-id]:not([data-searchopt-id=""]):not([data-nosort]) {
thead th[data-searchopt-id]:not([data-searchopt-id=""], [data-nosort]) {
cursor: pointer;

.sort-indicator {
Expand Down
2 changes: 1 addition & 1 deletion css/standalone/dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ $break_tablet: 1400px;
.edit-dashboard-properties {
display: none;

input.dashboard-name:not(.submit):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not(.select2-search__field) {
input.dashboard-name:not(.submit, [type="submit"], [type="reset"], [type="checkbox"], [type="radio"], .select2-search__field) {
min-width: 200px;
resize: horizontal;
}
Expand Down
2 changes: 1 addition & 1 deletion css/standalone/marketplace.scss
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ $break_s_screen: 1400px;
padding: 8px 10px;
}

&:not(.current):not(.nb_plugin):not(.nav-disabled):hover {
&:not(.current, .nb_plugin, .nav-disabled):hover {
background-color: #ddd;
cursor: pointer;
}
Expand Down
18 changes: 18 additions & 0 deletions js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1975,3 +1975,21 @@ window.displaySessionMessages = () => {
});
});
};

// Add/remove a special data attribute to bootstrap's modals when they are
// displayed/hidden.
// This is needed for e2e testing as bootstrap have some compatibility issues
// with cypress.
// See https://github.com/cypress-io/cypress/issues/25202.
document.addEventListener('shown.bs.modal', (e) => {
const modal = e.target.closest('.modal');
if (modal) {
modal.setAttribute('data-cy-shown', 'true');
}
});
document.addEventListener('hidden.bs.modal', (e) => {
const modal = e.target.closest('.modal');
if (modal) {
modal.setAttribute('data-cy-shown', 'false');
}
});
Loading
Loading