From 7281ee74b28522cb89ecdfc155a82a7b797930c9 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 12 Jul 2016 15:20:10 +0200 Subject: [PATCH 1/4] Fix bug double procedure path publish --- app/controllers/admin/procedures_controller.rb | 13 ++++++++----- app/models/procedure.rb | 3 +-- spec/factories/procedure.rb | 2 +- spec/views/admin/procedures/show.html.haml_spec.rb | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index 04ae580c1..b7d94302a 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -89,20 +89,22 @@ class Admin::ProceduresController < AdminController def publish procedure = current_administrateur.procedures.find(params[:procedure_id]) - test_procedure = ProcedurePath.new( + new_procedure_path = ProcedurePath.new( { path: params[:procedure_path], procedure: procedure, administrateur: procedure.administrateur }) - unless test_procedure.validate + if new_procedure_path.validate + new_procedure_path.delete + else flash.alert = 'Lien de la procédure invalide' return redirect_to admin_procedures_path end procedure_path = ProcedurePath.find_by_path(params[:procedure_path]) - if (procedure_path) - if (procedure_path.administrateur_id == current_administrateur.id) + if procedure_path + if procedure_path.administrateur_id == current_administrateur.id procedure_path.procedure.archive else @mine = false @@ -110,7 +112,8 @@ class Admin::ProceduresController < AdminController end end - procedure.publish(params[:procedure_path]) + procedure.publish!(params[:procedure_path]) + flash.notice = "Procédure publiée" render js: "window.location = '#{admin_procedures_path}'" diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 07505e2fd..ffbec6720 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -17,7 +17,6 @@ class Procedure < ActiveRecord::Base accepts_nested_attributes_for :types_de_champ,:reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true accepts_nested_attributes_for :types_de_piece_justificative, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true accepts_nested_attributes_for :module_api_carto - accepts_nested_attributes_for :procedure_path mount_uploader :logo, ProcedureLogoUploader @@ -76,7 +75,7 @@ class Procedure < ActiveRecord::Base return procedure if procedure.save end - def publish(path) + def publish!(path) self.update_attributes!({ published: true, archived: false }) ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur) end diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index 976a2bf50..d8d5dc8c1 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -58,7 +58,7 @@ FactoryGirl.define do trait :published do after(:create) do |procedure, _evaluator| - procedure.publish(generate(:published_path)) + procedure.publish!(generate(:published_path)) end end end diff --git a/spec/views/admin/procedures/show.html.haml_spec.rb b/spec/views/admin/procedures/show.html.haml_spec.rb index 92ad1d824..06c716479 100644 --- a/spec/views/admin/procedures/show.html.haml_spec.rb +++ b/spec/views/admin/procedures/show.html.haml_spec.rb @@ -27,7 +27,7 @@ describe 'admin/procedures/show.html.haml', type: :view do describe 'procedure is published' do before do - procedure.publish('fake_path') + procedure.publish!('fake_path') procedure.reload render end @@ -45,7 +45,7 @@ describe 'admin/procedures/show.html.haml', type: :view do describe 'procedure is archived' do before do - procedure.publish('fake_path') + procedure.publish!('fake_path') procedure.archive procedure.reload render From 23e582d59727e3fe5d505b429d0c5a967f4a6198 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 12 Jul 2016 15:25:26 +0200 Subject: [PATCH 2/4] Add type_de_champ yes/no --- app/assets/stylesheets/description.scss | 5 +++++ app/models/type_de_champ.rb | 3 ++- app/views/users/description/_champs.html.haml | 3 +++ app/views/users/description/champs/_yes_no.html.haml | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 app/views/users/description/champs/_yes_no.html.haml diff --git a/app/assets/stylesheets/description.scss b/app/assets/stylesheets/description.scss index 6bef57d7f..83028da8a 100644 --- a/app/assets/stylesheets/description.scss +++ b/app/assets/stylesheets/description.scss @@ -44,6 +44,11 @@ @extend .col-lg-3; } +.type_champ-yes_no { + @extend .col-md-3; + @extend .col-lg-3; +} + .type_champ-phone { @extend .col-md-2; @extend .col-lg-2; diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index 3f3bdf1f4..9dface12d 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -9,7 +9,8 @@ class TypeDeChamp < ActiveRecord::Base civilite: 'civilite', email: 'email', phone: 'phone', - address: 'address' + address: 'address', + yes_no: 'yes_no' } belongs_to :procedure diff --git a/app/views/users/description/_champs.html.haml b/app/views/users/description/_champs.html.haml index df175b482..57664feda 100644 --- a/app/views/users/description/_champs.html.haml +++ b/app/views/users/description/_champs.html.haml @@ -23,6 +23,9 @@ - elsif champ.type_champ == 'datetime' =render partial: 'users/description/champs/datetime', locals: {champ: champ} + - elsif champ.type_champ == 'yes_no' + =render partial: 'users/description/champs/yes_no', locals: {champ: champ} + -else %input.form-control{name:"champs['#{champ.id}']", placeholder: champ.libelle, diff --git a/app/views/users/description/champs/_yes_no.html.haml b/app/views/users/description/champs/_yes_no.html.haml new file mode 100644 index 000000000..9224f98f5 --- /dev/null +++ b/app/views/users/description/champs/_yes_no.html.haml @@ -0,0 +1,7 @@ +%label.radio-inline + = radio_button_tag "champs['#{champ.id}']", "true", champ.value == 'true' + Oui + +%label.radio-inline + = radio_button_tag "champs['#{champ.id}']", "false", champ.value == 'false' + Non \ No newline at end of file From 382c8d870018d8d0ded467b3e58afdaa0f3c9230 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 18 Jul 2016 09:37:22 +0200 Subject: [PATCH 3/4] Add minim preparation for dossier uniq page --- app/assets/javascripts/dossiers.js | 5 +++++ app/views/dossiers/_show.html.haml | 10 ++-------- app/views/dossiers/etapes/_etape1.html.haml | 5 +++-- app/views/dossiers/etapes/_etape2.html.haml | 1 + app/views/dossiers/etapes/_etape3.html.haml | 6 ++++++ app/views/dossiers/etapes/_etape4.html.haml | 6 ++++++ app/views/dossiers/new_siret.js.erb | 17 ++++++++++++----- config/initializers/carrierwave.rb | 2 ++ 8 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 app/views/dossiers/etapes/_etape3.html.haml create mode 100644 app/views/dossiers/etapes/_etape4.html.haml diff --git a/app/assets/javascripts/dossiers.js b/app/assets/javascripts/dossiers.js index 86764fb01..0307b5a63 100644 --- a/app/assets/javascripts/dossiers.js +++ b/app/assets/javascripts/dossiers.js @@ -31,4 +31,9 @@ function error_form_siret(invalid_siret){ function reset_form_siret(){ $("input[type='submit']").removeClass('btn-danger').addClass('btn-success').val('Valider'); $("#dossier_siret").removeClass('input-error'); +} + +function toggle_etape_1(){ + $('.row.etape.etape_1 .etapes_menu #logos').toggle(100); + $('.row.etape.etape_1 .etapes_informations #description_procedure').toggle(100); } \ No newline at end of file diff --git a/app/views/dossiers/_show.html.haml b/app/views/dossiers/_show.html.haml index 015360580..4874bedb6 100644 --- a/app/views/dossiers/_show.html.haml +++ b/app/views/dossiers/_show.html.haml @@ -8,13 +8,7 @@ -#- if @facade.procedure.module_api_carto.use_api_carto? -# .row.etape.etape_3 - -# .etape.etapes_menu.col-md-3.col-lg-3 - -# %h3 - -# 3 - Ma zone d'intervention - -# .etape.etapes_informations.col-md-9.col-lg-9 + -# = render partial: '/dossiers/etapes/etape3' -# -#.row.etape.etape_4 - -# .etape.etapes_menu.col-md-3.col-lg-3 - -# %h3 - -# = "#{@facade.procedure.module_api_carto.use_api_carto? ? '4' : '3'} - Mon dossier" - -# .etape.etapes_informations.col-md-9.col-lg-9 \ No newline at end of file + -# = render partial: '/dossiers/etapes/etape4' diff --git a/app/views/dossiers/etapes/_etape1.html.haml b/app/views/dossiers/etapes/_etape1.html.haml index 917e08b0f..9b3a10025 100644 --- a/app/views/dossiers/etapes/_etape1.html.haml +++ b/app/views/dossiers/etapes/_etape1.html.haml @@ -2,7 +2,8 @@ %h3 Ma procédure %br - .center + + #logos.center{class: (@facade.entreprise.nil? ? '' : 'mask')} - if @facade.procedure.euro_flag #euro_flag.flag =image_tag('drapeau_europe.png') @@ -15,5 +16,5 @@ %h2#titre_procedure.text-info = @facade.procedure.libelle - %p{style:'width: 95%;'} + %p#description_procedure{style:'width: 95%;', class: (@facade.entreprise.nil? ? '' : 'mask')} = h @facade.procedure.description.html_safe \ No newline at end of file diff --git a/app/views/dossiers/etapes/_etape2.html.haml b/app/views/dossiers/etapes/_etape2.html.haml index cb14a694c..2e8f161e9 100644 --- a/app/views/dossiers/etapes/_etape2.html.haml +++ b/app/views/dossiers/etapes/_etape2.html.haml @@ -22,6 +22,7 @@ = f.hidden_field :dossier_id, value: @facade.dossier.id = f.submit 'Valider', class: %w(btn btn-lg btn-success), data: { disable_with: "Recherche en cours ..." } - else + %br #recap_info_entreprise = render partial: '/dossiers/infos_entreprise' diff --git a/app/views/dossiers/etapes/_etape3.html.haml b/app/views/dossiers/etapes/_etape3.html.haml new file mode 100644 index 000000000..5e5735480 --- /dev/null +++ b/app/views/dossiers/etapes/_etape3.html.haml @@ -0,0 +1,6 @@ +.etape.etapes_menu.col-md-3.col-lg-3 + %h3 + Ma zone d'intervention + +.etape.etapes_informations.col-md-9.col-lg-9 + .row diff --git a/app/views/dossiers/etapes/_etape4.html.haml b/app/views/dossiers/etapes/_etape4.html.haml new file mode 100644 index 000000000..64636c231 --- /dev/null +++ b/app/views/dossiers/etapes/_etape4.html.haml @@ -0,0 +1,6 @@ +.etape.etapes_menu.col-md-3.col-lg-3 + %h3 + Mon dossier + +.etape.etapes_informations.col-md-9.col-lg-9 + .row diff --git a/app/views/dossiers/new_siret.js.erb b/app/views/dossiers/new_siret.js.erb index 803581a3c..c3d7503cf 100644 --- a/app/views/dossiers/new_siret.js.erb +++ b/app/views/dossiers/new_siret.js.erb @@ -1,7 +1,14 @@ -$('.row.etape.etape_2').html("<%= escape_javascript(render partial: '/dossiers/etapes/etape2', locals: { facade: @facade } ) %>"); -the_terms(); - -<% unless flash.empty? %> +<% if flash.empty? %> +$('.row.etape.etape_2').hide(300, render_new_siret); +$('.row.etape.etape_2').slideDown(400, the_terms); +toggle_etape_1(); +<% else %> error_form_siret('<%= invalid_siret %>'); <% end %> -<% flash.clear %> \ No newline at end of file + +<% flash.clear %> + + +function render_new_siret(){ + $('.row.etape.etape_2').html("<%= escape_javascript(render partial: '/dossiers/etapes/etape2', locals: { facade: @facade } ) %>"); +} \ No newline at end of file diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 35813733a..dcb948fc1 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -26,6 +26,8 @@ CarrierWave.configure do |config| if Rails.env.production? config.fog_directory = "tps" + elsif Rails.env.development? + config.fog_directory= "test_local" else config.fog_directory = "tps_dev" end From 5ba88aa31aa1b3c6285008f5434a114c6249aa2b Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 18 Jul 2016 11:23:03 +0200 Subject: [PATCH 4/4] Fix address type search --- app/assets/stylesheets/description.scss | 9 +- .../gestionnaires/passwords/new.html.haml | 1 + app/views/users/passwords/new.html.haml | 1 + vendor/assets/javascripts/typeahead.bundle.js | 2447 ++++++++++++++++- 4 files changed, 2455 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/description.scss b/app/assets/stylesheets/description.scss index 83028da8a..dc57f081a 100644 --- a/app/assets/stylesheets/description.scss +++ b/app/assets/stylesheets/description.scss @@ -25,7 +25,14 @@ @extend .col-md-6; @extend .col-lg-6; - input[type='address'] { + .twitter-typeahead { + width: 100%; + input { + width: 100%; + display: block !important; + } + } + .tt-menu { width: 100%; } } diff --git a/app/views/gestionnaires/passwords/new.html.haml b/app/views/gestionnaires/passwords/new.html.haml index 9c15a8ca9..eed941e40 100644 --- a/app/views/gestionnaires/passwords/new.html.haml +++ b/app/views/gestionnaires/passwords/new.html.haml @@ -1,5 +1,6 @@ = devise_error_messages! +%br #form_login = image_tag('logo-tps.png') %br diff --git a/app/views/users/passwords/new.html.haml b/app/views/users/passwords/new.html.haml index 4ffd7bc17..6504a7295 100644 --- a/app/views/users/passwords/new.html.haml +++ b/app/views/users/passwords/new.html.haml @@ -28,6 +28,7 @@ = devise_error_messages! +%br #form_login = image_tag('logo-tps.png') %br diff --git a/vendor/assets/javascripts/typeahead.bundle.js b/vendor/assets/javascripts/typeahead.bundle.js index ffd98f320..64b508ac5 100644 --- a/vendor/assets/javascripts/typeahead.bundle.js +++ b/vendor/assets/javascripts/typeahead.bundle.js @@ -4,5 +4,2448 @@ * Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT */ -!function(a,b){"function"==typeof define&&define.amd?define("bloodhound",["jquery"],function(c){return a.Bloodhound=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):a.Bloodhound=b(jQuery)}(this,function(a){var b=function(){"use strict";return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},isElement:function(a){return!(!a||1!==a.nodeType)},isJQuery:function(b){return b instanceof a},toStr:function(a){return b.isUndefined(a)||null===a?"":a+""},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,identity:function(a){return a},clone:function(b){return a.extend(!0,{},b)},getIdGenerator:function(){var a=0;return function(){return a++}},templatify:function(b){function c(){return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c="0.11.1",d=function(){"use strict";function a(a){return a=b.toStr(a),a?a.split(/\s+/):[]}function c(a){return a=b.toStr(a),a?a.split(/\W+/):[]}function d(a){return function(c){return c=b.isArray(c)?c:[].slice.call(arguments,0),function(d){var e=[];return b.each(c,function(c){e=e.concat(a(b.toStr(d[c])))}),e}}}return{nonword:c,whitespace:a,obj:{nonword:d(c),whitespace:d(a)}}}(),e=function(){"use strict";function c(c){this.maxSize=b.isNumber(c)?c:100,this.reset(),this.maxSize<=0&&(this.set=this.get=a.noop)}function d(){this.head=this.tail=null}function e(a,b){this.key=a,this.val=b,this.prev=this.next=null}return b.mixin(c.prototype,{set:function(a,b){var c,d=this.list.tail;this.size>=this.maxSize&&(this.list.remove(d),delete this.hash[d.key],this.size--),(c=this.hash[a])?(c.val=b,this.list.moveToFront(c)):(c=new e(a,b),this.list.add(c),this.hash[a]=c,this.size++)},get:function(a){var b=this.hash[a];return b?(this.list.moveToFront(b),b.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new d}}),b.mixin(d.prototype,{add:function(a){this.head&&(a.next=this.head,this.head.prev=a),this.head=a,this.tail=this.tail||a},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev},moveToFront:function(a){this.remove(a),this.add(a)}}),c}(),f=function(){"use strict";function c(a,c){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+b.escapeRegExChars(this.prefix)),this.ls=c||h,!this.ls&&this._noop()}function d(){return(new Date).getTime()}function e(a){return JSON.stringify(b.isUndefined(a)?null:a)}function f(b){return a.parseJSON(b)}function g(a){var b,c,d=[],e=h.length;for(b=0;e>b;b++)(c=h.key(b)).match(a)&&d.push(c.replace(a,""));return d}var h;try{h=window.localStorage,h.setItem("~~~","!"),h.removeItem("~~~")}catch(i){h=null}return b.mixin(c.prototype,{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=b.noop},_safeSet:function(a,b){try{this.ls.setItem(a,b)}catch(c){"QuotaExceededError"===c.name&&(this.clear(),this._noop())}},get:function(a){return this.isExpired(a)&&this.remove(a),f(this.ls.getItem(this._prefix(a)))},set:function(a,c,f){return b.isNumber(f)?this._safeSet(this._ttlKey(a),e(d()+f)):this.ls.removeItem(this._ttlKey(a)),this._safeSet(this._prefix(a),e(c))},remove:function(a){return this.ls.removeItem(this._ttlKey(a)),this.ls.removeItem(this._prefix(a)),this},clear:function(){var a,b=g(this.keyMatcher);for(a=b.length;a--;)this.remove(b[a]);return this},isExpired:function(a){var c=f(this.ls.getItem(this._ttlKey(a)));return b.isNumber(c)&&d()>c?!0:!1}}),c}(),g=function(){"use strict";function c(a){a=a||{},this.cancelled=!1,this.lastReq=null,this._send=a.transport,this._get=a.limiter?a.limiter(this._get):this._get,this._cache=a.cache===!1?new e(0):h}var d=0,f={},g=6,h=new e(10);return c.setMaxPendingRequests=function(a){g=a},c.resetCache=function(){h.reset()},b.mixin(c.prototype,{_fingerprint:function(b){return b=b||{},b.url+b.type+a.param(b.data||{})},_get:function(a,b){function c(a){b(null,a),k._cache.set(i,a)}function e(){b(!0)}function h(){d--,delete f[i],k.onDeckRequestArgs&&(k._get.apply(k,k.onDeckRequestArgs),k.onDeckRequestArgs=null)}var i,j,k=this;i=this._fingerprint(a),this.cancelled||i!==this.lastReq||((j=f[i])?j.done(c).fail(e):g>d?(d++,f[i]=this._send(a).done(c).fail(e).always(h)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(c,d){var e,f;d=d||a.noop,c=b.isString(c)?{url:c}:c||{},f=this._fingerprint(c),this.cancelled=!1,this.lastReq=f,(e=this._cache.get(f))?d(null,e):this._get(c,d)},cancel:function(){this.cancelled=!0}}),c}(),h=window.SearchIndex=function(){"use strict";function c(c){c=c||{},c.datumTokenizer&&c.queryTokenizer||a.error("datumTokenizer and queryTokenizer are both required"),this.identify=c.identify||b.stringify,this.datumTokenizer=c.datumTokenizer,this.queryTokenizer=c.queryTokenizer,this.reset()}function d(a){return a=b.filter(a,function(a){return!!a}),a=b.map(a,function(a){return a.toLowerCase()})}function e(){var a={};return a[i]=[],a[h]={},a}function f(a){for(var b={},c=[],d=0,e=a.length;e>d;d++)b[a[d]]||(b[a[d]]=!0,c.push(a[d]));return c}function g(a,b){var c=0,d=0,e=[];a=a.sort(),b=b.sort();for(var f=a.length,g=b.length;f>c&&g>d;)a[c]b[d]?d++:(e.push(a[c]),c++,d++);return e}var h="c",i="i";return b.mixin(c.prototype,{bootstrap:function(a){this.datums=a.datums,this.trie=a.trie},add:function(a){var c=this;a=b.isArray(a)?a:[a],b.each(a,function(a){var f,g;c.datums[f=c.identify(a)]=a,g=d(c.datumTokenizer(a)),b.each(g,function(a){var b,d,g;for(b=c.trie,d=a.split("");g=d.shift();)b=b[h][g]||(b[h][g]=e()),b[i].push(f)})})},get:function(a){var c=this;return b.map(a,function(a){return c.datums[a]})},search:function(a){var c,e,j=this;return c=d(this.queryTokenizer(a)),b.each(c,function(a){var b,c,d,f;if(e&&0===e.length)return!1;for(b=j.trie,c=a.split("");b&&(d=c.shift());)b=b[h][d];return b&&0===c.length?(f=b[i].slice(0),void(e=e?g(e,f):f)):(e=[],!1)}),e?b.map(f(e),function(a){return j.datums[a]}):[]},all:function(){var a=[];for(var b in this.datums)a.push(this.datums[b]);return a},reset:function(){this.datums={},this.trie=e()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),c}(),i=function(){"use strict";function a(a){this.url=a.url,this.ttl=a.ttl,this.cache=a.cache,this.prepare=a.prepare,this.transform=a.transform,this.transport=a.transport,this.thumbprint=a.thumbprint,this.storage=new f(a.cacheKey)}var c;return c={data:"data",protocol:"protocol",thumbprint:"thumbprint"},b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},store:function(a){this.cache&&(this.storage.set(c.data,a,this.ttl),this.storage.set(c.protocol,location.protocol,this.ttl),this.storage.set(c.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var a,b={};return this.cache?(b.data=this.storage.get(c.data),b.protocol=this.storage.get(c.protocol),b.thumbprint=this.storage.get(c.thumbprint),a=b.thumbprint!==this.thumbprint||b.protocol!==location.protocol,b.data&&!a?b.data:null):null},fromNetwork:function(a){function b(){a(!0)}function c(b){a(null,e.transform(b))}var d,e=this;a&&(d=this.prepare(this._settings()),this.transport(d).fail(b).done(c))},clear:function(){return this.storage.clear(),this}}),a}(),j=function(){"use strict";function a(a){this.url=a.url,this.prepare=a.prepare,this.transform=a.transform,this.transport=new g({cache:a.cache,limiter:a.limiter,transport:a.transport})}return b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},get:function(a,b){function c(a,c){b(a?[]:e.transform(c))}var d,e=this;if(b)return a=a||"",d=this.prepare(a,this._settings()),this.transport.get(d,c)},cancelLastRequest:function(){this.transport.cancel()}}),a}(),k=function(){"use strict";function d(d){var e;return d?(e={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:"",prepare:b.identity,transform:b.identity,transport:null},d=b.isString(d)?{url:d}:d,d=b.mixin(e,d),!d.url&&a.error("prefetch requires url to be set"),d.transform=d.filter||d.transform,d.cacheKey=d.cacheKey||d.url,d.thumbprint=c+d.thumbprint,d.transport=d.transport?h(d.transport):a.ajax,d):null}function e(c){var d;if(c)return d={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:b.identity,transport:null},c=b.isString(c)?{url:c}:c,c=b.mixin(d,c),!c.url&&a.error("remote requires url to be set"),c.transform=c.filter||c.transform,c.prepare=f(c),c.limiter=g(c),c.transport=c.transport?h(c.transport):a.ajax,delete c.replace,delete c.wildcard,delete c.rateLimitBy,delete c.rateLimitWait,c}function f(a){function b(a,b){return b.url=f(b.url,a),b}function c(a,b){return b.url=b.url.replace(g,encodeURIComponent(a)),b}function d(a,b){return b}var e,f,g;return e=a.prepare,f=a.replace,g=a.wildcard,e?e:e=f?b:a.wildcard?c:d}function g(a){function c(a){return function(c){return b.debounce(c,a)}}function d(a){return function(c){return b.throttle(c,a)}}var e,f,g;return e=a.limiter,f=a.rateLimitBy,g=a.rateLimitWait,e||(e=/^throttle$/i.test(f)?d(g):c(g)),e}function h(c){return function(d){function e(a){b.defer(function(){g.resolve(a)})}function f(a){b.defer(function(){g.reject(a)})}var g=a.Deferred();return c(d,e,f),g}}return function(c){var f,g;return f={initialize:!0,identify:b.stringify,datumTokenizer:null,queryTokenizer:null,sufficient:5,sorter:null,local:[],prefetch:null,remote:null},c=b.mixin(f,c||{}),!c.datumTokenizer&&a.error("datumTokenizer is required"),!c.queryTokenizer&&a.error("queryTokenizer is required"),g=c.sorter,c.sorter=g?function(a){return a.sort(g)}:b.identity,c.local=b.isFunction(c.local)?c.local():c.local,c.prefetch=d(c.prefetch),c.remote=e(c.remote),c}}(),l=function(){"use strict";function c(a){a=k(a),this.sorter=a.sorter,this.identify=a.identify,this.sufficient=a.sufficient,this.local=a.local,this.remote=a.remote?new j(a.remote):null,this.prefetch=a.prefetch?new i(a.prefetch):null,this.index=new h({identify:this.identify,datumTokenizer:a.datumTokenizer,queryTokenizer:a.queryTokenizer}),a.initialize!==!1&&this.initialize()}var e;return e=window&&window.Bloodhound,c.noConflict=function(){return window&&(window.Bloodhound=e),c},c.tokenizers=d,b.mixin(c.prototype,{__ttAdapter:function(){function a(a,b,d){return c.search(a,b,d)}function b(a,b){return c.search(a,b)}var c=this;return this.remote?a:b},_loadPrefetch:function(){function b(a,b){return a?c.reject():(e.add(b),e.prefetch.store(e.index.serialize()),void c.resolve())}var c,d,e=this;return c=a.Deferred(),this.prefetch?(d=this.prefetch.fromCache())?(this.index.bootstrap(d),c.resolve()):this.prefetch.fromNetwork(b):c.resolve(),c.promise()},_initialize:function(){function a(){b.add(b.local)}var b=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(a),this.initPromise},initialize:function(a){return!this.initPromise||a?this._initialize():this.initPromise},add:function(a){return this.index.add(a),this},get:function(a){return a=b.isArray(a)?a:[].slice.call(arguments),this.index.get(a)},search:function(a,c,d){function e(a){var c=[];b.each(a,function(a){!b.some(f,function(b){return g.identify(a)===g.identify(b)})&&c.push(a)}),d&&d(c)}var f,g=this;return f=this.sorter(this.index.search(a)),c(this.remote?f.slice():f),this.remote&&f.length=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c=function(){"use strict";function a(a){var g,h;return h=b.mixin({},f,a),g={css:e(),classes:h,html:c(h),selectors:d(h)},{css:g.css,html:g.html,classes:g.classes,selectors:g.selectors,mixin:function(a){b.mixin(a,g)}}}function c(a){return{wrapper:'',menu:'
'}}function d(a){var c={};return b.each(a,function(a,b){c[b]="."+a}),c}function e(){var a={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return b.isMsie()&&b.mixin(a.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),a}var f={wrapper:"twitter-typeahead",input:"tt-input",hint:"tt-hint",menu:"tt-menu",dataset:"tt-dataset",suggestion:"tt-suggestion",selectable:"tt-selectable",empty:"tt-empty",open:"tt-open",cursor:"tt-cursor",highlight:"tt-highlight"};return a}(),d=function(){"use strict";function c(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d,e;return d="typeahead:",e={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},b.mixin(c.prototype,{_trigger:function(b,c){var e;return e=a.Event(d+b),(c=c||[]).unshift(e),this.$el.trigger.apply(this.$el,c),e},before:function(a){var b,c;return b=[].slice.call(arguments,1),c=this._trigger("before"+a,b),c.isDefaultPrevented()},trigger:function(a){var b;this._trigger(a,[].slice.call(arguments,1)),(b=e[a])&&this._trigger(b,[].slice.call(arguments,1))}}),c}(),e=function(){"use strict";function a(a,b,c,d){var e;if(!c)return this;for(b=b.split(i),c=d?h(c,d):c,this._callbacks=this._callbacks||{};e=b.shift();)this._callbacks[e]=this._callbacks[e]||{sync:[],async:[]},this._callbacks[e][a].push(c);return this}function b(b,c,d){return a.call(this,"async",b,c,d)}function c(b,c,d){return a.call(this,"sync",b,c,d)}function d(a){var b;if(!this._callbacks)return this;for(a=a.split(i);b=a.shift();)delete this._callbacks[b];return this}function e(a){var b,c,d,e,g;if(!this._callbacks)return this;for(a=a.split(i),d=[].slice.call(arguments,1);(b=a.shift())&&(c=this._callbacks[b]);)e=f(c.sync,this,[b].concat(d)),g=f(c.async,this,[b].concat(d)),e()&&j(g);return this}function f(a,b,c){function d(){for(var d,e=0,f=a.length;!d&&f>e;e+=1)d=a[e].apply(b,c)===!1;return!d}return d}function g(){var a;return a=window.setImmediate?function(a){setImmediate(function(){a()})}:function(a){setTimeout(function(){a()},0)}}function h(a,b){return a.bind?a.bind(b):function(){a.apply(b,[].slice.call(arguments,0))}}var i=/\s+/,j=g();return{onSync:c,onAsync:b,off:d,trigger:e}}(),f=function(a){"use strict";function c(a,c,d){for(var e,f=[],g=0,h=a.length;h>g;g++)f.push(b.escapeRegExChars(a[g]));return e=d?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",c?new RegExp(e):new RegExp(e,"i")}var d={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(e){function f(b){var c,d,f;return(c=h.exec(b.data))&&(f=a.createElement(e.tagName),e.className&&(f.className=e.className),d=b.splitText(c.index),d.splitText(c[0].length),f.appendChild(d.cloneNode(!0)),b.parentNode.replaceChild(f,d)),!!c}function g(a,b){for(var c,d=3,e=0;e