Module: user_groups

Contains the functionalities related to the user groups page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.
Source:

Methods

(static) addToGroup()

Adds the found user to a new group and sets the global variable for the found user to null. If the user has already been added to the new group, displays a notification.
Source:

(static) displaySearchResult(searchText)

Shows the found user's name and a button that can be used to add the person to the new group. If no users can be found, displays a notification and hides the button.
Parameters:
Name Type Description
searchText string The string that must be matched.
Source:

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.
Source:

(static) initGroupList(groups)

If there are groups to be shown, empties the group list area and displays the information of all the current user's groups (except the default group).
Parameters:
Name Type Description
groups Object A list object of the user groups of the current user.
Source:

(static) initNewGroup(groups)

Initialises the area for creating a new user group. Sets the current user automatically as a member of the new user group.
Parameters:
Name Type Description
groups object A list of the user groups of the current user.
Source:

(static) makeRemoveGroup(groupId, groupName)

Creates a click event to a button. Returns a function that shows a modal with correct information and removes a user group. If a group is removed, the view is updated.
Parameters:
Name Type Description
groupId string The ID of the group to be removed.
groupName string The name of the group to be removed.
Source:
Returns:
A function that shows a modal with correct information.

(static) makeRemovePerson(groupId, userId, element)

Returns a function that removes a person from the group.
Parameters:
Name Type Description
groupId The ID of the group where the person is to be removed from. If the person is to be removed from an unregistered new group, set to null.
userId The ID of the user to be removed.
element The element (typically a list element) to be removed.
Source:
Returns:
A function that removes a person from the group.

(static) reloadGroups()

Empties the groupList area. Fetches the latest user group information from the database. If the user has only the default group, shows a notification that there are no user groups. Otherwise displays the user groups of the current user.
Source:

(static) saveNewGroup()

If all the necessary information has been given, saves the new user group and reloads the user group list.
Source:

(inner) modalButtonYes click()

Makes a call to remove the selected user group. Reloads the view.
Source: