##// END OF EJS Templates
download: make use of default landing revision for downloads too.
marcink -
r4412:a05a39ec default
parent child Browse files
Show More
@@ -1,252 +1,254 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <%def name="refs_counters(branches, closed_branches, tags, bookmarks)">
4 4 <span class="summary-branchtag summary-tag">
5 5 <a href="${h.route_path('branches_home',repo_name=c.repo_name)}" class="childs">
6 6 <i class="icon-branch"></i>
7 7 % if len(branches) == 1:
8 8 <span>${len(branches)}</span> ${_('Branch')}
9 9 % else:
10 10 <span>${len(branches)}</span> ${_('Branches')}
11 11 % endif
12 12 </a>
13 13 </span>
14 14
15 15 %if closed_branches:
16 16 <span class="summary-branchtag summary-tag">
17 17 <a href="${h.route_path('branches_home',repo_name=c.repo_name)}" class="childs">
18 18 <i class="icon-branch"></i>
19 19 % if len(closed_branches) == 1:
20 20 <span>${len(closed_branches)}</span> ${_('Closed Branch')}
21 21 % else:
22 22 <span>${len(closed_branches)}</span> ${_('Closed Branches')}
23 23 % endif
24 24 </a>
25 25 </span>
26 26 %endif
27 27
28 28 <span class="summary-tagtag summary-tag">
29 29 <a href="${h.route_path('tags_home',repo_name=c.repo_name)}" class="childs">
30 30 <i class="icon-tag"></i>
31 31 % if len(tags) == 1:
32 32 <span>${len(tags)}</span> ${_('Tag')}
33 33 % else:
34 34 <span>${len(tags)}</span> ${_('Tags')}
35 35 % endif
36 36 </a>
37 37 </span>
38 38
39 39 %if bookmarks:
40 40 <span class="summary-booktag summary-tag">
41 41 <a href="${h.route_path('bookmarks_home',repo_name=c.repo_name)}" class="childs">
42 42 <i class="icon-bookmark"></i>
43 43 % if len(bookmarks) == 1:
44 44 <span>${len(bookmarks)}</span> ${_('Bookmark')}
45 45 % else:
46 46 <span>${len(bookmarks)}</span> ${_('Bookmarks')}
47 47 % endif
48 48 </a>
49 49 </span>
50 50 %endif
51 51 </%def>
52 52
53 53 <%def name="summary_detail(breadcrumbs_links, show_downloads=True)">
54 54 <% summary = lambda n:{False:'summary-short'}.get(n) %>
55 55
56 56 <div id="summary-menu-stats" class="summary-detail">
57 57 <div class="fieldset">
58 58 <div class="left-content">
59 59 <div class="left-clone">
60 60 <select id="clone_option" name="clone_option">
61 61 <option value="http" selected="selected">HTTP</option>
62 62 <option value="http_id">HTTP UID</option>
63 63 % if c.ssh_enabled:
64 64 <option value="ssh">SSH</option>
65 65 % endif
66 66 </select>
67 67 </div>
68 68
69 69 <div class="right-clone">
70 70 <%
71 71 maybe_disabled = ''
72 72 if h.is_svn_without_proxy(c.rhodecode_db_repo):
73 73 maybe_disabled = 'disabled'
74 74 %>
75 75
76 76 <span id="clone_option_http">
77 77 <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url}"/>
78 78 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url}" title="${_('Copy the clone url')}"></i>
79 79 </span>
80 80
81 81 <span style="display: none;" id="clone_option_http_id">
82 82 <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url_id}"/>
83 83 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_id}" title="${_('Copy the clone by id url')}"></i>
84 84 </span>
85 85
86 86 <span style="display: none;" id="clone_option_ssh">
87 87 <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url_ssh}"/>
88 88 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_ssh}" title="${_('Copy the clone by ssh url')}"></i>
89 89 </span>
90 90
91 91 % if maybe_disabled:
92 92 <p class="help-block">${_('SVN Protocol is disabled. To enable it, see the')} <a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('documentation here')}</a>.</p>
93 93 % endif
94 94 </div>
95 95 </div>
96 96
97 97 <div class="right-content">
98 98 <div class="commit-info">
99 99 <div class="tags">
100 100 <% commit_rev = c.rhodecode_db_repo.changeset_cache.get('revision') %>
101 101 % if c.rhodecode_repo:
102 102 ${refs_counters(
103 103 c.rhodecode_repo.branches,
104 104 c.rhodecode_repo.branches_closed,
105 105 c.rhodecode_repo.tags,
106 106 c.rhodecode_repo.bookmarks)}
107 107 % else:
108 108 ## missing requirements can make c.rhodecode_repo None
109 109 ${refs_counters([], [], [], [])}
110 110 % endif
111 111
112 112 ## commits
113 113 <span class="summary-tag">
114 114 % if commit_rev == -1:
115 115 <i class="icon-history"></i>
116 116 % if commit_rev == -1:
117 117 <span>0</span> ${_('Commit')}
118 118 % else:
119 119 <span>0</span> ${_('Commits')}
120 120 % endif
121 121 % else:
122 122 <a href="${h.route_path('repo_commits', repo_name=c.repo_name)}">
123 123 <i class="icon-history"></i>
124 124 % if commit_rev == 1:
125 125 <span>${commit_rev}</span> ${_('Commit')}
126 126 % else:
127 127 <span>${commit_rev}</span> ${_('Commits')}
128 128 % endif
129 129 </a>
130 130 % endif
131 131 </span>
132 132
133 133 ## forks
134 134 <span class="summary-tag">
135 135 <a title="${_('Number of Repository Forks')}" href="${h.route_path('repo_forks_show_all', repo_name=c.repo_name)}">
136 136 <i class="icon-code-fork"></i>
137 137 <span>${c.repository_forks}</span> ${_ungettext('Fork', 'Forks', c.repository_forks)}</a>
138 138 </span>
139 139 </div>
140 140 </div>
141 141 </div>
142 142 </div>
143 143 ## owner, description, downloads, statistics
144 144
145 145 ## Owner
146 146 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
147 147 <div class="left-label-summary">
148 148 <p>${_('Owner')}</p>
149 149 <div class="right-label-summary">
150 150 ${base.gravatar_with_user(c.rhodecode_db_repo.user.email, 16, tooltip=True)}
151 151 </div>
152 152
153 153 </div>
154 154 </div>
155 155
156 156 ## Description
157 157 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
158 158 <div class="left-label-summary">
159 159 <p>${_('Description')}</p>
160 160
161 161 <div class="right-label-summary input ${summary(c.show_stats)}">
162 162 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
163 163 ${dt.repo_desc(c.rhodecode_db_repo.description_safe, c.visual.stylify_metatags)}
164 164 </div>
165 165 </div>
166 166 </div>
167 167
168 168 ## Downloads
169 169 % if show_downloads:
170 170 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
171 171 <div class="left-label-summary">
172 172 <p>${_('Downloads')}</p>
173 173
174 174 <div class="right-label-summary input ${summary(c.show_stats)} downloads">
175 175 % if c.rhodecode_repo and len(c.rhodecode_repo.commit_ids) == 0:
176 176 <span class="disabled">
177 177 ${_('There are no downloads yet')}
178 178 </span>
179 179 % elif not c.enable_downloads:
180 180 <span class="disabled">
181 181 ${_('Downloads are disabled for this repository')}.
182 182 </span>
183 183 % if c.is_super_admin:
184 184 ${h.link_to(_('Enable downloads'),h.route_path('edit_repo',repo_name=c.repo_name, _anchor='repo_enable_downloads'))}
185 185 % endif
186 186 % else:
187 187 <span class="enabled">
188 <a id="archive_link" class="btn btn-small" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name,fname='tip.zip')}">
189 tip.zip
188
189 <a id="archive_link" class="btn btn-small" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname=c.rhodecode_db_repo.landing_ref_name+'.zip')}">
190 <i class="icon-download"></i>
191 ${c.rhodecode_db_repo.landing_ref_name}.zip
190 192 ## replaced by some JS on select
191 193 </a>
192 194 </span>
193 195 ${h.hidden('download_options')}
194 196 % endif
195 197 </div>
196 198 </div>
197 199 </div>
198 200 % endif
199 201
200 202 ## Repo size
201 203 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
202 204 <div class="left-label-summary">
203 205 <p>${_('Repository size')}</p>
204 206
205 207 <div class="right-label-summary">
206 208 <div class="tags">
207 209 ## repo size
208 210 % if commit_rev == -1:
209 211 <span class="stats-bullet">0 B</span>
210 212 % else:
211 213 <span>
212 214 <a href="#showSize" onclick="calculateSize(); $(this).hide(); return false" id="show-repo-size">Show repository size</a>
213 215 </span>
214 216 <span class="stats-bullet" id="repo_size_container" style="display:none">
215 217 ${_('Calculating Repository Size...')}
216 218 </span>
217 219 % endif
218 220 </div>
219 221 </div>
220 222 </div>
221 223 </div>
222 224
223 225 ## Statistics
224 226 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
225 227 <div class="left-label-summary">
226 228 <p>${_('Code Statistics')}</p>
227 229
228 230 <div class="right-label-summary input ${summary(c.show_stats)} statistics">
229 231 % if c.show_stats:
230 232 <div id="lang_stats" class="enabled">
231 233 <a href="#showSize" onclick="calculateSize(); $('#show-repo-size').hide(); $(this).hide(); return false" id="show-repo-size">Show code statistics</a>
232 234 </div>
233 235 % else:
234 236 <span class="disabled">
235 237 ${_('Statistics are disabled for this repository')}.
236 238 </span>
237 239 % if c.is_super_admin:
238 240 ${h.link_to(_('Enable statistics'),h.route_path('edit_repo',repo_name=c.repo_name, _anchor='repo_enable_statistics'))}
239 241 % endif
240 242 % endif
241 243 </div>
242 244
243 245 </div>
244 246 </div>
245 247
246 248
247 249 </div><!--end summary-detail-->
248 250
249 251 <div id="summary_details_expand" class="btn-collapse" data-toggle="summary-details">
250 252 ${_('Show More')}
251 253 </div>
252 254 </%def>
@@ -1,118 +1,119 b''
1 1 <%inherit file="/summary/summary_base.mako"/>
2 2
3 3 <%namespace name="components" file="/summary/components.mako"/>
4 4
5 5
6 6 <%def name="menu_bar_subnav()">
7 7 ${self.repo_menu(active='summary')}
8 8 </%def>
9 9
10 10 <%def name="main()">
11 11
12 12 <div id="repo-summary" class="summary">
13 13 ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=True)}
14 14 </div><!--end repo-summary-->
15 15
16 16
17 17 <div class="box">
18 18 %if not c.repo_commits:
19 19 <div class="empty-repo">
20 20 <div class="title">
21 21 <h3>${_('Quick start')}</h3>
22 22 </div>
23 23 <div class="clear-fix"></div>
24 24 </div>
25 25 %endif
26 26 <div class="table">
27 27 <div id="shortlog_data">
28 28 <%include file='summary_commits.mako'/>
29 29 </div>
30 30 </div>
31 31 </div>
32 32
33 33 %if c.readme_data:
34 34 <div id="readme" class="anchor">
35 35 <div class="box">
36 36
37 37 <div class="readme-title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_ref_type, c.rhodecode_db_repo.landing_ref_name))}">
38 38 <div>
39 39 <i class="icon-file-text"></i>
40 40 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_ref_name,f_path=c.readme_file)}">
41 41 ${c.readme_file}
42 42 </a>
43 43 </div>
44 44 </div>
45 45 <div class="readme codeblock">
46 46 <div class="readme_box">
47 47 ${c.readme_data|n}
48 48 </div>
49 49 </div>
50 50 </div>
51 51 </div>
52 52 %endif
53 53
54 54 <script type="text/javascript">
55 55 $(document).ready(function(){
56 56
57 57 var showCloneField = function(clone_url_format){
58 58 $.each(['http', 'http_id', 'ssh'], function (idx, val) {
59 59 if(val === clone_url_format){
60 60 $('#clone_option_' + val).show();
61 61 $('#clone_option').val(val)
62 62 } else {
63 63 $('#clone_option_' + val).hide();
64 64 }
65 65 });
66 66 };
67 67 // default taken from session
68 68 showCloneField(templateContext.session_attrs.clone_url_format);
69 69
70 70 $('#clone_option').on('change', function(e) {
71 71 var selected = $(this).val();
72 72
73 73 storeUserSessionAttr('rc_user_session_attr.clone_url_format', selected);
74 74 showCloneField(selected)
75 75 });
76 76
77 77 var initialCommitData = {
78 78 id: null,
79 text: 'tip',
80 type: 'tag',
79 text: '${c.rhodecode_db_repo.landing_ref_name}',
80 type: '${c.rhodecode_db_repo.landing_ref_type}',
81 81 raw_id: null,
82 82 files_url: null
83 83 };
84 84
85 85 select2RefSwitcher('#download_options', initialCommitData);
86 86
87 87 // on change of download options
88 88 $('#download_options').on('change', function(e) {
89 89 // format of Object {text: "v0.0.3", type: "tag", id: "rev"}
90 90 var ext = '.zip';
91 91 var selected_cs = e.added;
92 92 var fname = e.added.raw_id + ext;
93 93 var href = pyroutes.url('repo_archivefile', {'repo_name': templateContext.repo_name, 'fname':fname});
94 94 // set new label
95 $('#archive_link').html('{0}{1}'.format(escapeHtml(e.added.text), ext));
95 var ico = '<i class="icon-download"></i>';
96 $('#archive_link').html(ico+' {0}{1}'.format(escapeHtml(e.added.text), ext));
96 97
97 98 // set new url to button,
98 99 $('#archive_link').attr('href', href)
99 100 });
100 101
101 102
102 103 // calculate size of repository
103 104 calculateSize = function () {
104 105
105 106 var callback = function (data) {
106 107 % if c.show_stats:
107 108 showRepoStats('lang_stats', data);
108 109 % endif
109 110 };
110 111
111 112 showRepoSize('repo_size_container', templateContext.repo_name, templateContext.repo_landing_commit, callback);
112 113
113 114 }
114 115
115 116 })
116 117 </script>
117 118
118 119 </%def>
General Comments 0
You need to be logged in to leave comments. Login now