Changeset - b56aa0ea3531
[Not reviewed]
default
0 14 0
Mads Kiilerich - 8 years ago 2017-06-25 18:49:21
mads@kiilerich.com
pagination: avoid superfluous margins - especially when pages are short and pagination isn't shown

Change our webhelpers paginator wrapper to emit full UL (or nothing) instead of
just ILs.

(Browsers still render extra space below the paginator - that is an artifact of
how Bootstrap use inline on the ILs.)
14 files changed with 20 insertions and 42 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/page.py
Show inline comments
 
@@ -20,13 +20,13 @@ import re
 
from kallithea.config.routing import url
 
from webhelpers.html import literal, HTML
 
from webhelpers.paginate import Page as _Page
 

	
 
class Page(_Page):
 
    """
 
    Custom pager to match rendering style with YUI paginator
 
    Custom pager to match rendering style with YUI paginator emitting Bootstrap paginators
 
    """
 

	
 
    def __init__(self, *args, **kwargs):
 
        kwargs.setdefault('url', url.current)
 
        _Page.__init__(self, *args, **kwargs)
 

	
 
@@ -111,13 +111,13 @@ class Page(_Page):
 

	
 
        #_page_link = url.current()
 
        #nav_items.append(literal('<link rel="prerender" href="%s?page=%s">' % (_page_link, str(int(self.page)+1))))
 
        #nav_items.append(literal('<link rel="prefetch" href="%s?page=%s">' % (_page_link, str(int(self.page)+1))))
 
        return self.separator.join(nav_items)
 

	
 
    def pager(self, format='$link_previous ~2~ $link_next', page_param='page', partial_param='partial',
 
    def pager(self, format='<ul class="pagination">$link_previous ~2~ $link_next</ul>', page_param='page', partial_param='partial',
 
        show_if_single_page=False, separator=' ', onclick=None,
 
        symbol_first='<<', symbol_last='>>',
 
        symbol_previous='<', symbol_next='>',
 
        link_attr=None,
 
        curpage_attr=None,
 
        dotdot_attr=None, **kwargs):
kallithea/public/css/style.css
Show inline comments
 
@@ -674,12 +674,16 @@ div.panel.panel-default div.panel-headin
 

	
 
#content div.panel div.action .ui-selectmenu {
 
    margin: 0;
 
    padding: 0;
 
}
 

	
 
#content div.panel ul.pagination {
 
    margin: 10px 0 0 0;
 
}
 

	
 
#content div.panel ul.pagination > li > a,
 
#content div.panel ul.pagination > li > span {
 
    background: #ebebeb url("../images/pager.png") repeat-x;
 
    color: #4A4A4A;
 
    font-weight: 700;
 
    border-top: 1px solid #dedede;
kallithea/templates/admin/admin_log.html
Show inline comments
 
@@ -52,12 +52,11 @@
 
      $('#'+el.id.substring(1)).show();
 
      $(el.parentNode).hide();
 
    });
 
  });
 
</script>
 

	
 
<ul class="pagination">
 
    ${c.users_log.pager()}
 
</ul>
 
${c.users_log.pager()}
 

	
 
%else:
 
    ${_('No actions yet')}
 
%endif
kallithea/templates/admin/gists/index.html
Show inline comments
 
@@ -58,16 +58,13 @@
 
                </span>
 
            </div>
 

	
 
            <div class="text-muted">${gist.gist_description}</div>
 
          </div>
 
        % endfor
 

	
 
        <ul class="pagination">
 
            ${c.gists_pager.pager(**request.GET.mixed())}
 
        </ul>
 
        ${c.gists_pager.pager(**request.GET.mixed())}
 
      %else:
 
        <div>${_('There are no gists yet')}</div>
 
      %endif
 
    </div>
 
</div>
 
</%def>
kallithea/templates/admin/notifications/notifications_data.html
Show inline comments
 
@@ -13,14 +13,10 @@
 
        %endif
 
        <span id="${notification.notification.notification_id}" class="btn btn-default btn-xs delete-notification"><i class="icon-minus-circled"></i>${_('Delete')}</span>
 
      </span>
 
  </div>
 
%endfor
 
</div>
 

	
 
<ul class="pagination">
 
    ${c.notifications.pager(controller='admin/notifications', **request.GET.mixed())}
 
</ul>
 

	
 
${c.notifications.pager(controller='admin/notifications', **request.GET.mixed())}
 
%else:
 
    <div>${_('No notifications here yet')}</div>
 
%endif
kallithea/templates/changelog/changelog.html
Show inline comments
 
@@ -172,15 +172,13 @@ ${self.repo_context_bar('changelog', c.f
 
                </table>
 

	
 
                <input type="checkbox" id="singlerange" style="display:none"/>
 

	
 
                </div>
 

	
 
                <ul class="pagination">
 
                    ${c.pagination.pager()}
 
                </ul>
 
                ${c.pagination.pager()}
 

	
 
        <script type="text/javascript" src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript">
 
            var jsdata = ${h.js(c.jsdata)};
 
            var graph = new BranchRenderer('graph_canvas', 'graph_content', 'chg_');
 

	
kallithea/templates/changelog/changelog_summary_data.html
Show inline comments
 
@@ -68,15 +68,14 @@
 
        </td>
 
    </tr>
 
%endfor
 

	
 
</table>
 

	
 
<ul class="pagination">
 
    ${c.repo_changesets.pager()}
 
</ul>
 
${c.repo_changesets.pager()}
 

	
 
%else:
 

	
 
%if h.HasRepoPermissionLevel('write')(c.repo_name):
 
<h4>${_('Add or upload files directly via Kallithea')}</h4>
 
<div>
 
  <div id="add_node_id" class="add_node">
kallithea/templates/followers/followers_data.html
Show inline comments
 
@@ -9,9 +9,7 @@
 
        <div class="follower_date">${_('Started following -')}
 
          <span data-toggle="tooltip" title="${f.follows_from}"> ${h.age(f.follows_from)}</span>
 
        </div>
 
    </div>
 
% endfor
 

	
 
<ul class="pagination">
 
    ${c.followers_pager.pager()}
 
</ul>
 
${c.followers_pager.pager()}
kallithea/templates/forks/forks_data.html
Show inline comments
 
@@ -16,12 +16,10 @@
 
                <a title="${_('Compare fork with %s') % c.repo_name}"
 
                   href="${h.url('compare_url',repo_name=c.repo_name, org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1],other_repo=f.repo_name,other_ref_type=c.db_repo.landing_rev[0],other_ref_name=c.db_repo.landing_rev[1], merge=1)}"
 
                   class="btn btn-default btn-sm"><i class="icon-git-compare"></i> ${_('Compare Fork')}</a>
 
            </div>
 
        </div>
 
    % endfor
 
    <ul class="pagination">
 
        ${c.forks_pager.pager()}
 
    </ul>
 
    ${c.forks_pager.pager()}
 
% else:
 
    ${_('There are no forks yet')}
 
% endif
kallithea/templates/journal/journal_data.html
Show inline comments
 
@@ -33,15 +33,12 @@
 
                    </div>
 
                  </div>
 
                %endfor
 
            </div>
 
        %endfor
 
    %endfor
 

	
 
    <ul class="pagination">
 
        ${c.journal_pager.pager()}
 
    </ul>
 
    ${c.journal_pager.pager()}
 
%else:
 
  <div>
 
      ${_('No entries yet')}
 
  </div>
 
%endif
kallithea/templates/pullrequests/pullrequest_data.html
Show inline comments
 
@@ -77,12 +77,10 @@
 
    </tr>
 
% endfor
 
  </table>
 
</div>
 

	
 
%if hasattr(pullrequests, 'pager'):
 
    <ul class="pagination">
 
        ${pullrequests.pager(**request.GET.mixed())}
 
    </ul>
 
    ${pullrequests.pager(**request.GET.mixed())}
 
%endif
 

	
 
</%def>
kallithea/templates/search/search_commit.html
Show inline comments
 
@@ -29,10 +29,8 @@
 
                ${_('Permission denied')}
 
            </div>
 
        %endif
 
    %endif
 
%endfor
 
%if c.cur_query and c.formated_results:
 
    <ul class="pagination">
 
        ${c.formated_results.pager()}
 
    </ul>
 
    ${c.formated_results.pager()}
 
%endif
kallithea/templates/search/search_content.html
Show inline comments
 
@@ -17,10 +17,8 @@
 
                ${_('Permission denied')}
 
            </div>
 
        %endif
 
    %endif
 
%endfor
 
%if c.cur_query and c.formated_results:
 
    <ul class="pagination">
 
        ${c.formated_results.pager()}
 
    </ul>
 
    ${c.formated_results.pager()}
 
%endif
kallithea/templates/search/search_path.html
Show inline comments
 
@@ -14,10 +14,8 @@
 
                ${_('Permission denied')}
 
            </div>
 
        %endif
 
    %endif
 
%endfor
 
%if c.cur_query and c.formated_results:
 
    <ul class="pagination">
 
        ${c.formated_results.pager()}
 
    </ul>
 
    ${c.formated_results.pager()}
 
%endif
0 comments (0 inline, 0 general)