diff --git a/client/stylesheets/modules/posts.import.less b/client/stylesheets/modules/posts.import.less index 7536bb4..7f1a87d 100644 --- a/client/stylesheets/modules/posts.import.less +++ b/client/stylesheets/modules/posts.import.less @@ -59,3 +59,7 @@ textarea { min-height: 200px; } } + +[data-id="insert-post-form"] .-autocomplete-container { + margin-top: 15px; +} diff --git a/client/views/feed.html b/client/views/feed.html index cdcde6e..b7195d2 100644 --- a/client/views/feed.html +++ b/client/views/feed.html @@ -21,7 +21,7 @@
- + {{>textareaAutocomplete settings=settings data-id="body" class="u-full-width insert-post-form" rows="1" placeholder="Write something..." }}
diff --git a/client/views/feed.js b/client/views/feed.js index 0fb7b41..6698727 100644 --- a/client/views/feed.js +++ b/client/views/feed.js @@ -64,6 +64,7 @@ Template.feed.onCreated(function () { this.autorun(() => { this.subscribe('posts.all', this.searchQuery.get(), this.filter.get(), this.limit.get()); + this.subscribe('users.all', this.searchQuery.get(), this.limit.get()); this.postsCount.set(Counts.get('posts.all')); }); }); @@ -71,3 +72,22 @@ Template.feed.onCreated(function () { Template.feed.onRendered(() => { autosize($('[data-id=body]')); }); + +Template.feed.helpers({ + //Settings for autocomplete in post field + settings: () => { + return { + position: 'bottom', + limit: 5, + rules: [ + { + token: '@', + collection: Meteor.users, + field: 'username', + template: Template.userList, + filter: { _id: { $ne: Meteor.userId() }} + } + ] + }; + } +});