Files @ 87c97fcea029
Branch filter:

Location: kallithea/rhodecode/templates/base/base.html

Leonardo
Adding the context bar too all pages related to a Repository.
Deleted top menu items that are on the context bar already.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
## -*- coding: utf-8 -*-
<%inherit file="root.html"/>

<!-- HEADER -->
<div id="header-dd"></div>
<div id="header">
    <div id="header-inner" class="title">
        <div id="logo">
            <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1>
        </div>
        <!-- MENU -->
        ${self.page_nav()}
        <!-- END MENU -->
        ${self.body()}
    </div>
</div>
<!-- END HEADER -->

<!-- CONTENT -->
<div id="content">
    <div class="flash_msg">
        <% messages = h.flash.pop_messages() %>
        % if messages:
        <ul id="flash-messages">
            % for message in messages:
            <li class="${message.category}_msg">${message}</li>
            % endfor
        </ul>
        % endif
    </div>
    <div id="main">
        ${next.main()}
    </div>
</div>
<!-- END CONTENT -->

<!-- FOOTER -->
<div id="footer">
   <div id="footer-inner" class="title">
       <div>
           <p class="footer-link">
                <a href="${h.url('bugtracker')}">${_('Submit a bug')}</a>
           </p>
           <p class="footer-link-right">
               <a href="${h.url('rhodecode_official')}">RhodeCode${'-%s' % c.rhodecode_instanceid if c.rhodecode_instanceid else ''}</a>
               ${c.rhodecode_version} &copy; 2010-${h.datetime.today().year} by Marcin Kuzminski
           </p>
       </div>
   </div>
</div>
<!-- END FOOTER -->

### MAKO DEFS ###
<%def name="page_nav()">
    ${self.menu()}
</%def>

<%def name="breadcrumbs()">
    <div class="breadcrumbs">
    ${self.breadcrumbs_links()}
    </div>
</%def>

<%def name="context_bar(current=None)">
   %if c.repo_name:
    ${repo_context_bar(current)}
   %endif
</%def>

<%def name="repo_context_bar(current=None)">
  <%
      def follow_class():
          if c.repository_following:
              return h.literal('following')
          else:
            return h.literal('follow')
  %>
  <%
    def is_current(selected):
        if selected == current:
            return h.literal('class="current"')
    %>

  <!--- CONTEXT BAR -->
  <div id="context-bar" class="box">
    <div id="context-top">
      <div id= "breadcrumbs">
        ${h.link_to(_(u'Repositories'),h.url('home'))}
        ยป
        ${h.repo_link(c.rhodecode_db_repo.groups_and_repo)}
      </div>
      ## TODO: this check feels wrong, it would be better to have a check for permissions
      ## also it feels like a job for the controller
      %if c.rhodecode_user.username != 'default':
        <ul id="context-actions" class="horizontal-list">
          <li>
           <button class="${follow_class()}" onclick="javascript:toggleFollowingRepo(this,${c.rhodecode_db_repo.repo_id},'${str(h.get_token())}');">
            <!--span class="icon show-follow follow"></span>
            <span class="icon show-following following"></span-->
            <span class="show-follow">${_('Follow')}</span>
            <span class="show-following">${_('Unfollow')}</span>
          </button>
          </li>
          <li><a href="${h.url('repo_fork_home',repo_name=c.repo_name)}" class="fork">${_('Fork')}</a></li>
          %if h.is_hg(c.rhodecode_repo):
          <li><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="pull-request">${_('Pull Request')}</a></li>
          %endif
        </ul>
      %endif
    </div>
    <div id="context-state">
      <button id="revision-changer">
        <span class="branch-name">graphics/shader-move</span>
        <span class="revision">@73318:8d3d6ee94072</span>
      </button>
      <ul id="context-pages" class="horizontal-list">
        <li ${is_current('summary')}><a href="${h.url('summary_home', repo_name=c.repo_name)}" class="summary">${_('Summary')}</a></li>
        <li ${is_current('changelog')}><a href="${h.url('changelog_home', repo_name=c.repo_name)}" class="changelogs">${_('Changelogs')}</a></li>
        <li ${is_current('files')}><a href="${h.url('files_home', repo_name=c.repo_name)}" class="files"></span>${_('Files')}</a></li>
        <li>
          <a href="#" id="branch_tag_switcher_2" class="dropdown switch-to"></span>${_('Switch To')}</a>
          <ul id="switch_to_list_2" class="switch_to submenu">
            <li><a href="#">${_('loading...')}</a></li>
          </ul>
        </li>
        <li ${is_current('options')}>
          <a href="#" class="dropdown options"></span>Options</a>
          <ul>
             %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
               %if h.HasPermissionAll('hg.admin')('access settings on repository'):
                   <li>${h.link_to(_('repository settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li>
               %else:
                   <li>${h.link_to(_('repository settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li>
               %endif
             %endif
              %if c.rhodecode_db_repo.fork:
               <li>${h.link_to(_('compare fork'),h.url('compare_url',repo_name=c.rhodecode_db_repo.fork.repo_name,org_ref_type='branch',org_ref='default',other_repo=c.repo_name,other_ref_type='branch',other_ref=request.GET.get('branch') or 'default'),class_='compare_request')}</li>
              %endif
              <li>${h.link_to(_('lightweight changelog'),h.url('shortlog_home',repo_name=c.repo_name),class_='shortlog')}</li>
              <li>${h.link_to(_('search'),h.url('search_repo',repo_name=c.repo_name),class_='search')}</li>

              %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
                %if c.rhodecode_db_repo.locked[0]:
                  <li>${h.link_to(_('unlock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_del')}</li>
                %else:
                  <li>${h.link_to(_('lock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_add')}</li>
                %endif
              %endif

              % if h.HasPermissionAll('hg.admin')('access admin main page'):
                 <li>
                   ${h.link_to(_('admin'),h.url('admin_home'),class_='admin childs')}
                    <%def name="admin_menu()">
                    <ul class="admin_menu">
                        <li>${h.link_to(_('admin journal'),h.url('admin_home'),class_='journal')}</li>
                        <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
                        <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
                        <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
                        <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li>
                        <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
                        <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
                        <li>${h.link_to(_('defaults'),h.url('defaults'),class_='defaults')}</li>
                        <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li>
                    </ul>
                    </%def>
                    ## ADMIN MENU
                    ${admin_menu()}
                 </li>
              ## if you're a admin of any groups, show admin menu for it
              % elif c.rhodecode_user.groups_admin:
                 <li>
                   ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
                    <%def name="admin_menu_simple()">
                    <ul>
                        <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
                    </ul>
                    </%def>
                    ## ADMIN MENU
                    ${admin_menu_simple()}
                 </li>
              % endif
             </ul>
        </li>
        <li ${is_current('showpullrequest')}><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}" title="${_('Show Pull Requests')}" class="pull-request">1</a></li>
      </ul>
    </div>
  </div>
  <script type="text/javascript">
      YUE.on('branch_tag_switcher_2','mouseover',function(){
         var loaded = YUD.hasClass('branch_tag_switcher_2','loaded');
         if(!loaded){
             YUD.addClass('branch_tag_switcher_2','loaded');
             ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list_2',
                 function(o){},
                 function(o){YUD.removeClass('branch_tag_switcher_2','loaded');}
                 ,null);
         }
         return false;
      });
  </script>
  <!--- END CONTEXT BAR -->
</%def>

<%def name="usermenu()">
    ## USER MENU
    <li>
      <a class="menu_link" id="quick_login_link">
          <span class="icon" style="padding:5px 5px 0px 5px">
             <img src="${h.gravatar_url(c.rhodecode_user.email,20)}" alt="avatar">
          </span>
          %if c.rhodecode_user.username != 'default':
            <span class="menu_link_user">${c.rhodecode_user.username}</span>
            %if c.unread_notifications != 0:
              <span class="menu_link_notifications">${c.unread_notifications}</span>
            %endif
          %else:
              <span>${_('Not logged in')}</span>
          %endif
      </a>

  <div class="user-menu">
      <div id="quick_login">
        %if c.rhodecode_user.username == 'default':
            <h4>${_('Login to your account')}</h4>
            ${h.form(h.url('login_home',came_from=h.url.current()))}
            <div class="form">
                <div class="fields">
                    <div class="field">
                        <div class="label">
                            <label for="username">${_('Username')}:</label>
                        </div>
                        <div class="input">
                            ${h.text('username',class_='focus',size=40)}
                        </div>

                    </div>
                    <div class="field">
                        <div class="label">
                            <label for="password">${_('Password')}:</label>
                        </div>
                        <div class="input">
                            ${h.password('password',class_='focus',size=40)}
                        </div>

                    </div>
                    <div class="buttons">
                        <div class="password_forgoten">${h.link_to(_('Forgot password ?'),h.url('reset_password'))}</div>
                        <div class="register">
                        %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
                         ${h.link_to(_("Don't have an account ?"),h.url('register'))}
                        %endif
                        </div>
                        <div class="submit">
                            ${h.submit('sign_in',_('Log In'),class_="ui-btn xsmall")}
                        </div>
                    </div>
                </div>
            </div>
            ${h.end_form()}
        %else:
            <div class="links_left">
                <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
                <div class="email">${c.rhodecode_user.email}</div>
                <div class="big_gravatar"><img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,48)}" /></div>
                <div class="notifications"><a href="${h.url('notifications')}">${_('Notifications')}</a></div>
                <div class="unread"><a href="${h.url('notifications')}">${_('Unread')}: ${c.unread_notifications}</a></div>
            </div>
            <div class="links_right">
            <ol class="links">
              <li>${h.link_to(_(u'Home'),h.url('home'))}</li>
              <li>${h.link_to(_(u'Journal'),h.url('journal'))}</li>
              <li>${h.link_to(_(u'My account'),h.url('admin_settings_my_account'))}</li>
              <li class="logout">${h.link_to(_(u'Log Out'),h.url('logout_home'))}</li>
            </ol>
            </div>
        %endif
      </div>
  </div>

    </li>
</%def>

<%def name="menu(current=None)">
        <%
        def is_current(selected):
            if selected == current:
                return h.literal('class="current"')
        %>
        <ul id="quick">
          <!-- repo switcher -->
          <li ${is_current('home')}>
              <a class="menu_link" id="repo_switcher" title="${_('Switch repository')}" href="${h.url('home')}">
              <span class="icon">
                  <img src="${h.url('/images/icons/database.png')}" alt="${_('Products')}" />
              </span>
              <span>${_('Repositories')}</span>
              </a>
              <ul id="repo_switcher_list" class="repo_switcher">
                  <li>
                      <a href="#">${_('loading...')}</a>
                  </li>
              </ul>
          </li>
        ## we render this menu only not for those pages
        %if current not in ['home','admin', 'search', 'journal']:
            ##REGULAR MENU
            <li>
                <a class="menu_link" title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}">
                <span class="icon_short">
                    <img src="${h.url('/images/icons/heart.png')}" alt="${_('Followers')}" />
                </span>
                <span id="current_followers_count" class="short">${c.repository_followers}</span>
                </a>
            </li>
            <li>
                <a class="menu_link" title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}">
                <span class="icon_short">
                    <img src="${h.url('/images/icons/arrow_divide.png')}" alt="${_('Forks')}" />
                </span>
                <span class="short">${c.repository_forks}</span>
                </a>
            </li>
            ${usermenu()}
            <script type="text/javascript">
                YUE.on('branch_tag_switcher','mouseover',function(){
                   var loaded = YUD.hasClass('branch_tag_switcher','loaded');
                   if(!loaded){
                       YUD.addClass('branch_tag_switcher','loaded');
                       ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list',
                           function(o){},
                           function(o){YUD.removeClass('branch_tag_switcher','loaded');}
                           ,null);
                   }
                   return false;
                });
            </script>
        %else:
            ##ROOT MENU
            %if c.rhodecode_user.username != 'default':
             <li ${is_current('journal')}>
                <a class="menu_link" title="${_('Show recent activity')}"  href="${h.url('journal')}">
                <span class="icon">
                    <img src="${h.url('/images/icons/book.png')}" alt="${_('Journal')}" />
                </span>
                <span>${_('Journal')}</span>
                </a>
             </li>
            %else:
             <li ${is_current('journal')}>
                <a class="menu_link" title="${_('Public journal')}"  href="${h.url('public_journal')}">
                <span class="icon">
                    <img src="${h.url('/images/icons/book.png')}" alt="${_('Public journal')}" />
                </span>
                <span>${_('Public journal')}</span>
                </a>
             </li>
            %endif
            <li ${is_current('search')}>
                <a class="menu_link" title="${_('Search in repositories')}"  href="${h.url('search')}">
                <span class="icon">
                    <img src="${h.url('/images/icons/search_16.png')}" alt="${_('Search')}" />
                </span>
                <span>${_('Search')}</span>
                </a>
            </li>
            % if h.HasPermissionAll('hg.admin')('access admin main page'):
            <li ${is_current('admin')}>
               <a class="menu_link" title="${_('Admin')}" href="${h.url('admin_home')}">
               <span class="icon">
                   <img src="${h.url('/images/icons/cog_edit.png')}" alt="${_('Admin')}" />
               </span>
               <span>${_('Admin')}</span>
               </a>
                ${admin_menu()}
            </li>
            % elif c.rhodecode_user.groups_admin:
            <li ${is_current('admin')}>
               <a class="menu_link" title="${_('Admin')}" href="${h.url('admin_home')}">
               <span class="icon">
                   <img src="${h.url('/images/icons/cog_edit.png')}" alt="${_('Admin')}" />
               </span>
               <span>${_('Admin')}</span>
               </a>
                ${admin_menu_simple()}
            </li>
            % endif
            ${usermenu()}
        %endif
<script type="text/javascript">
    YUE.on('repo_switcher','mouseover',function(){
      var target = 'q_filter_rs';
      var qfilter_activate = function(){
          var nodes = YUQ('ul#repo_switcher_list li a.repo_name');
          var func = function(node){
              return node.parentNode;
          }
          q_filter(target,nodes,func);
      }

      var loaded = YUD.hasClass('repo_switcher','loaded');
      if(!loaded){
         YUD.addClass('repo_switcher','loaded');
         ypjax("${h.url('repo_switcher')}",'repo_switcher_list',
             function(o){qfilter_activate();YUD.get(target).focus()},
             function(o){YUD.removeClass('repo_switcher','loaded');}
             ,null);
      }else{
         YUD.get(target).focus();
      }
      return false;
     });

     YUE.on('header-dd', 'click',function(e){
         YUD.addClass('header-inner', 'hover');
         YUD.addClass('content', 'hover');
     });

</script>
</%def>