function UserItem(user) {
    const url = app.forum.attribute('baseUrl') + '/u/' + user.id();
    const online = user.isOnline();

    return [
        m('li', {"data-id": user.id()}, [
            m('div', {className: 'UsersListItem-info'}, [
                m('span', {className: 'UsersListItem-name'}, [
                    user.username(),
                ]),
                m('span', {className: 'UserCard-lastSeen' + (online ? ' online' : '')}, [
                    online
                        ? [icon('circle'), ' ', app.translator.trans('avatar4eg-users-list.admin.page.online_text')]
                        : [icon('clock-o'), ' ', humanTime(user.lastSeenTime())]
                ]),
                m('span', {className: 'UsersListItem-comments'}, [
                    icon('comment-o'),
                    user.commentsCount()
                ]),
                m('span', {className: 'UsersListItem-discussions'}, [
                    icon('reorder'),
                    user.discussionsCount()
                ]),
                m('a', {
                    className: 'Button Button--link',
                    target: '_blank',
                    href: url
                }, [
                    icon('eye')
                ]),
                Button.component({
                    className: 'Button Button--link',
                    icon: 'envelope',
                    onclick: function (e) {
                        e.preventDefault();
                        app.modal.show(new EmailUserModal({user}));
                    }
                })
            ])
        ])
    ];
}
Esempio n. 2
0
              {pinned.map(tag => {
                const lastDiscussion = tag.lastDiscussion();
                const children = app.store.all('tags').filter(child => child.parent() === tag);

                return (
                  <li className={'TagTile ' + (tag.color() ? 'colored' : '')}
                    style={{backgroundColor: tag.color()}}>
                    <a className="TagTile-info" href={app.route.tag(tag)} config={m.route}>
                      <h3 className="TagTile-name">{tag.name()}</h3>
                      <p className="TagTile-description">{tag.description()}</p>
                      {children
                        ? (
                          <div className="TagTile-children">
                            {children.map(child =>
                              <a href={app.route.tag(child)} config={function(element, isInitialized) {
                                if (isInitialized) return;
                                $(element).on('click', e => e.stopPropagation());
                                m.route.apply(this, arguments);
                              }}>
                                {child.name()}
                              </a>
                            )}
                          </div>
                        ) : ''}
                    </a>
                    {lastDiscussion
                      ? (
                        <a className="TagTile-lastDiscussion"
                          href={app.route.discussion(lastDiscussion, lastDiscussion.lastPostNumber())}
                          config={m.route}>
                          <span className="TagTile-lastDiscussion-title">{lastDiscussion.title()}</span>
                          {humanTime(lastDiscussion.lastTime())}
                        </a>
                      ) : (
                        <span className="TagTile-lastDiscussion"/>
                      )}
                  </li>
                );
              })}
Esempio n. 3
0
  view() {
    const notification = this.props.notification;
    const href = this.href();

    return (
      <a className={'Notification Notification--' + notification.contentType() + ' ' + (!notification.isRead() ? 'unread' : '')}
        href={href}
        config={function(element, isInitialized) {
          if (href.indexOf('://') === -1) m.route.apply(this, arguments);

          if (!isInitialized) $(element).click(this.markAsRead.bind(this));
        }}>
        {avatar(notification.sender())}
        {icon(this.icon(), {className: 'Notification-icon'})}
        <span className="Notification-content">{this.content()}</span>
        {humanTime(notification.time())}
        <div className="Notification-excerpt">
          {this.excerpt()}
        </div>
      </a>
    );
  }
Esempio n. 4
0
              ? flags.map(flag => {
                const post = flag.post();

                return (
                  <li>
                    <a href={app.route.post(post)} className="Notification Flag" config={function(element, isInitialized) {
                      m.route.apply(this, arguments);

                      if (!isInitialized) $(element).on('click', () => app.cache.flagIndex = post);
                    }}>
                      {avatar(post.user())}
                      {icon('flag', {className: 'Notification-icon'})}
                      <span className="Notification-content">
                        {username(post.user())} in <em>{post.discussion().title()}</em>
                      </span>
                      {humanTime(flag.time())}
                      <div className="Notification-excerpt">
                        {post.contentPlain()}
                      </div>
                    </a>
                  </li>
                );
              })