Files @ 6db3122e4d75
Branch filter:

Location: kallithea/kallithea/templates/index_base.html

mads
index: show repositories and repository groups in the same table

Having two different tables with their own paging and search gave a bad UI.
Instead, do like all other UIs that show directory content and show both
"folders" and "files" in the same list.

The rendering of repo groups is changed to use js data instead of a taking data
from an html table.

Repository groups are shoe-horned into the repository DataTable. The columns
are no perfect match - some of the existing columns are thus given an empty
default value.
<%page args="parent,group_name=''" />
    <div class="panel panel-primary">
        <div class="panel-heading clearfix">
            <div class="pull-left breadcrumbs panel-title">
                %if c.group is not None:
                    %for group in c.group.parents:
                        ${h.link_to(group.name, url('repos_group_home', group_name=group.group_name))}
                        &raquo;
                    %endfor
                    ${c.group.name}
                %endif
            </div>

            %if request.authuser.username != 'default':
              <div class="pull-right">
                <%
                    gr_name = c.group.group_name if c.group else None
                    # create repositories with write permission on group is set to true
                    create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
                    group_admin = h.HasRepoGroupPermissionLevel('admin')(gr_name, 'can write into group index page')
                    group_write = h.HasRepoGroupPermissionLevel('write')(gr_name, 'can write into group index page')
                %>
                %if h.HasPermissionAny('hg.admin','hg.create.repository')() or (group_admin or (group_write and create_on_write)):
                  %if c.group:
                        <a href="${h.url('new_repo',parent_group=c.group.group_id)}" class="btn btn-default btn-xs"><i class="icon-plus"></i> ${_('Add Repository')}</a>
                        %if h.HasPermissionAny('hg.admin')() or h.HasRepoGroupPermissionLevel('admin')(c.group.group_name):
                            <a href="${h.url('new_repos_group', parent_group=c.group.group_id)}" class="btn btn-default btn-xs"><i class="icon-plus"></i> ${_('Add Repository Group')}</a>
                        %endif
                  %else:
                    <a href="${h.url('new_repo')}" class="btn btn-default btn-xs"><i class="icon-plus"></i> ${_('Add Repository')}</a>
                    %if h.HasPermissionAny('hg.admin')():
                        <a href="${h.url('new_repos_group')}" class="btn btn-default btn-xs"><i class="icon-plus"></i> ${_('Add Repository Group')}</a>
                    %endif
                  %endif
                %endif
                %if c.group and h.HasRepoGroupPermissionLevel('admin')(c.group.group_name):
                    <a href="${h.url('edit_repo_group',group_name=c.group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-default btn-xs"><i class="icon-pencil"></i> ${_('Edit Repository Group')}</a>
                %endif
              </div>
            %endif
        </div>
        <div class="panel-body">
            <table class="table" id="repos_list_wrap" width="100%"></table>
        </div>
    </div>

      <script>
        var data = ${h.js(c.data)},
            $dataTable = $("#repos_list_wrap").DataTable({
                data: data.records,
                columns: [
                    {data: "raw_name", visible: false, searchable: false},
                    {title: ${h.jshtml(_('Repository'))}, data: "name", orderData: [0,], render: {
                        filter: function(data, type, row, meta) {
                            return row.just_name;
                        }
                    }},
                    {data: "desc", title: ${h.jshtml(_('Description'))}, searchable: false},
                    {data: "last_change_iso", defaultContent: '', visible: false, searchable: false},
                    {data: "last_change", defaultContent: '', title: ${h.jshtml(_('Last Change'))}, orderData: [3,], searchable: false},
                    {data: "last_rev_raw", defaultContent: '', visible: false, searchable: false},
                    {data: "last_changeset", defaultContent: '', title: ${h.jshtml(_('Tip'))}, orderData: [5,], searchable: false},
                    {data: "owner", defaultContent: '', title: ${h.jshtml(_('Owner'))}, searchable: false},
                    {data: "atom", defaultContent: '', sortable: false}
                ],
                order: [[1, "asc"]],
                dom: '<"dataTables_left"f><"dataTables_right"ilp>t',
                pageLength: 100
            });
      </script>