Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updates, refactor for latest persvr and dgrid

  • Loading branch information...
commit 9020c8ad2edd4b73d4a1b22e576603c4e91b147a 1 parent ca3fd56
@kriszyp authored
Showing with 117 additions and 97 deletions.
  1. +50 −37 {public/js → }/app.js
  2. +16 −14 {public → }/css/app.css
  3. 0  {public → }/css/claro.css
  4. 0  {public → }/css/images/titlebar.png
  5. 0  {public → }/css/images/ui-bg_flat_0_aaaaaa_40x100.png
  6. 0  {public → }/css/images/ui-bg_flat_75_ffffff_40x100.png
  7. 0  {public → }/css/images/ui-bg_glass_55_fbf9ee_1x400.png
  8. 0  {public → }/css/images/ui-bg_glass_65_ffffff_1x400.png
  9. 0  {public → }/css/images/ui-bg_glass_75_dadada_1x400.png
  10. 0  {public → }/css/images/ui-bg_glass_75_e6e6e6_1x400.png
  11. 0  {public → }/css/images/ui-bg_glass_95_fef1ec_1x400.png
  12. 0  {public → }/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  13. 0  {public → }/css/images/ui-icons_222222_256x240.png
  14. 0  {public → }/css/images/ui-icons_2e83ff_256x240.png
  15. 0  {public → }/css/images/ui-icons_454545_256x240.png
  16. 0  {public → }/css/images/ui-icons_888888_256x240.png
  17. 0  {public → }/css/images/ui-icons_cd0a0a_256x240.png
  18. 0  {public → }/css/layout.css
  19. 0  {public → }/css/smoothness.css
  20. +2 −2 lib/app.js
  21. +36 −34 lib/index.js
  22. +3 −3 lib/model/package.js
  23. +1 −1  package.json
  24. 0  public/archives/placeholder
  25. +4 −2 public/js/packages.js
  26. +5 −4 public/list.html
View
87 public/js/app.js → app.js
@@ -2,9 +2,10 @@ define(function(require){
var claApprovedRepos = ["dojo", "ibm", "kriszyp", "jrburke/require"];
var exceptRepos = ["kriszyp/slick"];
var claRegex = new RegExp("https://github.com/(" + claApprovedRepos.join("|") + ")");
+ var put = require("put-selector/put");
var claRegexExcept = new RegExp(exceptRepos.join("|"));
var query = require("dojo/query");
- var Compose = require("compose"),
+ var Compose = require("compose/compose"),
QueryResults = require("dojo/store/util/QueryResults");
store = Compose(require("dojo/store/JsonRest"), {
query: function(id){
@@ -29,19 +30,17 @@ define(function(require){
return [{id:nextId++, name:"A number " + Math.random()}];
}
})({});
- require("cssx/css!../css/app.css");//.apply(document.body);
- require("cssx/css!../css/layout.css");
/* require("xstyle!../public/css/app").extend(require("xstyle/widget"), require("xstyle/generate"), require("xstyle/css3")).apply(document.body);*/
var nextId = 0;
/*require("remote-console").connectTo("http://192.168.0.6:8181/", "POST");*/
- var list = require("d-list/OnDemandList")({
+ var list = require("dgrid/OnDemandList")({
store: store,
/* data = [];
for(var i = 0;i < 20000; i++){
data.push({id:i, name:"A number " + Math.random()});
};
this.store = new (require("store/Memory"))({data: data});*/
- renderRow: function(row, object, options){
+ renderRow: function(object, options){
var licenses = [];
if(object.licenses){
for(var i = 0; i < object.licenses.length; i++){
@@ -50,67 +49,81 @@ define(function(require){
}
var claApproved = claRegex.test(object.repositories[0].url) && !claRegexExcept.test(object.repositories[0].url);
var icon = object.icon || "http://dojofoundation.org/images/icons/6.png";
+ var row = put('div');
row.innerHTML = '<img src="' + icon + '" /><div class="name">' + object.name +
'</div><div class="license">' + (licenses.join('/') || "&nbsp;") +
'</div><div class="cla' + (claApproved ? ' cla-approved' : '') + '"><span>&nbsp;</span>' +
'</div><div class="description">' + (object.description || '') + '</div>';
+ return row;
},
layout: [
- //require("d-list/Tree")({field:"id", sortable: true, width: "100px"}),
+ //require("dgrid/Tree")({field:"id", sortable: true, width: "100px"}),
{field:"name", sortable: true, width: "200px"}
]
}, query("#list")[0]);
- var tree = require("d-list/Tree")({field:"id", sortable: true, width: "100px"});
+ var tree = require("dgrid/Tree")({field:"id", sortable: true, width: "100px"});
tree.table = list;
list.on("click", function(event){
- var object = list.getObject(event);
- if(object){
- var row = list.getRowNode(object);
- var packageFull = query(".package-full", row)[0];
+ var row = list.row(event);
+ var object;
+ if(row && (object = row.data)){
+ row = row.element;
+ var packageFull = row.packageFull;
if(packageFull){
+ delete row.packageFull;
// already expanded
var parent = event.target;
while(parent != packageFull){
if(parent == null){
- row.removeChild(packageFull);
+ put(packageFull, "!");
return;
}
parent = parent.parentNode;
}
return;
}
- var packageFull = row.appendChild(document.createElement("div"));
- packageFull.className = "package-full";
- store.get(object.id).then(function(fullPackage){
- var versions = fullPackage.versions;
- for(var i in versions){
- if(i != "id"){
- var row = dojo.create("div",{
- className: "row"
- },packageFull);
- dojo.create("div",{
- className: "branch-name",
- innerHTML: i,
- href: "#" + i
- }, row);
- if(versions[i] && versions[i].dist){
- dojo.create("div",{
- className: "branch-description",
- innerHTML: '<a href="' + versions[i].dist.zip + '">download zip</a><br>' +
- '<a href="' + versions[i].dist.tarball + '">download tarball</a><br>' +
- (versions[i].dependencies ? 'Dependencies: ' + (function(dependencies){
+ var packageFull = put(row, "+div");
+ row.packageFull = packageFull;
+ var details = put(packageFull, ".package-full div.details");
+ put(details, "a", {
+ href: object.repositories[0].url,
+ innerHTML: "Go to project repo"
+ });
+ if(object.dependencies){
+ put(details, "div", {
+ innerHTML: "Dependencies: " + (function(dependencies){
var asHtml = "";
for(var i in dependencies){
asHtml += i + ' ' + dependencies[i];
}
return asHtml;
- })(versions[i].dependencies) : '')
- }, row);
- }
+ })(object.dependencies)
+ });
+ }
+ require("dojo/on")(put(details, "div", {
+ innerHTML: "Older versions"
+ }), "click", function(){
+ store.get(object.id).then(function(fullPackage){
+ var versions = fullPackage.versions;
+ for(var i in versions){
+ if(i != "id"){
+ var row = put(packageFull, "div.row");
+ put(row, "div.branch-name", {
+ innerHTML: i,
+ href: "#" + i
+ });
+ if(versions[i] && versions[i].dist){
+ put(row, "div.branch-description",{
+ innerHTML: '<a href="' + versions[i].dist.zip + '">download zip</a><br>' +
+ '<a href="' + versions[i].dist.tarball + '">download tarball</a><br>'
+
+ });
+ }
+ }
}
- }
+ });
});
}
});
- query("#list .d-list-header")[0].innerHTML= "Dojo Foundation Packages";
+ query("#list .dgrid-header")[0].innerHTML= "Dojo Foundation Packages";
});
View
30 public/css/app.css → css/app.css
@@ -1,6 +1,6 @@
/*@import url("/packages/dojo-mobile/themes/iphone/iphone.css") only screen(iphone);
@import url("/packages/dojo-mobile/themes/android/android.css") only screen(android);*/
-@import url("./claro.css") screen;
+@import url("/packages/dgrid/css/skins/claro.css") screen;
#list{
left: inherit;
@@ -11,13 +11,13 @@
width: 780px;
border: 1px solid #aaa;
margin: 5px;
- -webkit-border-radius: 5px;
- -webkit-box-shadow: 1px 1px 2px #888;
+ border-radius: 5px;
+ box-shadow: 1px 1px 2px #888;
background: -webkit-gradient(linear, left top, left bottom, from(#def), to(#fff), color-stop(0.5, #fff));
store: store;
- widget: require('d-list/OnDemandTable');
+ widget: require('dgrid/OnDemandTable');
/id {
- widget: require('d-list/Tree');
+ widget: require('dgrid/Tree');
sortable: true;
width: 100px;
};
@@ -27,29 +27,31 @@
};
}
-.d-list-header {
+.dgrid-header {
font-size: 1.5em;
padding: 10px;
}
-.d-list-row {
+.dgrid-row {
padding: 10px;
+ cursor: pointer;
+ height: 40px;
}
-.d-list-row img{
+.dgrid-row img{
float: left;
margin-right: 10px;
height: 32px;
width: 32px;
}
-.d-list-row .name{
+.dgrid-row .name{
float: left;
width: 400px;
}
-.d-list-row .license {
+.dgrid-row .license {
float: left;
width: 100px;
}
-.d-list-scroller {
+.dgrid-scroller {
top: 45px;
}
.branch-name {
@@ -87,7 +89,7 @@ input[type=range]{
/* could also do @import /packages/my-widget/css/claro-for-widget.css screen and (rule: .claro)
/ or @import /packages/dijit/themes/claro/Checkbox.css screen and (not missing-module: dijit/form/Checkbox)*/
-.d-list-row:hover {
+.dgrid-row:hover {
-webkit-transition-property: background-color;
-webkit-transition-duration: .3s;
background-color: #eff;
@@ -96,10 +98,10 @@ input[type=range]{
float: right;
width: 150px;
border: 1px solid #aaa;
- -webkit-border-radius: 5px;
+ border-radius: 5px;
padding: 5px;
margin: 5px;
- -webkit-box-shadow: 1px 1px 2px #888;
+ box-shadow: 1px 1px 2px #888;
background: -webkit-gradient(linear, left top, left bottom, from(#def), to(#fff), color-stop(0.5, #fff));
}
#package-setup div{
View
0  public/css/claro.css → css/claro.css
File renamed without changes
View
0  public/css/images/titlebar.png → css/images/titlebar.png
File renamed without changes
View
0  public/css/images/ui-bg_flat_0_aaaaaa_40x100.png → css/images/ui-bg_flat_0_aaaaaa_40x100.png
File renamed without changes
View
0  public/css/images/ui-bg_flat_75_ffffff_40x100.png → css/images/ui-bg_flat_75_ffffff_40x100.png
File renamed without changes
View
0  public/css/images/ui-bg_glass_55_fbf9ee_1x400.png → css/images/ui-bg_glass_55_fbf9ee_1x400.png
File renamed without changes
View
0  public/css/images/ui-bg_glass_65_ffffff_1x400.png → css/images/ui-bg_glass_65_ffffff_1x400.png
File renamed without changes
View
0  public/css/images/ui-bg_glass_75_dadada_1x400.png → css/images/ui-bg_glass_75_dadada_1x400.png
File renamed without changes
View
0  public/css/images/ui-bg_glass_75_e6e6e6_1x400.png → css/images/ui-bg_glass_75_e6e6e6_1x400.png
File renamed without changes
View
0  public/css/images/ui-bg_glass_95_fef1ec_1x400.png → css/images/ui-bg_glass_95_fef1ec_1x400.png
File renamed without changes
View
0  ...s/images/ui-bg_highlight-soft_75_cccccc_1x100.png → css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
File renamed without changes
View
0  public/css/images/ui-icons_222222_256x240.png → css/images/ui-icons_222222_256x240.png
File renamed without changes
View
0  public/css/images/ui-icons_2e83ff_256x240.png → css/images/ui-icons_2e83ff_256x240.png
File renamed without changes
View
0  public/css/images/ui-icons_454545_256x240.png → css/images/ui-icons_454545_256x240.png
File renamed without changes
View
0  public/css/images/ui-icons_888888_256x240.png → css/images/ui-icons_888888_256x240.png
File renamed without changes
View
0  public/css/images/ui-icons_cd0a0a_256x240.png → css/images/ui-icons_cd0a0a_256x240.png
File renamed without changes
View
0  public/css/layout.css → css/layout.css
File renamed without changes
View
0  public/css/smoothness.css → css/smoothness.css
File renamed without changes
View
4 lib/app.js
@@ -1,8 +1,8 @@
/**
* This is an example Wiki web application written on Pintura
*/
-var admins = require("commonjs-utils/settings").security.admins,
- copy = require("commonjs-utils/copy").copy,
+var admins = require("perstore/util/settings").security.admins,
+ copy = require("perstore/util/copy").copy,
Package = require("./model/package").Package,
Restrictive = require("perstore/facet").Restrictive,
FileSystem = require("perstore/store/filesystem").FileSystem,
View
70 lib/index.js
@@ -1,46 +1,48 @@
// helpful for debugging
print = require("promised-io/process").print;
var pinturaApp,
- settings = require("commonjs-utils/settings"),
+ settings = require("perstore/util/settings"),
Static = require("pintura/jsgi/static").Static,
- multiNode = require("multi-node/multi-node");
-
-require.reloadable(function(){
pinturaApp = require("pintura/pintura").app;
- require("app");
-});
-
-var nodes = multiNode.listen({port: settings.port || 8080, nodes: settings.processes || 1},
- require( "http" ).createServer(
- require("jsgi-node").Listener(
- // uncomment this to enable compression with node-compress
- //require("pintura/jsgi/compress").Compress(
- require("pintura/jsgi/cascade").Cascade([
- // cascade from static to pintura REST handling
- Static({urls:["/packages"], root: ".."}),
- require("./jsgi/archive"),
-
- Static({urls:["/explorer"], root: require("nodules").getCachePath("persevere-client/") + "/explorer"}),
- // this will provide access to the server side JS libraries from the client
- require("transporter/jsgi/transporter").Transporter({
- loader: require("nodules").forEngine("browser").useLocal().getModuleSource}),
- // main pintura app
- function(request){
- return pinturaApp(request);
- }
- ])
- )
- )
-);
+require("./app");
+try{
+var listener = require("jsgi-node").Listener(
+ // uncomment this to enable compression with node-compress
+ //require("pintura/jsgi/compress").Compress(
+ require("pintura/jsgi/cascade").Cascade([
+ // cascade from static to pintura REST handling
+ Static({urls:["/packages"], root: ".."}),
+ Static({urls:["/packages/dojo"], root: "/c/dev/dojo-toolkit/dojo"}),
+ require("./jsgi/archive"),
+ pinturaApp
+ ])
+ );
+}catch(e){
+console.log("a",e);
+}
+/*var nodes = multiNode.listen({port: settings.port || 8080, nodes: settings.processes || 1},
+ require("http").createServer(listener));
nodes.addListener("node", function(stream){
pinturaApp.addConnection(multiNode.frameStream(stream));
-});
-
+});*/
+require("http").createServer(listener).listen(7080);
+console.log("a2");
+try{
+var sslOptions = {
+ key: require('fs').readFileSync('privkey.pem'),
+ cert: require('fs').readFileSync('cacert.pem')
+};
+require("https").createServer(sslOptions, listener).listen(443);
+}catch(e){
+ console.log(e);
+}
// having a REPL is really helpful
-if(nodes.isMaster){
- require("pintura/util/repl").start();
+/*if(nodes.isMaster){
+ require("https").createServer(sslOptions, listener).listen(443);
+ require("pintura/util/repl").start();
}
// this is just to ensure the static analysis preloads the explorer package
-false&&require("persevere-client/explorer/explorer.js");
+false&&require("persevere-client/explorer/explorer.js");
+*/
View
6 lib/model/package.js
@@ -5,15 +5,15 @@ var Model = require("perstore/model").Model,
DefaultStore = require("perstore/stores").DefaultStore,
promiseModule = require("promised-io/promise"),
queryRepo = require("./git").queryRepo,
- host = require("commonjs-utils/settings").host || "/",
+ host = require("perstore/util/settings").host || "/",
print = console.log,
httpClient = require("promised-io/http-client"),
when = promiseModule.when,
fs = require("promised-io/fs"),
all = promiseModule.all;
-var packageStore = DefaultStore(),
- versionsStore = DefaultStore();
+var packageStore = DefaultStore({log:false}),
+ versionsStore = DefaultStore({log:false});
versionsStore.setPath("Versions");
// now we create a class, all central model logic is defined here (make Page be a global for convenience)
PackageModel = exports.Package = Model(packageStore, {
View
2  package.json
@@ -7,7 +7,7 @@
"mappings":{
"perstore": "http://github.com/kriszyp/perstore/zipball/master",
"commonjs-utils": "http://github.com/kriszyp/commonjs-utils/zipball/master",
- "pintura": "jar:http://github.com/kriszyp/pintura/zipball/master!/lib/",
+ "pintura": "jar:http://github.com/kriszyp/pintura/zipball/master!/",
"promised-io": "jar:http://github.com/kriszyp/promised-io/zipball/master!/",
"patr": "jar:http://github.com/kriszyp/patr/zipball/master!/",
"rql": "jar:http://github.com/kriszyp/rql/zipball/master!/",
View
0  public/archives/placeholder
No changes.
View
6 public/js/packages.js
@@ -1,6 +1,6 @@
require({"packages":[
{"name":"d-list","location":"/packages/d-list", "lib":"."},
-{"name":"compose","location":"/packages/compose", "main":"./compose"},
+{"name":"compose","location":"/packages/compose", "main":"./lib/compose"},
{"name":"cssx","location":"/packages/cssx", "lib":"src/cssx", "main":"./src/cssx/cssx"},
{"name":"lightning","location":"/packages/lightning", "lib":".", "main":"./lightning"},
{"name":"dojo","location":"/packages/dojo", "lib":".", "main": "./lib/main-browser"},
@@ -8,4 +8,6 @@ require({"packages":[
{"name":"sizzle","location":"/packages/sizzle", "main": "./sizzle"},
{"name":"slick","location":"/packages/slick", "lib":"./Source", "main": "./Slick.Finder"}
]});
-define('packages',[],{load: function(id, parentRequire, onLoad){require([id], onLoad);}});
+define([],{load: function(id, parentRequire, onLoad){
+ require([id], onLoad);
+}});
View
9 public/list.html
@@ -6,13 +6,14 @@
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/ico" href="/favicon.ico"/>
+<link rel="stylesheet" href="/packages/cpr/css/layout.css" media="screen">
+<link rel="stylesheet" href="/packages/cpr/css/app.css" media="screen">
<!-- Javascripts -->
<!-- <script src="js/packages/requirejs/require.js"></script>-->
-<script data-dojo-config="async:true, loaderOnly: true, hasTests:{'dojo-boot':false}" src="/packages/dojo/dojo.js"></script>
+<script data-dojo-config='async:true' src="/packages/dojo/dojo.js"></script>
<script>
- require({baseUrl:"js", paths:{"require": "/packages/requirejs/require"}});
- require(["packages!app"]);
+ require(["cpr/app"]);
</script>
</head>
<body>
@@ -23,7 +24,7 @@
<a id="logo" href="/"></a>
<div class="menu">
<ul>
- <li><a href="/">Home</a></li><li><a href="/about">About</a></li><li><a href="/projects">Projects</a></li><li><a href="/blog">Blog</a></li><li><a href="/contact">Contact</a></li><li><a href="http://my.dojofoundation.org/">Login</a></li> </ul>
+ <li><a href="http://dojofoundation.org/">Home</a></li><li><a href="http://dojofoundation.org/about">About</a></li><li><a href="http://dojofoundation.org/projects">Projects</a></li><li><a href="http://dojofoundation.org/blog">Blog</a></li><li><a href="http://dojofoundation.org/contact">Contact</a></li><li><a href="http://my.dojofoundation.org/">Login</a></li> </ul>
</div><!-- end of menu -->
</div><!-- end of header -->
<div class="shadow-sep"></div><!-- end of shadow-sep -->
Please sign in to comment.
Something went wrong with that request. Please try again.