From 86035750bc0d01ffdfaee5a08e23e59ecaaf47fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Becheras?= Date: Tue, 2 Jun 2015 17:28:12 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Ajout=20de=20la=20directive=20editAwesomepl?= =?UTF-8?q?ete=20+=20sa=20doc=20temporaire=20(/wip.txt)=20=C3=A0=20int?= =?UTF-8?q?=C3=A9grer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/directives/awesomplete.js | 23 +++++++++++++++++++++++ wip.txt | 14 ++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/js/directives/awesomplete.js create mode 100644 wip.txt diff --git a/src/js/directives/awesomplete.js b/src/js/directives/awesomplete.js new file mode 100644 index 00000000..ed992e23 --- /dev/null +++ b/src/js/directives/awesomplete.js @@ -0,0 +1,23 @@ +angular.module('xeditable').directive('editableAwesomplete', [ + 'editableDirectiveFactory', function(editableDirectiveFactory) { + return editableDirectiveFactory({ + directiveName: 'editableAwesomplete', + inputTpl: '', + render : function() { + this.parent.render.call(this); + new Awesomplete(this.inputEl[0], { + //list : ['CSS', 'JavaScript'], + filter: function(text, input) { + return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]); + }, + replace: function(text) { + var before = this.input.value.match(/^.+,\s*|/)[0]; + this.input.value = before + text + ", "; + var $e = angular.element(this.input); + $e.triggerHandler('input'); + } + }); + } + }); + +}]); diff --git a/wip.txt b/wip.txt new file mode 100644 index 00000000..f08ad7c4 --- /dev/null +++ b/wip.txt @@ -0,0 +1,14 @@ + +######################################### +PUT THIS IN THE REST OF THE DOCUMENTATION +######################################### + +Just use one of this snippets to add an Awesomplete widget to your template: + + +{{ data.name }} + + +{{ data.name }} From cbdc65212cf8138d2012a61c91949ad641993c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Becheras?= Date: Tue, 2 Jun 2015 17:59:53 +0200 Subject: [PATCH 2/2] Add awesomplete bower dependency --- bower.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index e1db722a..d05ee2e8 100644 --- a/bower.json +++ b/bower.json @@ -26,8 +26,9 @@ "package.json" ], "dependencies": { - "angular": "~1.x" + "angular": "~1.x", + "rbecheras-awesomplete": "~0.1.x" }, "devDependencies": { } -} \ No newline at end of file +}