Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/zhouyaoji/Mojito-Apps
- Loading branch information
Showing
69 changed files
with
2,169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ], | ||
"appPort": "8666", | ||
"specs": { | ||
"tribframe": { | ||
"type": "HTMLFrameMojit", | ||
"config": { | ||
"deploy": true, | ||
"title": "Trib - Contribute to the Tribe", | ||
"child": { | ||
"type": "githubMojit" | ||
}, | ||
"assets": { | ||
"top": { | ||
"css": ["/static/03_Frame_mojit/assets/trib.css"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"settings": [ "environment:development" ], | ||
"staticHandling": { | ||
"forceUpdate": true | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
div { | ||
xborder: 1px solid red; | ||
} | ||
|
||
.frameMojit { | ||
padding-top: 30px; | ||
} | ||
|
||
.mymodule { | ||
border: 1px solid #2d2d2d; | ||
margin: 8px; | ||
padding: 16px; | ||
border-radius: 3px; | ||
box-shadow: 2px 2px 2px #DDDDDD; | ||
|
||
/** temp until get grids going **/ | ||
float: left; | ||
} | ||
|
||
.mymodule h3 { | ||
margin: 0px; | ||
padding: 0px; | ||
font-weight: bold; | ||
} | ||
|
||
.myfooter { | ||
clear: left; | ||
} | ||
|
||
.bodytext { | ||
padding-left: 4px; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
body { | ||
background-color: #F8F8F8; | ||
padding-left: 8px; | ||
} | ||
|
||
div { | ||
xborder: 1px solid red; | ||
} | ||
|
||
.frameMojit { | ||
padding-top: 30px; | ||
} | ||
|
||
.mymodule { | ||
border: 1px solid #2d2d2d; | ||
margin: 8px; | ||
padding: 16px; | ||
border-radius: 3px; | ||
box-shadow: 2px 2px 2px #DDDDDD; | ||
|
||
/** temp until get grids going **/ | ||
float: left; | ||
} | ||
|
||
.mymodule h3 { | ||
margin: 0px; | ||
padding: 0px; | ||
font-weight: bold; | ||
} | ||
|
||
.myfooter { | ||
clear: left; | ||
} | ||
|
||
.bodytext { | ||
padding-left: 4px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dt { font-weight: bold; } | ||
.sel { background-color: #FF4; } |
54 changes: 54 additions & 0 deletions
54
dashboard/03_frame_mojit/mojits/githubMojit/binders/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*jslint anon:true, sloppy:true, nomen:true*/ | ||
YUI.add('githubMojitBinderIndex', function(Y, NAME) { | ||
|
||
/** | ||
* The githubMojitBinderIndex module. | ||
* | ||
* @module githubMojitBinderIndex | ||
*/ | ||
|
||
/** | ||
* Constructor for the githubMojitBinderIndex class. | ||
* | ||
* @class githubMojitBinderIndex | ||
* @constructor | ||
*/ | ||
Y.namespace('mojito.binders')[NAME] = { | ||
|
||
/** | ||
* Binder initialization method, invoked after all binders on the page | ||
* have been constructed. | ||
*/ | ||
init: function(mojitProxy) { | ||
this.mojitProxy = mojitProxy; | ||
}, | ||
|
||
/** | ||
* The binder method, invoked to allow the mojit to attach DOM event | ||
* handlers. | ||
* | ||
* @param node {Node} The DOM node to which this mojit is attached. | ||
*/ | ||
bind: function(node) { | ||
var me = this; | ||
this.node = node; | ||
/** | ||
* Example code for the bind method: | ||
* | ||
* node.all('dt').on('mouseenter', function(evt) { | ||
* var dd = '#dd_' + evt.target.get('text'); | ||
* me.node.one(dd).addClass('sel'); | ||
* | ||
* }); | ||
* node.all('dt').on('mouseleave', function(evt) { | ||
* | ||
* var dd = '#dd_' + evt.target.get('text'); | ||
* me.node.one(dd).removeClass('sel'); | ||
* | ||
* }); | ||
*/ | ||
} | ||
|
||
}; | ||
|
||
}, '0.0.1', {requires: ['event-mouseenter', 'mojito-client']}); |
55 changes: 55 additions & 0 deletions
55
dashboard/03_frame_mojit/mojits/githubMojit/controller.server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/*jslint anon:true, sloppy:true, nomen:true*/ | ||
YUI.add('githubMojit', function(Y, NAME) { | ||
|
||
/** | ||
* The githubMojit module. | ||
* | ||
* @module githubMojit | ||
*/ | ||
|
||
/** | ||
* Constructor for the Controller class. | ||
* | ||
* @class Controller | ||
* @constructor | ||
*/ | ||
Y.namespace('mojito.controllers')[NAME] = { | ||
|
||
/** | ||
* Method corresponding to the 'index' action. | ||
* | ||
* @param ac {Object} The ActionContext that provides access | ||
* to the Mojito API. | ||
*/ | ||
index: function(ac) { | ||
/** | ||
ac.models.get('githubMojitModelFoo').getData(function(err, data) { | ||
if (err) { | ||
ac.error(err); | ||
return; | ||
} | ||
ac.assets.addCss('./index.css'); | ||
ac.done({ | ||
status: 'Mojito is working.', | ||
data: data | ||
}); | ||
}); | ||
**/ | ||
|
||
var model = ac.models.get('StatsModelYQL'); | ||
Y.log(model); | ||
model.getData({}, function(data){ | ||
Y.log("githubmojit -index - model.getData:"); | ||
Y.log(data); | ||
var view = ac.params.url('custom') || 'index'; | ||
ac.done({ | ||
title: "", | ||
watchers: data.watchers, | ||
forks: data.forks | ||
}, view); | ||
}); | ||
} | ||
|
||
}; | ||
|
||
}, '0.0.1', {requires: ['mojito', 'mojito-assets-addon', 'mojito-models-addon', 'githubMojitModelFoo']}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ] | ||
} | ||
] |
34 changes: 34 additions & 0 deletions
34
dashboard/03_frame_mojit/mojits/githubMojit/models/foo.server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*jslint anon:true, sloppy:true, nomen:true*/ | ||
YUI.add('githubMojitModelFoo', function(Y, NAME) { | ||
|
||
/** | ||
* The githubMojitModelFoo module. | ||
* | ||
* @module githubMojit | ||
*/ | ||
|
||
/** | ||
* Constructor for the githubMojitModelFoo class. | ||
* | ||
* @class githubMojitModelFoo | ||
* @constructor | ||
*/ | ||
Y.namespace('mojito.models')[NAME] = { | ||
|
||
init: function(config) { | ||
this.config = config; | ||
}, | ||
|
||
/** | ||
* Method that will be invoked by the mojit controller to obtain data. | ||
* | ||
* @param callback {function(err,data)} The callback function to call when the | ||
* data has been retrieved. | ||
*/ | ||
getData: function(callback) { | ||
callback(null, { some: 'data' }); | ||
} | ||
|
||
}; | ||
|
||
}, '0.0.1', {requires: []}); |
45 changes: 45 additions & 0 deletions
45
dashboard/03_frame_mojit/mojits/githubMojit/models/yql.server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
YUI.add('StatsModelYQL', function(Y, NAME) { | ||
|
||
|
||
Y.mojito.models[NAME] = { | ||
|
||
init: function(config) { | ||
this.config = config; | ||
}, | ||
|
||
getData: function(params, callback) { | ||
var //yqlTable = 'store://kIfKmDunyT35ymUmFHJw0M', | ||
yqlTable = 'https://raw.github.com/triptych/trib/master/src/yql/github.xml', | ||
query = "use '{table}' as yahoo.awooldri.github.repo; select watchers,forks from yahoo.awooldri.github.repo where id='yql' and repo='yql-tables'", | ||
queryParams = { | ||
table: yqlTable | ||
}, | ||
cookedQuery = Y.substitute(query, queryParams); | ||
Y.log("getData called"); | ||
Y.log("cookedQuery:" + cookedQuery); | ||
Y.YQL(cookedQuery, Y.bind(this.onDataReturn, this, callback)); | ||
}, | ||
|
||
onDataReturn: function (cb, result) { | ||
Y.log("onDataReturn called"); | ||
if (typeof result.error === 'undefined') { | ||
|
||
Y.log("result:"); | ||
Y.log(result); | ||
|
||
|
||
|
||
var results = result.query.results.json; | ||
Y.log("results.json:"); | ||
Y.log(results); | ||
|
||
|
||
cb(results); | ||
} else { | ||
cb(result.error); | ||
} | ||
} | ||
|
||
}; | ||
|
||
}, '0.0.1', {requires: ['yql', 'substitute']}); |
62 changes: 62 additions & 0 deletions
62
dashboard/03_frame_mojit/mojits/githubMojit/tests/controller.server-tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
YUI.add('githubMojit-tests', function(Y) { | ||
|
||
var suite = new YUITest.TestSuite('githubMojit-tests'), | ||
controller = null, | ||
A = YUITest.Assert; | ||
|
||
suite.add(new YUITest.TestCase({ | ||
|
||
name: 'githubMojit user tests', | ||
|
||
setUp: function() { | ||
controller = Y.mojito.controllers.githubMojit; | ||
}, | ||
tearDown: function() { | ||
controller = null; | ||
}, | ||
|
||
'test mojit': function() { | ||
var ac, | ||
modelData, | ||
assetsResults, | ||
doneResults; | ||
modelData = { x:'y' }; | ||
ac = { | ||
assets: { | ||
addCss: function(css) { | ||
assetsResults = css; | ||
} | ||
}, | ||
models: { | ||
get: function(modelName) { | ||
A.areEqual('githubMojitModelFoo', modelName, 'wrong model name'); | ||
return { | ||
getData: function(cb) { | ||
cb(null, modelData); | ||
} | ||
} | ||
} | ||
}, | ||
done: function(data) { | ||
doneResults = data; | ||
} | ||
}; | ||
|
||
A.isNotNull(controller); | ||
A.isFunction(controller.index); | ||
controller.index(ac); | ||
A.areSame('./index.css', assetsResults); | ||
A.isObject(doneResults); | ||
A.areSame('Mojito is working.', doneResults.status); | ||
A.isObject(doneResults.data); | ||
A.isTrue(doneResults.data.hasOwnProperty('x')); | ||
A.areEqual('y', doneResults.data['x']); | ||
|
||
} | ||
|
||
})); | ||
|
||
YUITest.TestRunner.add(suite); | ||
|
||
}, '0.0.1', {requires: ['mojito-test', 'githubMojit']}); |
Oops, something went wrong.