aboutsummaryrefslogtreecommitdiffstats
path: root/templates/layerindex/layers.html
blob: f1a37034fa4d3cf5c463a89e87ec821740a54e62 (plain)
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
{% extends "base_toplevel.html" %}
{% load i18n %}
{% load static %}

{% comment %}

  layerindex-web - layer list page template

  Copyright (C) 2013 Intel Corporation
  Licensed under the MIT license, see COPYING.MIT for details

{% endcomment %}


<!--
{% block title_append %} - layers{% endblock %}
-->

{% block navs %}
{% autoescape on %}
                            <li class="active"><a href="{% url 'layer_list' url_branch %}">Layers</a></li>
                            <li><a href="{% url 'recipe_search' url_branch %}">Recipes</a></li>
                            <li><a href="{% url 'machine_search' url_branch %}">Machines</a></li>
                            <li><a href="{% url 'distro_search' url_branch %}">Distros</a></li>
{% endautoescape %}
{% endblock %}


{% block content_inner %}
{% autoescape on %}

{% if layerbranch_list %}

            <div class="row-fluid">
                <div class="span5">
                    <form id="filter-form">
                        <input type="text" class="input-xxlarge search-query" id="filter" placeholder="Search layers">
                    </form>
                </div>

                <div class="pull-right">
                    <div class="btn-group">
                        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                            Filter layers
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
                            {% for choice_id, choice_label in layer_type_choices %}
                            <li><a tabindex="-1" href="#">
                                <label class="checkbox">
                                    <input type="checkbox" checked value="{{ choice_id }}">{{ choice_label }}
                                </label>
                            </a></li>
                            {% endfor %}

                        </ul>

                    </div>
                </div>
            </div>

            <table class="table table-striped table-bordered layerstable">
                <thead>
                    <tr>
                        <th>Layer name</th>
                        <th class="span4">Description</th>
                        <th>Type</th>
                        <th>Repository</th>
                    </tr>
                </thead>

                <tbody>
                    {% for layerbranch in layerbranch_list %}
                    <tr class="layertype_{{ layerbranch.layer.layer_type }}">
                        <td><a href="{% url 'layer_item' url_branch layerbranch.layer.name %}">{{ layerbranch.layer.name }}</a>
                            {% if layerbranch.yp_compatible_version %}
                            <a href="{{layerbranch.yp_compatible_version.link_url}}"><img src="{{layerbranch.yp_compatible_version.image_url}}" alt="{{layerbranch.yp_compatible_version.description}}" class="yp-icon" title="{{layerbranch.yp_compatible_version.description}}" ></a>
                            {% endif %}
                        </td>
                        <td>{{ layerbranch.layer.summary }}</td>
                        <td>{{ layerbranch.layer.get_layer_type_display }}</td>
                        <td class="showRollie">
                            {{ layerbranch.layer.vcs_url }}
                                {% if layerbranch.layer.vcs_web_url %}
                                <a class="rollie" href="{{ layerbranch.layer.vcs_web_url }}">
                                <span class="label label-info">
                                    web repo
                                </span>
                                </a>
                                {% endif %}
                                {% if layerbranch.tree_url %}
                                <a class="rollie" href="{{ layerbranch.tree_url }}">
                                <span class="label label-info">
                                    tree
                                </span>
                                </a>
                                {% endif %}
                        </td>
                    </tr>
                    {% endfor %}

                </tbody>
            </table>

    {% if is_paginated %}
        {% load pagination %}
        {% pagination page_obj %}
    {% endif %}
{% else %}
    <p>No matching layers in database.</p>
{% endif %}

{% endautoescape %}

{% endblock %}


{% block scripts %}
<script src="{% static "js/uitablefilter.js" %}"></script>

<script>
    $(document).ready(function() {
        $("input:checkbox").change();

        $("input:checkbox").change(function(){
                var selectedType = $(this).val();
                if($(this).is(":checked")){
                    $(".layertype_"+selectedType).show();
                }
                else{
                    $(".layertype_"+selectedType).hide();
                }

        });

        $(function() {
            var theTable = $('table.layerstable');

            $("#filter").keyup(function() {
            $.uiTableFilter( theTable, this.value );
            })

            $('.dropdown-menu input, .dropdown-menu label').click(function(e) {
            e.stopPropagation();
            })

            $('#filter-form').submit(function(){
            theTable.find("tbody > tr:visible > td:eq(1)").mousedown();
            return false;
            }).focus(); //Give focus to input field
        });

    });
</script>
{% endblock %}