apostrophe-cms

Apostrophe Widget Helpers

梦想的初衷 提交于 2019-12-10 11:25:23
问题 I have to pass some extra data down to a widget to determine certain ownership/accessibility options of some of my users. I was following the instructions here in order to set up a helper to pass the data: http://apostrophecms.org/docs/technical-overviews/how-apostrophe-handles-requests.html#template-helpers-invoking-synchronous-java-script-code-from-your-template I have run into some issues, however. The code below is for the widget index.js file: module.exports = { extend: 'apostrophe

Pushing Assets to the Browser - Your Own Theme Module

♀尐吖头ヾ 提交于 2019-12-06 14:48:49
For some beginners including myself , still figuring out on how to make our own theme module. But this is how I found a solution myself. Please Note : I don't know if this effects the performance issue on ApostropheCMS , but I'll leave this as a solution for all of us. Let's Begin ! (See Answer Below) : It is not necessary or advisable to write your own link and script tags because this prevents Apostrophe from minifying your assets in production, and from compiling your LESS files as a single unit with the benefits of shared mixins, etc. However, the apostrophe-samples project now contains a

Apostrophe Widget Helpers

大憨熊 提交于 2019-12-06 07:01:16
I have to pass some extra data down to a widget to determine certain ownership/accessibility options of some of my users. I was following the instructions here in order to set up a helper to pass the data: http://apostrophecms.org/docs/technical-overviews/how-apostrophe-handles-requests.html#template-helpers-invoking-synchronous-java-script-code-from-your-template I have run into some issues, however. The code below is for the widget index.js file: module.exports = { extend: 'apostrophe-widgets', label: 'Unsubscribed Content', //contextualOnly: true, construct: function(self, options) { self

Auto login users to Apostrophe

拜拜、爱过 提交于 2019-12-05 23:06:50
I've extended the apostrophe-express module implementing logic to check cookies in the request headers. One of the cases in this check is to auto login users. If a cookie key/val matches a preset flag value, then I would like to do a lookup for the user in the aposUsersSafe collection (based on an email address) and, if the user exists in the collection, automatically sign him into the cms. Currently, I have implemented the user lookup by running a mongo query for the user based on email: var collection = db.collection('aposUsersSafe'); collection.find({email: email}).toArray(function (err,

Apostrophe cms - inline editing of rich text in custom widgets?

徘徊边缘 提交于 2019-12-02 09:28:02
I can't make inline editing of rich text save back to the db in some cases. Please bear with me, there will be some code pasted here, as it is the only way I can describe what I'm doing. I have two kinds of custom widgets in my project - the ones where there is only one instance of the widget, typically defined like this in the lib\modules directory: article-widgets - views - - widget.html - index.js And then the kind of widgets that are repeated, and can be used in several places around the site, typically defined like this: employees - index.js employees-widgets - views - - widget.html This

How-to access widget data in helper

泄露秘密 提交于 2019-12-01 01:35:54
in my frontend helper I use a parameter and give it everywhere data.widget. Is it possible to access data.widget in the helper context? I've only found the self.output object tree. But I think that is not a solution with good quality. Thanks. Edit for code sample: Well, in a template you can do something like: {{ apos.myModuleAlias.iCallAHelper(data.widget) }} And the part of myModule-widgets/index.js: construct: function(self, options) { self.addHelpers({ iCallAHelper: function(data) { console.log(data); } }); } Is it possible to access data.widget in the helper without providing data.widget