1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-17 11:54:22 +01:00

display the machine reservation user name to other members

This commit is contained in:
Sylvain 2018-07-24 12:24:51 +02:00
parent afc6ef40d2
commit 1b33f3c865
12 changed files with 65 additions and 3 deletions

View File

@ -3,6 +3,7 @@
## next release
- Upgraded ElasticSearch from 1.7 to 5.6
- Ability to display the name of the user who booked a machine slot to other members
- Updated OmniAuth to fix Hashie warnings [omniauth#872](https://github.com/omniauth/omniauth/issues/872)
- Fix a bug: unable to filter statistics from age 0
- Fix a bug: events categories are not reported correctly in statistics
@ -16,6 +17,7 @@
- [TODO DEPLOY] **IMPORTANT** Please read [elastic_upgrade.md](doc/elastic_upgrade.md) for instructions on upgrading ElasticSearch.
- [TODO DEPLOY] `rake fablab:fix:categories_slugs`
- [TODO DEPLOY] `bundle install`
- [TODO DEPLOY] `rake db:seed`
## v2.6.4 2018 March 15

View File

@ -92,6 +92,10 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', '
name: 'visibility_others'
value: parseInt(settingsPromise.visibility_others, 10)
$scope.displayNameEnable =
name: 'display_name_enable'
value: (settingsPromise.display_name_enable == 'true')
##

View File

@ -1158,7 +1158,8 @@ angular.module('application.router', ['ui.router']).
'reminder_enable',
'reminder_delay',
'visibility_yearly',
'visibility_others'
'visibility_others',
'display_name_enable'
]").$promise
]
cguFile: ['CustomAsset', (CustomAsset) ->

View File

@ -148,4 +148,28 @@
</form>
</div>
</div>
</div>
<div class="panel panel-default m-t-lg">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'settings.confidentiality' }}</span>
</div>
<div class="panel-body">
<div class="row">
<h3 class="m-l" translate>{{ 'settings.display_machine_reservation_user_name' }}</h3>
<div class="form-group m-l">
<label for="displayNameEnable" class="control-label m-r" translate>{{ 'settings.display_name' }}</label>
<input bs-switch
ng-model="displayNameEnable.value"
id="displayNameEnable"
type="checkbox"
class="form-control"
switch-on-text="{{ 'settings.enabled' | translate }}"
switch-off-text="{{ 'settings.disabled' | translate }}"
switch-animate="true"/>
<button name="button" class="btn btn-warning m-l" ng-click="save(displayNameEnable)" translate>{{ 'save' }}</button>
</div>
</div>
</div>
</div>

View File

@ -332,13 +332,14 @@ class API::AvailabilitiesController < API::ApiController
end
def verify_machine_is_reserved(slot, reservations, user, user_role)
show_name = (user_role == 'admin' or Setting.find_by(name: 'display_name_enable').value == 'true')
reservations.each do |r|
r.slots.each do |s|
if slot.machine.id == r.reservable_id
if s.start_at == slot.start_at and s.canceled_at == nil
slot.id = s.id
slot.is_reserved = true
slot.title = "#{slot.machine.name} - #{t('availabilities.not_available')}"
slot.title = "#{slot.machine.name} - #{show_name ? r.user.profile.full_name : t('availabilities.not_available')}"
slot.can_modify = true if user_role === 'admin'
slot.reservations.push r
end

View File

@ -34,7 +34,8 @@ class Setting < ActiveRecord::Base
event_explications_alert
space_explications_alert
visibility_yearly
visibility_others )
visibility_others
display_name_enable )
}
after_update :update_stylesheet if :value_changed?

View File

@ -657,6 +657,10 @@ en:
default_value_is_24_hours: "If the field is leaved empty: 24 hours."
visibility_yearly: "maximum visibility for annual subscribers"
visibility_others: "maximum visibility for other members"
confidentiality: "Confidentiality"
display_machine_reservation_user_name: "Display the full name of the user who booked a machine slot"
display_name: "Display the name"
display_name_enable: "name display"
open_api_clients:
add_new_client: "Create new API client"

View File

@ -657,6 +657,10 @@ es:
default_value_is_24_hours: "Si el campo es dejado vacio: 24 horas."
visibility_yearly: "máxima visibilidad para suscriptores anuales"
visibility_others: "máxima visibilidad para otros miembros"
confidentiality: "Confidencialidad"
display_machine_reservation_user_name: "Mostrar el nombre del usuario que ha reservado una maquina"
display_name: "Mostrar el nombre"
display_name_enable: "la visualización del nombre"
open_api_clients:
add_new_client: "Crear un nuevo cliente de API"

View File

@ -657,6 +657,10 @@ fr:
default_value_is_24_hours: "Si aucune valeur n'est renseignée : 24 heures."
visibility_yearly: "la visibilité maximum pour les abonnées annuels"
visibility_others: "la visibilité maximum pour les autres membres"
confidentiality: "Confidentialité"
display_machine_reservation_user_name: "Afficher le nom de l'utilisateur ayant réservé une machine"
display_name: "Afficher le nom"
display_name_enable: "l'affichage du nom"
open_api_clients:
add_new_client: "Créer un compte client"

View File

@ -657,6 +657,10 @@ pt:
default_value_is_24_hours: "Se o campo estiver vazio: 24 horas."
visibility_yearly: "visibilidade máxima para assinantes anuais"
visibility_others: "visibilidade máxima para outros membros"
confidentiality: "TODO"
display_machine_reservation_user_name: "TODO"
display_name: "TODO"
display_name_enable: "TODO"
open_api_clients:
add_new_client: "Criar novo cliente de API"

View File

@ -413,6 +413,12 @@ unless Setting.find_by(name: 'visibility_others').try(:value)
setting.save
end
unless Setting.find_by(name: 'display_name_enable').try(:value)
setting = Setting.find_or_initialize_by(name: 'display_name_enable')
setting.value = 'false'
setting.save
end
if StatisticCustomAggregation.count == 0
# available reservations hours for machines
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2)

View File

@ -239,3 +239,10 @@ setting_31:
value: 1
created_at: 2017-09-18 10:27:42.846510000 Z
updated_at: 2017-09-18 10:27:42.846510000 Z
setting_32:
id: 32
name: display_name_enable
value: false
created_at: 2018-07-24 11:45:31.512710000 Z
updated_at: 2018-07-24 11:45:31.512710000 Z