diff --git a/src/controllers/AppController.js b/src/controllers/AppController.js new file mode 100644 index 00000000..f4379a72 --- /dev/null +++ b/src/controllers/AppController.js @@ -0,0 +1,5 @@ +/* global angular */ +angular.module('codexen') + .controller('AppController', function ($scope) { + + }) diff --git a/src/filters/search-snippets.js b/src/filters/search-snippets.js new file mode 100644 index 00000000..b39cb07e --- /dev/null +++ b/src/filters/search-snippets.js @@ -0,0 +1,16 @@ +/* global angular */ +angular.module('codexen') + .filter('searchSnippets', function ($filter) { + return function (input, needle) { + if (!angular.isString(needle)) return input + if (needle.match(/^#./)) { + var name = needle.match(/^#(.+)/)[1] + return input.filter(function (snippet) { + return snippet.Tags.some(function (tag) { + return tag.name.match(new RegExp(name)) + }) + }) + } + else return $filter('filter')(input, needle) + } + }) diff --git a/src/index.html b/src/index.html index b4108d5e..e126fbf9 100644 --- a/src/index.html +++ b/src/index.html @@ -18,7 +18,7 @@ -
+ diff --git a/src/tpls/states/snippets.list.tpl.html b/src/tpls/states/snippets.list.tpl.html index da59a05d..3be0e44b 100644 --- a/src/tpls/states/snippets.list.tpl.html +++ b/src/tpls/states/snippets.list.tpl.html @@ -26,7 +26,7 @@ Sign In -