##// END OF EJS Templates
added author to main page tooltip
marcink -
r1458:9d9e491e beta
parent child Browse files
Show More
@@ -1,150 +1,150 b''
1 1 /**
2 2 RhodeCode JS Files
3 3 **/
4 4
5 5 if (typeof console == "undefined" || typeof console.log == "undefined"){
6 6 console = { log: function() {} }
7 7 }
8 8
9 9
10 10 function str_repeat(i, m) {
11 11 for (var o = []; m > 0; o[--m] = i);
12 12 return o.join('');
13 13 }
14 14
15 15 /**
16 16 * INJECT .format function into String
17 17 * Usage: "My name is {0} {1}".format("Johny","Bravo")
18 18 * Return "My name is Johny Bravo"
19 19 * Inspired by https://gist.github.com/1049426
20 20 */
21 21 String.prototype.format = function() {
22 22
23 23 function format() {
24 24 var str = this;
25 25 var len = arguments.length+1;
26 26 var safe = undefined;
27 27 var arg = undefined;
28 28
29 29 // For each {0} {1} {n...} replace with the argument in that position. If
30 30 // the argument is an object or an array it will be stringified to JSON.
31 31 for (var i=0; i < len; arg = arguments[i++]) {
32 32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
33 33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
34 34 }
35 35 return str;
36 36 }
37 37
38 38 // Save a reference of what may already exist under the property native.
39 39 // Allows for doing something like: if("".format.native) { /* use native */ }
40 40 format.native = String.prototype.format;
41 41
42 42 // Replace the prototype property
43 43 return format;
44 44
45 45 }();
46 46
47 47 /**
48 48 * GLOBAL YUI Shortcuts
49 49 */
50 50 var YUC = YAHOO.util.Connect;
51 51 var YUD = YAHOO.util.Dom;
52 52 var YUE = YAHOO.util.Event;
53 53 var YUQ = YAHOO.util.Selector.query;
54 54
55 55 // defines if push state is enabled for this browser ?
56 56 var push_state_enabled = Boolean(
57 57 window.history && window.history.pushState && window.history.replaceState
58 58 && !( /* disable for versions of iOS before version 4.3 (8F190) */
59 59 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
60 60 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
61 61 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
62 62 )
63 63 )
64 64
65 65 /**
66 66 * Partial Ajax Implementation
67 67 *
68 68 * @param url: defines url to make partial request
69 69 * @param container: defines id of container to input partial result
70 70 * @param s_call: success callback function that takes o as arg
71 71 * o.tId
72 72 * o.status
73 73 * o.statusText
74 74 * o.getResponseHeader[ ]
75 75 * o.getAllResponseHeaders
76 76 * o.responseText
77 77 * o.responseXML
78 78 * o.argument
79 79 * @param f_call: failure callback
80 80 * @param args arguments
81 81 */
82 82 function ypjax(url,container,s_call,f_call,args){
83 83 var method='GET';
84 84 if(args===undefined){
85 85 args=null;
86 86 }
87 87
88 88 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR
89 89 YUC.initHeader('X-PARTIAL-XHR',true);
90 90
91 91 // wrapper of passed callback
92 92 var s_wrapper = (function(o){
93 93 return function(o){
94 94 YUD.get(container).innerHTML=o.responseText;
95 95 YUD.setStyle(container,'opacity','1.0');
96 96 //execute the given original callback
97 97 if (s_call !== undefined){
98 98 s_call(o);
99 99 }
100 100 }
101 101 })()
102 102 YUD.setStyle(container,'opacity','0.3');
103 103 YUC.asyncRequest(method,url,{
104 104 success:s_wrapper,
105 105 failure:function(o){
106 106 //failure
107 107 window.location = url;
108 108 }
109 109 },args);
110 110
111 111 }
112 112
113 113 /**
114 114 * tooltip activate
115 115 */
116 function tooltip_activate(){
116 var tooltip_activate = function(){
117 117 function toolTipsId(){
118 118 var ids = [];
119 119 var tts = YUQ('.tooltip');
120 120 for (var i = 0; i < tts.length; i++) {
121 121 // if element doesn't not have and id
122 122 // autogenerate one for tooltip
123 123 if (!tts[i].id){
124 124 tts[i].id='tt'+((i*100)+tts.length);
125 125 }
126 126 ids.push(tts[i].id);
127 127 }
128 128 return ids
129 129 };
130 130 var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
131 131 context: [[toolTipsId()],"tl","bl",null,[0,5]],
132 132 monitorresize:false,
133 133 xyoffset :[0,0],
134 134 autodismissdelay:300000,
135 135 hidedelay:5,
136 136 showdelay:20,
137 137 });
138 138 }
139 139
140 140 /**
141 141 * show more
142 142 */
143 function show_more_event(){
143 var show_more_event = function(){
144 144 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
145 145 var el = e.target;
146 146 YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
147 147 YUD.setStyle(el.parentNode,'display','none');
148 148 });
149 149 }
150 150
@@ -1,246 +1,246 b''
1 1 <%page args="parent" />
2 2 <%def name="get_sort(name)">
3 3 <%name_slug = name.lower().replace(' ','_') %>
4 4
5 5 %if name_slug == c.sort_slug:
6 6 %if c.sort_by.startswith('-'):
7 7 <a href="?sort=${name_slug}">${name}&uarr;</a>
8 8 %else:
9 9 <a href="?sort=-${name_slug}">${name}&darr;</a>
10 10 %endif:
11 11 %else:
12 12 <a href="?sort=${name_slug}">${name}</a>
13 13 %endif
14 14 </%def>
15 15
16 16 <div class="box">
17 17 <!-- box / title -->
18 18 <div class="title">
19 19 <h5><input class="top-right-rounded-corner top-left-rounded-corner
20 20 bottom-left-rounded-corner bottom-right-rounded-corner"
21 21 id="q_filter" size="15" type="text" name="filter"
22 22 value="${_('quick filter...')}"/>
23 23 ${parent.breadcrumbs()} <span id="repo_count"></span> ${_('repositories')}
24 24 </h5>
25 25 %if c.rhodecode_user.username != 'default':
26 26 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
27 27 <ul class="links">
28 28 <li>
29 29 <span>${h.link_to(_('ADD NEW REPOSITORY'),h.url('admin_settings_create_repository'))}</span>
30 30 </li>
31 31 </ul>
32 32 %endif
33 33 %endif
34 34 </div>
35 35 <!-- end box / title -->
36 36 <div class="table">
37 37 % if c.groups:
38 38 <table>
39 39 <thead>
40 40 <tr>
41 41 <th class="left"><a href="#">${_('Group name')}</a></th>
42 42 <th class="left"><a href="#">${_('Description')}</a></th>
43 43 ##<th class="left"><a href="#">${_('Number of repositories')}</a></th>
44 44 </tr>
45 45 </thead>
46 46
47 47 ## REPO GROUPS
48 48
49 49 % for gr in c.groups:
50 50 <tr>
51 51 <td>
52 52 <div style="white-space: nowrap">
53 53 <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/>
54 54 ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))}
55 55 </div>
56 56 </td>
57 57 <td>${gr.group_description}</td>
58 58 ##<td><b>${gr.repositories.count()}</b></td>
59 59 </tr>
60 60 % endfor
61 61
62 62 </table>
63 63 <div style="height: 20px"></div>
64 64 % endif
65 65 <div id="welcome" style="display:none;text-align:center">
66 66 <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1>
67 67 </div>
68 68 <table id="repos_list">
69 69 <thead>
70 70 <tr>
71 71 <th class="left"></th>
72 72 <th class="left">${get_sort(_('Name'))}</th>
73 73 <th class="left">${get_sort(_('Description'))}</th>
74 74 <th class="left">${get_sort(_('Last change'))}</th>
75 75 <th class="left">${get_sort(_('Tip'))}</th>
76 76 <th class="left">${get_sort(_('Owner'))}</th>
77 77 <th class="left">${_('RSS')}</th>
78 78 <th class="left">${_('Atom')}</th>
79 79 </tr>
80 80 </thead>
81 81 <tbody>
82 82 %for cnt,repo in enumerate(c.repos_list):
83 83 <tr class="parity${cnt%2}">
84 84 <td class="quick_repo_menu">
85 85 <ul class="menu_items hidden">
86 86 <li>
87 87 <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=repo['name'])}">
88 88 <span class="icon">
89 89 <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" />
90 90 </span>
91 91 <span>${_('Summary')}</span>
92 92 </a>
93 93 </li>
94 94 <li>
95 95 <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=repo['name'])}">
96 96 <span class="icon">
97 97 <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" />
98 98 </span>
99 99 <span>${_('Changelog')}</span>
100 100 </a>
101 101 </li>
102 102 <li>
103 103 <a title="${_('Files')}" href="${h.url('files_home',repo_name=repo['name'])}">
104 104 <span class="icon">
105 105 <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" />
106 106 </span>
107 107 <span>${_('Files')}</span>
108 108 </a>
109 109 </li>
110 110 </ul>
111 111 </td>
112 112 <td>
113 113 ## TYPE OF REPO
114 114 <div style="white-space: nowrap">
115 115 %if repo['dbrepo']['repo_type'] =='hg':
116 116 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
117 117 %elif repo['dbrepo']['repo_type'] =='git':
118 118 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
119 119 %endif
120 120
121 121 ##PRIVATE/PUBLIC
122 122 %if repo['dbrepo']['private']:
123 123 <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/>
124 124 %else:
125 125 <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/>
126 126 %endif
127 127
128 128 ##NAME
129 129 ${h.link_to(repo['name'],
130 130 h.url('summary_home',repo_name=repo['name']),class_="repo_name")}
131 131 %if repo['dbrepo_fork']:
132 132 <a href="${h.url('summary_home',repo_name=repo['dbrepo_fork']['repo_name'])}">
133 133 <img class="icon" alt="${_('fork')}"
134 134 title="${_('Fork of')} ${repo['dbrepo_fork']['repo_name']}"
135 135 src="${h.url('/images/icons/arrow_divide.png')}"/></a>
136 136 %endif
137 137 </div>
138 138 </td>
139 139 ##DESCRIPTION
140 140 <td><span class="tooltip" title="${h.tooltip(repo['description'])}">
141 141 ${h.truncate(repo['description'],60)}</span>
142 142 </td>
143 143 ##LAST CHANGE
144 144 <td>
145 145 <span class="tooltip" title="${repo['last_change']}">
146 146 ${h.age(repo['last_change'])}</span>
147 147 </td>
148 148 <td>
149 149 %if repo['rev']>=0:
150 150 ${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
151 151 h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
152 152 class_="tooltip",
153 title=h.tooltip(repo['last_msg']))}
153 title=h.tooltip('%s\n%s' % (repo['author'],repo['last_msg'])))}
154 154 %else:
155 155 ${_('No changesets yet')}
156 156 %endif
157 157 </td>
158 158 <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
159 159 <td>
160 160 %if c.rhodecode_user.username != 'default':
161 161 <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
162 162 %else:
163 163 <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
164 164 %endif:
165 165 </td>
166 166 <td>
167 167 %if c.rhodecode_user.username != 'default':
168 168 <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
169 169 %else:
170 170 <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'])}"></a>
171 171 %endif:
172 172 </td>
173 173 </tr>
174 174 %endfor
175 175
176 176 </tbody>
177 177 </table>
178 178 </div>
179 179 </div>
180 180
181 181
182 182 <script type="text/javascript">
183 183 var D = YAHOO.util.Dom;
184 184 var E = YAHOO.util.Event;
185 185 var S = YAHOO.util.Selector;
186 186
187 187 var q_filter = D.get('q_filter');
188 188 var F = YAHOO.namespace('q_filter');
189 189
190 190 E.on(q_filter,'click',function(){
191 191 q_filter.value = '';
192 192 });
193 193
194 194 F.filterTimeout = null;
195 195
196 196 function set_count(count){
197 197
198 198 if(count == 0){
199 199 YUD.setStyle('repos_list','display','none');
200 200 YUD.setStyle('welcome','display','');
201 201 }
202 202 else{
203 203 YUD.setStyle('repos_list','display','');
204 204 YUD.setStyle('welcome','display','none');
205 205 }
206 206 YUD.get('repo_count').innerHTML = count;
207 207
208 208 }
209 209
210 210
211 211 //set initial count for repos
212 212 var nodes = S.query('div.table tr td div a.repo_name');
213 213
214 214 set_count(nodes.length)
215 215 F.updateFilter = function() {
216 216 // Reset timeout
217 217 F.filterTimeout = null;
218 218
219 219 var obsolete = [];
220 220 nodes = S.query('div.table tr td div a.repo_name');
221 221 var req = q_filter.value.toLowerCase();
222 222 for (n in nodes){
223 223 D.setStyle(nodes[n].parentNode.parentNode.parentNode,'display','')
224 224 }
225 225 if (req){
226 226 for (n in nodes){
227 227 if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) {
228 228 obsolete.push(nodes[n]);
229 229 }
230 230 }
231 231 if(obsolete){
232 232 for (n in obsolete){
233 233 D.setStyle(obsolete[n].parentNode.parentNode.parentNode,'display','none');
234 234 }
235 235 }
236 236 }
237 237 // set new count into dashboard
238 238 set_count(nodes.length - obsolete.length)
239 239 }
240 240
241 241 E.on(q_filter,'keyup',function(e){
242 242 clearTimeout(F.filterTimeout);
243 243 F.filterTimeout = setTimeout(F.updateFilter,600);
244 244 });
245 245
246 246 </script>
General Comments 0
You need to be logged in to leave comments. Login now