comparison MoinMoin/apps/frontend/views.py @ 2771:5762664a2887

make /+mychanges work similar to local history, needs more work... like better styling (somehow the history style doesn't get active although i copied the html from there - is it the moved <form>? also, to make the diff buttons work, we need to get the parent revid.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 02 Sep 2014 19:58:40 +0200
parents 53d6f0ec8073
children d75032c39f11
comparison
equal deleted inserted replaced
2770:264e4015212e 2771:5762664a2887
959 """ 959 """
960 Returns the list of all items the current user has contributed to. 960 Returns the list of all items the current user has contributed to.
961 961
962 :returns: a page with all the items the current user has contributed to 962 :returns: a page with all the items the current user has contributed to
963 """ 963 """
964 offset = request.values.get('offset', 0)
965 offset = max(int(offset), 0)
966 if flaskg.user.valid:
967 results_per_page = flaskg.user.results_per_page
968 else:
969 results_per_page = app.cfg.results_per_page
964 my_changes = _mychanges(flaskg.user.itemid) 970 my_changes = _mychanges(flaskg.user.itemid)
965 return render_template('link_list_no_item_panel.html', 971 my_changes_page = util.getPageContent(my_changes, offset, results_per_page)
972 return render_template('mychanges.html',
966 title_name=_(u'My Changes'), 973 title_name=_(u'My Changes'),
967 headline=_(u'My Changes'), 974 headline=_(u'My Changes'),
968 fq_names=my_changes 975 my_changes=my_changes,
976 my_changes_page=my_changes_page,
969 ) 977 )
970 978
971 979
972 def _mychanges(userid): 980 def _mychanges(userid):
973 """ 981 """
977 :type userid: unicode 985 :type userid: unicode
978 :returns: the list of all items with user userid's contributions 986 :returns: the list of all items with user userid's contributions
979 """ 987 """
980 q = And([Term(WIKINAME, app.cfg.interwikiname), 988 q = And([Term(WIKINAME, app.cfg.interwikiname),
981 Term(USERID, userid)]) 989 Term(USERID, userid)])
982 revs = flaskg.storage.search(q, idx_name=ALL_REVS, limit=None) 990 revs = flaskg.storage.search(q, idx_name=ALL_REVS, sortedby=[MTIME], reverse=True, limit=None)
983 fq_names = {fq_name for rev in revs for fq_name in rev.fqnames} 991 # get rid of the content value to save potentially big amounts of memory:
984 return fq_names 992 history = []
993 for rev in revs:
994 entry = dict(rev.meta)
995 entry[FQNAME] = rev.fqname
996 history.append(entry)
997 return history
985 998
986 999
987 @frontend.route('/+refs/<itemname:item_name>') 1000 @frontend.route('/+refs/<itemname:item_name>')
988 def refs(item_name): 1001 def refs(item_name):
989 """ 1002 """