apostrophe-snippets
Advanced tools
Comparing version 0.0.4 to 0.0.5
16
index.js
@@ -89,2 +89,4 @@ var async = require('async'); | ||
self.label = options.label || 'Snippets'; | ||
// Used just for the widget right now, could be handy elsewhere | ||
self.icon = options.icon || 'snippets'; | ||
@@ -591,2 +593,3 @@ // "Protected" properties. We want modules like the blog to be able | ||
console.log(options); | ||
@@ -756,6 +759,3 @@ // TODO: with many snippets there is a performance problem with calling | ||
} | ||
if (req.page.typeSettings && req.page.typeSettings.tags && req.page.typeSettings.tags.length) { | ||
criteria.tags = { $in: req.page.typeSettings.tags }; | ||
} | ||
self.addCriteria(req, criteria); | ||
self.get(req, criteria, function(err, snippets) { | ||
@@ -782,2 +782,7 @@ if (err) { | ||
self.addCriteria = function(req, criteria) { | ||
if (req.page.typeSettings && req.page.typeSettings.tags && req.page.typeSettings.tags.length) { | ||
criteria.tags = { $in: req.page.typeSettings.tags }; | ||
} | ||
}; | ||
@@ -912,6 +917,7 @@ // When a snippet (such as a blog post by Dave) appears as a callout on another | ||
}; | ||
self._pages.addType(self); | ||
self._apos.pushGlobalCall('@.replaceType(?, new @())', browser.pages, self.name, browser.construct); | ||
if (options.widget) { | ||
widget({ apos: self._apos, app: self._app, snippets: self, name: self.name, label: self.label }); | ||
widget({ apos: self._apos, icon: self.icon, app: self._app, snippets: self, name: self.name, label: self.label }); | ||
self._apos.pushGlobalCall('@.addWidgetType()', browser.construct); | ||
@@ -918,0 +924,0 @@ } |
{ | ||
"name": "apostrophe-snippets", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Reusable content snippets for the Apostrophe content management system. The blog and events modules are built on this foundation, which is also useful in and of itself.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,2 +15,3 @@ var _ = require('underscore'); | ||
self.app = options.app; | ||
self.icon = options.icon; | ||
@@ -41,3 +42,3 @@ self.name = options.name || 'snippets'; | ||
css: self.apos.cssName(self.name), | ||
icon: self.icon, | ||
sanitize: function(item) { | ||
@@ -51,5 +52,6 @@ item.by += ''; | ||
// Must be string | ||
id += ''; | ||
id = self.apos.sanitizeString(id); | ||
return id; | ||
}); | ||
item.limit = self.apos.sanitizeInteger(item.limit, 5, 1, 1000); | ||
}, | ||
@@ -56,0 +58,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
64027
1318