Skip to content

Commit

Permalink
Merge branch 'dev' for release 6.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Jul 21, 2023
2 parents 7841462 + 7ba596c commit 0597c98
Show file tree
Hide file tree
Showing 37 changed files with 113 additions and 69 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog Fab-manager

## v6.0.11 2023 July 21

- Fix a bug: incorrect date range in statistics
- Fix a bug: hide project categories filter if there is no project categories
- Improvement : dialog confirm to remove a project category

## v6.0.10 2023 July 13

- Fix a bug: unable to confirm payment of store for admin
Expand Down
9 changes: 7 additions & 2 deletions app/frontend/src/javascript/components/user/gender-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { useTranslation } from 'react-i18next';
interface GenderInputProps<TFieldValues> {
register: UseFormRegister<TFieldValues>,
disabled?: boolean|((id: string) => boolean),
required?: boolean
required?: boolean,
tooltip?: string
}

/**
* Input component to set the gender for the user
*/
export const GenderInput = <TFieldValues extends FieldValues>({ register, disabled = false, required }: GenderInputProps<TFieldValues>) => {
export const GenderInput = <TFieldValues extends FieldValues>({ register, disabled = false, required, tooltip }: GenderInputProps<TFieldValues>) => {
const { t } = useTranslation('shared');

const [isDisabled, setIsDisabled] = useState<boolean>(false);
Expand Down Expand Up @@ -46,6 +47,10 @@ export const GenderInput = <TFieldValues extends FieldValues>({ register, disabl
disabled={isDisabled}
{...register('statistic_profile_attributes.gender' as FieldPath<TFieldValues>)} />
</label>
{tooltip && <div className="fab-tooltip">
<span className="trigger"><i className="fa fa-question-circle" /></span>
<div className="content">{tooltip}</div>
</div>}
</fieldset>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const UserProfileForm: React.FC<UserProfileFormProps> = ({ action, size,
<div className="fields-group">
<div className="personnal-data">
<h4>{t('app.shared.user_profile_form.personal_data')}</h4>
<GenderInput register={register} disabled={isDisabled} required />
<GenderInput register={register} disabled={isDisabled} required tooltip={t('app.shared.user_profile_form.used_for_statistics')} />
<div className="names">
<FormInput id="profile_attributes.last_name"
register={register}
Expand Down Expand Up @@ -352,8 +352,7 @@ export const UserProfileForm: React.FC<UserProfileFormProps> = ({ action, size,
<FormSwitch control={control}
id="is_allow_newsletter"
disabled={isDisabled}
label={t('app.shared.user_profile_form.allow_newsletter')}
tooltip={t('app.shared.user_profile_form.allow_newsletter_help')} />
label={t('app.shared.user_profile_form.allow_newsletter')} />
</div>
{showGroupInput && <div className="group">
<FormSelect options={groups}
Expand Down
20 changes: 16 additions & 4 deletions app/frontend/src/javascript/controllers/admin/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*/
'use strict';

Application.Controllers.controller('AdminProjectsController', ['$scope', '$state', 'Component', 'Licence', 'Theme', 'ProjectCategory', 'componentsPromise', 'licencesPromise', 'themesPromise', 'projectCategoriesPromise', '_t', 'Member', 'uiTourService', 'settingsPromise', 'growl',
function ($scope, $state, Component, Licence, Theme, ProjectCategory, componentsPromise, licencesPromise, themesPromise, projectCategoriesPromise, _t, Member, uiTourService, settingsPromise, growl) {
Application.Controllers.controller('AdminProjectsController', ['$scope', '$state', 'Component', 'Licence', 'Theme', 'ProjectCategory', 'componentsPromise', 'licencesPromise', 'themesPromise', 'projectCategoriesPromise', '_t', 'Member', 'uiTourService', 'settingsPromise', 'growl', 'dialogs',
function ($scope, $state, Component, Licence, Theme, ProjectCategory, componentsPromise, licencesPromise, themesPromise, projectCategoriesPromise, _t, Member, uiTourService, settingsPromise, growl, dialogs) {
// Materials list (plastic, wood ...)
$scope.components = componentsPromise;

Expand Down Expand Up @@ -136,8 +136,20 @@ Application.Controllers.controller('AdminProjectsController', ['$scope', '$state
* @param index {number} project category index in the $scope.projectCategories array
*/
$scope.removeProjectCategory = function (index) {
ProjectCategory.delete($scope.projectCategories[index]);
return $scope.projectCategories.splice(index, 1);
return dialogs.confirm({
resolve: {
object () {
return {
title: _t('app.admin.project_categories.delete_dialog_title'),
msg: _t('app.admin.project_categories.delete_dialog_info')
};
}
}
}
, function () { // cancel confirmed
ProjectCategory.delete($scope.projectCategories[index]);
$scope.projectCategories.splice(index, 1);
});
};

/**
Expand Down
12 changes: 6 additions & 6 deletions app/frontend/src/javascript/controllers/admin/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,8 @@ Application.Controllers.controller('StatisticsController', ['$scope', '$state',
scroll: ES_SCROLL_TIME + 'm',
'stat-type': type,
'custom-query': custom ? JSON.stringify(Object.assign({ exclude: custom.exclude }, buildElasticCustomCriterion(custom))) : '',
'start-date': moment($scope.datePickerStart.selected).format(),
'end-date': moment($scope.datePickerEnd.selected).format(),
'start-date': moment($scope.datePickerStart.selected).format('YYYY-MM-DD'),
'end-date': moment($scope.datePickerEnd.selected).format('YYYY-MM-DD'),
body: buildElasticDataQuery(type, custom, $scope.agePicker.start, $scope.agePicker.end, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected), $scope.sorting)
}
, function (error, response) {
Expand Down Expand Up @@ -537,8 +537,8 @@ Application.Controllers.controller('StatisticsController', ['$scope', '$state',
{
range: {
date: {
gte: intervalBegin.format(),
lte: intervalEnd.format()
gte: intervalBegin.format('YYYY-MM-DD'),
lte: intervalEnd.format('YYYY-MM-DD')
}
}
}
Expand Down Expand Up @@ -767,8 +767,8 @@ Application.Controllers.controller('ExportStatisticsController', ['$scope', '$ui
{
range: {
date: {
gte: moment($scope.dates.start).format(),
lte: moment($scope.dates.end).format()
gte: moment($scope.dates.start).format('YYYY-MM-DD'),
lte: moment($scope.dates.end).format('YYYY-MM-DD')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/javascript/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco

// default user's parameters
$scope.user = {
is_allow_contact: true,
is_allow_contact: false,
is_allow_newsletter: false,
// reCaptcha response, received from Google (through AJAX) and sent to server for validation
recaptcha: undefined,
Expand Down
2 changes: 2 additions & 0 deletions app/frontend/src/stylesheets/modules/base/fab-tooltip.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.fab-tooltip {
position: relative;
display: inline-block;
cursor: help;
z-index: 10;

.trigger i { display: block; }
.content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
margin: 0;
}
}
.trainings { max-width: none; }
}

.main-actions {
Expand Down
7 changes: 3 additions & 4 deletions app/frontend/templates/admin/projects/project_categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
<tbody>
<tr ng-repeat="projectCategory in projectCategories">
<td>
<span editable-text="projectCategory.name" e-name="name" e-form="rowform" e-required>
{{ projectCategory.name }}
</span>
<span editable-text="projectCategory.name" e-name="name" e-form="rowform" e-required>
{{ projectCategory.name }}
</span>
</td>
<td>
<!-- form -->
<form editable-form name="rowform" onbeforesave="saveProjectCategory($data, projectCategory.id)" ng-show="rowform.$visible" class="form-buttons form-inline" shown="inserted == projectCategory">
<button type="submit" ng-disabled="rowform.$waiting" class="btn btn-warning">
<i class="fa fa-check"></i>
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/templates/machines/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1 translate>{{ 'app.public.machines_list.the_fablab_s_machines' }}</h1>
</div>
</section>

<section class="machines"
<section class="machines p-h-lg"
ui-tour="machines"
ui-tour-backdrop="true"
ui-tour-template-url="'/shared/tour-step-template.html'"
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/templates/projects/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h3 translate>{{ 'app.public.projects_list.filter' }}</h3>
<option value="" translate>{{ 'app.public.projects_list.all_themes' }}</option>
</select>

<select ng-model="search.project_category_id" ng-change="setUrlQueryParams(search) && triggerSearch()" class="form-control" ng-options="pc.id as pc.name for pc in projectCategories">
<select ng-show="projectCategories.length" ng-model="search.project_category_id" ng-change="setUrlQueryParams(search) && triggerSearch()" class="form-control" ng-options="pc.id as pc.name for pc in projectCategories">
<option value="" translate>{{ projectCategoriesFilterPlaceholder }}</option>
</select>

Expand Down
40 changes: 26 additions & 14 deletions app/frontend/templates/shared/signupModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
ng-model="user.statistic_profile_attributes.gender"
value="false"/> {{ 'app.public.common.woman' | translate }}
</label>
<span class="exponent m-l-xs help-cursor" title="{{ 'app.public.common.used_for_statistics' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<div class="fab-tooltip">
<span class="trigger"><i class="fa fa-question-circle"></i></span>
<div class="content" translate="">{{ 'app.public.common.used_for_statistics' }}</div>
</div>
<span class="exponent m-l-xs"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.gender.$dirty && signupForm.gender.$error.required" translate>{{ 'app.public.common.gender_is_required'}}</span>
</div>
</div>
Expand All @@ -37,7 +41,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
class="form-control"
placeholder="{{ 'app.public.common.your_first_name' | translate }}"
required>
<span class="exponent m-l-xs help-cursor" title="{{ 'app.public.common.used_for_invoicing' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="exponent m-l-xs"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.first_name.$dirty && signupForm.first_name.$error.required" translate>{{ 'app.public.common.first_name_is_required' }}</span>
</div>
<div class="m-b visible-xs"></div>
Expand All @@ -48,7 +52,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
class="form-control"
placeholder="{{ 'app.public.common.your_surname' | translate }}"
required>
<span class="exponent m-l-xs help-cursor" title="{{ 'app.public.common.used_for_invoicing' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="exponent m-l-xs"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.last_name.$dirty && signupForm.last_name.$error.required" translate>{{ 'app.public.common.surname_is_required' }}</span>
</div>
</div>
Expand All @@ -64,7 +68,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
placeholder="{{ 'app.public.common.your_pseudonym' | translate }}"
required>
</div>
<span class="exponent help-cursor" title="{{ 'app.public.common.used_for_profile' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="exponent"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.username.$dirty && signupForm.username.$error.required" translate>{{ 'app.public.common.pseudonym_is_required' }}</span>
</div>
</div>
Expand All @@ -81,7 +85,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
placeholder="{{ 'app.public.common.your_email_address' | translate }}"
required>
</div>
<span class="exponent help-cursor" title="{{ 'app.public.common.used_for_invoicing' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="exponent"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.email.$dirty && signupForm.email.$error.required" translate>{{ 'app.public.common.email_is_required' }}</span>
</div>
</div>
Expand Down Expand Up @@ -130,6 +134,10 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
ng-model="user.organization"
value="false"/>
<label for="organization" translate>{{ 'app.public.common.i_am_an_organization' }}</label>
<div class="fab-tooltip m-l-xs">
<span class="trigger"><i class="fa fa-question-circle"></i></span>
<div class="content" translate="">{{ 'app.shared.user_profile_form.declare_organization_help' }}</div>
</div>
</div>
</div>

Expand All @@ -144,7 +152,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
placeholder="{{ 'app.public.common.name_of_your_organization' | translate }}"
ng-required="user.organization">
</div>
<span class="exponent help-cursor" title="{{ 'app.public.common.used_for_invoicing' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="exponent"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.organization_name.$dirty && signupForm.organization_name.$error.required" translate>{{ 'app.public.common.organization_name_is_required' }}</span>
</div>
</div>
Expand All @@ -160,7 +168,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
placeholder="{{ 'app.public.common.address_of_your_organization' | translate }}"
ng-required="user.organization">
</div>
<span class="exponent help-cursor" title="{{ 'app.public.common.used_for_invoicing' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="exponent"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.organization_address.$dirty && signupForm.organization_address.$error.required" translate>{{ 'app.public.common.organization_address_is_required' }}</span>
</div>
</div>
Expand All @@ -177,7 +185,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
placeholder="{{profileCustomField.label}}"
ng-required="profileCustomField.required">
</div>
<span ng-show="profileCustomField.required" class="exponent help-cursor" title="{{ 'app.public.common.used_for_invoicing' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span ng-show="profileCustomField.required" class="exponent"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.user_profile_custom_fields{{i}}.$dirty && signupForm.user_profile_custom_fields{{i}}.$error.required" translate translate-values="{FEILD: profileCustomField.label}">{{ 'app.public.common.profile_custom_field_is_required' }}</span>
</div>
</div>
Expand All @@ -189,7 +197,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
<select ng-model="user.group_id" class="form-control" name="group_id" ng-options="g.id as g.name for g in enabledGroups" required>
<option value="" translate>{{ 'app.public.common.your_user_s_profile' }}</option>
</select>
<span class="exponent exponent-select help-cursor" title="{{ 'app.public.common.used_for_invoicing' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="exponent exponent-select"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
</div>
<span class="help-block" ng-show="signupForm.group_id.$dirty && signupForm.group_id.$error.required" translate>{{ 'app.public.common.user_s_profile_is_required' }}</span>
</div>
Expand All @@ -216,7 +224,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
ng-click="openDatePicker($event)"
required/>
</div>
<span class="exponent help-cursor" title="{{ 'app.public.common.used_for_statistics' | translate }}"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="exponent"><i class="fa fa-asterisk" aria-hidden="true"></i></span>
<span class="help-block" ng-show="signupForm.birthday.$dirty && signupForm.birthday.$error.required" translate>{{ 'app.public.common.birth_date_is_required' }}</span>
</div>
</div>
Expand Down Expand Up @@ -263,8 +271,12 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
name="is_allow_contact"
id="is_allow_contact"
ng-model="user.is_allow_contact"
value="true"/>
<label for="is_allow_contact" class="help-cursor" title="{{ 'app.public.common.public_profile' | translate }}" translate>{{ 'app.public.common.i_authorize_Fablab_users_registered_on_the_site_to_contact_me' }}</label>
value="false"/>
<label for="is_allow_contact" translate>{{ 'app.public.common.i_authorize_Fablab_users_registered_on_the_site_to_contact_me' }}</label>
<div class="fab-tooltip">
<span class="trigger"><i class="fa fa-question-circle"></i></span>
<div class="content" translate="">{{ 'app.public.common.public_profile' }}</div>
</div>
</div>
</div>

Expand All @@ -274,7 +286,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
name="is_allow_newsletter"
id="is_allow_newsletter"
ng-model="user.is_allow_newsletter"
value="true"/>
value="false"/>
<label for="is_allow_newsletter" translate>{{ 'app.public.common.i_accept_to_receive_information_from_the_fablab' }}</label>
</div>
</div>
Expand All @@ -285,7 +297,7 @@ <h1 translate>{{ 'app.public.common.create_your_account' }}</h1>
name="cgu"
id="cgu"
ng-model="user.cgu"
value="true"
value="false"
ng-required="cgu != null"/>
<label for="cgu">
<span translate>{{ 'app.public.common.i_ve_read_and_i_accept_' }}</span>
Expand Down
2 changes: 2 additions & 0 deletions config/locales/app.admin.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ de:
project_categories: Categories
project_categories:
name: "Name"
delete_dialog_title: "Confirmation required"
delete_dialog_info: "The associations between this category and the projects will me deleted."
projects_setting:
add: "Hinzufügen"
actions_controls: "Actions"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/app.admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ en:
project_categories: Categories
project_categories:
name: "Name"
delete_dialog_title: "Confirmation required"
delete_dialog_info: "The associations between this category and the projects will me deleted."
projects_setting:
add: "Add"
actions_controls: "Actions"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/app.admin.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ es:
project_categories: Categories
project_categories:
name: "Name"
delete_dialog_title: "Confirmation required"
delete_dialog_info: "The associations between this category and the projects will me deleted."
projects_setting:
add: "Add"
actions_controls: "Actions"
Expand Down
Loading

0 comments on commit 0597c98

Please sign in to comment.