improving blank package

This commit is contained in:
Sacha Greif 2014-12-11 12:07:41 +09:00
parent 5a868730da
commit 4155fb22a1
8 changed files with 61 additions and 12 deletions

View file

@ -1,14 +1,36 @@
// Custom Post Property
var customProperty = {
propertyName: 'customProperty',
propertySchema: {
type: String, // property type
label: 'customLabel', // key string used for internationalization
optional: true, // make this property optional
type: String, // property type
label: 'customLabel', // key string used for internationalization
optional: true, // make this property optional
autoform: {
editable: true, // make this property editable by users
group: 'xyz', // assign a custom form group
type: "bootstrap-datetimepicker" // assign a custom input type
editable: true, // make this property editable by users
type: "bootstrap-datetimepicker" // assign a custom input type
}
}
}
addToPostSchema.push(customProperty);
addToPostSchema.push(customProperty);
// Custom Setting
var customSetting = {
propertyName: 'customSetting',
propertySchema: {
type: String,
optional: true,
autoform: {
group: 'customGroup', // assign custom group (fieldset) in Settings form
private: true // mark as private (not published to client)
}
}
}
addToSettingsSchema.push(customSetting);
// Global Function
myFunction = function (a, b) {
return a + b;
}

View file

@ -0,0 +1,3 @@
<template name="customTemplate">
Hi there, {{name}}!
</template>

View file

@ -0,0 +1,9 @@
Meteor.startup(function () {
Template[getTemplate('customTemplate')].helpers({
name: function () {
return "Bruce Willis";
}
});
});

View file

@ -0,0 +1,8 @@
Meteor.startup(function () {
Router.route('/custom-path', {
name: 'customRoute',
template: getTemplate('customTemplate')
});
});

View file

@ -0,0 +1,3 @@
Meteor.publish('customPublication', function (limit) {
return Posts.find({}, {limit: limit});
});

View file

@ -19,7 +19,8 @@ Package.onUse(function (api) {
'iron:router', // routing package
'telescope-base', // basic Telescope hooks and objects
'telescope-lib', // useful functions
'telescope-i18n' // internationalization wrapper
'telescope-i18n', // internationalization wrapper
'fourseven:scss' // SCSS compilation package
]);
// client
@ -47,19 +48,22 @@ Package.onUse(function (api) {
// both
api.add_files([
'lib/both.js'
'lib/both.js',
'lib/routes.js'
], ['client', 'server']);
// client
api.add_files([
'lib/client/client_only.js'
'lib/client/templates/template.html',
'lib/client/templates/template.js',
'lib/client/scss/package.scss'
], ['client']);
// server
api.add_files([
'lib/server/server_only.js'
'lib/server/publications.js'
], ['server']);
// i18n languages (must come last)
@ -76,7 +80,7 @@ Package.onUse(function (api) {
// -------------------------------- 3. Variables to export --------------------------------
api.export([
//
'myFunction'
]);
});