diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -316,6 +316,8 @@ class BaseRepoController(BaseController) c.rhodecode_db_repo: instance of db c.repository_followers: number of followers c.repository_forks: number of forks + c.repository_following: weather the current user is following the current repo + """ def __before__(self): @@ -336,3 +338,5 @@ class BaseRepoController(BaseController) c.repository_followers = self.scm_model.get_followers(dbr) c.repository_forks = self.scm_model.get_forks(dbr) c.repository_pull_requests = self.scm_model.get_pull_requests(dbr) + c.repository_following = self.scm_model.is_following_repo(c.repo_name, + self.rhodecode_user.user_id) diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -905,13 +905,13 @@ def repo_link(groups_and_repos, last_url if not groups: if last_url: - return last_link - return repo_name + return literal('%s' % last_link) + return literal('%s' % repo_name) else: def make_link(group): return link_to(group.name, url('repos_group_home', group_name=group.group_name)) - return literal(' » '.join(map(make_link, groups) + [last_link])) + return literal(' » '.join(map(make_link, groups) + ['' + last_link + ''])) def fancy_file_stats(stats): diff --git a/rhodecode/public/css/contextbar.css b/rhodecode/public/css/contextbar.css new file mode 100644 --- /dev/null +++ b/rhodecode/public/css/contextbar.css @@ -0,0 +1,330 @@ +/** + * Stylesheets for the context bar + */ + +#context-bar button.follow { background-image: url("../images/icons/heart.png"); } +#context-bar button.following { background-image: url("../images/icons/heart_delete.png"); } +#context-bar a.fork { background-image: url("../images/icons/arrow_divide.png"); } +#context-bar a.summary { background-image: url("../images/icons/clipboard_16.png"); } +#context-bar a.changelogs { background-image: url("../images/icons/time.png"); } +#context-bar a.files { background-image: url("../images/icons/file.png"); } +#context-bar a.switch-to { background-image: url("../images/icons/arrow_switch.png"); } +#context-bar a.options { background-image: url("../images/icons/table_gear.png"); } +#context-bar a.pull-request { background-image: url("../images/icons/arrow_join.png"); } +#context-bar a.branches { background-image: url("../images/icons/arrow_branch.png"); } +#context-bar a.tags { background-image: url("../images/icons/tag_blue.png"); } +#context-bar a.bookmarks { background-image: url("../images/icons/tag_green.png"); } +#context-bar a.settings { background-image: url("../images/icons/cog.png"); } +#context-bar a.shortlog { background-image: url("../images/icons/time.png"); } +#context-bar a.search { background-image: url("../images/icons/search_16.png"); } +#context-bar a.admin { background-image: url("../images/icons/cog_edit.png"); } + +#context-bar a.journal { background-image: url("../images/icons/book.png"); } +#context-bar a.repos { background-image: url("../images/icons/database_edit.png"); } +#context-bar a.repos_groups { background-image: url("../images/icons/database_link.png"); } +#context-bar a.users { background-image: url("../images/icons/user_edit.png"); } +#context-bar a.groups { background-image: url("../images/icons/group_edit.png"); } +#context-bar a.permissions { background-image: url("../images/icons/key.png"); } +#context-bar a.ldap { background-image: url("../images/icons/server_key.png"); } +#context-bar a.defaults { background-image: url("../images/icons/wrench.png"); } +#context-bar a.settings { background-image: url("../images/icons/cog_edit.png"); } + +#content #context-bar { + position: relative; + background-color: #003B76 !important; + padding: 0px; + overflow: visible; +} + +#content #context-bar, +#content #context-bar a, +#content #context-bar button { + color: #FFFFFF; +} + +#content #context-bar a:hover, +#content #context-bar button:hover { + text-decoration: none; + color: #bfe3ff; +} + +#content #context-bar .icon { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: text-bottom; +} + +ul.horizontal-list { + display: block; +/* overflow: hidden;*/ +} +ul.horizontal-list > li { + float: left; + padding-right: 5px; + position: relative; +} + +ul.horizontal-list > li ul { + position: absolute; + display: none; + right: 0; +} + +ul.horizontal-list li:hover > ul { + display: block; +} + +ul.horizontal-list ul li { + position: relative; + border-bottom: 1px solid rgba(0,0,0,0.1); + border-top: 1px solid rgba(255,255,255,0.1); +} + +ul.horizontal-list > li ul ul { + position: absolute; + right: 100%; + top: -1px; + min-width: 200px; + max-height: 400px; + overflow-x:hidden; + overflow-y:auto; +} + +ul.horizontal-list > li a { + white-space: nowrap; +} + +#breadcrumbs { + float:left; + padding: 12px 0; + font-weight: bold; +} + +#breadcrumbs span{ + font-weight: bold; + font-size: 2em; +} + +#context-top { + position: relative; + overflow: hidden; + border-bottom: 1px solid #003162; + padding: 10px; +} + +#revision-changer, +#context-pages, +#context-pages ul, +ul#context-actions { + background: #3b6998; /* Old browsers */ + background: -moz-linear-gradient(top, #4574a2 0%, #2f5d8b 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4574a2), color-stop(100%,#2f5d8b)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #4574a2 0%, #2f5d8b 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #4574a2 0%, #2f5d8b 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #4574a2 0%, #2f5d8b 100%); /* IE10+ */ + background: linear-gradient(to bottom, #4574a2 0%, #2f5d8b 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4574a2', endColorstr='#2f5d8b',GradientType=0 ); /* IE6-9 */ +} + +#context-actions a, +#context-pages a { + background-repeat: no-repeat; + background-position: 10px 50%; + padding-left: 30px; +} + +#context-pages ul ul a{ + padding-left: 10px; +} + +ul#context-actions { + display: inline-block; + float: right; + border-radius: 4px; + background-color:#3b6998; + background-image: linear-gradient(top, #4574a2 0%, #2f5d8b 100%); + padding: 5px; +} + +#content ul#context-actions li { + padding: 0px; + border-right: 1px solid rgba(0,0,0,0.1); + border-left: 1px solid rgba(255,255,255,0.1); +} + +#context-actions button, +#context-actions a { + display: block; + cursor: pointer; + background: none; + border: none; + margin: 0px; + height: 13px; + padding: 3px 7px; + background-repeat: no-repeat; + background-position: 50% 3px; + padding-top: 24px; +} + +#context-actions button{ + padding-top: 22px; + height: 40px; +} + +#revision-changer:hover, +#context-pages li:hover, +#context-actions li:hover, +#content #context-actions li:hover { + /*background: rgba(255,255,255,0.2);*/ + background: #6388ad; /* Old browsers */ + background: -moz-linear-gradient(top, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#88bfe8', endColorstr='#70b0e0',GradientType=0 ); /* IE6-9 */ + + background-image: -webkit-gradient(linear, left top, left bottom, rgb(255,255,255) 0%, rgb(255,255,255) 100%); + + /*border-radius: 4px;*/ +} + + +#content #context-actions li:first-child { + border-left: none; + border-radius:4px 0 0px 4px; +} + +#content #context-actions li:last-child { + border-right: none; + border-radius:0 4px 4px 0; +} + +#content #context-actions .icon{ + margin: auto; + margin-bottom: 5px; + display: block; + clear: both; + float: none; +} + +#content #context-actions button.follow, +#content #context-actions button.following{ + width: auto; + float: none; +} + +#content #context-actions button .show-following, +#content #context-actions button .show-follow { + display: none; +} + +#content #context-bar #context-actions button.follow .show-follow { + display: block; +} + +#content #context-bar #context-actions button.following .show-following { + display: block; +} + +#context-state { + background-color: #336699; + border-top: 1px solid #517da8; +/* overflow: hidden;*/ +} + +#context-pages { + float: right; + border-left: 1px solid rgba(0,0,0,0.1); +/* overflow: hidden;*/ +} + +#context-pages li.current{ + background: #535353; /* Old browsers */ + background: -moz-linear-gradient(top, #5d5d5d 0%, #484848 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#5d5d5d), color-stop(100%,#484848)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #5d5d5d 0%, #484848 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #5d5d5d 0%, #484848 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #5d5d5d 0%, #484848 100%); /* IE10+ */ + background: linear-gradient(to bottom, #5d5d5d 0%, #484848 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5d5d5d', endColorstr='#484848',GradientType=0 ); /* IE6-9 */ +} + +#content #context-pages .icon { + margin-right:5px; +} + +#content #context-pages li { + border-right: 1px solid rgba(0,0,0,0.1); + border-left: 1px solid rgba(255,255,255,0.1); + padding: 0; +} + +#content #context-pages li:last-child { + border-right:none; +} + +#context-pages a, +#context-pages .admin_menu a{ + display: block; + padding: 0px 10px; + padding-left: 30px; + line-height: 35px; +} + +#revision-changer:before, +#context-pages a.childs:after, +#context-pages a.dropdown:after { + content: ' \25BE'; +} +#context-pages a.childs:after{ + float: right; + padding-left: 5px; +} + +#revision-changer:before { + position: absolute; + top: 0px; + right: 0px; + border-right: 1px solid rgba(0,0,0,0.1); + height: 25px; + padding-top: 10px; + padding-right: 10px; +} + +#context-pages li:last-child a { + padding-right: 10px; +} + +#context-bar #revision-changer { + position: relative; + cursor: pointer; + border: none; + padding: 0; + margin: 0; + color: #FFFFFF; + font-size: 0.85em; + padding: 2px 15px; + padding-bottom: 3px; + padding-right: 30px; + border-right: 1px solid rgba(255,255,255,0.1); +} + +#revision-changer .branch-name, +#revision-changer .revision { + display: block; + text-align: center; + line-height: 1.5em; +} + +#revision-changer .branch-name { + font-weight: bold; +} + +#revision-changer .revision{ + text-transform: uppercase; +} + + diff --git a/rhodecode/public/css/style.css b/rhodecode/public/css/style.css --- a/rhodecode/public/css/style.css +++ b/rhodecode/public/css/style.css @@ -3501,7 +3501,7 @@ div.gravatar img { #content { clear: both; - overflow: hidden; + /*overflow: hidden;*/ padding: 10px 10px 14px 10px; } diff --git a/rhodecode/public/js/rhodecode.js b/rhodecode/public/js/rhodecode.js --- a/rhodecode/public/js/rhodecode.js +++ b/rhodecode/public/js/rhodecode.js @@ -509,7 +509,7 @@ var show_changeset_tooltip = function(){ }; var onSuccessFollow = function(target){ - var f = YUD.get(target.id); + var f = YUD.get(target); var f_cnt = YUD.get('current_followers_count'); if(YUD.hasClass(f, 'follow')){ @@ -576,6 +576,7 @@ var showRepoSize = function(target, repo return false; } + /** * TOOLTIP IMPL. */ diff --git a/rhodecode/templates/admin/repos/repo_edit.html b/rhodecode/templates/admin/repos/repo_edit.html --- a/rhodecode/templates/admin/repos/repo_edit.html +++ b/rhodecode/templates/admin/repos/repo_edit.html @@ -18,6 +18,7 @@ <%def name="main()"> + ${self.context_bar('options')}
diff --git a/rhodecode/templates/base/base.html b/rhodecode/templates/base/base.html --- a/rhodecode/templates/base/base.html +++ b/rhodecode/templates/base/base.html @@ -61,6 +61,146 @@
+<%def name="context_bar(current=None)"> + %if c.repo_name: + ${repo_context_bar(current)} + %endif + + +<%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"') + %> + + +
+
+ + ## 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': + + %endif +
+
+ +
    +
  • ${_('Summary')}
  • +
  • ${_('Changelogs')}
  • +
  • ${_('Files')}
  • +
  • + ${_('Switch To')} + +
  • +
  • + Options +
      + %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): + %if h.HasPermissionAll('hg.admin')('access settings on repository'): +
    • ${h.link_to(_('repository settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}
    • + %else: +
    • ${h.link_to(_('repository settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}
    • + %endif + %endif + %if c.rhodecode_db_repo.fork: +
    • ${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')}
    • + %endif +
    • ${h.link_to(_('lightweight changelog'),h.url('shortlog_home',repo_name=c.repo_name),class_='shortlog')}
    • +
    • ${h.link_to(_('search'),h.url('search_repo',repo_name=c.repo_name),class_='search')}
    • + + %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking: + %if c.rhodecode_db_repo.locked[0]: +
    • ${h.link_to(_('unlock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_del')}
    • + %else: +
    • ${h.link_to(_('lock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_add')}
    • + %endif + %endif + + % if h.HasPermissionAll('hg.admin')('access admin main page'): +
    • + ${h.link_to(_('admin'),h.url('admin_home'),class_='admin childs')} + <%def name="admin_menu()"> +
        +
      • ${h.link_to(_('admin journal'),h.url('admin_home'),class_='journal')}
      • +
      • ${h.link_to(_('repositories'),h.url('repos'),class_='repos')}
      • +
      • ${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}
      • +
      • ${h.link_to(_('users'),h.url('users'),class_='users')}
      • +
      • ${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}
      • +
      • ${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}
      • +
      • ${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}
      • +
      • ${h.link_to(_('defaults'),h.url('defaults'),class_='defaults')}
      • +
      • ${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}
      • +
      + + ## ADMIN MENU + ${admin_menu()} +
    • + ## if you're a admin of any groups, show admin menu for it + % elif c.rhodecode_user.groups_admin: +
    • + ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')} + <%def name="admin_menu_simple()"> +
        +
      • ${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}
      • +
      + + ## ADMIN MENU + ${admin_menu_simple()} +
    • + % endif +
    +
  • +
  • 1
  • +
+
+
+ + + + <%def name="usermenu()"> ## USER MENU
  • @@ -164,109 +304,6 @@ ## we render this menu only not for those pages %if current not in ['home','admin', 'search', 'journal']: ##REGULAR MENU -
  • - - - ${_('Summary')} - - ${_('Summary')} - -
  • -
  • - - - ${_('Changelog')} - - ${_('Changelog')} - -
  • -
  • - - - ${_('Switch to')} - - ${_('Switch to')} - - -
  • -
  • - - - ${_('Files')} - - ${_('Files')} - -
  • -
  • - - - ${_('Admin')} - - ${_('Options')} - - -
  • @@ -283,14 +320,6 @@ ${c.repository_forks}
  • -
  • - - - ${_('Pull requests')} - - ${c.repository_pull_requests} - -
  • ${usermenu()}