Show More
@@ -148,8 +148,10 b' def make_map(config):' | |||||
148 |
|
148 | |||
149 | #USER JOURNAL |
|
149 | #USER JOURNAL | |
150 | routes_map.connect('journal', '/_admin/journal', controller='journal',) |
|
150 | routes_map.connect('journal', '/_admin/journal', controller='journal',) | |
151 | routes_map.connect('public_journal', '/_admin/public_journal', controller='journal', |
|
151 | routes_map.connect('public_journal', '/_admin/public_journal', controller='journal', action="public_journal") | |
152 | action="public_journal") |
|
152 | routes_map.connect('public_journal_rss', '/_admin/public_journal_rss', controller='journal', action="public_journal_rss") | |
|
153 | routes_map.connect('public_journal_atom', '/_admin/public_journal_atom', controller='journal', action="public_journal_atom") | |||
|
154 | ||||
153 | routes_map.connect('toggle_following', '/_admin/toggle_following', controller='journal', |
|
155 | routes_map.connect('toggle_following', '/_admin/toggle_following', controller='journal', | |
154 | action='toggle_following', conditions=dict(method=["POST"])) |
|
156 | action='toggle_following', conditions=dict(method=["POST"])) | |
155 |
|
157 |
@@ -46,7 +46,7 b' class FeedController(BaseRepoController)' | |||||
46 | super(FeedController, self).__before__() |
|
46 | super(FeedController, self).__before__() | |
47 | #common values for feeds |
|
47 | #common values for feeds | |
48 | self.description = _('Changes on %s repository') |
|
48 | self.description = _('Changes on %s repository') | |
49 | self.title = "%s feed" |
|
49 | self.title = self.title = _('%s %s feed') % (c.rhodecode_name, '%s') | |
50 | self.language = 'en-us' |
|
50 | self.language = 'en-us' | |
51 | self.ttl = "5" |
|
51 | self.ttl = "5" | |
52 | self.feed_nr = 10 |
|
52 | self.feed_nr = 10 |
@@ -32,11 +32,13 b' from webhelpers.paginate import Page' | |||||
32 | from itertools import groupby |
|
32 | from itertools import groupby | |
33 |
|
33 | |||
34 | from paste.httpexceptions import HTTPInternalServerError |
|
34 | from paste.httpexceptions import HTTPInternalServerError | |
35 | from pylons import request, tmpl_context as c |
|
35 | from pylons import request, tmpl_context as c, response, url | |
|
36 | from pylons.i18n.translation import _ | |||
|
37 | from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed | |||
36 |
|
38 | |||
|
39 | import rhodecode.lib.helpers as h | |||
37 | from rhodecode.lib.auth import LoginRequired, NotAnonymous |
|
40 | from rhodecode.lib.auth import LoginRequired, NotAnonymous | |
38 | from rhodecode.lib.base import BaseController, render |
|
41 | from rhodecode.lib.base import BaseController, render | |
39 | from rhodecode.lib.helpers import get_token |
|
|||
40 | from rhodecode.model.db import UserLog, UserFollowing |
|
42 | from rhodecode.model.db import UserLog, UserFollowing | |
41 |
|
43 | |||
42 | log = logging.getLogger(__name__) |
|
44 | log = logging.getLogger(__name__) | |
@@ -47,6 +49,10 b' class JournalController(BaseController):' | |||||
47 | @LoginRequired() |
|
49 | @LoginRequired() | |
48 | def __before__(self): |
|
50 | def __before__(self): | |
49 | super(JournalController, self).__before__() |
|
51 | super(JournalController, self).__before__() | |
|
52 | self.title = _('%s public journal %s feed') % (c.rhodecode_name, '%s') | |||
|
53 | self.language = 'en-us' | |||
|
54 | self.ttl = "5" | |||
|
55 | self.feed_nr = 20 | |||
50 |
|
56 | |||
51 | @NotAnonymous() |
|
57 | @NotAnonymous() | |
52 | def index(self): |
|
58 | def index(self): | |
@@ -113,7 +119,7 b' class JournalController(BaseController):' | |||||
113 | @NotAnonymous() |
|
119 | @NotAnonymous() | |
114 | def toggle_following(self): |
|
120 | def toggle_following(self): | |
115 | cur_token = request.POST.get('auth_token') |
|
121 | cur_token = request.POST.get('auth_token') | |
116 | token = get_token() |
|
122 | token = h.get_token() | |
117 | if cur_token == token: |
|
123 | if cur_token == token: | |
118 |
|
124 | |||
119 | user_id = request.POST.get('follows_user_id') |
|
125 | user_id = request.POST.get('follows_user_id') | |
@@ -160,3 +166,79 b' class JournalController(BaseController):' | |||||
160 | if request.params.get('partial'): |
|
166 | if request.params.get('partial'): | |
161 | return c.journal_data |
|
167 | return c.journal_data | |
162 | return render('journal/public_journal.html') |
|
168 | return render('journal/public_journal.html') | |
|
169 | ||||
|
170 | ||||
|
171 | ||||
|
172 | def public_journal_atom(self): | |||
|
173 | """ | |||
|
174 | Produce an atom-1.0 feed via feedgenerator module | |||
|
175 | """ | |||
|
176 | c.following = self.sa.query(UserFollowing)\ | |||
|
177 | .filter(UserFollowing.user_id == c.rhodecode_user.user_id)\ | |||
|
178 | .options(joinedload(UserFollowing.follows_repository))\ | |||
|
179 | .all() | |||
|
180 | ||||
|
181 | journal = self._get_journal_data(c.following) | |||
|
182 | ||||
|
183 | feed = Atom1Feed(title=self.title % 'atom', | |||
|
184 | link=url('public_journal_atom', qualified=True), | |||
|
185 | description=_('Public journal'), | |||
|
186 | language=self.language, | |||
|
187 | ttl=self.ttl) | |||
|
188 | ||||
|
189 | for entry in journal[:self.feed_nr]: | |||
|
190 | #tmpl = h.action_parser(entry)[0] | |||
|
191 | action, action_extra = h.action_parser(entry, feed=True) | |||
|
192 | title = "%s - %s %s" % (entry.user.short_contact, action, | |||
|
193 | entry.repository.repo_name) | |||
|
194 | desc = action_extra() | |||
|
195 | feed.add_item(title=title, | |||
|
196 | pubdate=entry.action_date, | |||
|
197 | link=url('', qualified=True), | |||
|
198 | author_email=entry.user.email, | |||
|
199 | author_name=entry.user.full_contact, | |||
|
200 | description=desc) | |||
|
201 | ||||
|
202 | response.content_type = feed.mime_type | |||
|
203 | return feed.writeString('utf-8') | |||
|
204 | ||||
|
205 | def public_journal_rss(self): | |||
|
206 | """ | |||
|
207 | Produce an rss2 feed via feedgenerator module | |||
|
208 | """ | |||
|
209 | c.following = self.sa.query(UserFollowing)\ | |||
|
210 | .filter(UserFollowing.user_id == c.rhodecode_user.user_id)\ | |||
|
211 | .options(joinedload(UserFollowing.follows_repository))\ | |||
|
212 | .all() | |||
|
213 | ||||
|
214 | journal = self._get_journal_data(c.following) | |||
|
215 | ||||
|
216 | feed = Rss201rev2Feed(title=self.title % 'rss', | |||
|
217 | link=url('public_journal_rss', qualified=True), | |||
|
218 | description=_('Public journal'), | |||
|
219 | language=self.language, | |||
|
220 | ttl=self.ttl) | |||
|
221 | ||||
|
222 | for entry in journal[:self.feed_nr]: | |||
|
223 | #tmpl = h.action_parser(entry)[0] | |||
|
224 | action, action_extra = h.action_parser(entry, feed=True) | |||
|
225 | title = "%s - %s %s" % (entry.user.short_contact, action, | |||
|
226 | entry.repository.repo_name) | |||
|
227 | desc = action_extra() | |||
|
228 | feed.add_item(title=title, | |||
|
229 | pubdate=entry.action_date, | |||
|
230 | link=url('', qualified=True), | |||
|
231 | author_email=entry.user.email, | |||
|
232 | author_name=entry.user.full_contact, | |||
|
233 | description=desc) | |||
|
234 | ||||
|
235 | response.content_type = feed.mime_type | |||
|
236 | return feed.writeString('utf-8') | |||
|
237 | ||||
|
238 | ||||
|
239 | ||||
|
240 | ||||
|
241 | ||||
|
242 | ||||
|
243 | ||||
|
244 |
@@ -98,6 +98,11 b' class User(Base):' | |||||
98 | return '%s %s <%s>' % (self.name, self.lastname, self.email) |
|
98 | return '%s %s <%s>' % (self.name, self.lastname, self.email) | |
99 |
|
99 | |||
100 | @property |
|
100 | @property | |
|
101 | def short_contact(self): | |||
|
102 | return '%s %s' % (self.name, self.lastname) | |||
|
103 | ||||
|
104 | ||||
|
105 | @property | |||
101 | def is_admin(self): |
|
106 | def is_admin(self): | |
102 | return self.admin |
|
107 | return self.admin | |
103 |
|
108 |
@@ -605,16 +605,16 b' padding:0;' | |||||
605 | } |
|
605 | } | |
606 |
|
606 | |||
607 | #content div.box div.title ul.links li a { |
|
607 | #content div.box div.title ul.links li a { | |
608 | height:1%; |
|
608 | border-left: 1px solid #316293; | |
609 | display:block; |
|
609 | color: #FFFFFF; | |
610 | float:left; |
|
610 | display: block; | |
611 | border-left:1px solid #316293; |
|
611 | float: left; | |
612 | color:#fff; |
|
612 | font-size: 13px; | |
613 | font-size:11px; |
|
613 | font-weight: 700; | |
614 | font-weight:700; |
|
614 | height: 1%; | |
615 | text-decoration:none; |
|
615 | margin: 0; | |
616 | margin:0; |
|
616 | padding: 11px 22px 12px; | |
617 | padding:13px 16px 12px; |
|
617 | text-decoration: none; | |
618 | } |
|
618 | } | |
619 |
|
619 | |||
620 | #content div.box h1,#content div.box h2,#content div.box h3,#content div.box h4,#content div.box h5,#content div.box h6 { |
|
620 | #content div.box h1,#content div.box h2,#content div.box h3,#content div.box h4,#content div.box h5,#content div.box h6 { |
General Comments 0
You need to be logged in to leave comments.
Login now