diff --git a/src/app/assets/javascripts/application.js b/src/app/assets/javascripts/application.js
index 26fcc9dd..0a9ec35b 100644
--- a/src/app/assets/javascripts/application.js
+++ b/src/app/assets/javascripts/application.js
@@ -13,7 +13,6 @@
//= require jquery
//= require jquery_ujs
//= require jquery.scrollTo.min
-//= require typeahead.min
//= require fancybox
var Sessionizer = {};
diff --git a/src/app/assets/stylesheets/application.css.scss b/src/app/assets/stylesheets/application.css.scss
index 1b3bbb5c..47464d04 100644
--- a/src/app/assets/stylesheets/application.css.scss
+++ b/src/app/assets/stylesheets/application.css.scss
@@ -9,7 +9,6 @@
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
- *= require typeahead.min
*= require fancybox
*= require formtastic
*= require formtastic_changes
@@ -20,7 +19,3 @@
*= require tables
*= require_tree .
*/
-
-
-
-
diff --git a/src/app/controllers/presentations_controller.rb b/src/app/controllers/presentations_controller.rb
index 91dc32f0..8ffdca8b 100644
--- a/src/app/controllers/presentations_controller.rb
+++ b/src/app/controllers/presentations_controller.rb
@@ -9,16 +9,14 @@ def index
end
def create
- # super lame: look up the person by name. Twitter's typeahead library doesn't currently have a way to report an item's been selected.
-
- participant = Participant.where(:name => params[:name]).first
+ participant = Participant.find(params[:id])
if participant.nil?
- flash[:error] = "Sorry, no presenter named '#{params[:name]}' was found. Please try again."
+ flash[:error] = "Sorry, no presenter named #{params[:name]} was found. Please try again."
redirect_to session_presentations_path(@session)
return
elsif participant.signed_code_of_conduct_for_current_event? == false
- flash[:error] = "Sorry, '#{params[:name]}' hasn't signed the Code of Conduct for this event."
+ flash[:error] = "Sorry, #{params[:name]} hasn't signed the current Code of Conduct."
redirect_to session_presentations_path(@session)
return
end
diff --git a/src/app/views/layouts/application.html.erb b/src/app/views/layouts/application.html.erb
index 7bf0d342..63e26e6c 100644
--- a/src/app/views/layouts/application.html.erb
+++ b/src/app/views/layouts/application.html.erb
@@ -8,7 +8,8 @@
<%= stylesheet_link_tag "https://fonts.googleapis.com/css?family=Roboto:500|Titillium+Web:400,600" %>
<%= favicon_link_tag 'favicon.ico' %>
<%= yield(:head) %>
-
+
+
diff --git a/src/app/views/presentations/index.html.erb b/src/app/views/presentations/index.html.erb
index c82a4f7e..737a6862 100644
--- a/src/app/views/presentations/index.html.erb
+++ b/src/app/views/presentations/index.html.erb
@@ -8,23 +8,46 @@
<% end %>
-
Add presenters
-
-Note: In order to add a presenter to your session, they must be registered in the system and have agreed to the Code of Conduct.
+
+ Presenters must be registered and have agreed to the current Code of Conduct.
+
<%= semantic_form_for([@session, @presentation]) do |f| %>
-<%= text_field_tag 'name', '', :placeholder => 'Type a name', :id => 'typeahead' %> <%= submit_tag 'Add', :id => 'add-presenter' %>
+ <%= text_field_tag 'name', '', :id => 'autoComplete', :style => 'padding-left: 10px;', :autocomplete => "off" %>
+ <%= hidden_field_tag 'id', '', :id => 'autoCompleteValue' %>
+ <%= submit_tag 'Add Presenter', :id => 'add-presenter', :class => 'button' %>
<% end %>
<% content_for :javascript do %>
$(function() {
- $('#typeahead').typeahead(
- {name: 'presenters',
- prefetch: '/participants.json'}
- );
+ fetch('/participants.json').then(source => {
+ const autoCompleteJS = new autoComplete({
+ placeHolder: 'Search for name',
+ data: {
+ src: source.json(),
+ cache: true,
+ keys: ['value']
+ },
+ events: {
+ input: {
+ selection: (event) => {
+ const selection = event.detail.selection.value;
+ autoCompleteJS.input.value = selection.value;
+
+ const ele = document.getElementById("autoCompleteValue");
+ ele.value = selection.id;
+ }
+ }
+ },
+ resultItem: {
+ tag: "li",
+ class: "autoComplete_result",
+ highlight: "autoComplete_highlight",
+ selected: "autoComplete_selected"
+ },
+ });
+ });
});
-
-
<% end %>
diff --git a/src/vendor/assets/javascripts/typeahead.min.js b/src/vendor/assets/javascripts/typeahead.min.js
deleted file mode 100644
index 3d17a03f..00000000
--- a/src/vendor/assets/javascripts/typeahead.min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*!
- * typeahead.js 0.8.1
- * https://github.com/twitter/typeahead
- * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
- */
-
-(function(){var t="0.8.1",e={isMsie:function(){return/msie [\w.]+/i.test(navigator.userAgent)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isArray:$.isArray,isFunction:$.isFunction,isObject:function(t){return t===Object(t)},isUndefined:function(t){return t===void 0},bind:$.proxy,bindAll:function(t){var n;for(var i in t)e.isFunction(n=t[i])&&(t[i]=$.proxy(n,t))},indexOf:function(t,e){for(var n=0;t.length>n;n++)if(t[n]===e)return n;return-1},each:$.each,map:$.map,filter:function(t,e){var n=[];return $.each(t,function(i,s){e(s,i,t)&&n.push(s)}),n},every:function(t,e){var n=!0;return t?($.each(t,function(i,s){return(n=e.call(null,s,i,t))?void 0:!1}),!!n):n},mixin:$.extend,getUniqueId:function(){var t=0;return function(){return t++}}(),debounce:function(t,e,n){var i,s;return function(){var r,o,u=this,a=arguments;return r=function(){i=null,n||(s=t.apply(u,a))},o=n&&!i,clearTimeout(i),i=setTimeout(r,e),o&&(s=t.apply(u,a)),s}},throttle:function(t,e){var n,i,s,r,o,u;return o=0,u=function(){o=new Date,s=null,r=t.apply(n,i)},function(){var a=new Date,c=e-(a-o);return n=this,i=arguments,0>=c?(clearTimeout(s),s=null,o=a,r=t.apply(n,i)):s||(s=setTimeout(u,c)),r}},uniqueArray:function(t){for(var e={},n=[],i=0,s=t.length;s>i;++i)e.hasOwnProperty(t[i])||(n.push(t[i]),e[t[i]]=1);return n},tokenizeQuery:function(t){return $.trim(t).toLowerCase().split(/[\s]+/)},tokenizeText:function(t){return $.trim(t).toLowerCase().split(/[\s\-_]+/)},getProtocol:function(){return location.protocol},noop:function(){}},n=function(){var t=/\s+/;return{on:function(e,n){var i;if(!n)return this;for(this._callbacks=this._callbacks||{},e=e.split(t);i=e.shift();)this._callbacks[i]=this._callbacks[i]||[],this._callbacks[i].push(n);return this},trigger:function(e,n){var i,s;if(!this._callbacks)return this;for(e=e.split(t);i=e.shift();)if(s=this._callbacks[i])for(var r=0;s.length>r;r+=1)s[r].call(this,{type:i,data:n});return this}}}(),i=function(){function t(t){this.prefix=["__",t,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=RegExp("^"+this.prefix)}function n(){return(new Date).getTime()}function i(t){return JSON.stringify(e.isUndefined(t)?null:t)}function s(t){return JSON.parse(t)}var r,o=window.localStorage;return r=window.localStorage&&window.JSON?{_prefix:function(t){return this.prefix+t},_ttlKey:function(t){return this._prefix(t)+this.ttlKey},get:function(t){return this.isExpired(t)&&this.remove(t),s(o.getItem(this._prefix(t)))},set:function(t,s,r){return e.isNumber(r)?o.setItem(this._ttlKey(t),i(n()+r)):o.removeItem(this._ttlKey(t)),o.setItem(this._prefix(t),i(s))},remove:function(t){return o.removeItem(this._ttlKey(t)),o.removeItem(this._prefix(t)),this},clear:function(){var t,e,n=[],i=o.length;for(t=0;i>t;t++)(e=o.key(t)).match(this.keyMatcher)&&n.push(e.replace(this.keyMatcher,""));for(t=n.length;t--;)this.remove(n[t]);return this},isExpired:function(t){var i=s(o.getItem(this._ttlKey(t)));return e.isNumber(i)&&n()>i?!0:!1}}:{get:e.noop,set:e.noop,remove:e.noop,clear:e.noop,isExpired:e.noop},e.mixin(t.prototype,r),t}(),s=function(){function t(t){e.bindAll(this),t=t||{},this.sizeLimit=t.sizeLimit||10,this.cache={},this.cachedKeysByAge=[]}return e.mixin(t.prototype,{get:function(t){return this.cache[t]},set:function(t,e){var n;this.cachedKeysByAge.length===this.sizeLimit&&(n=this.cachedKeysByAge.shift(),delete this.cache[n]),this.cache[t]=e,this.cachedKeysByAge.push(t)}}),t}(),r=function(){function t(t){var n;e.bindAll(this),t=t||{},n=/^throttle$/i.test(t.rateLimitFn)?e.throttle:e.debounce,this.wait=t.wait||300,this.wildcard=t.wildcard||"%QUERY",this.maxConcurrentRequests=t.maxConcurrentRequests||6,this.concurrentRequests=0,this.onDeckRequestArgs=null,this.cache=new s,this.get=n(this.get,this.wait)}return e.mixin(t.prototype,{_incrementConcurrentRequests:function(){this.concurrentRequests++},_decrementConcurrentRequests:function(){this.concurrentRequests--},_belowConcurrentRequestsThreshold:function(){return this.concurrentRequests-1});return n?t:void 0})},_getItemsFromIds:function(t){var n=[];return e.map(t,e.bind(function(t){var e=this.itemHash[t];e&&n.push(e)},this)),n},_matcher:function(t){if(this._customMatcher){var n=this._customMatcher;return function(t){return n(t)}}return function(n){var i=n.tokens,s=e.every(t,function(t){var n=e.filter(i,function(e){return 0===e.indexOf(t)});return n.length});return s?n:void 0}},_compareItems:function(t,e,n){var i=t.score_boost?t.score_boost:0,s=e.score_boost?e.score_boost:0,r=t.score?t.score:0,o=e.score?e.score:0;return n?e.weight+s-(t.weight+i):o+s-(r+i)},_ranker:function(t,e){if(this._customRanker)return this._customRanker(t,e);var n=t.weight&&0!==t.weight,i=e.weight&&0!==e.weight;return n&&!i?-1:i&&!n?1:n&&i?this._compareItems(t,e,!0):this._compareItems(t,e,!1)},_processRemoteSuggestions:function(t,n){var i=this;return function(s){e.each(s,function(t,s){var r=!1;return s=e.isString(s)?{value:s}:s,e.each(n,function(t,e){return s.value===e.value?(r=!0,!1):void 0}),!r&&n.push(s),n.length").css({position:"absolute",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",fontFamily:t.css("font-family"),fontSize:t.css("font-size"),fontStyle:t.css("font-style"),fontVariant:t.css("font-variant"),fontWeight:t.css("font-weight"),wordSpacing:t.css("word-spacing"),letterSpacing:t.css("letter-spacing"),textIndent:t.css("text-indent"),textRendering:t.css("text-rendering"),textTransform:t.css("text-transform")}).insertAfter(t)}function s(t,e){return t=(t||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ").toLowerCase(),e=(e||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ").toLowerCase(),t===e}return e.mixin(t.prototype,n,{_handleFocus:function(){this.trigger("focus")},_handleBlur:function(){this.trigger("blur")},_handleSpecialKeyEvent:function(t){var e=this.specialKeyCodeMap[t.which||t.keyCode];e&&this.trigger(e,t)},_compareQueryToInputValue:function(){var t=this.getInputValue(),e=s(this.query,t),n=e?this.query.length!==t.length:!1;n?this.trigger("whitespaceChange",{value:this.query}):e||this.trigger("queryChange",{value:this.query=t})},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},getInputValue:function(){return this.$input.val()},setInputValue:function(t,e){this.$input.val(t),e!==!0&&this._compareQueryToInputValue()},getHintValue:function(){return this.$hint.val()},setHintValue:function(t){this.$hint.val(t)},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},isOverflow:function(){return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>this.$input.width()},isCursorAtEnd:function(){var t,n=this.$input.val().length,i=this.$input[0].selectionStart;return e.isNumber(i)?i===n:document.selection?(t=document.selection.createRange(),t.moveStart("character",-n),n===t.text.length):!0}}),t}(),a=function(){function t(t){e.bindAll(this),this.isMouseOverDropdown,this.$menu=$(t.menu).on("mouseenter",this._handleMouseenter).on("mouseleave",this._handleMouseleave).on("mouseover",".tt-suggestions > .tt-suggestion",this._handleMouseover).on("click",".tt-suggestions > .tt-suggestion",this._handleSelection)}function i(t){var e=t.parents(".tt-suggestions").first();return{value:t.data("value"),query:e.data("query"),dataset:e.data("dataset")}}return e.mixin(t.prototype,n,{_handleMouseenter:function(){this.isMouseOverDropdown=!0},_handleMouseleave:function(){this.isMouseOverDropdown=!1},_handleMouseover:function(t){this._getSuggestions().removeClass("tt-is-under-cursor"),$(t.currentTarget).addClass("tt-is-under-cursor")},_handleSelection:function(t){this.trigger("select",i($(t.currentTarget)))},_moveCursor:function(t){var e,n,i,s;if(this.$menu.hasClass("tt-is-open")){if(e=this._getSuggestions(),n=e.filter(".tt-is-under-cursor"),n.removeClass("tt-is-under-cursor"),i=e.index(n)+t,i=(i+1)%(e.length+1)-1,-1===i)return this.trigger("cursorOff"),void 0;-1>i&&(i=e.length-1),s=e.eq(i).addClass("tt-is-under-cursor"),this.trigger("cursorOn",{value:s.data("value")})}},_getSuggestions:function(){return this.$menu.find(".tt-suggestions > .tt-suggestion")},hideUnlessMouseIsOverDropdown:function(){this.isMouseOverDropdown||this.hide()},hide:function(){this.$menu.hasClass("tt-is-open")&&(this.$menu.removeClass("tt-is-open").find(".tt-suggestions > .tt-suggestion").removeClass("tt-is-under-cursor"),this.trigger("hide"))},show:function(){this.$menu.hasClass("tt-is-open")||(this.$menu.addClass("tt-is-open"),this.trigger("show"))},isOpen:function(){return this.$menu.hasClass("tt-is-open")},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(1)},getSuggestionUnderCursor:function(){var t=this._getSuggestions().filter(".tt-is-under-cursor").first();return t.length>0?i(t):null},getFirstSuggestion:function(){var t=this._getSuggestions().first();return t.length>0?i(t):null},renderSuggestions:function(t,n,i){var s,r,o,u="tt-dataset-"+n.name,a=this.$menu.find("."+u);0===a.length&&(a=$('
').addClass(u).appendTo(this.$menu)),s=document.createElement("div"),r=document.createDocumentFragment(),this.clearSuggestions(n.name),i.length>0&&(this.$menu.removeClass("tt-is-empty"),e.each(i,function(t,e){s.innerHTML=n.template.render(e),o=s.firstChild,o.setAttribute("data-value",e.value),r.appendChild(o)})),a.find("> .tt-suggestions").data({query:t,dataset:n.name}).append(r),this.trigger("suggestionsRender")},clearSuggestions:function(t){var e=t?this.$menu.find(".tt-dataset-"+t+" .tt-suggestions"):this.$menu.find(".tt-suggestions");e.empty(),0===this._getSuggestions().length&&this.$menu.addClass("tt-is-empty")}}),t}(),c=function(){function t(t){e.bindAll(this),this.$node=i(t.input),this.datasets=t.datasets,e.each(this.datasets,function(t,e){var n='%body';e.template=e.template?e.engine.compile(n.replace("%body",e.template)):{render:function(t){return n.replace("%body",""+t.value+"
")}}}),this.inputView=new u({input:this.$node.find(".tt-query"),hint:this.$node.find(".tt-hint")}),this.dropdownView=new a({menu:this.$node.find(".tt-dropdown-menu")}),this.dropdownView.on("select",this._handleSelection).on("cursorOn",this._clearHint).on("cursorOn",this._setInputValueToSuggestionUnderCursor).on("cursorOff",this._setInputValueToQuery).on("cursorOff",this._updateHint).on("suggestionsRender",this._updateHint).on("show",this._updateHint).on("hide",this._clearHint),this.inputView.on("focus",this._showDropdown).on("blur",this._hideDropdown).on("blur",this._setInputValueToQuery).on("enter",this._handleSelection).on("queryChange",this._clearHint).on("queryChange",this._clearSuggestions).on("queryChange",this._getSuggestions).on("whitespaceChange",this._updateHint).on("queryChange whitespaceChange",this._showDropdown).on("queryChange whitespaceChange",this._setLanguageDirection).on("esc",this._hideDropdown).on("esc",this._setInputValueToQuery).on("tab up down",this._managePreventDefault).on("up down",this._moveDropdownCursor).on("up down",this._showDropdown).on("tab left right",this._autocomplete)}function i(t){var e=$(t),n=$(s.hint).css({"background-color":e.css("background-color")});if(0===e.length)return null;try{!e.attr("dir")&&e.attr("dir","auto")}catch(i){}return e.attr({autocomplete:"off",spellcheck:!1}).addClass("tt-query").wrap(s.wrapper).parent().prepend(n).append(s.dropdown)}var s={wrapper:'',hint:'',dropdown:''};return e.mixin(t.prototype,n,{_managePreventDefault:function(t){var e,n,i=t.data,s=!1;switch(t.type){case"tab":e=this.inputView.getHintValue(),n=this.inputView.getInputValue(),s=e&&e!==n;break;case"up":case"down":s=!i.shiftKey&&!i.ctrlKey&&!i.metaKey}s&&i.preventDefault()},_setLanguageDirection:function(){var t="tt-"+this.inputView.getLanguageDirection();this.$node.hasClass(t)||this.$node.removeClass("tt-ltr tt-rtl").addClass(t)},_updateHint:function(){var t,e,n,i,s=this.dropdownView.getFirstSuggestion(),r=s?s.value:null;r&&this.dropdownView.isOpen()&&!this.inputView.isOverflow()&&(t=this.inputView.getInputValue(),e=t.replace(/\s{2,}/g," ").replace(/^\s+/g,""),n=RegExp("^(?:"+e+")(.*$)","i"),i=n.exec(r),this.inputView.setHintValue(t+(i?i[1]:"")))},_clearHint:function(){this.inputView.setHintValue("")},_clearSuggestions:function(){this.dropdownView.clearSuggestions()},_setInputValueToQuery:function(){this.inputView.setInputValue(this.inputView.getQuery())},_setInputValueToSuggestionUnderCursor:function(t){var e=t.data;this.inputView.setInputValue(e.value,!0)},_showDropdown:function(){this.dropdownView.show()},_hideDropdown:function(t){this.dropdownView["blur"===t.type?"hideUnlessMouseIsOverDropdown":"hide"]()},_moveDropdownCursor:function(t){var e=t.data;e.shiftKey||e.ctrlKey||e.metaKey||this.dropdownView["up"===t.type?"moveCursorUp":"moveCursorDown"]()},_handleSelection:function(t){var n="select"===t.type,i=n?t.data:this.dropdownView.getSuggestionUnderCursor();i&&(this.inputView.setInputValue(i.value),n?this.inputView.focus():t.data.preventDefault(),n&&e.isMsie()?setTimeout(this.dropdownView.hide,0):this.dropdownView.hide())},_getSuggestions:function(){var t=this,n=this.inputView.getQuery();e.each(this.datasets,function(e,i){i.getSuggestions(n,function(e){t._renderSuggestions(n,i,e)})})},_renderSuggestions:function(t,e,n){t===this.inputView.getQuery()&&(n=n.slice(0,e.limit),this.dropdownView.renderSuggestions(t,e,n))},_autocomplete:function(t){var e,n,i,s;("right"!==t.type&&"left"!==t.type||(e=this.inputView.isCursorAtEnd(),n="ltr"===this.inputView.getLanguageDirection()?"left"===t.type:"right"===t.type,e&&!n))&&(i=this.inputView.getQuery(),s=this.inputView.getHintValue(),""!==s&&i!==s&&this.inputView.setInputValue(s))}}),t}();(function(){function t(t){return s[t]?s[t].apply(this,[].slice.call(arguments,1)):s.initialize.apply(this,arguments)}function n(t){a=t}var i,s,u={},a={};jQuery.fn.typeahead=t,t.configureTransport=n,s={initialize:function(n){var s={};if(n=e.isArray(n)?n:[n],0===n.length)throw Error("no datasets provided");return delete t.configureTransport,i=i||new r(a),e.each(n,function(t,n){var r,a=n.name=n.name||e.getUniqueId();if(u[a])r=u[a];else{if(n.limit=n.limit||5,n.template=n.template,n.engine=n.engine,n.template&&!n.engine)throw Error("no template engine specified for "+a);r=u[a]=new o({name:n.name,limit:n.limit,local:n.local,prefetch:n.prefetch,ttl_ms:n.ttl_ms,remote:n.remote,matcher:n.matcher,ranker:n.ranker,transport:i})}s[a]={name:n.name,limit:n.limit,template:n.template,engine:n.engine,getSuggestions:r.getSuggestions}}),this.each(function(){$(this).data({typeahead:new c({input:this,datasets:s})})})}}})()})();
\ No newline at end of file
diff --git a/src/vendor/assets/stylesheets/typeahead.min.css b/src/vendor/assets/stylesheets/typeahead.min.css
deleted file mode 100644
index 87b44b65..00000000
--- a/src/vendor/assets/stylesheets/typeahead.min.css
+++ /dev/null
@@ -1,7 +0,0 @@
-/*!
- * typeahead.js 0.8.1
- * https://github.com/twitter/typeahead
- * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
- */
-
-.twitter-typeahead{position:relative!important;display:inline-block;*display:inline;*zoom:1}.tt-query{position:relative!important;*margin-top:-1px!important;vertical-align:top!important;background-color:transparent!important;background-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)!important}.tt-hint{position:absolute!important;top:0!important;left:0!important;border-color:transparent!important;-webkit-box-shadow:none!important;-moz-box-shadow:none!important;box-shadow:none!important}.tt-dropdown-menu,.tt-suggestions,.tt-suggestion{padding:0;margin:0;list-style:none}.tt-dropdown-menu{position:absolute;top:100%;left:0;z-index:100;display:none}.tt-dropdown-menu.tt-is-open{display:block}.tt-dropdown-menu.tt-is-empty{display:none}.tt-suggestion{display:block;white-space:nowrap;cursor:pointer}.tt-suggestion *{white-space:normal}.twitter-typeahead.tt-rtl{direction:rtl}.twitter-typeahead.tt-rtl .tt-dropdown-menu{left:auto;right:0}
\ No newline at end of file