From 54154b17133e69cb37e328b0dd24082233da3a17 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 16 May 2017 10:23:25 +0200 Subject: [PATCH] [feature] ability for admins to create users or organizations --- .fabmanager-version | 2 +- CHANGELOG.md | 4 ++++ .../controllers/admin/members.coffee.erb | 9 ++++++++ .../templates/admin/members/new.html.erb | 21 ++++++++++++++++--- config/locales/app.admin.en.yml | 4 +++- config/locales/app.admin.fr.yml | 4 +++- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/.fabmanager-version b/.fabmanager-version index 0cadbc1e3..a8758d5c7 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.5.5 +2.5.6-dev diff --git a/CHANGELOG.md b/CHANGELOG.md index c00b1b210..0fdac6d99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog Fab Manager +## next release + +- Ability for admins to create users as organizations + ## v2.5.5 2017 May 15 - Fix a bug: New groups does not have their spaces prices initialized diff --git a/app/assets/javascripts/controllers/admin/members.coffee.erb b/app/assets/javascripts/controllers/admin/members.coffee.erb index 14b2c42a9..6e0d2f016 100644 --- a/app/assets/javascripts/controllers/admin/members.coffee.erb +++ b/app/assets/javascripts/controllers/admin/members.coffee.erb @@ -535,6 +535,15 @@ Application.Controllers.controller "NewMemberController", ["$scope", "$state", " $scope.user = plan_interval: '' + ## Callback when the admin check/unckeck the box telling that the new user is an organization. + ## Disable or enable the organization fields in the form, accordingly + $scope.toggleOrganization = -> + if $scope.user.organization + $scope.user.profile = {} unless $scope.user.profile + $scope.user.profile.organization = {} + else + $scope.user.profile.organization = undefined + ## Using the MembersController diff --git a/app/assets/templates/admin/members/new.html.erb b/app/assets/templates/admin/members/new.html.erb index 30c049de1..a4b233c19 100644 --- a/app/assets/templates/admin/members/new.html.erb +++ b/app/assets/templates/admin/members/new.html.erb @@ -9,7 +9,7 @@
-

{{ 'add_a_member' }}

+

{{ 'members_new.add_a_member' }}

@@ -33,8 +33,23 @@
-
-
+
+
+ +
+
+
+ + +
+
+
+ diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 9619e9aa7..5d797a7f2 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -410,7 +410,9 @@ en: members_new: # add a member - add_a_member: "Add a member" + members_new: + add_a_member: "Add a member" + user_is_an_organization: "User is an organization" members_edit: # edit a member diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index fe99bd355..7a12737db 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -410,7 +410,9 @@ fr: members_new: # ajouter un membre - add_a_member: "Ajouter un membre" + members_new: + add_a_member: "Ajouter un membre" + user_is_an_organization: "L'utilisateur est une structure" members_edit: # modifier un membre