Skip to content

Commit

Permalink
Tags plugin moved to demo/plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
nodeminderjs committed May 12, 2014
1 parent 2dfa648 commit f4320a1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 28 deletions.
18 changes: 0 additions & 18 deletions demo/admin_cfg.html

This file was deleted.

13 changes: 3 additions & 10 deletions demo/admin_cfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,13 @@ Admin.startup(function() {
}
],
plugins: {
category: {
template: 'adminCategoryPlugin',
getValue: function(field) {
var value = $('#' + field).val();
return value.split(',').sort();
}
}
category: aspTagsPlugin
}
});
});

/*
* Plugins
* Tags plugin
*/

if (Meteor.isServer) {
Expand All @@ -146,9 +140,8 @@ if (Meteor.isServer) {
if (Meteor.isClient) {
Meteor.subscribe('adminCategoryPlugin');

Template.adminCategoryPlugin.getCategories = function() {
Template.aspTags.getTags = function() {
var categories = Categories.find({}, {sort: {name: 1}}).map(function(c) {return c.name;});
//return JSON.stringify(['Belo Horizonte', 'Niterói', 'Nova Friburgo', 'Rio de Janeiro', 'São Paulo']);
return JSON.stringify(categories);
}
}
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions demo/plugins/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Plugins
=======

* Addresses
* Tags
14 changes: 14 additions & 0 deletions demo/plugins/tags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template name="aspTags">
<div id="asp-tags-{{name}}">
<input id="{{name}}" type="text" value="{{value}}" style="display: none;">
</div>

<script>
$("#asp-tags-{{name}} input").tagsinput({
typeahead: {
source: {{getTags}}
},
freeInput: false
});
</script>
</template>
12 changes: 12 additions & 0 deletions demo/plugins/tags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Tags plugin
*/
aspTagsPlugin = {
template: 'aspTags',

getValue: function(field) {
var value = $('#' + field).val();
return value.split(',').sort();
}
}

0 comments on commit f4320a1

Please sign in to comment.