def GET_show(self, meetup, sort, num_comments): article = Link._byID(meetup.assoc_link) # figure out number to show based on the menu user_num = c.user.pref_num_comments or g.num_comments num = g.max_comments if num_comments == 'true' else user_num builder = CommentBuilder(article, CommentSortMenu.operator(sort), None, None) listing = NestedListing(builder, num=num, parent_name=article._fullname) displayPane = PaneStack() # insert reply box only for logged in user if c.user_is_loggedin: displayPane.append(CommentReplyBox()) displayPane.append(CommentReplyBox(link_name=article._fullname)) # finally add the comment listing displayPane.append(listing.listing()) sort_menu = CommentSortMenu(default=sort, type='dropdown2') nav_menus = [ sort_menu, NumCommentsMenu(article.num_comments, default=num_comments) ] content = CommentListing( content=displayPane, num_comments=article.num_comments, nav_menus=nav_menus, ) # Update last viewed time, and return the previous last viewed time. Actually tracked on the article lastViewed = None if c.user_is_loggedin: clicked = article._getLastClickTime(c.user) lastViewed = clicked._date if clicked else None article._click(c.user) res = ShowMeetup(meetup=meetup, content=content, fullname=article._fullname, lastViewed=lastViewed) return BoringPage(pagename=meetup.title, content=res, body_class='meetup').render()
def GET_show(self, meetup, sort, num_comments): article = Link._byID(meetup.assoc_link) # figure out number to show based on the menu user_num = c.user.pref_num_comments or g.num_comments num = g.max_comments if num_comments == 'true' else user_num builder = CommentBuilder(article, CommentSortMenu.operator(sort), None, None) listing = NestedListing(builder, num=num, parent_name = article._fullname) displayPane = PaneStack() # insert reply box only for logged in user if c.user_is_loggedin: displayPane.append(CommentReplyBox()) displayPane.append(CommentReplyBox(link_name = article._fullname)) # finally add the comment listing displayPane.append(listing.listing()) sort_menu = CommentSortMenu(default = sort, type='dropdown2') nav_menus = [sort_menu, NumCommentsMenu(article.num_comments, default=num_comments)] content = CommentListing( content = displayPane, num_comments = article.num_comments, nav_menus = nav_menus, ) # Update last viewed time, and return the previous last viewed time. Actually tracked on the article lastViewed = None if c.user_is_loggedin: clicked = article._getLastClickTime(c.user) lastViewed = clicked._date if clicked else None article._click(c.user) res = ShowMeetup(meetup = meetup, content = content, fullname=article._fullname, lastViewed = lastViewed) return BoringPage(pagename = meetup.title, content = res, body_class = 'meetup').render()
def GET_contributors(self): """Get a list of users that contribute to this thread. See also: [/api/live/*thread*/invite_contributor] (#POST_api_live_{thread}_invite_contributor), and [/api/live/*thread*/rm_contributor] (#POST_api_live_{thread}_rm_contributor). """ editable = c.liveupdate_permissions.allow("manage") content = [pages.LinkBackToLiveUpdate()] contributors = c.liveupdate_event.contributors invites = LiveUpdateContributorInvitesByEvent.get_all(c.liveupdate_event) contributor_builder = LiveUpdateContributorBuilder( c.liveupdate_event, contributors, editable) contributor_listing = pages.LiveUpdateContributorListing( c.liveupdate_event, contributor_builder, has_invite=c.user_is_loggedin and c.user._id in invites, is_contributor=c.user_is_loggedin and c.user._id in contributors, ).listing() content.append(contributor_listing) if editable: invite_builder = LiveUpdateInvitedContributorBuilder( c.liveupdate_event, invites, editable) invite_listing = pages.LiveUpdateInvitedContributorListing( c.liveupdate_event, invite_builder, editable=editable, ).listing() content.append(invite_listing) return pages.LiveUpdateEventPage( content=PaneStack(content), ).render()