2
0
Эх сурвалжийг харах

Admin Panel/People/People/New User: Added Initials.

Thanks to xet7 !
Lauri Ojansivu 4 жил өмнө
parent
commit
3a2deb0039

+ 4 - 1
client/components/settings/peopleBody.jade

@@ -332,7 +332,7 @@ template(name="editUserPopup")
       input.js-profile-fullname(type="text" value=user.profile.fullname required)
       input.js-profile-fullname(type="text" value=user.profile.fullname required)
     label
     label
       | {{_ 'initials'}}
       | {{_ 'initials'}}
-      input.js-profile-initials(type="text" value=user.profile.initials)
+      input.js-profile-initials(type="text" value=user.profile.initials required)
     label
     label
       | {{_ 'admin'}}
       | {{_ 'admin'}}
       select.select-role.js-profile-isadmin
       select.select-role.js-profile-isadmin
@@ -436,6 +436,9 @@ template(name="newUserPopup")
       //  input.js-profile-username(type="text" value=user.username readonly)
       //  input.js-profile-username(type="text" value=user.username readonly)
       //else
       //else
       input.js-profile-username(type="text" value="" required)
       input.js-profile-username(type="text" value="" required)
+    label
+      | {{_ 'initials'}}
+      input.js-profile-initials(type="text" value="" required)
     label
     label
       | {{_ 'email'}}
       | {{_ 'email'}}
       span.error.hide.email-taken
       span.error.hide.email-taken

+ 2 - 0
client/components/settings/peopleBody.js

@@ -654,6 +654,7 @@ Template.newUserPopup.events({
     event.preventDefault();
     event.preventDefault();
     const fullname = templateInstance.find('.js-profile-fullname').value.trim();
     const fullname = templateInstance.find('.js-profile-fullname').value.trim();
     const username = templateInstance.find('.js-profile-username').value.trim();
     const username = templateInstance.find('.js-profile-username').value.trim();
+    const initials = templateInstance.find('.js-profile-initials').value.trim();
     const password = templateInstance.find('.js-profile-password').value;
     const password = templateInstance.find('.js-profile-password').value;
     const isAdmin = templateInstance.find('.js-profile-isadmin').value.trim();
     const isAdmin = templateInstance.find('.js-profile-isadmin').value.trim();
     const isActive = templateInstance.find('.js-profile-isactive').value.trim();
     const isActive = templateInstance.find('.js-profile-isactive').value.trim();
@@ -666,6 +667,7 @@ Template.newUserPopup.events({
       'setCreateUser',
       'setCreateUser',
       fullname,
       fullname,
       username,
       username,
+      initials,
       password,
       password,
       isAdmin,
       isAdmin,
       isActive,
       isActive,

+ 7 - 1
models/users.js

@@ -800,6 +800,7 @@ if (Meteor.isServer) {
     setCreateUser(
     setCreateUser(
       fullname,
       fullname,
       username,
       username,
+      initials,
       password,
       password,
       isAdmin,
       isAdmin,
       isActive,
       isActive,
@@ -809,6 +810,7 @@ if (Meteor.isServer) {
       if (Meteor.user() && Meteor.user().isAdmin) {
       if (Meteor.user() && Meteor.user().isAdmin) {
         check(fullname, String);
         check(fullname, String);
         check(username, String);
         check(username, String);
+        check(initials, String);
         check(password, String);
         check(password, String);
         check(isAdmin, String);
         check(isAdmin, String);
         check(isActive, String);
         check(isActive, String);
@@ -833,7 +835,11 @@ if (Meteor.isServer) {
           const user = Users.findOne(username) || Users.findOne({ username });
           const user = Users.findOne(username) || Users.findOne({ username });
           if (user) {
           if (user) {
             Users.update(user._id, {
             Users.update(user._id, {
-              $set: { 'profile.fullname': fullname, importUsernames },
+              $set: {
+                'profile.fullname': fullname,
+                importUsernames,
+                'profile.initials': initials,
+              },
             });
             });
           }
           }
         }
         }