• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

knowledgepixels / nanodash / 23047492673

13 Mar 2026 10:50AM UTC coverage: 15.67% (-0.006%) from 15.676%
23047492673

Pull #389

github

web-flow
Merge caafcefe6 into 84ce3619e
Pull Request #389: Reconsider title bar (#293)

710 of 5489 branches covered (12.93%)

Branch coverage included in aggregate %.

1751 of 10216 relevant lines covered (17.14%)

2.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
src/main/java/com/knowledgepixels/nanodash/component/ProfileItem.java
1
package com.knowledgepixels.nanodash.component;
2

3
import com.knowledgepixels.nanodash.NanodashPreferences;
4
import com.knowledgepixels.nanodash.NanodashSession;
5
import com.knowledgepixels.nanodash.domain.User;
6
import com.knowledgepixels.nanodash.page.*;
7
import org.apache.wicket.markup.html.WebMarkupContainer;
8
import org.apache.wicket.markup.html.basic.Label;
9
import org.apache.wicket.markup.html.image.ExternalImage;
10
import org.apache.wicket.markup.html.image.Image;
11
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
12
import org.apache.wicket.markup.html.link.ExternalLink;
13
import org.apache.wicket.markup.html.panel.Panel;
14
import org.apache.wicket.request.mapper.parameter.PageParameters;
15
import org.apache.wicket.request.resource.ContextRelativeResourceReference;
16
import org.eclipse.rdf4j.model.IRI;
17

18
/**
19
 * A panel that displays a link to the user's profile.
20
 */
21
public class ProfileItem extends Panel {
22

23
    /**
24
     * Constructor for the ProfileItem panel.
25
     *
26
     * @param id   the component id
27
     * @param page a {@link com.knowledgepixels.nanodash.page.NanodashPage} object
28
     */
29
    public ProfileItem(String id, NanodashPage page) {
30
        super(id);
×
31
        NanodashSession session = NanodashSession.get();
×
32
        NanodashPreferences prefs = NanodashPreferences.get();
×
33
        IRI userId = session.getUserIri();
×
34
        if (prefs.isOrcidLoginMode() && userId == null) {
×
35
            String redirectMountPath = ProfilePage.MOUNT_PATH;
×
36
            PageParameters redirectPageParams = new PageParameters();
×
37
            if (page != null) {
×
38
                redirectMountPath = ((NanodashPage) page).getMountPath();
×
39
                redirectPageParams = ((NanodashPage) page).getPageParameters();
×
40
            }
41
            ExternalLink l = new ExternalLink("profilelink", OrcidLoginPage.getOrcidLoginUrl(redirectMountPath, redirectPageParams));
×
42
            l.add(new WebMarkupContainer("profileimage").setVisible(false));
×
43
            l.add(new Label("profiletext", "Login"));
×
44
            add(l);
×
45
        } else if (prefs.isReadOnlyMode()) {
×
46
            BookmarkablePageLink<HomePage> l = new BookmarkablePageLink<>("profilelink", HomePage.class);
×
47
            l.add(new WebMarkupContainer("profileimage").setVisible(false));
×
48
            l.add(new Label("profiletext", ""));
×
49
            add(l);
×
50
        } else {
×
51
            if (userId != null) {
×
52
                BookmarkablePageLink<ProfilePage> l = new BookmarkablePageLink<ProfilePage>("profilelink", UserPage.class, new PageParameters().set("id", userId.stringValue()));
×
53
                IRI profilePictureIri = User.getProfilePicture(userId);
×
54
                if (profilePictureIri != null) {
×
55
                    l.add(new ExternalImage("profileimage", profilePictureIri.stringValue()));
×
56
                } else {
57
                    l.add(new Image("profileimage", new ContextRelativeResourceReference("images/user-icon.svg", false)));
×
58
                }
59
                l.add(new Label("profiletext", "").setVisible(false));
×
60
                add(l);
×
61
            } else {
×
62
                BookmarkablePageLink<ProfilePage> l = new BookmarkablePageLink<ProfilePage>("profilelink", ProfilePage.class);
×
63
                l.add(new Image("profileimage", new ContextRelativeResourceReference("images/user-icon.svg", false)));
×
64
                l.add(new Label("profiletext", "").setVisible(false));
×
65
                add(l);
×
66
            }
67
        }
68
    }
×
69

70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc