entry.jsx 28.2 KB
Newer Older
1
import $, { type } from "jquery";
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
2
3
import "slick-carousel";
import ReactDOM from "react-dom";
4
import React, { useState } from "react";
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

// const path = require("path");
// const YAML = require('yamljs');
// const widths = YAML.load(path.join(__dirname, "../menu.yml")).widths;
// console.log(widths);

// ////////////////////////////////////////////////////////////////////////////
// Load scss files (mind ordering)
// ////////////////////////////////////////////////////////////////////////////
// import "slick-carousel/slick/slick.scss";
// import "slick-carousel/slick/slick-theme.scss";
// import "./scss/_main.scss";

// ////////////////////////////////////////////////////////////////////////////
// Render responsive menu
// ////////////////////////////////////////////////////////////////////////////
// import menu from "../menu.js";

const Nav = class extends React.Component {
    constructor(props) {
        super(props);
        this.isTouchDevice = "ontouchstart" in window || navigator.maxTouchPoints;  // See: https://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript/4819886#4819886
        const getWidth = () => Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
        window.onresize = () => this.setState({ width: getWidth() });
        this.state = {
            activeIndex: undefined,
            width: getWidth(),
            mobileMenuActive: false
        };
    }

    render() {
        const mobileMenu = (this.isTouchDevice && this.state.width <= 980) || this.state.width <= 980;
        return (
            <nav className={"navigation" + (mobileMenu ? " is-touch" : "")} role="navigation">
                {
                    mobileMenu ? (
                        <div className="navigation-header-mobile" onClick={() => this.setState({ mobileMenuActive: !this.state.mobileMenuActive })}>
                            <i className="icon-menu"></i>
                        </div>
                    ) : ""
                }
                {
                    (!mobileMenu || (mobileMenu && this.state.mobileMenuActive)) ? (
                        <div className="navigation-header">
                            {
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
51
                                window.menu.map((item, index) => (
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
52
53
54
55
56
57
58
59
60
61
                                    <div
                                        onMouseEnter={!mobileMenu ? () => this.setState({ activeIndex: index }) : undefined}
                                        onMouseLeave={!mobileMenu ? () => this.setState({ activeIndex: undefined }) : undefined}
                                        key={index}>
                                        <div className="category-title">
                                            {
                                                mobileMenu ? (
                                                    (item.items !== undefined) ? (
                                                        <i className={"toggle-button " + (this.state.activeIndex === index ? "icon-minus-circled" : "icon-plus-circled")} onClick={() => this.setState({ activeIndex: this.state.activeIndex === index ? undefined : index })}></i>
                                                    ) : (
62
63
                                                        <span className="toggle-button-placeholder"></span>
                                                    )
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
                                                ) : ""
                                            }
                                            <a
                                                href={item.href}
                                                className={(this.state.activeIndex === index) ? "active" : ""}
                                            >{item.title}</a>
                                        </div>
                                        {
                                            (item.items !== undefined && (this.state.activeIndex === index)) ? (
                                                <div className="navigation-submenu">
                                                    {
                                                        item.items.map((subItem, index) => (
                                                            <div className="navigation-submenu-column" key={index}>
                                                                <a className="navigation-submenu-column-header" href={subItem.href}>
                                                                    <i className="icon-right-open-top-item"></i>
                                                                    {subItem.title}
                                                                </a>
                                                                {
                                                                    (subItem.items !== undefined) ? (
                                                                        subItem.items.map((subSubItem, index) => (
                                                                            <a className="navigation-submenu-column-sub" href={subSubItem.href} key={index}>
                                                                                <i className="icon-right-open"></i>
                                                                                {subSubItem.title}
                                                                            </a>
                                                                        ))
                                                                    ) : ""
                                                                }
                                                            </div>
                                                        ))
                                                    }
                                                </div>
                                            ) : ""
                                        }
                                    </div>
                                ))
                            }
                        </div>
                    ) : ""
                }
            </nav>
        );
    }
};

ReactDOM.render(<Nav />, document.getElementById("react-placeholder-navigation"));

// ////////////////////////////////////////////////////////////////////////////
// Render breadcrumb navigation
// ////////////////////////////////////////////////////////////////////////////
const Breadcrumb = () => {
    const breadcrumbPlaceholder = document.getElementById("react-placeholder-breadcrumb");
    const url = breadcrumbPlaceholder.getAttribute("url").replace(/\/$/, "");

    const getBreadcrombItems = () => {
        let result = undefined;

        const home = Object.assign({}, menu[0]);
        home.title = "Home";

        menu.map(item1 => {
            if (item1.href.replace(/\/$/, "") === url) {
                if (item1 !== menu[0]) {
                    result = [home, item1];
                }
            }
            else if (item1.items) {
                item1.items.map(item2 => {
                    if (item2.href.replace(/\/$/, "") === url) {
                        result = [home, item1, item2];
                    }
                    else if (item2.items) {
                        item2.items.map(item3 => {
                            if (item3.href.replace(/\/$/, "") === url) {
                                result = [home, item1, item2, item3];
                            }
                        });
                    }
                });
            }
        });
        return result;
    };

    const items = getBreadcrombItems();
    return (
        <div>
            {
                items ? (
                    items.map((item, index) => (
                        (index !== items.length - 1) ? (
                            <span key={index}><a href={item.href}>{item.title}</a> / </span>
                        ) : (
156
157
                            <span key={index}>{item.title}</span>
                        )
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
                    ))
                ) : ""
            }
        </div>
    );
};

ReactDOM.render(<Breadcrumb />, document.getElementById("react-placeholder-breadcrumb"));

// ////////////////////////////////////////////////////////////////////////////
// Render toggle visibility button
// ////////////////////////////////////////////////////////////////////////////

if (document.getElementById("react-placeholder-toggleVisibility") !== null) {
    const ToggleVisibility = class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                visible: false,
                language: document.getElementById("react-placeholder-toggleVisibility").getAttribute("language") // null if not set
            };
        }

        render() {
            console.log(this.state.language);
            const stringShowLess = this.state.language === "DE" ? "Weniger anzeigen" : "Show less";
            const stringShowMore = this.state.language === "DE" ? "Mehr anzeigen" : "Show more";

            const toggle = () => this.setState({ visible: !this.state.visible },
                (this.state.visible) ? (
                    () => $(".toggle-visibility").addClass("hide")
                ) : (
190
191
                    () => $(".toggle-visibility").removeClass("hide")
                )
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
192
193
194
195
196
197
198
199
            );

            return (
                <div className="u-cursor-pointer" onClick={toggle}>
                    {
                        (this.state.visible) ? (
                            stringShowLess
                        ) : (
200
201
                            stringShowMore
                        )
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
202
203
204
205
206
207
208
209
210
                    }
                </div>
            );
        }
    };

    ReactDOM.render(<ToggleVisibility />, document.getElementById("react-placeholder-toggleVisibility"));
}

tron's avatar
tron committed
211

212
if (document.getElementById("react-placeholder-toggleVisibility-topics-open") !== null) {
tron's avatar
tron committed
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
    const ToggleVisibilityTopicsOpen = class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                visible: false,
                language: document.getElementById("react-placeholder-toggleVisibility-topics-open").getAttribute("language") // null if not set
            };
        }

        render() {
            console.log(this.state.language);
            const stringShowLess = this.state.language === "DE" ? "Weniger anzeigen" : "Show less";
            const stringShowMore = this.state.language === "DE" ? "Mehr anzeigen" : "Show more";

            const toggle = () => this.setState({ visible: !this.state.visible },
                (this.state.visible) ? (
                    () => $(".toggle-visibility-topics-open").addClass("hide")
                ) : (
231
232
                    () => $(".toggle-visibility-topics-open").removeClass("hide")
                )
tron's avatar
tron committed
233
234
235
236
237
238
239
240
            );

            return (
                <div className="u-cursor-pointer" onClick={toggle}>
                    {
                        (this.state.visible) ? (
                            stringShowLess
                        ) : (
241
242
                            stringShowMore
                        )
tron's avatar
tron committed
243
244
245
246
247
248
249
250
251
                    }
                </div>
            );
        }
    };

    ReactDOM.render(<ToggleVisibilityTopicsOpen />, document.getElementById("react-placeholder-toggleVisibility-topics-open"));
}

252
if (document.getElementById("react-placeholder-toggleVisibility-topics-closed") !== null) {
tron's avatar
tron committed
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
    const ToggleVisibilityTopicsClosed = class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                visible: false,
                language: document.getElementById("react-placeholder-toggleVisibility-topics-closed").getAttribute("language") // null if not set
            };
        }

        render() {
            console.log(this.state.language);
            const stringShowLess = this.state.language === "DE" ? "Weniger anzeigen" : "Show less";
            const stringShowMore = this.state.language === "DE" ? "Mehr anzeigen" : "Show more";

            const toggle = () => this.setState({ visible: !this.state.visible },
                (this.state.visible) ? (
                    () => $(".toggle-visibility-topics-closed").addClass("hide")
                ) : (
271
272
                    () => $(".toggle-visibility-topics-closed").removeClass("hide")
                )
tron's avatar
tron committed
273
274
275
276
277
278
279
280
            );

            return (
                <div className="u-cursor-pointer" onClick={toggle}>
                    {
                        (this.state.visible) ? (
                            stringShowLess
                        ) : (
281
282
                            stringShowMore
                        )
tron's avatar
tron committed
283
284
285
286
287
288
289
290
291
                    }
                </div>
            );
        }
    };

    ReactDOM.render(<ToggleVisibilityTopicsClosed />, document.getElementById("react-placeholder-toggleVisibility-topics-closed"));
}

292
if (document.getElementById("react-placeholder-toggleVisibility-topics-assigned") !== null) {
tron's avatar
tron committed
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
    const ToggleVisibilityTopicsAssigned = class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                visible: false,
                language: document.getElementById("react-placeholder-toggleVisibility-topics-assigned").getAttribute("language") // null if not set
            };
        }

        render() {
            console.log(this.state.language);
            const stringShowLess = this.state.language === "DE" ? "Weniger anzeigen" : "Show less";
            const stringShowMore = this.state.language === "DE" ? "Mehr anzeigen" : "Show more";

            const toggle = () => this.setState({ visible: !this.state.visible },
                (this.state.visible) ? (
                    () => $(".toggle-visibility-topics-assigned").addClass("hide")
                ) : (
311
312
                    () => $(".toggle-visibility-topics-assigned").removeClass("hide")
                )
tron's avatar
tron committed
313
314
315
316
317
318
319
320
            );

            return (
                <div className="u-cursor-pointer" onClick={toggle}>
                    {
                        (this.state.visible) ? (
                            stringShowLess
                        ) : (
321
322
                            stringShowMore
                        )
tron's avatar
tron committed
323
324
325
326
327
328
329
330
331
                    }
                </div>
            );
        }
    };

    ReactDOM.render(<ToggleVisibilityTopicsAssigned />, document.getElementById("react-placeholder-toggleVisibility-topics-assigned"));
}

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
// ////////////////////////////////////////////////////////////////////////////
// Render filter input
// ////////////////////////////////////////////////////////////////////////////

if (document.getElementById("react-placeholder-filterInput") !== null) {
    const FilterInput = class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                visible: false
            };
        }

        render() {
            // Define case insensitive selector (https://stackoverflow.com/questions/187537/is-there-a-case-insensitive-jquery-contains-selector/187557)
            $.extend($.expr[":"], {
                "containsIN": function (elem, i, match, array) {
                    return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
                }
            });

            const onChange = (event) => {
                const searchString = event.target.value;
                const targetElements = $(".filterInput-targetElement");
                if (searchString == "") {
                    targetElements.show();
                }
                else {
                    targetElements.hide();
                    targetElements.filter(function () {
                        return !searchString.split(" ").map(word => $(this).is(":containsIN('" + word + "')")).includes(false);
                    }).show();
                }
            };

367
            const copyURL = (event) => {
368
                var copyText = window.location.origin + '/publications/?query=' + $("#react-placeholder-filterInput[bibType='filter'] > div > input").val().replace(' ', '&query=');
369
370
371
372
373
374
375
                var $temp = $("<input>");
                $("body").append($temp);
                $temp.val(copyText).select();
                document.execCommand("copy");
                $temp.remove();
            };

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
376
377
378
379
            return (
                <div className="filterInput">
                    <i className="icon-search"></i>
                    <input type="text" onChange={onChange} placeholder="Filter..." />
380
                    <i class="icon-copy ripple" onClick={copyURL}></i>
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
                </div>
            );
        }
    };

    ReactDOM.render(<FilterInput />, document.getElementById("react-placeholder-filterInput"));
}

// ////////////////////////////////////////////////////////////////////////////
// Activate carousel
// ////////////////////////////////////////////////////////////////////////////

$(document).ready(function () {
    $(".slick-element").slick({
        dots: true,
        autoplay: true,
        fade: true,
        autoplaySpeed: 6000,
        speed: 1000
    });

    $(".slick-element > div").removeClass("hide");
});


// ////////////////////////////////////////////////////////////////////////////
// Render bibsonomy
// ////////////////////////////////////////////////////////////////////////////
import initBibsonomy from "./bibsonomy.js";
$(document).ready(function () {
    if ($(".bibsonomy").length) {
        initBibsonomy();
    }
});


// ////////////////////////////////////////////////////////////////////////////
// Render topic selector
// ////////////////////////////////////////////////////////////////////////////
const element = document.getElementById("react-placeholder-topicSelector");
if (element !== null) {
422

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
423
424
425
426
    const TopicSelector = class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
427
                topic: [
tron's avatar
tron committed
428
429
430
431
432
433
434
435
436
                    { id: 1, category: "focus", label: "hci", name: "Human-Computer Interaction", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 2, category: "focus", label: "cs", name: "Computer Science", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 3, category: "focus", label: "ge", name: "Games Engineering", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 4, category: "level", label: "ba", name: "Bachelor", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 5, category: "level", label: "ma", name: "Master", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 6, category: "level", label: "phd", name: "Ph.D.", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 7, category: "type", label: "project", name: "Project", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 8, category: "type", label: "thesis", name: "Thesis", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 9, category: "type", label: "intern", name: "Internship", isChecked: false, checkBoxRef: React.createRef()},
tron's avatar
tron committed
437
                    { id: 10, category: "affiliation", label: "no-affil", name: "No Affiliation", isChecked: false, checkBoxRef: React.createRef()},
tron's avatar
tron committed
438
                    { id: 11, category: "affiliation", label: "emlab", name: "Embodiment Lab", isChecked: false, checkBoxRef: React.createRef()},
tron's avatar
tron committed
439
440
                    { id: 12, category: "affiliation", label: "grl", name: "Games Research Lab", isChecked: false, checkBoxRef: React.createRef()},
                    { id: 13, category: "affiliation", label: "ind", name: "Industry Cooperation", isChecked: false, checkBoxRef: React.createRef()}
dihokon's avatar
dihokon committed
441
                ],
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
442
            };
443

tron's avatar
tron committed
444
445
446
447
448
449
            this.state.topic.forEach(function(e){
                if (element.attributes.filterDefault.value.includes(e.label)) {
                    e.isChecked = true;
                }
            });
            this.updateTopics = this.updateTopics.bind(this);
dihokon's avatar
dihokon committed
450
            this.handleChange = this.handleChange.bind(this);
tron's avatar
tron committed
451
            this.updateTopics();
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
452
453
454
        }

        updateTopics() {
tron's avatar
tron committed
455
456
457
            let checked = {};
            let unChecked = {};

dihokon's avatar
dihokon committed
458
            this.state.topic.forEach(function(element){
tron's avatar
tron committed
459
460
461
462
                if(!(element.category in checked)){
                    checked[element.category] = [];
                    unChecked[element.category] = [];
                }
tron's avatar
tron committed
463
                if (element.isChecked) {
tron's avatar
tron committed
464
                    checked[element.category].push("."+element.label);
tron's avatar
tron committed
465
                } else {
tron's avatar
tron committed
466
                    unChecked[element.category].push("."+element.label);
dihokon's avatar
dihokon committed
467
468
                }
            });
tron's avatar
tron committed
469
470
471
472
473
474
475
476
477

            let toShow = $('.topic');
            let toHide = $('.topic');

            Object.keys(checked).forEach(e => {
                toShow = checked[e].length != 0 ? toShow.filter(checked[e].join(',')) : toShow.not(unChecked[e].join(','));
            });
            toHide.hide();   
            toShow.show();
tron's avatar
tron committed
478
479
480
481
482
483
484
485
486
487
488
489
            
            let dummyBlocks = toShow.length % 3;
            $('.block.placeholder').remove();
            let topicContainer = $('.column-layout.topics');
            if(dummyBlocks == 1){
                topicContainer.append('<div class="block placeholder"></div>');
                topicContainer.append('<div class="block placeholder"></div>');
            }
            if(dummyBlocks == 2){
                topicContainer.append('<div class="block placeholder"></div>');
            }
        
tron's avatar
tron committed
490
        }
491

tron's avatar
tron committed
492
493
494
495
496
497
        handleChange (event) {
            this.state.topic.filter(unfiltered => (unfiltered.id == event.target.value)).map(idOnly => {
                idOnly.isChecked = !idOnly.isChecked;
                idOnly.checkBoxRef.checked = idOnly.isChecked;
            });
            this.setState({selectedCheckboxes: this.state.topic}, this.updateTopics);
dihokon's avatar
dihokon committed
498
        }
499

tron's avatar
tron committed
500
        /*renderFullList() {
501
502
503
504
505
506
507
508
509
510
511
512
513
            return this.state.topic.map(item => (
                <div>
                  <input
                    key={item.id}
                    type="checkbox"
                    label={item.label}
                    value={item.label}
                    checked={item.isChecked}
                    onChange={this.handleChange}
                  />
                  <label>{item.label}</label>
                </div>
              ));
dihokon's avatar
dihokon committed
514
        }
515
516

        renderFocusList() {
tron's avatar
tron committed
517
518
519
520
521
            const { selectedCheckboxes } = this.state;
            return this.state.topic.filter(unfiltered => (unfiltered.category === "focus")).map((focusOnly) => (
                <div>
                    <input
                        key={focusOnly.id}
522
                        type="checkbox"
dihokon's avatar
dihokon committed
523
                        label={focusOnly.name}
tron's avatar
tron committed
524
525
                        value={focusOnly.id}
                        checked={focusOnly.isChecked}
tron's avatar
tron committed
526
527
528
                        onChange={() => this.handleChange(this)}
                    /> 
                    <label>{focusOnly.name}</label>
529
                </div>
tron's avatar
tron committed
530
            ));
531
        }
dihokon's avatar
dihokon committed
532

533
534
        renderLevelList() {
            return this.state.topic.filter(unfiltered => (unfiltered.category === "level")).map(levelOnly => (
tron's avatar
tron committed
535
536
537
                <div>
                    <input
                        key={levelOnly.id}
538
                        type="checkbox"
dihokon's avatar
dihokon committed
539
                        label={levelOnly.name}
tron's avatar
tron committed
540
541
                        value={levelOnly.id}
                        checked={levelOnly.isChecked}
tron's avatar
tron committed
542
543
544
                        onChange={this.handleChange}
                    /> 
                    <label>{levelOnly.name}</label>
545
                </div>
tron's avatar
tron committed
546
            ));
547
        }
dihokon's avatar
dihokon committed
548

549
550
        renderTypeList() {
            return this.state.topic.filter(unfiltered => (unfiltered.category === "type")).map(typeOnly => (
tron's avatar
tron committed
551
552
553
                <div>
                    <input
                        key={typeOnly.id}
554
                        type="checkbox"
dihokon's avatar
dihokon committed
555
                        label={typeOnly.name}
tron's avatar
tron committed
556
557
                        value={typeOnly.id}
                        checked={typeOnly.isChecked}
tron's avatar
tron committed
558
559
560
                        onChange={this.handleChange}
                    /> 
                    <label>{typeOnly.name}</label>
561
                </div>
tron's avatar
tron committed
562
563
            ));
        }*/
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
564
565
566

        render() {
            return (
567
                <div className="column-layout">
tron's avatar
tron committed
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
                    <div class="block topic-filter">
                        <b class="topicfilterheading">Focus</b> 
                        {this.state.topic.filter(unfiltered => (unfiltered.category === "focus")).map(focusOnly => (
                        <div class="topicfiltercheckbox" key={focusOnly.id}>
                            <label for={focusOnly.id} ><input
                                type="checkbox"
                                id = {focusOnly.id}
                                name = {focusOnly.id} 
                                label={focusOnly.name}
                                value={focusOnly.id}
                                checked={focusOnly.isChecked}
                                ref={focusOnly.checkBoxRef}
                                onChange={() => this.handleChange(event)}
                            />  <span>{focusOnly.name}</span></label>
                        </div>
                        ))}
                    </div>

                    <div class="block topic-filter">
                        <b class="topicfilterheading">Level</b>
                        {this.state.topic.filter(unfiltered => (unfiltered.category === "level")).map(levelOnly => (
                        <div class="topicfiltercheckbox" key={levelOnly.id}>
                            <label for={levelOnly.id}><input
                                type="checkbox"
                                id = {levelOnly.id}
                                name = {levelOnly.id} 
                                label={levelOnly.name}
                                value={levelOnly.id}
                                checked={levelOnly.isChecked}
                                ref={levelOnly.checkBoxRef}
                                onChange={() => this.handleChange(event)}
                            />  <span>{levelOnly.name}</span></label>
dihokon's avatar
dihokon committed
600
                        </div>
tron's avatar
tron committed
601
                        ))}
602
                    </div>
tron's avatar
tron committed
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617

                    <div class="block topic-filter">
                        <b class="topicfilterheading">Type</b>
                        {this.state.topic.filter(unfiltered => (unfiltered.category === "type")).map(typeOnly => (
                        <div class="topicfiltercheckbox" key={typeOnly.id}>
                            <label for={typeOnly.id} ><input
                                type="checkbox"
                                id = {typeOnly.id}
                                name = {typeOnly.id} 
                                label={typeOnly.name}
                                value={typeOnly.id}
                                checked={typeOnly.isChecked}
                                ref={typeOnly.checkBoxRef}
                                onChange={() => this.handleChange(event)}
                            />  <span>{typeOnly.name}</span></label>
dihokon's avatar
dihokon committed
618
                        </div>
tron's avatar
tron committed
619
                        ))}
620
                    </div>
tron's avatar
tron committed
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635

                      <div class="block topic-filter">
                        <b class="topicfilterheading">Affiliation</b>
                        {this.state.topic.filter(unfiltered => (unfiltered.category === "affiliation")).map(affiliationOnly => (
                        <div class="topicfiltercheckbox" key={affiliationOnly.id}>
                            <label for={affiliationOnly.id} ><input
                                type="checkbox"
                                id = {affiliationOnly.id}
                                name = {affiliationOnly.id} 
                                label={affiliationOnly.name}
                                value={affiliationOnly.id}
                                checked={affiliationOnly.isChecked}
                                ref={affiliationOnly.checkBoxRef}
                                onChange={() => this.handleChange(event)}
                            />  <span>{affiliationOnly.name}</span></label>
dihokon's avatar
dihokon committed
636
                        </div>
tron's avatar
tron committed
637
                        ))}
638
                    </div>
tron's avatar
tron committed
639

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
640
641
642
                </div>
            );
        }
tron's avatar
tron committed
643
644


Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
645
646
647
648
    };

    ReactDOM.render(<TopicSelector />, document.getElementById("react-placeholder-topicSelector"));
}