apostrophe
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -101,3 +101,3 @@ var oembed = require('oembed'); | ||
db = options.db; | ||
self.db = db = options.db; | ||
@@ -108,3 +108,3 @@ async.series([setupAreas, setupPages, setupFiles, afterDb], callback); | ||
db.collection('aposAreas', options, function(err, collection) { | ||
areas = collection; | ||
self.areas = areas = collection; | ||
collection.ensureIndex({ slug: 1 }, { unique: true }, function(err) { | ||
@@ -118,6 +118,8 @@ return callback(err); | ||
db.collection('aposPages', options, function(err, collection) { | ||
pages = collection; | ||
collection.ensureIndex({ slug: 1 }, { unique: true }, function(err) { | ||
return callback(err); | ||
}); | ||
self.pages = pages = collection; | ||
async.series([indexSlug], callback); | ||
function indexSlug(callback) { | ||
self.pages.ensureIndex({ slug: 1 }, { unique: true }, callback); | ||
} | ||
// ... more index functions | ||
}); | ||
@@ -128,3 +130,3 @@ } | ||
db.collection('aposFiles', options, function(err, collection) { | ||
files = collection; | ||
self.files = files = collection; | ||
return callback(err); | ||
@@ -189,3 +191,2 @@ }); | ||
} | ||
console.log(options); | ||
return partial('area.html', options); | ||
@@ -224,3 +225,3 @@ } | ||
} | ||
attributes[key] = value; | ||
attributes[key] = value + ''; | ||
}); | ||
@@ -267,2 +268,9 @@ return partial('itemNormalView.html', { item: item, itemType: itemType, options: options, attributes: attributes }); | ||
// Add more locals for Apostrophe later. Used by extension modules | ||
// like apostrophe-pages | ||
self.addLocal = function(name, fn) { | ||
aposLocals[name] = fn; | ||
app.locals[name] = fn; | ||
} | ||
// All routes must begin with /apos! | ||
@@ -439,2 +447,4 @@ | ||
console.log('PREVIEW: ', item); | ||
var itemType = self.itemTypes[item.type]; | ||
@@ -446,2 +456,5 @@ if (!itemType) { | ||
itemType.sanitize(item); | ||
console.log('AFTER SANITIZE:', item); | ||
// Invoke server-side loader middleware like getArea or getPage would, | ||
@@ -688,2 +701,4 @@ // unless explicitly asked not to | ||
if (page) { | ||
console.log('LOADED PAGE:'); | ||
console.log(page); | ||
// For convenience guarantee there is a page.areas property | ||
@@ -901,2 +916,26 @@ if (!page.areas) { | ||
self.slugify = function(text, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
_.defaults(options, { | ||
disallow: /[^\w\d]+/g, | ||
substitute: '-' | ||
}); | ||
slug = text.toLowerCase().replace(options.disallow, options.substitute); | ||
// Lop off leading and trailing - | ||
if (slug.length) | ||
{ | ||
if (slug.substr(0, 1) === options.substitute) | ||
{ | ||
slug = slug.substr(1); | ||
} | ||
if (slug.substr(slug.length - 1, 1) === options.substitute) | ||
{ | ||
slug = slug.substr(0, slug.length - 1); | ||
} | ||
} | ||
return slug; | ||
}; | ||
// For convenience when configuring uploadfs | ||
@@ -903,0 +942,0 @@ self.defaultImageSizes = [ |
{ | ||
"name": "apostrophe", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "Apostrophe is a user-friendly content management system. This core module of Apostrophe provides rich content editing and essential facilities to integrate Apostrophe into your Express project. Apostrophe also includes simple facilities for storing your rich content areas in MongoDB and fetching them back again. Additional functionality is available in modules like apostrophe-twitter and apostrophe-rss and forthcoming modules that address page trees, blog posts, events and the like.", | ||
@@ -5,0 +5,0 @@ "main": "apostrophe.js", |
@@ -1310,4 +1310,37 @@ if (!window.apos) { | ||
} | ||
}; | ||
apos.modalFromTemplate = function(sel, options) { | ||
_.defaults(options,{ | ||
init: function(callback) {callback(null);}, | ||
save: function(callback) {callback(null);} | ||
}); | ||
function hideModal() { | ||
apos.modal($el, 'hide'); | ||
$el.remove(); | ||
return false; | ||
}; | ||
var $el = $(sel).filter('.apos-template').clone(); | ||
$el.removeClass('.apos-template'); | ||
$el.on('click', '.apos-cancel', hideModal); | ||
$el.on('click', '.apos-save', function() { | ||
options.save(function(err) { | ||
if(!err) { | ||
hideModal(); | ||
} | ||
}); | ||
return false; | ||
}); | ||
options.init(function(){ | ||
apos.log("INIT",$el.length); | ||
apos.modal($el); | ||
}); | ||
return $el; | ||
} | ||
// Display the hint if the user hasn't seen it already. Use a cookie with an | ||
@@ -1331,3 +1364,3 @@ // array of hint titles to figure out if we've seen it before. TODO: consider | ||
// Give the dialog that inspired this hint time to get out of the way | ||
// (TODO: this is a crude workaround) | ||
// (TODO: this is a crude workaround, improve on it) | ||
@@ -1341,2 +1374,3 @@ setTimeout(function() { | ||
apos.modal(hint, 'hide'); | ||
hint.remove(); | ||
}); | ||
@@ -1343,0 +1377,0 @@ apos.modal(hint); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2829533
14654