Show More
@@ -43,19 +43,24 b' except ImportError:' | |||||
43 | log = logging.getLogger(__name__) |
|
43 | log = logging.getLogger(__name__) | |
44 |
|
44 | |||
45 | class SummaryController(BaseController): |
|
45 | class SummaryController(BaseController): | |
46 |
|
46 | |||
47 | @LoginRequired() |
|
47 | @LoginRequired() | |
48 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
48 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
49 |
'repository.admin') |
|
49 | 'repository.admin') | |
50 | def __before__(self): |
|
50 | def __before__(self): | |
51 | super(SummaryController, self).__before__() |
|
51 | super(SummaryController, self).__before__() | |
52 |
|
52 | |||
53 | def index(self): |
|
53 | def index(self): | |
54 | hg_model = HgModel() |
|
54 | hg_model = HgModel() | |
55 | c.repo_info = hg_model.get_repo(c.repo_name) |
|
55 | c.repo_info = hg_model.get_repo(c.repo_name) | |
56 | c.repo_changesets = Page(list(c.repo_info[:10]), page=1, items_per_page=20) |
|
56 | def url_generator(**kw): | |
|
57 | return url('shortlog_home', repo_name=c.repo_name, **kw) | |||
|
58 | ||||
|
59 | c.repo_changesets = Page(c.repo_info, page=1, items_per_page=10, | |||
|
60 | url=url_generator) | |||
|
61 | ||||
57 | e = request.environ |
|
62 | e = request.environ | |
58 |
|
63 | |||
59 | uri = u'%(protocol)s://%(user)s@%(host)s%(prefix)s/%(repo_name)s' % { |
|
64 | uri = u'%(protocol)s://%(user)s@%(host)s%(prefix)s/%(repo_name)s' % { | |
60 | 'protocol': e.get('wsgi.url_scheme'), |
|
65 | 'protocol': e.get('wsgi.url_scheme'), | |
61 | 'user':str(c.rhodecode_user.username), |
|
66 | 'user':str(c.rhodecode_user.username), | |
@@ -66,30 +71,30 b' class SummaryController(BaseController):' | |||||
66 | c.repo_tags = OrderedDict() |
|
71 | c.repo_tags = OrderedDict() | |
67 | for name, hash in c.repo_info.tags.items()[:10]: |
|
72 | for name, hash in c.repo_info.tags.items()[:10]: | |
68 | c.repo_tags[name] = c.repo_info.get_changeset(hash) |
|
73 | c.repo_tags[name] = c.repo_info.get_changeset(hash) | |
69 |
|
74 | |||
70 | c.repo_branches = OrderedDict() |
|
75 | c.repo_branches = OrderedDict() | |
71 | for name, hash in c.repo_info.branches.items()[:10]: |
|
76 | for name, hash in c.repo_info.branches.items()[:10]: | |
72 | c.repo_branches[name] = c.repo_info.get_changeset(hash) |
|
77 | c.repo_branches[name] = c.repo_info.get_changeset(hash) | |
73 |
|
78 | |||
74 |
td = datetime.today() + timedelta(days=1) |
|
79 | td = datetime.today() + timedelta(days=1) | |
75 | y, m, d = td.year, td.month, td.day |
|
80 | y, m, d = td.year, td.month, td.day | |
76 |
|
81 | |||
77 | ts_min_y = mktime((y - 1, (td - timedelta(days=calendar.mdays[m])).month, |
|
82 | ts_min_y = mktime((y - 1, (td - timedelta(days=calendar.mdays[m])).month, | |
78 | d, 0, 0, 0, 0, 0, 0,)) |
|
83 | d, 0, 0, 0, 0, 0, 0,)) | |
79 | ts_min_m = mktime((y, (td - timedelta(days=calendar.mdays[m])).month, |
|
84 | ts_min_m = mktime((y, (td - timedelta(days=calendar.mdays[m])).month, | |
80 | d, 0, 0, 0, 0, 0, 0,)) |
|
85 | d, 0, 0, 0, 0, 0, 0,)) | |
81 |
|
86 | |||
82 | ts_max_y = mktime((y, m, d, 0, 0, 0, 0, 0, 0,)) |
|
87 | ts_max_y = mktime((y, m, d, 0, 0, 0, 0, 0, 0,)) | |
83 |
|
88 | |||
84 | run_task(get_commits_stats, c.repo_info.name, ts_min_y, ts_max_y) |
|
89 | run_task(get_commits_stats, c.repo_info.name, ts_min_y, ts_max_y) | |
85 | c.ts_min = ts_min_m |
|
90 | c.ts_min = ts_min_m | |
86 | c.ts_max = ts_max_y |
|
91 | c.ts_max = ts_max_y | |
87 |
|
92 | |||
88 | stats = self.sa.query(Statistics)\ |
|
93 | stats = self.sa.query(Statistics)\ | |
89 | .filter(Statistics.repository == c.repo_info.dbrepo)\ |
|
94 | .filter(Statistics.repository == c.repo_info.dbrepo)\ | |
90 | .scalar() |
|
95 | .scalar() | |
91 |
|
96 | |||
92 |
|
97 | |||
93 | if stats and stats.languages: |
|
98 | if stats and stats.languages: | |
94 | lang_stats = json.loads(stats.languages) |
|
99 | lang_stats = json.loads(stats.languages) | |
95 | c.commit_data = stats.commit_activity |
|
100 | c.commit_data = stats.commit_activity | |
@@ -103,6 +108,6 b' class SummaryController(BaseController):' | |||||
103 | c.commit_data = json.dumps({}) |
|
108 | c.commit_data = json.dumps({}) | |
104 | c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 0] ]) |
|
109 | c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 0] ]) | |
105 | c.trending_languages = json.dumps({}) |
|
110 | c.trending_languages = json.dumps({}) | |
106 |
|
111 | |||
107 | return render('summary/summary.html') |
|
112 | return render('summary/summary.html') | |
108 |
|
113 |
@@ -116,14 +116,14 b'' | |||||
116 | <span>${_('Summary')}</span> |
|
116 | <span>${_('Summary')}</span> | |
117 | </a> |
|
117 | </a> | |
118 | </li> |
|
118 | </li> | |
119 | <li ${is_current('shortlog')}> |
|
119 | ##<li ${is_current('shortlog')}> | |
120 | <a title="${_('Shortlog')}" href="${h.url('shortlog_home',repo_name=c.repo_name)}"> |
|
120 | ## <a title="${_('Shortlog')}" href="${h.url('shortlog_home',repo_name=c.repo_name)}"> | |
121 | <span class="icon"> |
|
121 | ## <span class="icon"> | |
122 | <img src="/images/icons/application_view_list.png" alt="${_('Shortlog')}" /> |
|
122 | ## <img src="/images/icons/application_view_list.png" alt="${_('Shortlog')}" /> | |
123 | </span> |
|
123 | ## </span> | |
124 | <span>${_('Shortlog')}</span> |
|
124 | ## <span>${_('Shortlog')}</span> | |
125 | </a> |
|
125 | ## </a> | |
126 | </li> |
|
126 | ##</li> | |
127 | <li ${is_current('changelog')}> |
|
127 | <li ${is_current('changelog')}> | |
128 | <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=c.repo_name)}"> |
|
128 | <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=c.repo_name)}"> | |
129 | <span class="icon"> |
|
129 | <span class="icon"> | |
@@ -142,7 +142,7 b'' | |||||
142 | </a> |
|
142 | </a> | |
143 | <ul> |
|
143 | <ul> | |
144 | <li> |
|
144 | <li> | |
145 | ${h.link_to(_('branches'),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')} |
|
145 | ${h.link_to('%s (%s)' % (_('branches'),len(c.repository_branches.values()),),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')} | |
146 | <ul> |
|
146 | <ul> | |
147 | %if c.repository_branches.values(): |
|
147 | %if c.repository_branches.values(): | |
148 | %for cnt,branch in enumerate(c.repository_branches.items()): |
|
148 | %for cnt,branch in enumerate(c.repository_branches.items()): | |
@@ -154,7 +154,7 b'' | |||||
154 | </ul> |
|
154 | </ul> | |
155 | </li> |
|
155 | </li> | |
156 | <li> |
|
156 | <li> | |
157 | ${h.link_to(_('tags'),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')} |
|
157 | ${h.link_to('%s (%s)' % (_('tags'),len(c.repository_tags.values()),),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')} | |
158 | <ul> |
|
158 | <ul> | |
159 | %if c.repository_tags.values(): |
|
159 | %if c.repository_tags.values(): | |
160 | %for cnt,tag in enumerate(c.repository_tags.items()): |
|
160 | %for cnt,tag in enumerate(c.repository_tags.items()): |
@@ -42,14 +42,12 b' E.onDOMReady(function(e){' | |||||
42 | <label>${_('Name')}:</label> |
|
42 | <label>${_('Name')}:</label> | |
43 | </div> |
|
43 | </div> | |
44 | <div class="input-short"> |
|
44 | <div class="input-short"> | |
45 |
|
45 | %if c.repo_info.dbrepo.repo_type =='hg': | ||
46 | %if c.repo_info.dbrepo.repo_type =='hg': |
|
46 | <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/> | |
47 | <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/> |
|
47 | %endif | |
48 |
|
|
48 | %if c.repo_info.dbrepo.repo_type =='git': | |
49 |
|
|
49 | <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="/images/icons/giticon.png"/> | |
50 |
|
|
50 | %endif | |
51 |
|
||||
52 | %endif |
|
|||
53 |
|
51 | |||
54 | %if c.repo_info.dbrepo.private: |
|
52 | %if c.repo_info.dbrepo.private: | |
55 | <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/> |
|
53 | <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/> | |
@@ -561,10 +559,12 b' E.onDOMReady(function(e){' | |||||
561 | <div class="breadcrumbs">${h.link_to(_('Last ten changes'),h.url('changelog_home',repo_name=c.repo_name))}</div> |
|
559 | <div class="breadcrumbs">${h.link_to(_('Last ten changes'),h.url('changelog_home',repo_name=c.repo_name))}</div> | |
562 | </div> |
|
560 | </div> | |
563 | <div class="table"> |
|
561 | <div class="table"> | |
564 | <%include file='../shortlog/shortlog_data.html'/> |
|
562 | <div id="shortlog_data"> | |
565 | %if c.repo_changesets: |
|
563 | <%include file='../shortlog/shortlog_data.html'/> | |
566 | ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))} |
|
564 | </div> | |
567 | %endif |
|
565 | ##%if c.repo_changesets: | |
|
566 | ## ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))} | |||
|
567 | ##%endif | |||
568 | </div> |
|
568 | </div> | |
569 | </div> |
|
569 | </div> | |
570 | <div class="box"> |
|
570 | <div class="box"> |
General Comments 0
You need to be logged in to leave comments.
Login now