Ejemplo n.º 1
0
/**
 * Kanso document types to export
 */

var Type = require('couchtypes/types').Type,
    fields = require('couchtypes/fields'),
    widgets = require('couchtypes/widgets');

exports.work_type = new Type('work_type', {
    fields: {
        name: fields.string(),
        code: fields.number({required: false}),
        description: fields.string({required: false})
    }
});

exports.transaction = new Type('transaction', {
    fields: {
        transaction_type: fields.choice({values: {"donation": "Donation", "sale": "Sale"}}),
        party: {
            name: fields.string(),
            email: fields.email({required: false}),
            city: fields.string({required: false}),
            /* the first option for 'referred by' is deliberately blank, to allow for a default of no referral source */
            referred_by: fields.choice({required: false, values: {"": "", "search:cheap-computer": "Search for cheap/free computers", "search:recycling": "Search for computer recycling", "news": "News story", "flyer": "Flyer", "school": "School", "social-service": "Social service agency", "facebook": "Facebook", "twitter": "Twitter", "other": "Other"}})
        },
        items: fields.array({widget: widgets.textarea({cols: 40, rows: 5}), hint: "See sidebar for tips on entering item quantities and prices",
            /* the parseEach function should split off the numeric part of each item and use that as the item quantity; the remainder - anything after a number and a space */
            parseEach: function (string) {
                var description, desc_split, unit_price, extended_price
                var quantity = parseFloat(string.split(" ", 1)[0]);
Ejemplo n.º 2
0
/**
 * Kanso document types to export
 */

var Type = require('couchtypes/types').Type,
    fields = require('couchtypes/fields'),
    widgets = require('couchtypes/widgets');

exports.recipe = new Type('recipe', {
    fields: {
        title: fields.string(),
        source: fields.string({required: false}),
        ns: fields.number({required: false}),
        pageid: fields.number({required: false}),
        templates: fields.string({required: false}),
        iwlinks: fields.string({required: false}),
        displaytitle: fields.string({required: false}),
        langlinks: fields.string({required: false}),
        links: fields.string({required: false}),
        title: fields.string({required: false}),
        text: fields.string({required: false}),
        revid: fields.string({required: false}),
        externallinks: fields.string({required: false}),
        images: fields.string({required: false}),
        sections: fields.string({required: false}),
        properties: fields.string({required: false}),
        categories: fields.string({required: false})
    }
});
Ejemplo n.º 3
0
    fields: {
        created: fields.createdTime(),
		creator: fields.creator(),
        goal: fields.string({widget: widgets.textarea({cols: 40, rows: 1})}) ,
        keyresults: fields.embedList({
        	type: exports.keyresult

        })
    }
});

exports.OKR = new Type('OKR', {
	fields: {
		created: fields.createdTime(),
		creator: fields.creator(),
		quarter: fields.number(),
		objectives: fields.embedList({
			type: exports.objective
		})
	}
});


// a login
exports.login = new Type('login', {

	// we need a username and password to login a user
    fields: {
        user: fields.string(),
        pass: fields.string(),
    }
Ejemplo n.º 4
0
var Type = require('couchtypes/types').Type,
	fields = require('couchtypes/fields');

exports.picture = new Type('picture', {
	fields: {
		creator: fields.creator(),
		dateinit: fields.createdTime(),
		title: fields.string(),
		description: fields.string(),
		vote: fields.number(),
		picture: fields.attachments()
	}
});

exports.comment = new Type('comment', {
	fields: {
		creator: fields.creator(),
		dateinit: fields.createdTime(),
		content: fields.string(),
		vote: fields.number(),
		ref_picture : fields.string()
	}
});
Ejemplo n.º 5
0
/**
 * Kanso document types to export
 */

var Type = require('couchtypes/types').Type,
    fields = require('couchtypes/fields'),
    widgets = require('couchtypes/widgets');

exports.page = new Type('page', {
    fields: {
        title: fields.string(),
        // empty slug field maps to homepage
        slug: fields.string(),
        body: fields.string({
            widget: widgets.textarea({cols: 40, rows: 10})
        }),
        ordering: fields.number(),
        template: fields.string(),
        audit: {
            // add prev revisions field ?
            created: fields.createdTime(), // timestamp to created?
            //updated: fields.number(), // add modified field?
            created_by: fields.creator(), // creator field?
            //updated_by: fields.string() // add updator field?
        }
    }
});
Ejemplo n.º 6
0
   permissions: {
     update: permissions.fieldUneditable(),
   },
 }),
 editableBy:       fields.string({
   permissions: {
     update: permissions.fieldUneditable(),
   },
 }),
 declaredBy:    fields.creator(),
 from:           fields.string({
   permissions: {
     update: permissions.fieldUneditable(),
   },
 }),
 amount:         fields.number(),
 executionDate: fields.string({
   required: false,
   permissions: {
     update: canEdit(),
   }
 }),
 message:        fields.string({
   required: false,
   permissions: {
     update: canEdit(),
   }
 }),
 reference:      fields.string({
   required: false,
   permissions: {