#217 Add: User Membership widget
Merged by atelic. Opened by atelic.
atelic/fedora-hubs feature/user-membership-widget  into  develop

Download 217.patch

Purpose

This widget should be available on all user profile hubs. It shows which hubs that user is a member of.

It should not display the ones that they subscribe to / follow - it should only display membership.

Changes

  • Add a new membership widget.

Refs

Ticket #159. One difference from the ticket is that it appears that there is no way to determine if a hub is a Team or Project so right now the widget just gets all memberships and displays them.

rebased

rebased

rebased

Hm this is confusing me a little, why does the membership widget need a FAS username? Shouldn't it list the members of the hubs it's installed on?

This crashes if no user were found for the specified username

This is my proposal:

def data(session, widget, **kwargs):
    members = []
    members_name = []
    for member in widget.hub.members:
        if member.username in members_name:
            continue
        members_name.append(member.username)
        members.append(member.__json__(session))
    return dict(memberships=list(members))

It doesn't seem to be ellipsized, should it be?

This is how it looks like to me atm: http://img.susepaste.org/30718140

I was thinking, maybe we could make it more like the group owners, two columns and include the names rather than the status.

Unless @duffy has another opinion on this :)

This widget needs to display (on a user hub) all of the hubs that the user is a member of. Not which members the hub has.

So the logic I propose is invalid but I still think this widget shouldn't need to be configured, either it's on a user_hub and then it lists all the hubs the user is a member of, or it is on a group hubs and then it lists all the members of the hubs.

Did I understand it correctly?

I think you're right about the configuration. I will get that info from widget.hub.name if widget.hub.user_hub

As for group hubs, per the ticket it doesn't look like it should be available on groups. If we have to define behavior for a group I think listing all the members of the hub would be fine

So we should add logic to widgets to support group/user specific widgets, but that something for another PR then

rebased

Okay, after dealing with small CSS stuff for over an hour here is how it turned out:

http://i.imgur.com/K4jLjGA.png

2 new commits added

  • Configure user membership for user and groups
  • Naive implementation of User Members widget

You're going to kill me, but would that work over 2 columns? :D

I would love for it to be able to. I tried for a while and I'll try to describe why I couldn't get it to work:

  • For it to be displayed in two columns we want each to be class="col-sm-6"
  • Unless two of those col-sm-6 are wrapped in a <div class="row"> they will overflow onto the next line
  • If the number of columns is odd, that overflow will cause the Close button to be floating off into space.

If I could loop through the memberships two by two I could probably do that but couldn't figure out a way to iterate like that. Any suggestions are welcome though!

rebased

1 new commit added

  • Display memberships in modal as two columns

Oh boy this looks good, oh boy oh boy oh boy!!!

:thumbsup:

Maybe for another PR/time, but the widget has currently a lot of space around the avatar/role on the hub itself, maybe we could try a 2 columns approach there as well?

Great, I can look into the 2 columns for the widget itself too. Good to merge this for now though?

rebased

Pull-Request has been merged by atelic

Metadata