Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Refael Ackermann committed Jan 20, 2014
1 parent e513525 commit ddd65eb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/classic/models/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ schema.methods.toString = function () {return this.string_req};

schema.formage = {
filters: ['ref', 'string_req'],
list: ['embeded.name1', 'ref', 'filepicker', 'filepicker_picture', 'filepicker_aviary', 'swizzle'],
list: ['embeded.name1', 'ref', 'filepicker', 'filepicker_picture', 'filepicker_aviary', 'swizzle', 'date'],
subCollections: [{label: 'Sub Tests', model: 'pages', field:'ref'}],
list_populate: ['ref']
};
Expand Down
3 changes: 2 additions & 1 deletion generated/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ var cloudinary_url = value_url && value.url.split('/upload/')[0] + '/upload/c_fi
var geomery = value && value.geometry && value.geometry.lat + ',' + value.geometry.lng;
var maps_url = geomery && 'https://maps.google.com/?q=' + geomery;
var filename = value && value.filename;
var date_string = value && value.toISOString ? value.toISOString().split('T')[0] : '';
switch (type){
case 'Picture':
buf.push("<a" + (jade.attrs({ 'href':(value_url), 'target':('_blank') }, {"href":true,"target":true})) + "><img" + (jade.attrs({ 'src':(cloudinary_url) }, {"src":true})) + "/></a>");
Expand Down Expand Up @@ -243,7 +244,7 @@ buf.push.apply(buf, jade.indent);
buf.push("<div class=\"bool\"><i" + (jade.attrs({ "class": [((value ? 'icon-ok' : 'icon-remove'))] }, {"class":true})) + "></i></div>");
break;
case 'Date':
buf.push("<a" + (jade.attrs({ 'href':(document_url) }, {"href":true})) + ">" + (jade.escape(null == (jade.interp = value.toISOString().split('T')[0]) ? "" : jade.interp)) + "</a>");
buf.push("<a" + (jade.attrs({ 'href':(document_url) }, {"href":true})) + ">" + (jade.escape(null == (jade.interp = date_string) ? "" : jade.interp)) + "</a>");
break;
default:
buf.push("<a" + (jade.attrs({ 'href':(document_url) }, {"href":true})) + ">" + (jade.escape(null == (jade.interp = value) ? "" : jade.interp)) + "</a>");
Expand Down
1 change: 1 addition & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ global.mockFind = function mockFindFactory(arr) {
populate: function mockLimit() { return this; },
skip: function mockLimit() { return this; },
limit: function mockLimit() { return this; },
sort: function mockLimit() { return this; },
exec: function mockExec(cb) {
var p = new Promise(cb);
p.fulfill(arr);
Expand Down
2 changes: 1 addition & 1 deletion test/test-mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ describe("high level REST requests on mongoose", function () {
});


it.skip("view model page 2", function (done) {
it("view model page 2", function (done) {
var Tests = this.registry.models['Tests'].model;
var old_Tests_find = Tests.find;
Tests.find = mockFind([new Tests()]);
Expand Down
3 changes: 2 additions & 1 deletion views/model.jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mixin fielddesc(value, type, document_url)
- var geomery = value && value.geometry && value.geometry.lat + ',' + value.geometry.lng;
- var maps_url = geomery && 'https://maps.google.com/?q=' + geomery;
- var filename = value && value.filename;
- var date_string = value && value.toISOString ? value.toISOString().split('T')[0] : '';
case type
when 'Picture'
a(href=value_url, target='_blank'): img(src=cloudinary_url)
Expand All @@ -32,7 +33,7 @@ mixin fielddesc(value, type, document_url)
i(class=(value ? 'icon-ok' : 'icon-remove'))

when 'Date'
a(href=document_url): =value.toISOString().split('T')[0]
a(href=document_url): =date_string

default
a(href=document_url): =value
Expand Down

0 comments on commit ddd65eb

Please sign in to comment.