Skip to content

Commit

Permalink
Merge branch 'dev' for release 6.3.27
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Jun 12, 2024
2 parents ea4d6fe + 4ad6ecf commit 9e5ebfe
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Next release

## v6.3.27 2024 June 12

- Fix a bug: unable to show gender wowan in member export
- Add a new feature: add a new button to automatically refresh the public calendar

## v6.3.26 2024 June 5

- improvement: add uid_attribute for saml provider
Expand Down
58 changes: 53 additions & 5 deletions app/frontend/src/javascript/controllers/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* Controller used in the public calendar global
*/

Application.Controllers.controller('CalendarController', ['$scope', '$state', '$aside', '$uibModal', 'moment', 'Availability', 'Setting', 'growl', 'dialogs', 'bookingWindowStart', 'bookingWindowEnd', '_t', 'uiCalendarConfig', 'CalendarConfig', 'trainingsPromise', 'machinesPromise', 'spacesPromise', 'iCalendarPromise', 'machineCategoriesPromise',
function ($scope, $state, $aside, $uibModal, moment, Availability, Setting, growl, dialogs, bookingWindowStart, bookingWindowEnd, _t, uiCalendarConfig, CalendarConfig, trainingsPromise, machinesPromise, spacesPromise, iCalendarPromise, machineCategoriesPromise) {
Application.Controllers.controller('CalendarController', ['$scope', '$state', '$aside', '$uibModal', 'moment', 'Availability', 'Setting', 'growl', 'dialogs', 'bookingWindowStart', 'bookingWindowEnd', '_t', 'uiCalendarConfig', 'CalendarConfig', 'trainingsPromise', 'machinesPromise', 'spacesPromise', 'iCalendarPromise', 'machineCategoriesPromise', '$interval',
function ($scope, $state, $aside, $uibModal, moment, Availability, Setting, growl, dialogs, bookingWindowStart, bookingWindowEnd, _t, uiCalendarConfig, CalendarConfig, trainingsPromise, machinesPromise, spacesPromise, iCalendarPromise, machineCategoriesPromise, $interval) {
/* PRIVATE STATIC CONSTANTS */
let currentMachineEvent = null;
machinesPromise.forEach(m => m.checked = true);
Expand All @@ -27,6 +27,8 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
// check all formation/machine is select in filter
const isSelectAll = (type, scope) => scope[type].length === scope[type].filter(t => t.checked).length;

let stopRedirectPage = false;

/* PUBLIC SCOPE */

// List of trainings
Expand Down Expand Up @@ -190,6 +192,46 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
}]
});

$scope.triggerOnlyCalendarViewMode = function () {
const header = document.getElementById('top-header');
const nav = document.getElementById('nav');
const calendarBackButton = document.getElementById('calendar-back-button');
const mainContent = $('.vbox > header.header-md ~ section');
if (!header || !nav || !calendarBackButton || !mainContent) { return; }
if (header.style.display === 'none') {
header.style.display = '';
nav.style.display = '';
calendarBackButton.style.display = '';
mainContent.css('top', '');
} else {
header.style.display = 'none';
nav.style.display = 'none';
calendarBackButton.style.display = 'none';
mainContent.css('top', '0');
}
};

// refresh calendar every 5 minutes
$scope.triggerAutoRefresh = function () {
if ($scope.autoRefresh) {
$interval.cancel($scope.autoRefresh);
$scope.autoRefresh = undefined;
stopRedirectPage = false;
} else {
// refresh calendar every 1 minute
$scope.autoRefresh = $interval(refreshCalendar, 60000);
stopRedirectPage = true;
}
};

$scope.$on('$destroy', function () {
if ($scope.autoRefresh) {
$interval.cancel($scope.autoRefresh);
$scope.autoRefresh = undefined;
stopRedirectPage = false;
}
});

/* PRIVATE SCOPE */

/**
Expand Down Expand Up @@ -257,13 +299,13 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
} else if (event.available_type === 'space') {
calendar.fullCalendar('changeView', 'agendaDay');
calendar.fullCalendar('gotoDate', event.start);
} else if (event.available_type === 'event') {
} else if (event.available_type === 'event' && !stopRedirectPage) {
$state.go('app.public.events_show', { id: event.event_id });
} else if (event.available_type === 'training') {
} else if (event.available_type === 'training' && !stopRedirectPage) {
$state.go('app.public.training_show', { id: event.training_id });
} else {
if (event.machine_ids) {
if (event.machine_ids.length === 1) {
if (event.machine_ids.length === 1 && !stopRedirectPage) {
$state.go('app.public.machines_show', { id: event.machine_ids[0] });
} else {
// open a modal to ask the user to select the machine to show
Expand Down Expand Up @@ -350,6 +392,12 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$

const availabilitySourceUrl = () => `/api/availabilities/public?${$.param(getFilter())}`;

const refreshCalendar = function () {
uiCalendarConfig.calendars.calendar.fullCalendar('changeView', 'agendaWeek');
uiCalendarConfig.calendars.calendar.fullCalendar('today');
uiCalendarConfig.calendars.calendar.fullCalendar('refetchEvents');
};

// !!! MUST BE CALLED AT THE END of the controller
return initialize();
}
Expand Down
5 changes: 5 additions & 0 deletions app/frontend/src/stylesheets/app.layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
height: 94px;
text-align: center;
}

.public-calendar-heading-actions {
display: flex;
justify-content: right;
}
}

body.container {
Expand Down
16 changes: 11 additions & 5 deletions app/frontend/templates/calendar/calendar.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
<section class="heading b-b">
<div class="row no-gutter">
<div class="col-xs-2 col-sm-2 col-md-1">
<div class="col-xs-2 col-sm-2 col-md-1" id="calendar-back-button">
<section class="heading-btn">
<a ng-click="backPrevLocation($event)"><i class="fas fa-long-arrow-alt-left "></i></a>
</section>
</div>
<div class="col-xs-10 col-sm-10 col-md-8 b-l b-r-md hide-b-r-lg">
<div class="col-xs-10 col-sm-10 col-md-3 b-l b-r-md hide-b-r-lg">
<section class="heading-title">
<h1 translate>{{ 'app.public.calendar.calendar' }}</h1>
</section>
</div>

<div class="col-xs-12 col-sm-12 col-md-3 b-t hide-b-md">
<div class="heading-actions wrapper">
<button type="button" class="btn btn-default m-t m-b" ng-click="openFilterAside()">
<div class="col-xs-12 col-sm-12 col-md-8 b-t hide-b-md">
<div class="heading-actions wrapper public-calendar-heading-actions">
<button type="button" class="btn btn-default m-t m-b m-r-sm" ng-click="openFilterAside()">
<span class="fa fa-filter"></span> {{ 'app.shared.calendar.filter_calendar' | translate }}
</button>
<button type="button" class="btn btn-default m-t m-b m-r-sm" ng-click="triggerAutoRefresh()">
<span class="fas fa-redo"></span>
</button>
<button type="button" class="btn btn-default m-t m-b" ng-click="triggerOnlyCalendarViewMode()">
<span class="fas fa-expand"></span>
</button>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/excel_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def statistics_line(hit, user, type, subtype, date_format)
user&.profile&.full_name || t('export.deleted_user'),
user&.email || '',
user&.profile&.phone || '',
hit['_source']['gender'].present? ? t("export.#{hit['_source']['gender']}") : '',
hit['_source']['gender'].nil? ? t("export.#{hit['_source']['gender']}") : '',
hit['_source']['age'],
subtype.nil? ? '' : subtype.label
]
Expand Down
2 changes: 1 addition & 1 deletion app/views/application/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

<section class="vbox">

<header class="header header-md navbar navbar-fixed-top-xs">
<header id="top-header" class="header header-md navbar navbar-fixed-top-xs">
<div ui-view="header"></div>
</header>

Expand Down
2 changes: 1 addition & 1 deletion app/views/exports/users_members.xlsx.axlsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_members.members'))) do |
member.email,
member.is_allow_newsletter,
member.last_sign_in_at&.to_date,
member.statistic_profile.gender.present? ? (member.statistic_profile.gender ? t('export_members.man') : t('export_members.woman')) : '',
member.statistic_profile.gender.nil? ? (member.statistic_profile.gender ? t('export_members.man') : t('export_members.woman')) : '',
member.statistic_profile.age,
member.invoicing_profile&.address&.address || '',
member.profile.phone,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fab-manager",
"version": "6.3.26",
"version": "6.3.27",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [
"fablab",
Expand Down

0 comments on commit 9e5ebfe

Please sign in to comment.