Changeset - f70a268bac41
[Not reviewed]
default
0 3 0
Mads Kiilerich - 8 years ago 2017-06-11 15:02:09
mads@kiilerich.com
style: replace file browse browserblock with Bootstrap panel
3 files changed with 11 insertions and 73 deletions:
0 comments (0 inline, 0 general)
kallithea/public/css/style.css
Show inline comments
 
@@ -2364,158 +2364,96 @@ div.panel-body #files_data .revision-lin
 
.branchtag a,
 
.branchtag a:hover {
 
    text-decoration: none;
 
    color: inherit;
 
}
 
.logtags .tagtag {
 
    padding: 1px 3px 1px 3px;
 
    background-color: #62cffc;
 
    font-size: 10px;
 
    color: #ffffff;
 
    white-space: nowrap;
 
    border-radius: 3px;
 
}
 

	
 
.tagtag a,
 
.tagtag a:hover,
 
.logtags .tagtag a,
 
.logtags .tagtag a:hover {
 
    text-decoration: none;
 
    color: inherit;
 
}
 
.logbooks .booktag,
 
.logbooks .booktag,
 
.logtags .booktag,
 
.logtags .booktag {
 
    padding: 1px 3px 1px 3px;
 
    background-color: #46A546;
 
    font-size: 10px;
 
    color: #ffffff;
 
    white-space: nowrap;
 
    border-radius: 3px;
 
}
 
.logbooks .booktag,
 
.logbooks .booktag a,
 
.right .logtags .booktag,
 
.logtags .booktag a {
 
    color: #ffffff;
 
}
 

	
 
.logbooks .booktag,
 
.logbooks .booktag a:hover,
 
.logtags .booktag,
 
.logtags .booktag a:hover,
 
.booktag a,
 
.booktag a:hover {
 
    text-decoration: none;
 
    color: inherit;
 
}
 
div.browserblock {
 
    overflow: hidden;
 
    border: 1px solid #ccc;
 
    background: #f8f8f8;
 
    font-size: 100%;
 
    line-height: 125%;
 
    padding: 0;
 
    border-radius: 6px 6px 0px 0px;
 
}
 

	
 
div.browserblock .browser-header {
 
    background: #FFF;
 
    padding: 10px 0px 15px 0px;
 
    width: 100%;
 
}
 

	
 
div.browserblock .browser-nav {
 
    float: left
 
}
 

	
 
div.browserblock .browser-branch {
 
    float: left;
 
}
 

	
 
div.browserblock .browser-branch label {
 
    color: #4A4A4A;
 
    vertical-align: text-top;
 
    padding-right: 2px;
 
}
 

	
 
div.browserblock .browser-header span {
 
    margin-left: 5px;
 
    font-weight: 700;
 
}
 

	
 
div.browserblock .browser-search {
 
    clear: both;
 
    padding: 8px 8px 0px 5px;
 
    height: 20px;
 
}
 

	
 
div.browserblock #node_filter_box {
 
}
 

	
 
div.browserblock .search_activate {
 
    float: left
 
}
 

	
 
div.browserblock .add_node {
 
    float: left;
 
    padding-left: 5px;
 
}
 

	
 
div.browserblock .search_activate a:hover,
 
div.browserblock .add_node a:hover {
 
    text-decoration: none !important;
 
}
 

	
 
div.browserblock .browser-body {
 
    background: #EEE;
 
    border-top: 1px solid #CCC;
 
}
 

	
 
table.code-browser {
 
    border-collapse: collapse;
 
    width: 100%;
 
}
 

	
 
table.code-browser tr {
 
    margin: 3px;
 
}
 

	
 
table.code-browser thead th {
 
    background-color: #EEE;
 
    height: 20px;
 
    font-size: 1.1em;
 
    font-weight: 700;
 
    text-align: left;
 
    padding-left: 10px;
 
}
 

	
 
table.code-browser tbody td {
 
    padding-left: 10px;
 
    height: 20px;
 
}
 

	
 
table.code-browser .browser-file {
 
    height: 16px;
 
    padding-left: 5px;
 
    text-align: left;
 
}
 

	
 
table.code-browser .browser-dir {
 
    height: 16px;
 
    padding-left: 5px;
 
    text-align: left;
 
}
 

	
 
table.code-browser .submodule-dir {
 
    height: 16px;
 
    padding-left: 5px;
 
    text-align: left;
 
}
 

	
 
/* add some padding to the right of the file, folder, or submodule icon and
 
before the text */
 
table.code-browser i[class^='icon-'] {
 
    padding-right: .3em;
 
}
 

	
kallithea/templates/files/files.html
Show inline comments
 
@@ -201,59 +201,59 @@ $(document).ready(function(){
 
    ypjax_links();
 
    var $files_data = $('#files_data');
 
    //Bind to StateChange Event
 
    History.Adapter.bind(window,'statechange',function(){
 
        var State = History.getState();
 
        cache_key = State.url;
 
        //check if we have this request in cache maybe ?
 
        var _cache_obj = CACHE[cache_key];
 
        var _cur_time = new Date().getTime();
 
        // get from cache if it's there and not yet expired !
 
        if(_cache_obj !== undefined && _cache_obj[0] > _cur_time){
 
            $files_data.html(_cache_obj[1]);
 
            $files_data.css('opacity','1.0');
 
            //callbacks after ypjax call
 
            callbacks(State);
 
        }
 
        else{
 
            asynchtml(State.url, $files_data, function(){
 
                    callbacks(State);
 
                    var expire_on = new Date().getTime() + CACHE_EXPIRE;
 
                    CACHE[cache_key] = [expire_on, $files_data.html()];
 
                });
 
        }
 
    });
 

	
 
    // init the search filter
 
    var _State = {
 
       url: ${h.js(h.url.current())},
 
       data: {
 
         node_list_url: node_list_url.replace('__REV__',${h.js(c.changeset.raw_id)}).replace('__FPATH__', ${h.js(h.safe_unicode(c.file.path))}),
 
         url_base: url_base.replace('__REV__',${h.js(c.changeset.raw_id)}),
 
         rev:${h.js(c.changeset.raw_id)},
 
         f_path: ${h.js(h.safe_unicode(c.file.path))}
 
       }
 
    }
 
    fileBrowserListeners(_State.url, _State.data.node_list_url, _State.data.url_base);
 

	
 
    // change branch filter
 
    $("#branch_selector").select2({
 
        dropdownAutoWidth: true,
 
        maxResults: 50,
 
        sortResults: branchSort
 
        });
 

	
 
    $("#branch_selector").change(function(e){
 
        var selected = e.currentTarget.options[e.currentTarget.selectedIndex].value;
 
        if(selected && selected != ${h.js(c.changeset.raw_id)}){
 
            window.location = pyroutes.url('files_home', {'repo_name': ${h.js(h.safe_unicode(c.repo_name))}, 'revision': selected, 'f_path': ${h.js(h.safe_unicode(c.file.path))}});
 
            $("#body.browserblock").hide();
 
            $("#body").hide();
 
        } else {
 
            $("#branch_selector").val(${h.js(c.changeset.raw_id)});
 
        }
 
    });
 

	
 
});
 

	
 
</script>
 

	
 
</%def>
kallithea/templates/files/files_browser.html
Show inline comments
 
<%def name="file_class(node)">
 
    %if node.is_file():
 
        <%return "browser-file" %>
 
    %elif node.is_submodule():
 
        <%return "submodule-dir"%>
 
    %else:
 
        <%return "browser-dir"%>
 
    %endif
 
</%def>
 
<%def name="file_url(node, c)">
 
    %if node.is_submodule():
 
        <%return node.url or '#'%>
 
    %else:
 
        <%return h.url('files_home', repo_name=c.repo_name, revision=c.changeset.raw_id, f_path=h.safe_unicode(node.path))%>
 
    %endif
 
</%def>
 
<%def name="file_name(node)">
 
    <%
 
        c = "icon-folder-open"
 
        if node.is_file():
 
            c = "icon-doc"
 
        elif node.is_submodule():
 
            c = "icon-file-submodule"
 
    %>
 
    <%return h.literal('<i class="%s"></i><span>%s</span>' % (c, h.escape(node.name)))%>
 
</%def>
 
<div id="body" class="browserblock">
 
    <div class="browser-header">
 
        <div class="browser-nav">
 
<div id="body" class="panel panel-default">
 
    <div class="panel-heading clearfix">
 
        <div class="browser-nav form-inline pull-left">
 
            ${h.form(h.url.current())}
 
            <div class="info_box">
 
              <div class="info_box_elem rev">${_('Revision')}</div>
 
              <div class="info_box_elem"><a class="btn btn-default btn-xs ypjax-link" href="${c.url_prev}" title="${_('Previous revision')}"><i class="icon-left-open"></i></a></div>
 
              <div class="info_box_elem">${h.text('at_rev',value=c.changeset.revision,size=5)}</div>
 
              <div class="info_box_elem">${h.text('at_rev',value=c.changeset.revision,size=5,class_='form-control input-sm')}</div>
 
              <div class="info_box_elem"><a class="btn btn-default btn-xs ypjax-link" href="${c.url_next}" title="${_('Next revision')}"><i class="icon-right-open"></i></a></div>
 
            </div>
 
            ${h.end_form()}
 
        </div>
 
        <div class="browser-branch">
 
        <div class="browser-branch form-inline pull-left">
 
            <label>
 
                ${h.checkbox('stay_at_branch',c.changeset.branch,c.changeset.branch==c.branch)}
 
                ${h.checkbox('stay_at_branch',c.changeset.branch,c.changeset.branch==c.branch,class_="form-control")}
 
                ${_('Follow current branch')}
 
            </label>
 
        </div>
 
        <div id="search_activate_id" class="search_activate">
 
        <div id="search_activate_id" class="search_activate pull-left">
 
            <a class="btn btn-default btn-xs" id="filter_activate" href="#">${_('Search File List')}</a>
 
        </div>
 
        <div class="browser-search">
 
        <div class="browser-search form-inline pull-left">
 
            <div>
 
                <div id="node_filter_box_loading" style="display:none">${_('Loading file list...')}</div>
 
                <div id="node_filter_box" style="display:none">
 
                ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)}/<input class="init" type="text" value="type to search..." name="filter" size="25" id="node_filter">
 
                ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)}/<input class="init form-control" type="text" value="type to search..." name="filter" size="25" id="node_filter">
 
                </div>
 
            </div>
 
        </div>
 
    </div>
 

	
 
    <div>
 
    <div class="panel-body">
 
        <table class="table code-browser">
 
            <thead>
 
                <tr>
 
                    <th>${_('Name')}</th>
 
                    <th>${_('Size')}</th>
 
                    <th>${_('Last Revision')}</th>
 
                    <th>${_('Last Modified')}</th>
 
                    <th>${_('Last Committer')}</th>
 
                </tr>
 
            </thead>
 

	
 
            <tbody id="tbody">
 
                %if c.file.parent:
 
                <tr class="parity0">
 
                    <td>
 
                        ${h.link_to(h.literal('<i class="icon-folder-open"></i><span>..</span>'),h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.parent.path),class_="browser-dir ypjax-link")}
 
                    </td>
 
                    <td></td>
 
                    <td></td>
 
                    <td></td>
 
                    <td></td>
 
                </tr>
 
                %endif
 

	
 
            %for cnt,node in enumerate(c.file):
 
                <tr class="parity${cnt%2}">
 
                     <td>
 
                         ${h.link_to(file_name(node),file_url(node,c),class_=file_class(node)+" ypjax-link")}
 
                     </td>
 
                     <td>
 
                     %if node.is_file():
 
                         ${h.format_byte_size(node.size,binary=True)}
 
                     %endif
 
                     </td>
 
                     <td>
 
                         %if node.is_file():
 
                             <a data-toggle="tooltip" title="${node.last_changeset.message}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=node.last_changeset.raw_id)}" class="revision-link">${h.show_id(node.last_changeset)}</a>
 
                         %endif
 
                     </td>
 
                     <td>
 
                         %if node.is_file():
 
                             <span data-toggle="tooltip" title="${h.fmt_date(node.last_changeset.date)}">
 
                            ${h.age(node.last_changeset.date)}</span>
 
                         %endif
 
                     </td>
 
                     <td>
 
                         %if node.is_file():
 
                             <span title="${node.last_changeset.author}">
0 comments (0 inline, 0 general)