Show More
@@ -10,6 +10,7 b' from pylons.controllers.util import redi' | |||||
10 | from pylons.templating import render_mako as render |
|
10 | from pylons.templating import render_mako as render | |
11 |
|
11 | |||
12 | from rhodecode import __version__ |
|
12 | from rhodecode import __version__ | |
|
13 | from rhodecode.lib import str2bool | |||
13 | from rhodecode.lib.auth import AuthUser |
|
14 | from rhodecode.lib.auth import AuthUser | |
14 | from rhodecode.lib.utils import get_repo_slug |
|
15 | from rhodecode.lib.utils import get_repo_slug | |
15 | from rhodecode.model import meta |
|
16 | from rhodecode.model import meta | |
@@ -24,6 +25,7 b' class BaseController(WSGIController):' | |||||
24 | def __before__(self): |
|
25 | def __before__(self): | |
25 | c.rhodecode_version = __version__ |
|
26 | c.rhodecode_version = __version__ | |
26 | c.rhodecode_name = config.get('rhodecode_title') |
|
27 | c.rhodecode_name = config.get('rhodecode_title') | |
|
28 | c.use_gravatar = str2bool(config.get('use_gravatar')) | |||
27 | c.ga_code = config.get('rhodecode_ga_code') |
|
29 | c.ga_code = config.get('rhodecode_ga_code') | |
28 | c.repo_name = get_repo_slug(request) |
|
30 | c.repo_name = get_repo_slug(request) | |
29 | c.backends = BACKENDS.keys() |
|
31 | c.backends = BACKENDS.keys() | |
@@ -32,8 +34,6 b' class BaseController(WSGIController):' | |||||
32 | self.sa = meta.Session() |
|
34 | self.sa = meta.Session() | |
33 | self.scm_model = ScmModel(self.sa) |
|
35 | self.scm_model = ScmModel(self.sa) | |
34 |
|
36 | |||
35 | #c.unread_journal = scm_model.get_unread_journal() |
|
|||
36 |
|
||||
37 | def __call__(self, environ, start_response): |
|
37 | def __call__(self, environ, start_response): | |
38 | """Invoke the Controller""" |
|
38 | """Invoke the Controller""" | |
39 | # WSGIController.__call__ dispatches to the Controller method |
|
39 | # WSGIController.__call__ dispatches to the Controller method | |
@@ -56,11 +56,13 b' class BaseController(WSGIController):' | |||||
56 |
|
56 | |||
57 | class BaseRepoController(BaseController): |
|
57 | class BaseRepoController(BaseController): | |
58 | """ |
|
58 | """ | |
59 | Base class for controllers responsible for loading all needed data |
|
59 | Base class for controllers responsible for loading all needed data for | |
60 |
|
|
60 | repository loaded items are | |
61 |
|
61 | |||
62 |
c.rhodecode_repo: instance of scm repository |
|
62 | c.rhodecode_repo: instance of scm repository | |
63 |
|
63 | c.rhodecode_db_repo: instance of db | ||
|
64 | c.repository_followers: number of followers | |||
|
65 | c.repository_forks: number of forks | |||
64 | """ |
|
66 | """ | |
65 |
|
67 | |||
66 | def __before__(self): |
|
68 | def __before__(self): | |
@@ -76,7 +78,6 b' class BaseRepoController(BaseController)' | |||||
76 |
|
78 | |||
77 | redirect(url('home')) |
|
79 | redirect(url('home')) | |
78 |
|
80 | |||
79 |
c.repository_followers = |
|
81 | c.repository_followers = self.scm_model.get_followers(c.repo_name) | |
80 | self.scm_model.get_followers(c.repo_name) |
|
|||
81 | c.repository_forks = self.scm_model.get_forks(c.repo_name) |
|
82 | c.repository_forks = self.scm_model.get_forks(c.repo_name) | |
82 |
|
83 |
@@ -454,8 +454,8 b' HasRepoPermissionAny, HasRepoPermissionA' | |||||
454 | #============================================================================== |
|
454 | #============================================================================== | |
455 |
|
455 | |||
456 | def gravatar_url(email_address, size=30): |
|
456 | def gravatar_url(email_address, size=30): | |
457 |
if not str2bool(config['app_conf'].get('use_gravatar')) or |
|
457 | if (not str2bool(config['app_conf'].get('use_gravatar')) or | |
458 | email_address == 'anonymous@rhodecode.org': |
|
458 | not email_address or email_address == 'anonymous@rhodecode.org'): | |
459 | return url("/images/user%s.png" % size) |
|
459 | return url("/images/user%s.png" % size) | |
460 |
|
460 | |||
461 | ssl_enabled = 'https' == request.environ.get('wsgi.url_scheme') |
|
461 | ssl_enabled = 'https' == request.environ.get('wsgi.url_scheme') |
@@ -29,10 +29,13 b'' | |||||
29 | <div class="field"> |
|
29 | <div class="field"> | |
30 | <div class="gravatar_box"> |
|
30 | <div class="gravatar_box"> | |
31 | <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div> |
|
31 | <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div> | |
32 | <p> |
|
32 | <p> | |
33 | <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong><br/> |
|
33 | %if c.use_gravatar: | |
34 | ${_('Using')} ${c.user.email} |
|
34 | <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong> | |
35 | </p> |
|
35 | <br/>${_('Using')} ${c.user.email} | |
|
36 | %else: | |||
|
37 | <br/>${c.user.email} | |||
|
38 | %endif | |||
36 | </div> |
|
39 | </div> | |
37 | </div> |
|
40 | </div> | |
38 | <div class="field"> |
|
41 | <div class="field"> |
@@ -29,8 +29,12 b'' | |||||
29 | <div class="gravatar_box"> |
|
29 | <div class="gravatar_box"> | |
30 | <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div> |
|
30 | <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div> | |
31 | <p> |
|
31 | <p> | |
32 | <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong><br/> |
|
32 | %if c.use_gravatar: | |
33 | ${_('Using')} ${c.user.email} |
|
33 | <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong> | |
|
34 | <br/>${_('Using')} ${c.user.email} | |||
|
35 | %else: | |||
|
36 | <br/>${c.user.email} | |||
|
37 | %endif | |||
34 | </p> |
|
38 | </p> | |
35 | </div> |
|
39 | </div> | |
36 | </div> |
|
40 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now