|
| 1 | +{% comment %} |
| 2 | + Copyright (C) 2020 Gitcoin Core |
| 3 | + |
| 4 | + This program is free software: you can redistribute it and/or modify |
| 5 | + it under the terms of the GNU Affero General Public License as published |
| 6 | + by the Free Software Foundation, either version 3 of the License, or |
| 7 | + (at your option) any later version. |
| 8 | + |
| 9 | + This program is distributed in the hope that it will be useful, |
| 10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + GNU Affero General Public License for more details. |
| 13 | + |
| 14 | + You should have received a copy of the GNU Affero General Public License |
| 15 | + along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + |
| 17 | +{% endcomment %} |
| 18 | +{% load i18n static email_obfuscator add_url_schema avatar_tags %} |
| 19 | +<!DOCTYPE html> |
| 20 | +<html lang="en"> |
| 21 | + |
| 22 | + <head> |
| 23 | + {% include 'shared/head.html' %} |
| 24 | + {% include 'shared/cards.html' %} |
| 25 | + <link rel="stylesheet" href={% static "v2/css/users.css" %} /> |
| 26 | + <link rel="stylesheet" href={% static "v2/css/tag.css" %} /> |
| 27 | + <link rel="stylesheet" href={% static "v2/css/rating.css" %} /> |
| 28 | + <link rel="stylesheet" href="https://unpkg.com/vue-innersearch/default-innersearch-theme.min.css"> |
| 29 | + </head> |
| 30 | + |
| 31 | + <body id="{{ explore }}" class="interior {{active}} g-font-muli"> |
| 32 | + {% include 'shared/tag_manager_2.html' %} |
| 33 | + <div class="container-fluid header dash"> |
| 34 | + {% include 'shared/top_nav.html' with class='d-md-flex' %} |
| 35 | + {% include 'home/nav.html' %} |
| 36 | + </div> |
| 37 | + {% block content %} |
| 38 | + <h2>Search</h2> |
| 39 | + |
| 40 | + <form method="get" action=""> |
| 41 | + <table> |
| 42 | + {{ form.as_table }} |
| 43 | + <tr> |
| 44 | + <td> </td> |
| 45 | + <td> |
| 46 | + <input type="submit" value="Search"> |
| 47 | + </td> |
| 48 | + </tr> |
| 49 | + </table> |
| 50 | + |
| 51 | + {% if query %} |
| 52 | + <h3>Results</h3> |
| 53 | + |
| 54 | + {% for result in page.object_list %} |
| 55 | + <p> |
| 56 | + <a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a> |
| 57 | + </p> |
| 58 | + {% empty %} |
| 59 | + <p>No results found.</p> |
| 60 | + {% endfor %} |
| 61 | + |
| 62 | + {% if page.has_previous or page.has_next %} |
| 63 | + <div> |
| 64 | + {% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Previous{% if page.has_previous %}</a>{% endif %} |
| 65 | + | |
| 66 | + {% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Next »{% if page.has_next %}</a>{% endif %} |
| 67 | + </div> |
| 68 | + {% endif %} |
| 69 | + {% else %} |
| 70 | + {# Show some example queries to run, maybe query syntax, something else? #} |
| 71 | + {% endif %} |
| 72 | + </form> |
| 73 | +{% endblock %} |
| 74 | + <div id="gc-users-directory" v-cloak> |
| 75 | + |
| 76 | + <section> |
| 77 | + <h1 class='is-title'>Hacky User Directory</h1> |
| 78 | + |
| 79 | + <hr class='is-line' /> |
| 80 | + |
| 81 | + <div class="filters" style="width : 90%; margin : 0 auto;"> |
| 82 | + <tag-filter :for="'searchbox'"></tag-filter> |
| 83 | + <tag-filter :for="'searchdatalist'"> |
| 84 | + <template slot-scope="{ data }"> |
| 85 | + [[ data._source.keywords ]] |
| 86 | + </template> |
| 87 | + </tag-filter> |
| 88 | + <tag-filter :for="'nlf'"> |
| 89 | + <template slot-scope="{ data }"> |
| 90 | + Number of Hacks Joined: [[ data._source.keywords ]] |
| 91 | + </template> |
| 92 | + </tag-filter> |
| 93 | + </div> |
| 94 | + |
| 95 | + <div class="is-columns"> |
| 96 | + <div class="is-column is-one-fifth"> |
| 97 | + <div> |
| 98 | + <numeric-list-filter :id="'nlf'" :field="'num_hacks_joined'"> |
| 99 | + <template slot="header"> |
| 100 | + <h3 class="is-nlf-title">Number of Hacks Joined : </h3> |
| 101 | + </template> |
| 102 | + </numeric-list-filter> |
| 103 | + </div> |
| 104 | + </div> |
| 105 | + <div class="is-column"> |
| 106 | + <div> |
| 107 | + <searchbox :id="'searchbox'" :autofocus="true" :realtime="true" :timeout="200" :field="['keywords', 'handle', 'persona']" :placeholder="'Search by keyword'"></searchbox> |
| 108 | + <search-datalist :id="'searchdatalist'" :realtime="true" :field="'keywords'" :suggestion="['keywords']"> |
| 109 | + <template slot="items" slot-scope="{ item, value }"> |
| 110 | + [[ value ]] [[ item._source.keywords ]] |
| 111 | + </template> |
| 112 | + |
| 113 | + <template slot="nosuggestion" slot-scope="{ value }"> |
| 114 | + Sorry, "[[ value ]]" doesn't exist... :( |
| 115 | + </template> |
| 116 | + |
| 117 | + <template slot="suggestions" slot-scope="{ suggestion }"> |
| 118 | + <span v-html="suggestion.highlight.first_name ? suggestion.highlight.first_name[0] : suggestion._source.first_name"></span> |
| 119 | + <span v-html="suggestion.highlight.last_name ? suggestion.highlight.last_name[0] : suggestion._source.last_name"></span> |
| 120 | + <span v-html="suggestion.highlight.handle ? suggestion.highlight.handle[0] : suggestion._source.handle"></span> |
| 121 | + <span v-html="suggestion.highlight.persona ? suggestion.highlight.persona[0] : suggestion._source.persona"></span> |
| 122 | + </template> |
| 123 | + </search-datalist> |
| 124 | + |
| 125 | + <div style="margin: 20px auto;width: 90%"> |
| 126 | + <search-button></search-button> |
| 127 | + <reset-button :emptyHits="false"></reset-button> |
| 128 | + </div> |
| 129 | + <hits> |
| 130 | + <template slot="hits" slot-scope="{ hits }"> |
| 131 | + <div class="is-score is-hits"> |
| 132 | + <strong v-if="hits.score === 0">No result found</strong> |
| 133 | + <strong v-else-if="hits.score === 1">1 result found</strong> |
| 134 | + <strong v-else-if="hits.score > 1">[[ hits.score ]] results found</strong> |
| 135 | + </div> |
| 136 | + <div v-for="item in hits.items" :item="item"> |
| 137 | + <div><strong>Identity (firstname, lastname) :</strong> ([[ item._source.first_name ]] [[ item._source.last_name ]] )</div> |
| 138 | + </div> |
| 139 | + </template> |
| 140 | + </hits> |
| 141 | + |
| 142 | + <paginate :previousText="'⮜ Previous page'" :nextText="'Next page ⮞'" :size="10"></paginate> |
| 143 | + </div> |
| 144 | + </div> |
| 145 | + </div> |
| 146 | + </section> |
| 147 | + </div> |
| 148 | + |
| 149 | + <script type="text/x-template" id="select2-template"> |
| 150 | + <select> |
| 151 | + <slot></slot> |
| 152 | + </select> |
| 153 | + </script> |
| 154 | + |
| 155 | + {% csrf_token %} |
| 156 | + {% include 'shared/analytics.html' %} |
| 157 | + {% include 'shared/footer_scripts.html' %} |
| 158 | + {% include 'shared/footer.html' %} |
| 159 | + <script src="https://unpkg.com/vue-innersearch@0.0.12/vue-innersearch.min.js"></script> |
| 160 | + |
| 161 | + |
| 162 | + <script> |
| 163 | + $('body').bootstrapTooltip({ |
| 164 | + selector: '[data-toggle="tooltip"]' |
| 165 | + }); |
| 166 | + const csrftoken = jQuery("[name=csrfmiddlewaretoken]").val(); |
| 167 | + document.keywords = {{keywords | safe}}; |
| 168 | + </script> |
| 169 | + <script src="{% static "v2/js/users.js" %}"></script> |
| 170 | + </body> |
| 171 | +</html> |
0 commit comments