diff --git a/.fabmanager-version b/.fabmanager-version index ff3b2cd99..06d0f343f 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.5.10 +2.5.11 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f171b3878..aa5472ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog Fab Manager +## v2.5.11 2017 September 7 + +- Added tooltip concerning images insertion while configuring the about page +- Ability for admins to configure the maximum visibility for availabilities reservation +- Administrators isolation in a special group +- In login modal, displays an alert if Caps lock key is pressed +- Prevent creation of irregular yearly plans (eg. 12 months) +- Ability to lock machine, space or training availability slots, to prevent new reservations on them +- Fix a bug: admins cannot see all availabilities for spaces in reservation calendar when a user is selected +- Fix a bug: missing translation after payment in english and portuguese +- Fix a bug: invalid notification when sending monetary coupon to users +- Fix a bug: unable to delete group "standard" +- Fix a bug: recursive events crossing Daylight Saving Time period changes are shifted by 1 hour +- Fix a bug: unable to see availabilities in the public calendar when browsing as a visitor (non-connected) +- Updated puma for compatibility with openSSL > 1.0 +- Documented installation on ArchLinux +- [TODO DEPLOY] `rake db:seed` then `rake fablab:fix:migrate_admins_group` +- [TODO DEPLOY] `rake fablab:fix:recursive_events_over_DST` + ## v2.5.10 2017 August 16 - Updated axlsx gem for excel files generation, possible fix for #489 diff --git a/Gemfile b/Gemfile index 94257d0e0..5686d6664 100644 --- a/Gemfile +++ b/Gemfile @@ -43,7 +43,7 @@ group :development do gem 'mailcatcher' gem 'awesome_print' - gem "puma" + gem 'puma' gem 'foreman' gem 'capistrano' diff --git a/Gemfile.lock b/Gemfile.lock index f992737be..e611da0fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -301,8 +301,7 @@ GEM prawn-table (0.2.1) protected_attributes (1.1.3) activemodel (>= 4.0.1, < 5.0) - puma (2.11.1) - rack (>= 1.1, < 2.0) + puma (3.10.0) pundit (1.0.0) activesupport (>= 3.0.0) rack (1.6.8) @@ -568,4 +567,4 @@ DEPENDENCIES webmock BUNDLED WITH - 1.15.3 + 1.15.4 diff --git a/README.md b/README.md index cbd6a1f8b..ae1a09838 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ In you only intend to run fab-manager on your local machine for testing purposes 1. Install RVM with the ruby version specified in the [.ruby-version file](.ruby-version). For more details about the process, Please read the [official RVM documentation](http://rvm.io/rvm/install). + If you're using ArchLinux, you may have to [read this](doc/archlinux_readme.md) before. 2. Retrieve the project from Git diff --git a/app/assets/javascripts/app.js.erb b/app/assets/javascripts/app.js.erb index 7049d79b8..bb05f35c7 100644 --- a/app/assets/javascripts/app.js.erb +++ b/app/assets/javascripts/app.js.erb @@ -20,7 +20,7 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ngCooki 'ui.select', 'ui.calendar', 'angularMoment', 'Devise', 'DeviseModal', 'angular-growl', 'xeditable', 'checklist-model', 'unsavedChanges', 'angular-loading-bar', 'ngTouch', 'angular-google-analytics', 'angularUtils.directives.dirDisqus', 'summernote', 'elasticsearch', 'angular-medium-editor', 'naif.base64', - 'minicolors', 'pascalprecht.translate', 'ngFitText', 'ngAside']). + 'minicolors', 'pascalprecht.translate', 'ngFitText', 'ngAside', 'ngCapsLock']). config(['$httpProvider', 'AuthProvider', "growlProvider", "unsavedWarningsConfigProvider", "AnalyticsProvider", "uibDatepickerPopupConfig", "$provide", "$translateProvider", function($httpProvider, AuthProvider, growlProvider, unsavedWarningsConfigProvider, AnalyticsProvider, uibDatepickerPopupConfig, $provide, $translateProvider) { diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index d9f900521..c77993ffd 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -68,6 +68,7 @@ //= require angular-translate-interpolation-messageformat/angular-translate-interpolation-messageformat //= require ngFitText/dist/ng-FitText.min //= require angular-aside/dist/js/angular-aside +//= require ngCapsLock/ng-caps-lock //= require_tree ./controllers //= require_tree ./services //= require_tree ./directives diff --git a/app/assets/javascripts/controllers/admin/calendar.coffee.erb b/app/assets/javascripts/controllers/admin/calendar.coffee.erb index 33f9394ad..bb9764117 100644 --- a/app/assets/javascripts/controllers/admin/calendar.coffee.erb +++ b/app/assets/javascripts/controllers/admin/calendar.coffee.erb @@ -132,6 +132,40 @@ Application.Controllers.controller "AdminCalendarController", ["$scope", "$state + ## + # Mark the selected slot as unavailable for new reservations or allow reservations again on it + ## + $scope.toggleLockReservations = -> + # first, define a shortcut to the lock property + locked = $scope.availability.lock + # then check if we'll allow reservations locking + prevent = !locked # if currently locked, allow unlock anyway + if (!locked) + prevent = false + angular.forEach $scope.reservations, (r) -> + if r.canceled_at == null + prevent = true # if currently unlocked and has any non-cancelled reservation, disallow locking + if (!prevent) + # open a confirmation dialog + dialogs.confirm + resolve: + object: -> + title: _t('admin_calendar.confirmation_required') + msg: if locked then _t("admin_calendar.do_you_really_want_to_allow_reservations") else _t("admin_calendar.do_you_really_want_to_block_this_slot") + , -> + # the admin has confirmed, lock/unlock the slot + Availability.lock {id: $scope.availability.id}, {lock: !locked} + , (data) -> # success + $scope.availability = data + growl.success(if locked then _t('admin_calendar.unlocking_success') else _t('admin_calendar.locking_success') ) + uiCalendarConfig.calendars.calendar.fullCalendar 'refetchEvents' + , (error) -> # failed + growl.error(if locked then _t('admin_calendar.unlocking_failed') else _t('admin_calendar.locking_failed')) + else + growl.error(_t('admin_calendar.unlockable_because_reservations')) + + + ### PRIVATE SCOPE ### ## diff --git a/app/assets/javascripts/controllers/admin/members.coffee.erb b/app/assets/javascripts/controllers/admin/members.coffee.erb index 79d4ea3fe..86df205b0 100644 --- a/app/assets/javascripts/controllers/admin/members.coffee.erb +++ b/app/assets/javascripts/controllers/admin/members.coffee.erb @@ -25,7 +25,7 @@ class MembersController ## Retrieve the profiles groups (eg. students ...) Group.query (groups) -> - $scope.groups = groups + $scope.groups = groups.filter (g) -> g.slug != 'admins' ## Retrieve the list the available trainings Training.query().$promise.then (data)-> diff --git a/app/assets/javascripts/controllers/admin/plans.coffee.erb b/app/assets/javascripts/controllers/admin/plans.coffee.erb index 588718641..4c4486728 100644 --- a/app/assets/javascripts/controllers/admin/plans.coffee.erb +++ b/app/assets/javascripts/controllers/admin/plans.coffee.erb @@ -13,7 +13,7 @@ class PlanController ## groups list - $scope.groups = groups + $scope.groups = groups.filter (g) -> g.slug != 'admins' ## users with role 'partner', notifiables for a partner plan $scope.partners = partners.users diff --git a/app/assets/javascripts/controllers/admin/pricing.coffee.erb b/app/assets/javascripts/controllers/admin/pricing.coffee.erb index c77e181e4..53bd9a78d 100644 --- a/app/assets/javascripts/controllers/admin/pricing.coffee.erb +++ b/app/assets/javascripts/controllers/admin/pricing.coffee.erb @@ -17,7 +17,7 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state", $scope.plans = plans ## List of groups (eg. normal, student ...) - $scope.groups = groups + $scope.groups = groups.filter (g) -> g.slug != 'admins' ## Associate free machine hours with subscriptions $scope.machineCredits = machineCreditsPromise diff --git a/app/assets/javascripts/controllers/admin/settings.coffee b/app/assets/javascripts/controllers/admin/settings.coffee index 1bb3ff416..a549c3cdf 100644 --- a/app/assets/javascripts/controllers/admin/settings.coffee +++ b/app/assets/javascripts/controllers/admin/settings.coffee @@ -66,7 +66,7 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', ' $scope.moveDelay = name: 'booking_move_delay' - value: parseInt(settingsPromise.booking_move_delay) + value: parseInt(settingsPromise.booking_move_delay, 10) $scope.enableCancel = name: 'booking_cancel_enable' @@ -74,7 +74,7 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', ' $scope.cancelDelay = name: 'booking_cancel_delay' - value: parseInt(settingsPromise.booking_cancel_delay) + value: parseInt(settingsPromise.booking_cancel_delay, 10) $scope.enableReminder = name: 'reminder_enable' @@ -82,7 +82,15 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', ' $scope.reminderDelay = name: 'reminder_delay' - value: parseInt(settingsPromise.reminder_delay) + value: parseInt(settingsPromise.reminder_delay, 10) + + $scope.visibilityYearly = + name: 'visibility_yearly' + value: parseInt(settingsPromise.visibility_yearly, 10) + + $scope.visibilityOthers = + name: 'visibility_others' + value: parseInt(settingsPromise.visibility_others, 10) diff --git a/app/assets/javascripts/controllers/machines.coffee.erb b/app/assets/javascripts/controllers/machines.coffee.erb index fd3d0ed5e..ed4cfdade 100644 --- a/app/assets/javascripts/controllers/machines.coffee.erb +++ b/app/assets/javascripts/controllers/machines.coffee.erb @@ -256,6 +256,9 @@ Application.Controllers.controller "ShowMachineController", ['$scope', '$state', $state.go('app.public.machines_list') , (error)-> growl.warning(_t('the_machine_cant_be_deleted_because_it_is_already_reserved_by_some_users')) + + + ## # Callback to book a reservation for the current machine ## @@ -412,6 +415,7 @@ Application.Controllers.controller "ReserveMachineController", ["$scope", '$stat updateCalendar() + ## # When modifying an already booked reservation, callback when the modification was successfully done. ## diff --git a/app/assets/javascripts/controllers/plans.coffee.erb b/app/assets/javascripts/controllers/plans.coffee.erb index 4396d03e9..f4f428e33 100644 --- a/app/assets/javascripts/controllers/plans.coffee.erb +++ b/app/assets/javascripts/controllers/plans.coffee.erb @@ -8,7 +8,7 @@ Application.Controllers.controller "PlansIndexController", ["$scope", "$rootScop ### PUBLIC SCOPE ### ## list of groups - $scope.groups = groupsPromise + $scope.groups = groupsPromise.filter (g) -> g.slug != 'admins' ## default : do not show the group changing form ## group ID of the current/selected user @@ -18,7 +18,7 @@ Application.Controllers.controller "PlansIndexController", ["$scope", "$rootScop ## list of plans, classified by group $scope.plansClassifiedByGroup = [] - for group in groupsPromise + for group in $scope.groups groupObj = { id: group.id, name: group.name, plans: [] } for plan in plansPromise groupObj.plans.push(plan) if plan.group_id == group.id diff --git a/app/assets/javascripts/router.coffee.erb b/app/assets/javascripts/router.coffee.erb index 7ffadb9ea..badac5113 100644 --- a/app/assets/javascripts/router.coffee.erb +++ b/app/assets/javascripts/router.coffee.erb @@ -1156,7 +1156,9 @@ angular.module('application.router', ['ui.router']). 'fablab_name', 'name_genre', 'reminder_enable', - 'reminder_delay' + 'reminder_delay', + 'visibility_yearly', + 'visibility_others' ]").$promise ] cguFile: ['CustomAsset', (CustomAsset) -> diff --git a/app/assets/javascripts/services/availability.coffee b/app/assets/javascripts/services/availability.coffee index 4bc448b13..c837977c1 100644 --- a/app/assets/javascripts/services/availability.coffee +++ b/app/assets/javascripts/services/availability.coffee @@ -24,4 +24,7 @@ Application.Services.factory 'Availability', ["$resource", ($resource)-> isArray: true update: method: 'PUT' + lock: + method: 'PUT' + url: '/api/availabilities/:id/lock' ] diff --git a/app/assets/stylesheets/app.layout.scss b/app/assets/stylesheets/app.layout.scss index bd693d343..3ad8383b8 100644 --- a/app/assets/stylesheets/app.layout.scss +++ b/app/assets/stylesheets/app.layout.scss @@ -360,6 +360,10 @@ body.container{ } +.reservations-locked { + background-color: #f5f5f5; +} + .reservation-canceled { color: #606060; border-radius: 0.2em; diff --git a/app/assets/templates/admin/calendar/calendar.html.erb b/app/assets/templates/admin/calendar/calendar.html.erb index 2e7c16dd3..e8909d26e 100644 --- a/app/assets/templates/admin/calendar/calendar.html.erb +++ b/app/assets/templates/admin/calendar/calendar.html.erb @@ -42,11 +42,12 @@ -