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