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

#326 - Abonnement au calendrier Robert2 depuis application de calendrier externe #330

Merged
merged 20 commits into from
Mar 5, 2022
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d8f6484
Sécurise la route d'update des settings
Donov4n Feb 12, 2022
80c68bd
Ajoute les nouvelles clés de configuration liées au calendrier public
Donov4n Feb 12, 2022
19da2c7
Corrige l'URL de création d'un utilisateur par les admins
Donov4n Feb 12, 2022
7b40e52
Refactoring
Donov4n Feb 12, 2022
0525e01
Supprime le support de PHP < 7.4 (#327)
Donov4n Feb 12, 2022
6042a04
Ajout de l'action de controller liée au calendrier public
Donov4n Feb 13, 2022
5ce4529
Début de l'ajout de la section "Abonnement externe au calendrier" dan…
Donov4n Feb 19, 2022
272afb4
Ajoute le formatage des données du calendrier public
Donov4n Feb 20, 2022
a38a8ae
Ajoute la possibilité de reset une des configurations de l'application
Donov4n Feb 20, 2022
8f661ac
Améliore le style de la page des paramètres
Donov4n Feb 20, 2022
5258fe8
Affiche l'URL du calendrier public si les données sont persistées côt…
Donov4n Feb 20, 2022
aceff26
Remplace les modules lodash par lodash lui-même (les modules sont obs…
Donov4n Feb 20, 2022
e6faa52
Améliore le component `<Button>`
Donov4n Feb 26, 2022
a0a845a
Ajoute la possibilité de regénerer l'URL du calendrier public en cas …
Donov4n Feb 27, 2022
73c1879
Ajoute un `input[type=copy]` permettant de facilement copier l'URL du…
Donov4n Feb 27, 2022
f15c902
Met à jour le CHANGELOG
Donov4n Feb 27, 2022
1779295
Corrections suite au CI
Donov4n Feb 27, 2022
52543c3
Corrige certaines typos / formulations
Donov4n Mar 5, 2022
bd3d929
Supprime les codes retour explicites dans le `SettingController`
Donov4n Mar 5, 2022
b2ad807
Corrige un test unitaire
Donov4n Mar 5, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
runs-on : ubuntu-latest
strategy :
matrix:
php: [7.3, 7.4, 8.0]
php: [7.4, 8.0]
defaults : { run: { working-directory: ./server }}
services :
mysql:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ Ce projet adhère au principe du [Semantic Versioning](https://semver.org/spec/v

## 0.18.0 (UNRELEASED)

- __[CHANGEMENT CRITIQUE]__ Robert2 requiert maintenant au minimum PHP 7.4 pour fonctionner (#327).
- Ajoute la possibilité de configurer les données affichées dans les événements du calendrier
via la page des paramètres de l'application (fin du ticket #302).
- Il est maintenant possible de s'abonner depuis votre application de calendrier préférée (Google Agenda, Apple Calendrier, etc.) au calendrier Robert2 / Loxya.
Pour plus d'informations, rendez-vous dans les paramètres de votre instance Robert2 / Loxya, onglet "Calendrier" (#326).

## 0.17.1 (2022-01-06)

Expand Down
9 changes: 3 additions & 6 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"deep-freeze-strict": "1.1.1",
"invariant": "2.2.4",
"js-cookie": "2.2.1",
"lodash.clonedeep": "4.5.0",
"lodash.pick": "4.4.0",
"lodash.times": "4.3.2",
"lodash": "^4.17.21",
"moment": "2.29.1",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand All @@ -45,13 +43,12 @@
"@babel/core": "7.14.8",
"@babel/preset-react": "7.16.7",
"@babel/preset-typescript": "7.15.0",
"@pulsanova/eslint-config-vue": "2.1.2",
"@pulsanova/eslint-config-react": "2.1.2",
"@pulsanova/eslint-config-vue": "2.1.2",
"@pulsanova/stylelint-config-scss": "2.0.1",
"@types/debounce": "1.2",
"@types/invariant": "2.2",
"@types/lodash.clonedeep": "4.5",
"@types/lodash.times": "4.3",
"@types/lodash": "^4.14.178",
"@types/react": "17.0",
"@types/react-dom": "17.0",
"@vue/babel-preset-app": "4.5.15",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Alert/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ConfirmDelete = ($t, entityName, isSoft = true) => Swal.fire({
icon: 'warning',
showCancelButton: true,
customClass: {
confirmButton: isSoft ? 'swal2-confirm--trash' : 'swal2-confirm--delete',
confirmButton: isSoft ? 'swal2-confirm--warning' : 'swal2-confirm--danger',
},
confirmButtonText: isSoft ? $t('yes-delete') : $t('yes-permanently-delete'),
cancelButtonText: $t('cancel'),
Expand Down
55 changes: 55 additions & 0 deletions client/src/components/Button/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
@use '~@/style/globals';
@use 'sass:color';

/// Marge entre l'icône et le texte des boutons (quand il y en a une, d'icône)
/// @type Number
$icon-margin: 0.3571rem !default;

//
// - Default variant
//

$default-color: globals.$color-base-button !default;
$default-background: globals.$bg-color-button-default !default;

$default-focused-color: color.adjust(globals.$bg-color-button-default, $lightness: 8%) !default;
$default-focused-background: globals.$color-hover-button !default;

$default-active-color: color.adjust(globals.$bg-color-button-default, $lightness: -8%) !default;
$default-active-background: globals.$color-active-button !default;

//
// - Success variant
//

$success-variant-color: #fff !default;
$success-variant-background: globals.$bg-color-button-success !default;

$success-variant-focused-color: $success-variant-color !default;
$success-variant-focused-background: color.adjust(globals.$bg-color-button-success, $lightness: 5%) !default;

$success-variant-active-color: globals.$color-active-button !default;
$success-variant-active-background: color.adjust(globals.$bg-color-button-success, $lightness: -5%) !default;

//
// - Warning variant
//

$warning-variant-color: #fff !default;
$warning-variant-background: #be692d !default;

$warning-variant-focused-color: $warning-variant-color !default;
$warning-variant-focused-background: color.adjust(#be692d, $lightness: 8%) !default;

$warning-variant-active-color: globals.$color-active-button !default;
$warning-variant-active-background: color.adjust(#be692d, $lightness: 8%) !default;

//
// - Danger variant
//

$danger-variant-color: #fff !default;
$danger-variant-background: globals.$bg-color-button-danger !default;

$danger-variant-focused-color: $danger-variant-color !default;
$danger-variant-focused-background: color.adjust(globals.$bg-color-button-danger, $lightness: 8%) !default;

$danger-variant-active-color: globals.$color-active-button !default;
$danger-variant-active-background: color.adjust(globals.$bg-color-button-danger, $lightness: -8%) !default;
25 changes: 20 additions & 5 deletions client/src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import './index.scss';
import { toRefs, computed } from '@vue/composition-api';
import Icon from '@/components/Icon';

const BUTTON_TYPE = ['default', 'success', 'warning', 'danger'];

// type Props = {
// /**
// * Le type de bouton pour l'attribut `type` de la balise `<button>`?
Expand All @@ -28,8 +30,8 @@ import Icon from '@/components/Icon';
// };

// @vue/component
const Button = (props, { slots }) => {
const { htmlType, icon, disabled } = toRefs(props);
const Button = (props, { slots, emit }) => {
const { htmlType, icon, disabled, type } = toRefs(props);
const _icon = computed(() => {
if (!icon.value) {
return null;
Expand All @@ -43,16 +45,22 @@ const Button = (props, { slots }) => {
return { name: iconType, variant };
});

const _className = ['Button', {
const _className = ['Button', `Button--${type.value}`, {
'Button--disabled': disabled.value,
'Button--with-icon': !!_icon,
}];

return () => {
const children = slots.default?.();

return (
// eslint-disable-next-line react/button-has-type
<button type={htmlType.value} class={_className} disabled={disabled.value}>
<button
// eslint-disable-next-line react/button-has-type
type={htmlType.value}
class={_className}
disabled={disabled.value}
onClick={emit.bind(null, 'click')}
>
{_icon.value && <Icon {...{ props: _icon.value }} class="Button__icon" />}
{children && <span class="Button__content">{children}</span>}
</button>
Expand All @@ -68,8 +76,15 @@ Button.props = {
['button', 'submit', 'reset'].includes(value)
),
},
type: {
type: String,
validator: (value) => BUTTON_TYPE.includes(value),
default: 'default',
},
icon: { type: String, default: undefined },
disabled: { type: Boolean, default: false },
};

Button.emits = ['click'];

export default Button;
94 changes: 94 additions & 0 deletions client/src/components/Button/index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,49 @@
@use './variables' as *;
@use '~@/style/globals';
@use 'sass:color';

.Button {
display: inline-block;
padding: 0.55rem 0.78rem;
border: none;
border-radius: 2px;
background-color: $default-background;
color: $default-color;
font-size: 1rem;
line-height: 1.25;
text-decoration: none;
cursor: pointer;
transition: all 300ms;

& + & {
margin-left: 5px;
}

&:hover,
&:focus {
outline: 0;
background-color: $default-focused-color;
color: $default-focused-background;
}

&:active {
background-color: $default-active-color;
color: $default-active-background;
}

//
// - Disabled
//

&--disabled {
cursor: not-allowed;
opacity: 0.6;
}

//
// - Icône
//

&::before,
&__icon {
display: inline-flex;
Expand All @@ -18,4 +60,56 @@
&__icon + &__content {
margin-left: $icon-margin;
}

//
// - Variantes
//

&--success {
background-color: $success-variant-background;
color: $success-variant-color;

&:hover,
&:focus {
background-color: $success-variant-focused-background;
color: $success-variant-focused-color;
}

&:active {
background-color: $success-variant-active-background;
color: $success-variant-active-color;
}
}

&--warning {
background-color: $warning-variant-background;
color: $warning-variant-color;

&:hover,
&:focus {
background-color: $warning-variant-focused-background;
color: $warning-variant-focused-color;
}

&:active {
background-color: $warning-variant-active-background;
color: $warning-variant-active-color;
}
}

&--danger {
background-color: $danger-variant-background;
color: $danger-variant-color;

&:hover,
&:focus {
background-color: $danger-variant-focused-background;
color: $danger-variant-focused-color;
}

&:active {
background-color: $danger-variant-active-background;
color: $danger-variant-active-color;
}
}
}
2 changes: 1 addition & 1 deletion client/src/components/EventDetails/Header/Actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const EventDetailsHeaderActions = (props, { root, emit }) => {
title: __('please-confirm'),
text: __('page-calendar.confirm-delete'),
confirmButtonText: __('yes-delete'),
type: 'warning',
type: 'danger',
});
if (!isConfirmed) {
return;
Expand Down
11 changes: 11 additions & 0 deletions client/src/components/FormField/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import moment from 'moment';
import { defineComponent } from '@vue/composition-api';
import Datepicker from '@/components/Datepicker';
import SwitchToggle from '@/components/SwitchToggle';
import InputCopy from '@/components/InputCopy';

const ALLOWED_TYPES = [
'text',
'email',
'copy',
'static',
'password',
'number',
'tel',
Expand Down Expand Up @@ -84,6 +87,7 @@ export default defineComponent({
render() {
const {
$t: __,
$scopedSlots: slots,
type,
label,
name,
Expand Down Expand Up @@ -202,11 +206,18 @@ export default defineComponent({
/>
</div>
)}
{type === 'copy' && (
<InputCopy class="FormField__input" value={value} />
)}
{type === 'static' && (
<p class="FormField__static-value">{value}</p>
)}
{errors && (
<div class="FormField__error">
<span class="FormField__error__text">{errors[0]}</span>
</div>
)}
{(!errors && slots.help) && <div class="FormField__help">{slots.help()}</div>}
</div>
);
},
Expand Down
21 changes: 19 additions & 2 deletions client/src/components/FormField/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@

&__input,
&__textarea,
&__datepicker {
&__datepicker,
&__static-value {
width: 90%;
}

&__static-value {
margin: 0;
padding: 10px 0;
font-weight: 500;
font-style: italic;
}

&__switch {
display: flex;
}
Expand All @@ -46,9 +54,13 @@
min-height: 50px;
}

&__help,
&__error {
flex: 0 0 100%;
margin-top: 0.3rem;
}

&__error {
color: globals.$text-danger-color;

&__text {
Expand All @@ -62,6 +74,10 @@
padding-right: 0;
border-right: 0;
border-radius: globals.$input-border-radius 0 0 globals.$input-border-radius;

&:focus + #{$block}__addon {
border-color: globals.$input-focus-border-color;
}
}
}

Expand All @@ -88,7 +104,8 @@

&__input,
&__textarea,
&__datepicker {
&__datepicker,
&__static-value {
flex: 1;
}

Expand Down
Loading