Adds member search
This commit is contained in:
1 parent
c9bc0b77b0
commit
8e2ebf7bda
8 files changed
+1389
-6
No files matched your search
@@ -4,7 +4,6 @@
|
||||
|
||||
# TODO
|
||||
|
||||
- [ ] member search
|
||||
- [ ] calendar plugin (responsive calendar)
|
||||
- [ ] link to calendars (add to own calendar)
|
||||
- [ ] custom colors for popular categories
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
'use strict';
|
||||
/*global moment, jQuery, document */
|
||||
/*global moment, jQuery, document, _ */
|
||||
var program_endpoint = 'https://studentersamfundet.no/api/events/get_upcoming/';
|
||||
var inside_url = 'https://inside.studentersamfundet.no';
|
||||
var user_search_endpoint = inside_url + '/api/user.php';
|
||||
//var user_search_endpoint = 'http://inside.dev/api/user.php';
|
||||
var query_params = {
|
||||
//meta_key: '_neuf_events_starttime',
|
||||
//meta_value: moment().add('days', 1).format('X'),
|
||||
@@ -77,5 +80,29 @@ jQuery(document).ready(function() {
|
||||
$('.introduction').addClass('fadein');
|
||||
}
|
||||
|
||||
/* Search */
|
||||
$('.search-field').focus();
|
||||
var header_template = '<table><thead><tr><th>Navn</th><th>Brukernavn</th><th>Epost</th><th>Telefon</th></tr></thead>';
|
||||
$('.search-field').on('keyup', _.debounce(function(e) {
|
||||
if(e.target.value.length > 2) {
|
||||
$.getJSON(user_search_endpoint, {q: e.target.value}, function(data) {
|
||||
if(data.meta.num_results === 0) {
|
||||
$('.search-result-list').html('Ingen treff.');
|
||||
$('.search-results .meta').html('');
|
||||
return;
|
||||
}
|
||||
var list = '<tbody><% _.each(results, function(u) { %>' +
|
||||
'<tr><td><a href="'+ inside_url +'/?page=display-user&userid=<%= u.id %>"><%= u.firstname %> <%= u.lastname %></a></td><td><%= u.username %></td><td><a href="mailto:<%= u.email %>"><%= u.email %></a></td><td><a href="tlf:<%= u.number %>"><%= u.number %></a></td></li> <% }); %></tbody></table>';
|
||||
var html = header_template + _.template(list, data);
|
||||
$('.search-result-list').html(html);
|
||||
|
||||
var search_meta = 'Antall treff: <%= meta.num_results %>';
|
||||
$('.search-results .meta').html(_.template(search_meta, data));
|
||||
});
|
||||
} else {
|
||||
console.log('too short');
|
||||
}
|
||||
}, 300));
|
||||
|
||||
|
||||
});
|
||||
@@ -351,12 +351,21 @@ input[type=submit]{
|
||||
.search-form {
|
||||
@include grid-column(12);
|
||||
@extend .card;
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.search-about {
|
||||
@include grid-column(12);
|
||||
@extend .card;
|
||||
margin-top: rem-calc(32);
|
||||
}
|
||||
.meta {
|
||||
margin-bottom: rem-calc(16);
|
||||
font-style: italic;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"modernizr": "~2.6.2",
|
||||
"jquery": "~1.11.0",
|
||||
"foundation": "~5.3.0",
|
||||
"moment": "~2.7.0"
|
||||
"moment": "~2.7.0",
|
||||
"underscore": "~1.6.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"resolutions": {
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
"use strict";function format_posts(t){var e="",n=0;if(0===t.length)return"";for(e+='<thead><tr class="fadein"><th width="53%">Arrangement</th><th>Sted</th><th>Tid</th></tr></thead>',n=0;n<t.length;n++){var r=t[n];e+='<tr class="fadein">',e+='<td class="entry-title"><a href="'+r.url+'">'+r.title+"</a></td>",e+='<td class="entry-venue">'+r.custom_fields._neuf_events_venue+"</td>",e+='<td class="entry-starttime">'+moment.unix(r.custom_fields._neuf_events_starttime).utc().format("DD. MMMM YYYY, HH.mm")+"</td></tr>"}return e}var program_endpoint="https://studentersamfundet.no/api/events/get_upcoming/",query_params={count:10},entrypoint=".program-list";jQuery(document).ready(function(){moment.lang("nb");var t=jQuery;t.getJSON(program_endpoint+"?callback=?",query_params,function(e){if(e&&e.events){var n=format_posts(e.events);t(entrypoint).html(n)}}),t("#menu .menu-toggle").on("click",function(e){e.preventDefault();var n=t("#menu .main-menu, #menu .user-menu-wrap");n.toggleClass("visible")}),t("#menu a.profile-badge").on("click",function(e){e.preventDefault();var n=t("#menu .user-menu");n.toggleClass("visible")}),t("[data-toggle-introduction]").on("click",function(){t(this).parent().fadeOut(600),t.cookie("introduction-dismissed","1")}),"1"!==t.cookie("introduction-dismissed")&&(t(".introduction").show(),t(".introduction").addClass("fadein"))});
|
||||
"use strict";function format_posts(t){var e="",n=0;if(0===t.length)return"";for(e+='<thead><tr class="fadein"><th width="53%">Arrangement</th><th>Sted</th><th>Tid</th></tr></thead>',n=0;n<t.length;n++){var r=t[n];e+='<tr class="fadein">',e+='<td class="entry-title"><a href="'+r.url+'">'+r.title+"</a></td>",e+='<td class="entry-venue">'+r.custom_fields._neuf_events_venue+"</td>",e+='<td class="entry-starttime">'+moment.unix(r.custom_fields._neuf_events_starttime).utc().format("DD. MMMM YYYY, HH.mm")+"</td></tr>"}return e}var program_endpoint="https://studentersamfundet.no/api/events/get_upcoming/",inside_url="https://inside.studentersamfundet.no",user_search_endpoint=inside_url+"/api/user.php",query_params={count:10},entrypoint=".program-list";jQuery(document).ready(function(){moment.lang("nb");var t=jQuery;t.getJSON(program_endpoint+"?callback=?",query_params,function(e){if(e&&e.events){var n=format_posts(e.events);t(entrypoint).html(n)}}),t("#menu .menu-toggle").on("click",function(e){e.preventDefault();var n=t("#menu .main-menu, #menu .user-menu-wrap");n.toggleClass("visible")}),t("#menu a.profile-badge").on("click",function(e){e.preventDefault();var n=t("#menu .user-menu");n.toggleClass("visible")}),t("[data-toggle-introduction]").on("click",function(){t(this).parent().fadeOut(600),t.cookie("introduction-dismissed","1")}),"1"!==t.cookie("introduction-dismissed")&&(t(".introduction").show(),t(".introduction").addClass("fadein")),t(".search-field").focus();var e="<table><thead><tr><th>Navn</th><th>Brukernavn</th><th>Epost</th><th>Telefon</th></tr></thead>";t(".search-field").on("keyup",_.debounce(function(n){n.target.value.length>2?t.getJSON(user_search_endpoint,{q:n.target.value},function(n){if(0===n.meta.num_results)return t(".search-result-list").html("Ingen treff."),void t(".search-results .meta").html("");var r='<tbody><% _.each(results, function(u) { %><tr><td><a href="'+inside_url+'/?page=display-user&userid=<%= u.id %>"><%= u.firstname %> <%= u.lastname %></a></td><td><%= u.username %></td><td><a href="mailto:<%= u.email %>"><%= u.email %></a></td><td><a href="tlf:<%= u.number %>"><%= u.number %></a></td></li> <% }); %></tbody></table>',a=e+_.template(r,n);t(".search-result-list").html(a);var s="Antall treff: <%= meta.num_results %>";t(".search-results .meta").html(_.template(s,n))}):console.log("too short")},300))});
|
||||
+1344
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1 +1 @@
|
||||
/*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}dfn{font-style:italic}mark{background:#ff0;color:#000}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-size:1em}kbd,pre,samp{font-family:monospace,monospace}button{font:inherit}input,optgroup{margin:0}input,optgroup,select,textarea{color:inherit;font:inherit}button{overflow:visible}button,select{text-transform:none}html input[type="button"],input[type="reset"]{-webkit-appearance:button;cursor:pointer}input[type="submit"]{cursor:pointer}html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}meta.foundation-version{font-family:"/5.2.3/"}meta.foundation-mq-small{font-family:"/only screen/";width:0}meta.foundation-mq-medium{font-family:"/only screen and (min-width:40.063em)/";width:40.063em}meta.foundation-mq-large{font-family:"/only screen and (min-width:64.063em)/";width:64.063em}meta.foundation-mq-xlarge{font-family:"/only screen and (min-width:90.063em)/";width:90.063em}meta.foundation-mq-xxlarge{font-family:"/only screen and (min-width:120.063em)/";width:120.063em}meta.foundation-data-attribute-namespace{font-family:false}html,body{height:100%}*,*:before,*:after{box-sizing:border-box}html,body{font-size:100%}body{background:#fafafa;color:#000;padding:0;margin:0;font-family:"Open Sans",sans-serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:default}a:hover{cursor:pointer}img{max-width:100%;height:auto;-ms-interpolation-mode:bicubic}#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none!important}.left{float:left!important}.right{float:right!important}.clearfix:before,.clearfix:after{content:" ";display:table}.clearfix:after{clear:both}.hide{display:none}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}img{display:inline-block;vertical-align:middle}textarea{height:auto;min-height:50px}select,.row{width:100%}.row{margin:0 auto;max-width:78.125rem}.row:before,.row:after{content:" ";display:table}.row:after{clear:both}.row.collapse>.column,.row.collapse>.columns{padding-left:0;padding-right:0}.row.collapse .row{margin-left:0;margin-right:0}.row .row{width:auto;margin:0 -.9375rem;max-width:none}.row .row:before,.row .row:after{content:" ";display:table}.row .row:after{clear:both}.row .row.collapse{width:auto;margin:0;max-width:none}.row .row.collapse:before,.row .row.collapse:after{content:" ";display:table}.row .row.collapse:after{clear:both}.column,.columns{padding-left:.9375rem;padding-right:.9375rem;width:100%;float:left}[class*="column"]+[class*="column"]:last-child{float:right}[class*="column"]+[class*="column"].end{float:left}@media only screen{.small-push-0{position:relative;left:0%;right:auto}.small-pull-0{position:relative;right:0%;left:auto}.small-push-1{position:relative;left:8.33333%;right:auto}.small-pull-1{position:relative;right:8.33333%;left:auto}.small-push-2{position:relative;left:16.66667%;right:auto}.small-pull-2{position:relative;right:16.66667%;left:auto}.small-push-3{position:relative;left:25%;right:auto}.small-pull-3{position:relative;right:25%;left:auto}.small-push-4{position:relative;left:33.33333%;right:auto}.small-pull-4{position:relative;right:33.33333%;left:auto}.small-push-5{position:relative;left:41.66667%;right:auto}.small-pull-5{position:relative;right:41.66667%;left:auto}.small-push-6{position:relative;left:50%;right:auto}.small-pull-6{position:relative;right:50%;left:auto}.small-push-7{position:relative;left:58.33333%;right:auto}.small-pull-7{position:relative;right:58.33333%;left:auto}.small-push-8{position:relative;left:66.66667%;right:auto}.small-pull-8{position:relative;right:66.66667%;left:auto}.small-push-9{position:relative;left:75%;right:auto}.small-pull-9{position:relative;right:75%;left:auto}.small-push-10{position:relative;left:83.33333%;right:auto}.small-pull-10{position:relative;right:83.33Line truncated
|
||||
/*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}dfn{font-style:italic}mark{background:#ff0;color:#000}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-size:1em}kbd,pre,samp{font-family:monospace,monospace}button{font:inherit}input,optgroup{margin:0}input,optgroup,select,textarea{color:inherit;font:inherit}button{overflow:visible}button,select{text-transform:none}html input[type="button"],input[type="reset"]{-webkit-appearance:button;cursor:pointer}input[type="submit"]{cursor:pointer}html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}meta.foundation-version{font-family:"/5.2.3/"}meta.foundation-mq-small{font-family:"/only screen/";width:0}meta.foundation-mq-medium{font-family:"/only screen and (min-width:40.063em)/";width:40.063em}meta.foundation-mq-large{font-family:"/only screen and (min-width:64.063em)/";width:64.063em}meta.foundation-mq-xlarge{font-family:"/only screen and (min-width:90.063em)/";width:90.063em}meta.foundation-mq-xxlarge{font-family:"/only screen and (min-width:120.063em)/";width:120.063em}meta.foundation-data-attribute-namespace{font-family:false}html,body{height:100%}*,*:before,*:after{box-sizing:border-box}html,body{font-size:100%}body{background:#fafafa;color:#000;padding:0;margin:0;font-family:"Open Sans",sans-serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:default}a:hover{cursor:pointer}img{max-width:100%;height:auto;-ms-interpolation-mode:bicubic}#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none!important}.left{float:left!important}.right{float:right!important}.clearfix:before,.clearfix:after{content:" ";display:table}.clearfix:after{clear:both}.hide{display:none}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}img{display:inline-block;vertical-align:middle}textarea{height:auto;min-height:50px}select,.row{width:100%}.row{margin:0 auto;max-width:78.125rem}.row:before,.row:after{content:" ";display:table}.row:after{clear:both}.row.collapse>.column,.row.collapse>.columns{padding-left:0;padding-right:0}.row.collapse .row{margin-left:0;margin-right:0}.row .row{width:auto;margin:0 -.9375rem;max-width:none}.row .row:before,.row .row:after{content:" ";display:table}.row .row:after{clear:both}.row .row.collapse{width:auto;margin:0;max-width:none}.row .row.collapse:before,.row .row.collapse:after{content:" ";display:table}.row .row.collapse:after{clear:both}.column,.columns{padding-left:.9375rem;padding-right:.9375rem;width:100%;float:left}[class*="column"]+[class*="column"]:last-child{float:right}[class*="column"]+[class*="column"].end{float:left}@media only screen{.small-push-0{position:relative;left:0%;right:auto}.small-pull-0{position:relative;right:0%;left:auto}.small-push-1{position:relative;left:8.33333%;right:auto}.small-pull-1{position:relative;right:8.33333%;left:auto}.small-push-2{position:relative;left:16.66667%;right:auto}.small-pull-2{position:relative;right:16.66667%;left:auto}.small-push-3{position:relative;left:25%;right:auto}.small-pull-3{position:relative;right:25%;left:auto}.small-push-4{position:relative;left:33.33333%;right:auto}.small-pull-4{position:relative;right:33.33333%;left:auto}.small-push-5{position:relative;left:41.66667%;right:auto}.small-pull-5{position:relative;right:41.66667%;left:auto}.small-push-6{position:relative;left:50%;right:auto}.small-pull-6{position:relative;right:50%;left:auto}.small-push-7{position:relative;left:58.33333%;right:auto}.small-pull-7{position:relative;right:58.33333%;left:auto}.small-push-8{position:relative;left:66.66667%;right:auto}.small-pull-8{position:relative;right:66.66667%;left:auto}.small-push-9{position:relative;left:75%;right:auto}.small-pull-9{position:relative;right:75%;left:auto}.small-push-10{position:relative;left:83.33333%;right:auto}.small-pull-10{position:relative;right:83.33Line truncated
|
||||
@@ -13,7 +13,10 @@
|
||||
<h1 class="page-title"><?php wp_title("", true); ?></h1>
|
||||
<form method="get">
|
||||
<input type="text" id="id_user_query" class="search-field" name="q" placeholder="Søk på navn, epost, telefonnummer, brukernavn, medlemsnummer eller kortnummer" />
|
||||
<div class="search-results"></div>
|
||||
<div class="search-results">
|
||||
<div class="meta"></div>
|
||||
<div class="search-result-list"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user