1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

Make the username column optionnal (#375)

This commit is contained in:
Sylvain 2022-07-27 09:59:23 +02:00
parent be5b6af3f1
commit 98b1919de2
10 changed files with 40 additions and 6 deletions

View File

@ -7,6 +7,7 @@
- Display bookers names to connected users now apply to all resources
- Updated rails locales files
- Usage of the rails logger instead of printing to standard output
- Optionnaly add a username column to the member list (#375)
- Fix a bug: canceled trainings are still shown on the public profile page
- Fix a bug: prevent same slot booking feature ignores canceled reservations
- Fix a bug: wrong currency on invoices files

View File

@ -163,6 +163,9 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
// is user validation required
$scope.enableUserValidationRequired = (settingsPromise.user_validation_required === 'true');
// should we display the username in the list?
$scope.displayUsername = (settingsPromise.show_username_in_admin_list === 'true');
// Admins ordering/sorting. Default: not sorted
$scope.orderAdmin = null;

View File

@ -136,7 +136,8 @@ export enum SettingName {
MachinesModule = 'machines_module',
UserChangeGroup = 'user_change_group',
UserValidationRequired = 'user_validation_required',
UserValidationRequiredList = 'user_validation_required_list'
UserValidationRequiredList = 'user_validation_required_list',
ShowUsernameInAdminList = 'show_username_in_admin_list'
}
export type SettingValue = string|boolean|number;

View File

@ -936,7 +936,7 @@ angular.module('application.router', ['ui.router'])
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
tagsPromise: ['Tag', function (Tag) { return Tag.query().$promise; }],
authProvidersPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.query().$promise; }],
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display', 'user_validation_required']" }).$promise; }]
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display', 'user_validation_required', 'show_username_in_admin_list']" }).$promise; }]
}
})
.state('app.admin.members_new', {
@ -1093,7 +1093,7 @@ angular.module('application.router', ['ui.router'])
"'link_name', 'home_content', 'home_css', 'phone_required', 'upcoming_events_shown', 'public_agenda_module'," +
"'renew_pack_threshold', 'pack_only_for_subscription', 'overlapping_categories', 'public_registrations'," +
"'extended_prices_in_same_day', 'recaptcha_site_key', 'recaptcha_secret_key', 'user_validation_required', " +
"'user_validation_required_list', 'machines_module', 'user_change_group']"
"'user_validation_required_list', 'machines_module', 'user_change_group', 'show_username_in_admin_list']"
}).$promise;
}],
privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }],

View File

@ -38,7 +38,7 @@
<thead>
<tr>
<th style="width:4%" class="hidden-xs" ng-if="enableUserValidationRequired"></th>
<th style="width:8%"><a ng-click="setOrderMember('username')">{{ 'app.admin.members.username' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='username', 'fa fa-sort-alpha-desc': member.order=='-username', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:8%" ng-show="displayUsername"><a ng-click="setOrderMember('username')">{{ 'app.admin.members.username' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='username', 'fa fa-sort-alpha-desc': member.order=='-username', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:14%"><a ng-click="setOrderMember('last_name')">{{ 'app.admin.members.surname' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='last_name', 'fa fa-sort-alpha-desc': member.order=='-last_name', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:14%"><a ng-click="setOrderMember('first_name')">{{ 'app.admin.members.first_name' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='first_name', 'fa fa-sort-alpha-desc': member.order=='-first_name', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:14%" class="hidden-xs"><a ng-click="setOrderMember('email')">{{ 'app.admin.members.email' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='email', 'fa fa-sort-alpha-desc': member.order=='-email', 'fa fa-arrows-v': member.order }"></i></a></th>
@ -53,7 +53,7 @@
<td class="text-center" ng-if="enableUserValidationRequired">
<span ng-class="{ 'text-success': !!m.validated_at }"><i class="fa fa-user-check"></i></span>
</td>
<td class="text-c">{{ m.username }}</td>
<td class="text-c" ng-show="displayUsername">{{ m.username }}</td>
<td class="text-c">{{ m.profile.last_name }}</td>
<td class="text-c">{{ m.profile.first_name }}</td>
<td class="hidden-xs">{{ m.email }}</td>

View File

@ -73,6 +73,27 @@
</div>
</div>
</div>
<div class="panel panel-default m-t-md">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'app.admin.settings.accounts_management' }}</span>
</div>
<div class="panel-body">
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.members_list' }}</h3>
<p class="alert alert-warning m-h-md" translate>
{{ 'app.admin.settings.members_list_info' }}
</p>
<div class="col-md-10 col-md-offset-1">
<boolean-setting name="'show_username_in_admin_list'"
settings="allSettings"
label="'app.admin.settings.show_username_in_admin_list' | translate"
on-success="onSuccess"
on-error="onError">
</boolean-setting>
</div>
</div>
</div>
</div>
<div class="panel panel-default m-t-md">
<div class="panel-heading">

View File

@ -147,7 +147,8 @@ class Setting < ApplicationRecord
machines_module
user_change_group
user_validation_required
user_validation_required_list] }
user_validation_required_list
show_username_in_admin_list] }
# WARNING: when adding a new key, you may also want to add it in:
# - config/locales/en.yml#settings
# - app/frontend/src/javascript/models/setting.ts#SettingName

View File

@ -1427,6 +1427,9 @@ en:
enable_invoicing: "Enable invoicing"
invoicing_module: "invoicing module"
account_creation: "Account creation"
accounts_management: "Accounts management"
members_list: "Members list"
members_list_info: "You can customize the fields to display in the member management list"
phone: "Phone"
phone_is_required: "Phone required"
phone_required_info: "You can define if the phone number should be required to register a new user on Fab-manager."
@ -1470,6 +1473,7 @@ en:
extended_prices_info_html: "Spaces can have different prices depending on the cumulated duration of the booking. You can choose if this apply to all bookings or only to those starting within the same day."
extended_prices_in_same_day: "Extended prices in the same day"
public_registrations: "Public registrations"
show_username_in_admin_list: "Show the username in the list"
overlapping_options:
training_reservations: "Trainings"
machine_reservations: "Machines"

View File

@ -595,3 +595,4 @@ en:
flickr: "flickr"
machines_module: "Machines module"
user_change_group: "Allow users to change their group"
show_username_in_admin_list: "Show the username in the admin's members list"

View File

@ -917,6 +917,8 @@ end
Setting.set('extended_prices_in_same_day', false) unless Setting.find_by(name: 'extended_prices_in_same_day').try(:value)
Setting.set('show_username_in_admin_list', false) unless Setting.find_by(name: 'show_username_in_admin_list').try(:value)
if StatisticCustomAggregation.count.zero?
# available reservations hours for machines
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2)