On Github thet / mockup-slides-ploneconf2014
Plone Conference 2014, Bristol Authors: Franco Pellegrini & Johannes Raggam
Franco Pellegrini is a software developer from Cordoba, Argentina. He started developing Plone in 2005 in a small software company, and as an independent contractor since 2011. He believes in free software philosophy, and so, he has been a Plone core developer since 2010 and Framework Team member since 2012.
Johannes Raggam from Graz/Austria works most of the time with a technology stack based around Python, Plone, Pyramid and Javascript. As an active Open Source / Free Software developer he believes in the power of collaborative work. He is BlueDynamics Alliance Partner and Plone Core Contributor since 2009 and member of the Plone Framework Team since 2012.
2014-10-30T15:10:00October 30th 2014, 3:10:00 pm
2014-10-30T15:10:00October 30th 2014, 3:10:00 pm
define(['jquery', 'mockup-patterns-base', 'moment'], function($, Base, moment) { 'use strict'; var Moment = Base.extend({ name: 'moment', defaults: {format: 'MMMM Do YYYY, h:mm:ss a'}, init: function () { var self = this, $el = self.$el, format = self.options.format; // TODO: do something } }); return Moment; });
define([ 'jquery', 'mockup-patterns-base', 'moment' ], function($, Base, moment) { 'use strict'; var Moment = Base.extend({ name: 'moment', defaults: { // selector of elements to format dates for selector: null, // also available options are relative, calendar format: 'MMMM Do YYYY, h:mm:ss a' }, convert: function($el) { var self = this; var date = $el.attr('data-date'); if (!date) { date = $.trim($el.html()); } date = moment(date); if (!date.isValid()) { return; } if (self.options.format === 'relative') { date = date.fromNow(); }else if (self.options.format === 'calendar') { date = date.calendar(); } else { date = date.format(self.options.format); } if (date) { $el.html(date); } }, init: function() { var self = this; if (self.options.selector) { self.$el.find(self.options.selector).each(function() { self.convert($(this)); }); } else { self.convert(self.$el); } } }); return Moment; });
define(['expect', 'jquery', 'mockup-registry', 'mockup-patterns-moment'], function(expect, $, registry, Moment) { 'use strict'; window.mocha.setup('bdd'); $.fx.off = true; describe('Moment', function () { it('test parse relative', function() { var date = new Date(); date.setMinutes(date.getMinutes() + 2); var $el = $('
$ npm install -g generator-plonemockup $ yo plonemockup
├── bower.json ├── config.js ├── dev │ ├── dev.html │ └── dev.js ├── Gruntfile.js ├── js │ ├── bundles │ │ └── myproject.js │ └── patterns │ └── mypattern.js ├── less │ └── myproject.less ├── package.json ├── README.md └── tests ├── config.js └── pattern-mypattern-test.js
$ grunt