Permalink
Browse files

2.14.0:

All tests passing.

* A version rollback dialog box for the `global` doc is now opened if an element with the `data-apos-versions-global` attribute is clicked. There is currently no such element in the standard UI but you may introduce one in your own layout if you have mission-critical content in the `global` doc that is awkward to recreate after an accidental deletion, such as a custom sitewide nav.
* An error message is correctly displayed when login fails.
* Many UI messages are now passed through the `__()` internationalization helper correctly. Thanks to `timaebi`.
  • Loading branch information...
1 parent bfd01b9 commit c6d52b2be7db764abc15cd69352505a22c7adb4c @boutell boutell committed Jan 6, 2017
Showing with 69 additions and 3 deletions.
  1. +8 −0 CHANGELOG.md
  2. +37 −2 lib/modules/apostrophe-global/index.js
  3. +23 −0 lib/modules/apostrophe-global/public/js/user.js
  4. +1 −1 package.json
View
@@ -1,5 +1,13 @@
# Changelog
+## 2.14.0
+
+All tests passing.
+
+* A version rollback dialog box for the `global` doc is now opened if an element with the `data-apos-versions-global` attribute is clicked. There is currently no such element in the standard UI but you may introduce one in your own layout if you have mission-critical content in the `global` doc that is awkward to recreate after an accidental deletion, such as a custom sitewide nav.
+* An error message is correctly displayed when login fails.
+* Many UI messages are now passed through the `__()` internationalization helper correctly. Thanks to `timaebi`.
+
## 2.13.2
All tests passing.
@@ -2,6 +2,19 @@
// for sitewide content such as a footer displayed on all pages.
// Provides middleware so that `req.data.global` is always available,
// even in requests that are not for Apostrophe pages.
+//
+// ## properties
+//
+// `_id`: the MongoDB ID of the global page. Available after `modulesReady`.
+//
+// ## click handlers
+//
+// Although it is not in the UI by default, if you create an element with
+// a `data-apos-versions-global` attribute, a click on that element will
+// open the doc versions dialog box for the global doc. This is useful if
+// your global doc is used for critical infrastructure like building
+// custom sitewide navigation. TODO: consider how this might be best made available
+// as a standard feature in the UI.
var async = require('async');
@@ -10,6 +23,8 @@ module.exports = {
extend: 'apostrophe-doc-type-manager',
name: 'apostrophe-global',
+
+ alias: 'global',
afterConstruct: function(self) {
self.enableMiddleware();
@@ -77,9 +92,16 @@ module.exports = {
if (existing) {
return setImmediate(callback);
}
- return self.apos.docs.insert(req, { slug: self.slug, published: true, type: self.name }, callback);
+ existing = { slug: self.slug, published: true, type: self.name };
+ return self.apos.docs.insert(req, existing, callback);
}
- }, callback)
+ }, function(err) {
+ if (err) {
+ return callback(err);
+ }
+ self._id = existing._id;
+ return callback(null);
+ });
};
// Add the `addGlobalToData` middleware.
@@ -100,5 +122,18 @@ module.exports = {
});
};
+ self.pushAssets = function() {
+ self.pushAsset('script', 'user', { when: 'user' });
+ self.pushAsset('script', 'editor', { when: 'user' });
+ self.pushAsset('stylesheet', 'user', { when: 'user' });
+ };
+
+ var superGetCreateSingletonOptions = self.getCreateSingletonOptions;
+ self.getCreateSingletonOptions = function(req) {
+ var browserOptions = superGetCreateSingletonOptions(req);
+ browserOptions._id = self._id;
+ return browserOptions;
+ };
+
}
}
@@ -0,0 +1,23 @@
+apos.define('apostrophe-global', {
+ extend: 'apostrophe-doc-type-manager',
+
+ afterConstruct: function(self) {
+ self.addClickHandlers();
+ },
+
+ beforeConstruct: function(self, options) {
+ self.options = options;
+ },
+
+ construct: function(self, options) {
+
+ self._id = self.options._id;
+
+ self.addClickHandlers = function() {
+ apos.ui.link('apos-versions', 'global', function($button) {
+ apos.versions.edit(self._id);
+ });
+ };
+
+ }
+});
View
@@ -1,6 +1,6 @@
{
"name": "apostrophe",
- "version": "2.13.2",
+ "version": "2.14.0",
"description": "The Apostrophe Content Management System.",
"main": "index.js",
"scripts": {

0 comments on commit c6d52b2

Please sign in to comment.