Show More
@@ -19,6 +19,7 b' news' | |||||
19 | into clone url |
|
19 | into clone url | |
20 | - fixed #90 whoosh indexer can index chooses repositories passed in command |
|
20 | - fixed #90 whoosh indexer can index chooses repositories passed in command | |
21 | line |
|
21 | line | |
|
22 | - added dynamic download links in summary. With quick branch/tag selection | |||
22 |
|
23 | |||
23 | fixes |
|
24 | fixes | |
24 | ----- |
|
25 | ----- |
@@ -130,14 +130,14 b'' | |||||
130 | <div class="input-short"> |
|
130 | <div class="input-short"> | |
131 |
|
131 | |||
132 | ${h.select('download_options','tip',c.download_options)} |
|
132 | ${h.select('download_options','tip',c.download_options)} | |
133 |
|
||||
134 | %for cnt,archive in enumerate(c.repo_info._get_archives()): |
|
133 | %for cnt,archive in enumerate(c.repo_info._get_archives()): | |
135 | %if cnt >=1: |
|
134 | %if cnt >=1: | |
136 | | |
|
135 | | | |
137 | %endif |
|
136 | %endif | |
138 | ${h.link_to(archive['type'], |
|
137 | <span class="tooltip" title="${_('Download %s as %s') %('tip',archive['type'])}" | |
|
138 | id="${archive['type']+'_link'}">${h.link_to(archive['type'], | |||
139 | h.url('files_archive_home',repo_name=c.repo_info.name, |
|
139 | h.url('files_archive_home',repo_name=c.repo_info.name, | |
140 | fname='tip'+archive['extension']),class_="archive_icon")} |
|
140 | fname='tip'+archive['extension']),class_="archive_icon")}</span> | |
141 | %endfor |
|
141 | %endfor | |
142 | </div> |
|
142 | </div> | |
143 | </div> |
|
143 | </div> | |
@@ -153,97 +153,112 b'' | |||||
153 | </div> |
|
153 | </div> | |
154 | </div> |
|
154 | </div> | |
155 | </div> |
|
155 | </div> | |
156 |
|
|
156 | <script type="text/javascript"> | |
157 |
|
|
157 | YUE.onDOMReady(function(e){ | |
158 |
|
|
158 | id = 'clone_url'; | |
159 |
|
|
159 | YUE.on(id,'click',function(e){ | |
160 |
|
|
160 | YUD.get('clone_url').select(); | |
161 |
|
|
161 | }) | |
162 |
|
|
162 | }) | |
163 |
|
|
163 | var data = ${c.trending_languages|n}; | |
164 |
|
|
164 | var total = 0; | |
165 |
|
|
165 | var no_data = true; | |
166 |
|
|
166 | for (k in data){ | |
167 |
|
|
167 | total += data[k]; | |
168 |
|
|
168 | no_data = false; | |
169 |
|
|
169 | } | |
170 |
|
|
170 | var tbl = document.createElement('table'); | |
171 |
|
|
171 | tbl.setAttribute('class','trending_language_tbl'); | |
172 |
|
|
172 | var cnt =0; | |
173 |
|
|
173 | for (k in data){ | |
174 |
|
|
174 | cnt+=1; | |
175 |
|
|
175 | var hide = cnt>2; | |
176 |
|
|
176 | var tr = document.createElement('tr'); | |
177 |
|
|
177 | if (hide){ | |
178 |
|
|
178 | tr.setAttribute('style','display:none'); | |
179 |
|
|
179 | tr.setAttribute('class','stats_hidden'); | |
180 |
|
|
180 | } | |
181 |
|
|
181 | var percentage = Math.round((data[k]/total*100),2); | |
182 |
|
|
182 | var value = data[k]; | |
183 |
|
|
183 | var td1 = document.createElement('td'); | |
184 |
|
|
184 | td1.width=150; | |
185 |
|
|
185 | var trending_language_label = document.createElement('div'); | |
186 |
|
|
186 | trending_language_label.innerHTML = k; | |
187 |
|
|
187 | td1.appendChild(trending_language_label); | |
188 |
|
188 | |||
189 |
|
|
189 | var td2 = document.createElement('td'); | |
190 |
|
|
190 | td2.setAttribute('style','padding-right:14px !important'); | |
191 |
|
|
191 | var trending_language = document.createElement('div'); | |
192 |
|
|
192 | var nr_files = value+" ${_('files')}"; | |
193 |
|
|
193 | ||
194 |
|
|
194 | trending_language.title = k+" "+nr_files; | |
195 |
|
|
195 | ||
196 |
|
|
196 | if (percentage>20){ | |
197 |
|
|
197 | trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>"; | |
198 |
|
|
198 | } | |
199 |
|
|
199 | else{ | |
200 |
|
|
200 | trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>"; | |
201 |
|
|
201 | } | |
202 |
|
|
202 | ||
203 |
|
|
203 | trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner'); | |
204 |
|
|
204 | trending_language.style.width=percentage+"%"; | |
205 |
|
|
205 | td2.appendChild(trending_language); | |
206 |
|
|
206 | ||
207 |
|
|
207 | tr.appendChild(td1); | |
208 |
|
|
208 | tr.appendChild(td2); | |
209 |
|
|
209 | tbl.appendChild(tr); | |
210 |
|
|
210 | if(cnt == 2){ | |
211 |
|
|
211 | var show_more = document.createElement('tr'); | |
212 |
|
|
212 | var td=document.createElement('td'); | |
213 |
|
|
213 | lnk = document.createElement('a'); | |
214 |
|
|
214 | lnk.href='#'; | |
215 |
|
|
215 | lnk.innerHTML = "${_("show more")}"; | |
216 |
|
|
216 | lnk.id='code_stats_show_more'; | |
217 |
|
|
217 | td.appendChild(lnk); | |
218 |
|
|
218 | show_more.appendChild(td); | |
219 |
|
|
219 | show_more.appendChild(document.createElement('td')); | |
220 |
|
|
220 | tbl.appendChild(show_more); | |
221 |
|
|
221 | } | |
222 |
|
|
222 | ||
223 |
|
|
223 | } | |
224 |
|
|
224 | if(no_data){ | |
225 |
|
|
225 | var tr = document.createElement('tr'); | |
226 |
|
|
226 | var td1 = document.createElement('td'); | |
227 |
|
|
227 | td1.innerHTML = "${c.no_data_msg}"; | |
228 |
|
|
228 | tr.appendChild(td1); | |
229 |
|
|
229 | tbl.appendChild(tr); | |
230 |
|
|
230 | } | |
231 |
|
|
231 | YUD.get('lang_stats').appendChild(tbl); | |
232 |
|
|
232 | YUE.on('code_stats_show_more','click',function(){ | |
233 |
|
|
233 | l = YUD.getElementsByClassName('stats_hidden') | |
234 |
|
|
234 | for (e in l){ | |
235 |
|
|
235 | YUD.setStyle(l[e],'display',''); | |
236 |
|
|
236 | }; | |
237 |
|
|
237 | YUD.setStyle(YUD.get('code_stats_show_more'), | |
238 |
|
|
238 | 'display','none'); | |
239 |
|
|
239 | }) | |
240 |
|
|
240 | ||
|
241 | ||||
|
242 | YUE.on('download_options','change',function(e){ | |||
|
243 | var new_cs = e.target.options[e.target.selectedIndex]; | |||
|
244 | var tmpl_links = {} | |||
|
245 | %for cnt,archive in enumerate(c.repo_info._get_archives()): | |||
|
246 | tmpl_links['${archive['type']}'] = '${h.link_to(archive['type'], | |||
|
247 | h.url('files_archive_home',repo_name=c.repo_info.name, | |||
|
248 | fname='__CS__'+archive['extension']),class_="archive_icon")}'; | |||
|
249 | %endfor | |||
241 |
|
250 | |||
242 | YUE.on('download_options','change',function(e){ |
|
251 | ||
243 | var new_cs = e.target.options[e.target.selectedIndex].value; |
|
252 | for(k in tmpl_links){ | |
244 | }) |
|
253 | var s = YUD.get(k+'_link') | |
245 |
|
254 | title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__',archive['type'])}"; | ||
246 | </script> |
|
255 | s.title = title_tmpl.replace('__CS_NAME__',new_cs.text) | |
|
256 | s.innerHTML = tmpl_links[k].replace('__CS__',new_cs.value); | |||
|
257 | } | |||
|
258 | ||||
|
259 | }) | |||
|
260 | ||||
|
261 | </script> | |||
247 | </div> |
|
262 | </div> | |
248 |
|
263 | |||
249 | <div class="box box-right" style="min-height:455px"> |
|
264 | <div class="box box-right" style="min-height:455px"> |
General Comments 0
You need to be logged in to leave comments.
Login now