Skip to content

Commit

Permalink
Merge branch 'main' into global-search
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastian Rihm authored and Bastian Rihm committed May 16, 2023
2 parents f8773d0 + c7c8285 commit 75ebb41
Show file tree
Hide file tree
Showing 52 changed files with 509 additions and 262 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,7 @@ Generally, please work in your own fork, make branches and make a pull request i

## Commit messages

Write your commit messages like they could appear in a change log.

- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. how
See https://github.com/OpenSlides/OpenSlides/wiki/Development-organization#pull-request-titles-and-commit-messages.

## Code alignment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const meetingSettingsDefaults: { [key: string]: any } = {
motions_supporters_min_amount: 0,
motions_block_slide_columns: 3,
motion_poll_default_type: `pseudoanonymous`,
motion_poll_default_100_percent_base: `YNA`,
motion_poll_default_onehundred_percent_base: `YNA`,
motion_poll_ballot_paper_selection: `CUSTOM_NUMBER`,
motion_poll_ballot_paper_number: 8,
motion_poll_default_backend: `fast`,
Expand All @@ -67,7 +67,7 @@ export const meetingSettingsDefaults: { [key: string]: any } = {
motions_export_follow_recommendation: false,
assignment_poll_default_method: `Y`,
assignment_poll_default_type: `pseudoanonymous`,
assignment_poll_default_100_percent_base: `valid`,
assignment_poll_default_onehundred_percent_base: `valid`,
assignment_poll_sort_poll_result_by_votes: true,
assignment_poll_add_candidates_to_list_of_speakers: false,
assignment_poll_enable_max_votes_per_option: false,
Expand Down
14 changes: 7 additions & 7 deletions client/src/app/domain/models/meetings/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class Settings {
public motion_poll_ballot_paper_selection!: BallotPaperSelection;
public motion_poll_ballot_paper_number!: number;
public motion_poll_default_type!: PollType;
public motion_poll_default_100_percent_base!: PollPercentBase;
public motion_poll_default_onehundred_percent_base!: PollPercentBase;
public motion_poll_default_group_ids!: Id[]; // (group/used_as_motion_poll_default_id)[];
public motion_poll_default_backend!: PollBackendDurationType;

Expand Down Expand Up @@ -171,7 +171,7 @@ export class Settings {
public assignment_poll_sort_poll_result_by_votes!: boolean;
public assignment_poll_default_type!: PollType;
public assignment_poll_default_method!: PollMethod;
public assignment_poll_default_100_percent_base!: PollPercentBase;
public assignment_poll_default_onehundred_percent_base!: PollPercentBase;
public assignment_poll_default_group_ids!: Id[]; // (group/used_as_assignment_poll_default_id)[];
public assignment_poll_default_backend!: PollBackendDurationType;

Expand All @@ -183,7 +183,7 @@ export class Settings {
topic_poll_sort_poll_result_by_votes: boolean;
topic_poll_default_type: PollType;
topic_poll_default_method: PollMethod;
topic_poll_default_100_percent_base: PollPercentBase;
topic_poll_default_onehundred_percent_base: PollPercentBase;
topic_poll_default_group_ids: Id[]; // (group/used_as_poll_default_id)[];
topic_poll_default_backend: PollBackendDurationType;

Expand All @@ -195,7 +195,7 @@ export class Settings {
poll_sort_poll_result_by_votes: boolean;
poll_default_type: PollType;
poll_default_method: PollMethod;
poll_default_100_percent_base: PollPercentBase;
poll_default_onehundred_percent_base: PollPercentBase;
poll_default_group_ids: Id[]; // (group/used_as_poll_default_id)[];
poll_default_backend: PollBackendDurationType;
}
Expand Down Expand Up @@ -378,7 +378,7 @@ export class Meeting extends BaseModel<Meeting> {
`motion_poll_ballot_paper_selection`,
`motion_poll_ballot_paper_number`,
`motion_poll_default_type`,
`motion_poll_default_100_percent_base`,
`motion_poll_default_onehundred_percent_base`,
`motion_poll_default_group_ids`,
`motion_poll_default_backend`,
`poll_candidate_list_ids`,
Expand All @@ -405,15 +405,15 @@ export class Meeting extends BaseModel<Meeting> {
`assignment_poll_sort_poll_result_by_votes`,
`assignment_poll_default_type`,
`assignment_poll_default_method`,
`assignment_poll_default_100_percent_base`,
`assignment_poll_default_onehundred_percent_base`,
`assignment_poll_default_group_ids`,
`assignment_poll_default_backend`,
`poll_ballot_paper_selection`,
`poll_ballot_paper_number`,
`poll_sort_poll_result_by_votes`,
`poll_default_type`,
`poll_default_method`,
`poll_default_100_percent_base`,
`poll_default_onehundred_percent_base`,
`poll_default_group_ids`,
`poll_default_backend`,
`topic_poll_default_group_ids`,
Expand Down
6 changes: 3 additions & 3 deletions client/src/app/domain/models/users/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type UserSortProperty = 'first_name' | 'last_name' | 'number';
/**
* Iterable pre selection of genders
*/
export const GENDERS = [_(`female`), _(`male`), _(`diverse`)];
export const GENDERS = [_(`female`), _(`male`), _(`diverse`), _(`non-binary`)];

/**
* Representation of a user in contrast to the operator.
Expand All @@ -37,7 +37,7 @@ export class User extends BaseDecimalModel<User> {
public readonly default_structure_level!: string;
public readonly structure_level_$!: string[];
public readonly email!: string;
public readonly last_email_send!: number; // comes in seconds
public readonly last_email_sent!: number; // comes in seconds
public readonly last_login!: number; // comes in seconds
public readonly vote_weight_$!: number[];
public readonly default_vote_weight!: number;
Expand Down Expand Up @@ -193,7 +193,7 @@ export class User extends BaseDecimalModel<User> {
`default_number`,
`default_structure_level`,
`default_vote_weight`,
`last_email_send`,
`last_email_sent`,
`is_demo_user`,
`last_login`,
`organization_management_level`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,19 @@ export class HtmlToPdfService {
* Can be overwritten by subclasses for more specific functionality.
*/
protected createListParagraph(data: CreateSpecificParagraphPayload): any {
const children = this.parseChildren(data.element, data.styles);
let children = this.parseChildren(data.element, data.styles);
const list = this.create(data.nodeName);

// Fixes nested lists being placed inside `text` elements
if (
children.length === 1 &&
(<any>children[0])?.text.length &&
(<any>children[0])?.text.find((el: any) => !!el.ul)
) {
// @ts-ignore
children = [{ stack: (<any>children[0]).text }];
}

// keep the numbers of the ol list
if (data.nodeName === `ol`) {
const start = data.element.getAttribute(`start`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {

const filterableListFields: TypedFieldset<User> = listFields.concat([
`email`,
`last_email_send`,
`last_email_sent`,
`last_login`,
`organization_management_level`
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
<os-account-button></os-account-button>
</div>
</mat-toolbar>

<ng-template [cdkPortalOutlet]="headbarService.headbar"></ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MatDialog } from '@angular/material/dialog';
import { ActiveMeetingService } from 'src/app/site/pages/meetings/services/active-meeting.service';
import { OrganizationService } from 'src/app/site/pages/organization/services/organization.service';

import { GlobalHeadbarService } from '../../global-headbar.service';
import { GlobalSearchComponent } from '../global-search/global-search.component';

@Component({
Expand All @@ -26,7 +27,8 @@ export class GlobalHeadbarComponent {
public constructor(
private activeMeeting: ActiveMeetingService,
private orgaService: OrganizationService,
private dialog: MatDialog
private dialog: MatDialog,
public headbarService: GlobalHeadbarService
) {}

public openSearch(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PortalModule } from '@angular/cdk/portal';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
Expand Down Expand Up @@ -31,7 +32,8 @@ const MODULES = [
MatTooltipModule,
MatDialogModule,
MatCheckboxModule,
MatBadgeModule
MatBadgeModule,
PortalModule
];
const DECLARATIONS = [GlobalHeadbarComponent];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TemplatePortal } from '@angular/cdk/portal';
import { Injectable } from '@angular/core';

@Injectable({ providedIn: `root` })
export class GlobalHeadbarService {
private _headbar: TemplatePortal = null;

public get headbar() {
return this._headbar;
}

public set headbar(portal: TemplatePortal) {
this._headbar = portal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@

.os-router-outlet-container {
flex-grow: 1;
overflow: auto;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ <h2>{{ 'Personal information' | translate }}</h2>
<!-- Pronoun -->
<mat-form-field class="width-16p force-min-width">
<input type="text" matInput placeholder="{{ 'Pronoun' | translate }}" formControlName="pronoun" />
<mat-error>{{ 'Pronoun can only have 32 letters' | translate }}</mat-error>
</mat-form-field>

<!-- Gender -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ export class UserDetailViewComponent extends BaseUiComponent implements OnInit,
this.personalInfoForm = this.fb.group(
{
username: [``, this.isNewUser ? [] : [Validators.required]],
pronoun: [``],
pronoun: [``, Validators.maxLength(32)],
title: [``],
first_name: [``],
last_name: [``],
gender: [``],
email: [``],
last_email_send: [``],
last_email_sent: [``],
default_password: [``],
is_active: [true],
is_physical_person: [true],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class AgendaContentObjectFormComponent
}

public get itemObserver(): Observable<ViewAgendaItem[]> {
return this._itemsSubject.asObservable();
return this._itemsSubject;
}

public permission = Permission;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,8 @@
</ng-template>
<ng-template osSidenavMainContent>
<div class="content">
<main>
<div>
<os-global-headbar></os-global-headbar>
<div class="scrollable-content">
<router-outlet #o="outlet"></router-outlet>
</div>
</div>
</main>
<os-global-headbar></os-global-headbar>
<router-outlet #o="outlet"></router-outlet>
</div>
<div class="toolbars">
<os-action-bar></os-action-bar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class TopicPollService extends PollService {
) {
super(organizationSettingsService, translate, pollKeyVerbose, parsePollNumber, themeService);
this.meetingSettingsService
.get(`topic_poll_default_100_percent_base`)
.get(`topic_poll_default_onehundred_percent_base`)
.subscribe(base => (this.defaultPercentBase = base ?? PollPercentBase.Y));

this.meetingSettingsService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { FormsModule } from '@angular/forms';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatIconModule } from '@angular/material/icon';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatTooltipModule } from '@angular/material/tooltip';
import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';
Expand All @@ -26,6 +28,8 @@ import { AgendaSortComponent } from './components/agenda-sort/agenda-sort.compon
MatCheckboxModule,
MatCardModule,
MatTooltipModule,
MatMenuModule,
MatListModule,
SortingModule
]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,21 @@ <h2>{{ 'Sort agenda' | translate }}</h2>
</div>
</div>
<div class="button-menu right">
<button mat-button (click)="visibilityFilter.opened ? visibilityFilter.close() : visibilityFilter.open()">
Filter
</button>
<mat-drawer #visibilityFilter mode="over" position="end">
<section class="sort-drawer-content">
<button mat-button (click)="visibilityFilter.toggle()">
<mat-icon>keyboard_arrow_right</mat-icon>
</button>
<span class="sort-grid">
<div class="hint">{{ 'Visibility' | translate }}</div>
<div>
<mat-checkbox
*ngFor="let option of filterOptions"
[(ngModel)]="option.state"
(change)="onFilterChange(option.id)"
>
<mat-icon matTooltip="{{ option.label | translate }}" class="icon-16">
{{ getIcon(option.id) }}
</mat-icon>
{{ option.label | translate }}
</mat-checkbox>
</div>
</span>
</section>
</mat-drawer>
<button mat-button [matMenuTriggerFor]="menu">Filter</button>
<mat-menu #menu>
<div class="filter-hint hint">{{ 'Visibility' | translate }}</div>
<mat-selection-list #visibilities (selectionChange)="onFilterChange(visibilities.selectedOptions.selected)">
<mat-list-option
*ngFor="let option of filterOptions"
[value]="option.id"
[selected]="option.state">
<mat-icon matListIcon matTooltip="{{ option.label | translate }}">
{{ getIcon(option.id) }}
</mat-icon>
<p matLine>{{ option.label | translate }}</p>
</mat-list-option>
</mat-selection-list>
</mat-menu>
</div>
</div>
<mat-card>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.filter-hint {
padding: 0 16px;
}

.sort-header {
display: block;
padding: 0 8px;
width: auto;
position: relative;
text-align: center;

.button-menu {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatListOption, MatSelectionList } from '@angular/material/list';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { AgendaItemType, ItemTypeChoices } from 'src/app/domain/models/agenda/agenda-item';
Expand All @@ -23,6 +24,8 @@ export class AgendaSortComponent extends BaseSortTreeViewComponent<ViewAgendaIte
*/
public itemsObservable: Observable<ViewAgendaItem[]>;

@ViewChild(`visibilities`) visibilitiesEl: MatSelectionList;

/**
* These are the available options for filtering the nodes.
* Adds the property `state` to identify if the option is marked as active.
Expand Down Expand Up @@ -56,14 +59,8 @@ export class AgendaSortComponent extends BaseSortTreeViewComponent<ViewAgendaIte
*
* @param filter Is the filter that was activated by the user.
*/
public onFilterChange(filter: SortTreeFilterId): void {
const value = this.activeFilters.value;
if (!value.includes(filter)) {
value.push(filter);
} else {
value.splice(value.indexOf(filter), 1);
}
this.activeFilters.next(value);
public onFilterChange(filter: MatListOption[]): void {
this.activeFilters.next(filter.map(f => f.value));
}

/**
Expand All @@ -89,6 +86,7 @@ export class AgendaSortComponent extends BaseSortTreeViewComponent<ViewAgendaIte
for (const option of this.filterOptions) {
option.state = false;
}
this.visibilitiesEl.deselectAll();
this.activeFilters.next([]);
}

Expand Down
Loading

0 comments on commit 75ebb41

Please sign in to comment.