Show More
@@ -149,15 +149,23 b' class FilesController(BaseController):' | |||||
149 | return render('files/files_annotate.html') |
|
149 | return render('files/files_annotate.html') | |
150 |
|
150 | |||
151 | def archivefile(self, repo_name, fname): |
|
151 | def archivefile(self, repo_name, fname): | |
152 | info = fname.split('.') |
|
|||
153 | revision, fileformat = info[0], '.' + '.'.join(info[1:]) |
|
|||
154 | archive_specs = { |
|
152 | archive_specs = { | |
155 | '.tar.bz2': ('application/x-tar', 'tbz2'), |
|
153 | '.tar.bz2': ('application/x-tar', 'tbz2'), | |
156 | '.tar.gz': ('application/x-tar', 'tgz'), |
|
154 | '.tar.gz': ('application/x-tar', 'tgz'), | |
157 | '.zip': ('application/zip', 'zip'), |
|
155 | '.zip': ('application/zip', 'zip'), | |
158 | } |
|
156 | } | |
|
157 | ||||
|
158 | fileformat = None | |||
|
159 | revision = None | |||
|
160 | ||||
|
161 | for ext in archive_specs.keys(): | |||
|
162 | archive_spec = fname.split(ext) | |||
|
163 | if len(archive_spec) == 2: | |||
|
164 | fileformat = archive_spec[1] or ext | |||
|
165 | revision = archive_spec[0] | |||
|
166 | ||||
159 | if not archive_specs.has_key(fileformat): |
|
167 | if not archive_specs.has_key(fileformat): | |
160 |
return _('Unknown archive type |
|
168 | return _('Unknown archive type') | |
161 |
|
169 | |||
162 | repo = ScmModel().get_repo(repo_name) |
|
170 | repo = ScmModel().get_repo(repo_name) | |
163 |
|
171 |
@@ -142,5 +142,27 b' class SummaryController(BaseController):' | |||||
142 | c.trending_languages = json.dumps({}) |
|
142 | c.trending_languages = json.dumps({}) | |
143 | c.no_data = True |
|
143 | c.no_data = True | |
144 |
|
144 | |||
|
145 | c.download_options = self._get_download_links(c.repo_info) | |||
|
146 | ||||
145 | return render('summary/summary.html') |
|
147 | return render('summary/summary.html') | |
146 |
|
148 | |||
|
149 | ||||
|
150 | ||||
|
151 | def _get_download_links(self, repo): | |||
|
152 | ||||
|
153 | download_l = [] | |||
|
154 | ||||
|
155 | branches_group = ([], _("Branches")) | |||
|
156 | tags_group = ([], _("Tags")) | |||
|
157 | ||||
|
158 | for name, chs in c.repository_branches.items(): | |||
|
159 | #chs = chs.split(':')[-1] | |||
|
160 | branches_group[0].append((chs, name),) | |||
|
161 | download_l.append(branches_group) | |||
|
162 | ||||
|
163 | for name, chs in c.repository_tags.items(): | |||
|
164 | #chs = chs.split(':')[-1] | |||
|
165 | tags_group[0].append((chs, name),) | |||
|
166 | download_l.append(tags_group) | |||
|
167 | ||||
|
168 | return download_l |
@@ -119,8 +119,39 b'' | |||||
119 | <label>${_('Trending source files')}:</label> |
|
119 | <label>${_('Trending source files')}:</label> | |
120 | </div> |
|
120 | </div> | |
121 | <div class="input-short"> |
|
121 | <div class="input-short"> | |
122 | <div id="lang_stats"> |
|
122 | <div id="lang_stats"></div> | |
|
123 | </div> | |||
|
124 | </div> | |||
|
125 | ||||
|
126 | <div class="field"> | |||
|
127 | <div class="label"> | |||
|
128 | <label>${_('Download')}:</label> | |||
|
129 | </div> | |||
|
130 | <div class="input-short"> | |||
|
131 | ||||
|
132 | ${h.select('download_options','tip',c.download_options)} | |||
123 |
|
133 | |||
|
134 | %for cnt,archive in enumerate(c.repo_info._get_archives()): | |||
|
135 | %if cnt >=1: | |||
|
136 | | | |||
|
137 | %endif | |||
|
138 | ${h.link_to(archive['type'], | |||
|
139 | h.url('files_archive_home',repo_name=c.repo_info.name, | |||
|
140 | fname='tip'+archive['extension']),class_="archive_icon")} | |||
|
141 | %endfor | |||
|
142 | </div> | |||
|
143 | </div> | |||
|
144 | ||||
|
145 | <div class="field"> | |||
|
146 | <div class="label"> | |||
|
147 | <label>${_('Feeds')}:</label> | |||
|
148 | </div> | |||
|
149 | <div class="input-short"> | |||
|
150 | ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.repo_info.name),class_='rss_icon')} | |||
|
151 | ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.repo_info.name),class_='atom_icon')} | |||
|
152 | </div> | |||
|
153 | </div> | |||
|
154 | </div> | |||
124 | </div> |
|
155 | </div> | |
125 | <script type="text/javascript"> |
|
156 | <script type="text/javascript"> | |
126 | YUE.onDOMReady(function(e){ |
|
157 | YUE.onDOMReady(function(e){ | |
@@ -207,38 +238,12 b'' | |||||
207 | 'display','none'); |
|
238 | 'display','none'); | |
208 | }) |
|
239 | }) | |
209 |
|
|
240 | ||
210 | </script> |
|
|||
211 |
|
||||
212 | </div> |
|
|||
213 | </div> |
|
|||
214 |
|
241 | |||
215 | <div class="field"> |
|
242 | YUE.on('download_options','change',function(e){ | |
216 | <div class="label"> |
|
243 | var new_cs = e.target.options[e.target.selectedIndex].value; | |
217 | <label>${_('Download')}:</label> |
|
244 | }) | |
218 | </div> |
|
|||
219 | <div class="input-short"> |
|
|||
220 | %for cnt,archive in enumerate(c.repo_info._get_archives()): |
|
|||
221 | %if cnt >=1: |
|
|||
222 | | |
|
|||
223 | %endif |
|
|||
224 | ${h.link_to(c.repo_info.name+'.'+archive['type'], |
|
|||
225 | h.url('files_archive_home',repo_name=c.repo_info.name, |
|
|||
226 | fname='tip'+archive['extension']),class_="archive_icon")} |
|
|||
227 | %endfor |
|
|||
228 | </div> |
|
|||
229 | </div> |
|
|||
230 |
|
245 | |||
231 | <div class="field"> |
|
246 | </script> | |
232 | <div class="label"> |
|
|||
233 | <label>${_('Feeds')}:</label> |
|
|||
234 | </div> |
|
|||
235 | <div class="input-short"> |
|
|||
236 | ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.repo_info.name),class_='rss_icon')} |
|
|||
237 | ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.repo_info.name),class_='atom_icon')} |
|
|||
238 | </div> |
|
|||
239 | </div> |
|
|||
240 | </div> |
|
|||
241 | </div> |
|
|||
242 | </div> |
|
247 | </div> | |
243 |
|
248 | |||
244 | <div class="box box-right" style="min-height:455px"> |
|
249 | <div class="box box-right" style="min-height:455px"> | |
@@ -644,4 +649,4 b'' | |||||
644 | </div> |
|
649 | </div> | |
645 | </div> |
|
650 | </div> | |
646 |
|
651 | |||
647 | </%def> No newline at end of file |
|
652 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now