Skip to content

Commit

Permalink
Merge pull request #12 from gameclosure/feature-support-links
Browse files Browse the repository at this point in the history
Feature support links
  • Loading branch information
Martin Hunt committed Feb 13, 2013
2 parents 73e9dbb + 1350f5b commit 08eee3b
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 52 deletions.
2 changes: 1 addition & 1 deletion src/serve/plugins/about/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"version": "0.1.0",
"author": "Game Closure",
"name": "About",
"scope": "main"
"scope": "footer"
}
1 change: 0 additions & 1 deletion src/serve/plugins/about/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ exports.load = function (app) {
res.json({
info: {
lastChecked: lastChecked,
isDev: true,
version: version
},
tags: tagData
Expand Down
58 changes: 26 additions & 32 deletions src/serve/plugins/about/static/Pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ var VersionCell = Class(squill.Cell, function(supr) {
});

this.render = function() {
this.label.setText(this._data.toString());
this.label.setText(this._data.version.toString());

if (this._data == currentVersion) {
if (this._data.version == currentVersion) {
$.addClass(this._el, 'current');
} else {
$.removeClass(this._el, 'current');
}
};
});

var versionData = new squill.models.DataSource({key: 'src'});
var versionData = new squill.models.DataSource({key: 'src', sorter: function (v) { return Version.sorterKey(v.version); }});

exports = Class(sdkPlugin.SDKPlugin, function(supr) {
this._def = {
id: 'aboutPane',
children: [
{className: 'topTabs', type: squill.TabbedPane, panes: [
{id: 'aboutMain', className: 'mainPanel', title: 'about', children: [
{id: 'aboutMain', className: 'mainPanel', title: 'about', children: [
{className: 'table-wrapper', children: [
{className: 'table', children: [
{className: 'table-row', children: [
{className: 'table-cell', children: [
Expand All @@ -72,23 +72,18 @@ exports = Class(sdkPlugin.SDKPlugin, function(supr) {
{id: 'updateStatus'},
{id: 'lastCheckedStatus'},
{id: 'refresh', type: 'button', text: '\u21BB', className: 'circle'}
]}
]},
{id: 'btnSwitchVersion', type: 'button', text: 'switch version'}
]}
]},
]},
]},

{
className: 'support mainPanel',
title: 'support',
id: 'support'
},

{className: 'mainPanel', title: 'versions', children: [
{id: 'versionHeader', children: [{tag: 'span', text: 'current version: '}, {tag: 'span', id: 'aboutVersion'}]},
{id: 'versionWrapper', className: 'darkPanel', children: [

{id: 'versionWrapper', children: [
{id: 'versionHeader', text: 'all versions:'}, // children: [{tag: 'span', text: 'all versions: '}, {tag: 'span', id: 'aboutVersion'}]},
{id: 'versionListWrapper', className: 'darkPanel', children: [
{id: 'versions', type: 'list', dataSource: versionData, cellCtor: VersionCell, selectable: 'single'}
]},
]}
]}
]}
]
Expand All @@ -103,10 +98,14 @@ exports = Class(sdkPlugin.SDKPlugin, function(supr) {
type: 'json'
}, bind(this, 'onVersions'));
};

on.btnSwitchVersion = function () {
$.addClass(this._el, 'showVersions');
this.versions.needsRender();
}
});

this.onSwitchVersion = function(version) {
this.hideMore();
$.setText(this.lastCheckedStatus, 'Updating... Please wait.');
util.ajax.get({
url: '/plugins/about/update/',
Expand All @@ -127,14 +126,6 @@ exports = Class(sdkPlugin.SDKPlugin, function(supr) {

this.getVersions();
this.versions.subscribe('Switch', this, 'onSwitchVersion');

this.support._el.innerHTML = '<ul class="support">\
<li><a href="http://docs.gameclosure.com">Documentation</a></li>\
<li><a href="https://gcsdk.zendesk.com/forums">Forum</a></li>\
<li><a href="">Mailing List</a></li>\
<li><a href="http://webchat.freenode.net/?channels=#gameclosure">IRC</a></li>\
<li><a href="mailto:[email protected]">[email protected]</a></li>\
</ul>';
};

this.getVersions = function() {
Expand All @@ -148,6 +139,7 @@ exports = Class(sdkPlugin.SDKPlugin, function(supr) {
if (!response) {
return;
}

var lastChecked = response.info ? response.info.lastChecked : -1;
if (lastChecked == -1) {
$.setText(this.lastCheckedStatus, 'checking for updates...');
Expand All @@ -169,7 +161,10 @@ exports = Class(sdkPlugin.SDKPlugin, function(supr) {
currentVersion = v;
}

versionData.add(v);
versionData.add({
version: v,
src: v.src
});
}

versionData.sort(Version.sorterDesc);
Expand All @@ -186,8 +181,7 @@ exports = Class(sdkPlugin.SDKPlugin, function(supr) {
}

$.setText(this.version, verStr);
$.setText(this.aboutVersion, verStr);


this._checkUpdates();
};

Expand All @@ -199,9 +193,9 @@ exports = Class(sdkPlugin.SDKPlugin, function(supr) {
var nextVersion = null;

// find the first non-beta version greater than the current version
versionData.forEach(function(v) {
if (currentVersion.lt(v)) {
nextVersion = v;
versionData.forEach(function(data) {
if (currentVersion.lt(data.version)) {
nextVersion = data.version;
return true;
}
}, this);
Expand Down
39 changes: 31 additions & 8 deletions src/serve/plugins/about/static/about.styl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,31 @@
background: bglight(), -webkit-radial-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
}

#aboutMain .table {
width: 100%;
height: 100%;
display: table;
}
#aboutPane .table-wrapper
height 100%
overflow auto

#aboutPane .table
width 100%;
height 100%;
display table;
overflow auto

#aboutPane.showVersions .table-wrapper,
#aboutPane.showVersions .table
height 50%

#aboutPane #versionWrapper
display none

absoluteBox(0px, 15px, 15px, 15px)
top: 50%;

#aboutPane.showVersions #versionWrapper
display block

#aboutPane.showVersions #btnSwitchVersion
display none

#aboutPane input[type=checkbox] {
margin-right: 5px;
Expand Down Expand Up @@ -59,13 +79,16 @@
text-size: 80%;
}

#aboutPane #btnSwitchVersion
margin-top: 40px

#aboutPane #versionHeader
padding 15px
text-align center

#aboutPane #versionWrapper {
#aboutPane #versionListWrapper
overflow auto
absoluteBox(45px, 15px, 15px, 15px)
}
absoluteBox(35px, 15px, 15px, 15px)

#aboutPane #versions
padding 10px 0px
Expand Down
6 changes: 6 additions & 0 deletions src/serve/plugins/documentation/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "0.1.0",
"author": "Game Closure",
"name": "Documentation",
"scope": "footer"
}
20 changes: 20 additions & 0 deletions src/serve/plugins/documentation/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* @license
* This file is part of the Game Closure SDK.
*
* The Game Closure SDK is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* The Game Closure SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with the Game Closure SDK. If not, see <http://www.gnu.org/licenses/>.
*/

exports.load = function (app) {

};
40 changes: 40 additions & 0 deletions src/serve/plugins/documentation/static/Pane.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* @license
* This file is part of the Game Closure SDK.
*
* The Game Closure SDK is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* The Game Closure SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with the Game Closure SDK. If not, see <http://www.gnu.org/licenses/>.
*/

import ....sdkPlugin;
import shared.Version as Version;
import util.ajax;
import string.timeAgo;

import squill.TabbedPane;
import squill.Delegate;
import squill.models.DataSource;
import squill.Cell;

from util.browser import $;

exports = Class(sdkPlugin.SDKPlugin, function(supr) {
this._def = {
id: 'aboutPane',
style: {overflow: 'hidden'},
children: [
{tag: 'iframe', src: '//docs.gameclosure.com', style: {border: 0, width: '100%', height: '100%'}}
]
};


});
2 changes: 1 addition & 1 deletion src/serve/plugins/native/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"version": "0.2.0",
"author": "Game Closure",
"name": "Remote Debug",
"scope": "inspectors"
"scope": "debug"
}
2 changes: 1 addition & 1 deletion src/serve/plugins/projects/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"version": "0.1.0",
"author": "Game Closure",
"name": "Projects",
"scope": "main"
"scope": "header"
}
14 changes: 7 additions & 7 deletions src/serve/public/Overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ import util.ajax;
var PluginGroup = Class(function() {
var PRIORITIES = {
header: 'a',
project: 'b',
debug: 'c'
main: 'b',
project: 'c',
debug: 'd',
footer: 'z'
};

var DEFAULT_PRIORITY = 'z';
Expand All @@ -44,7 +46,7 @@ var PluginGroup = Class(function() {
this.priority = PRIORITIES[name] || DEFAULT_PRIORITY;
};

this.add = function(plugin) { this.plugins.push(plugin); };
this.add = function(plugin) { this.plugins.push(plugin); console.log(plugin, this.priority); };
this.toString = function() { return this.priority; };
});

Expand Down Expand Up @@ -229,8 +231,7 @@ exports = Class(squill.TabbedPane, function(supr) {

// sort the plugins by group
var groups = [];
plugins.forEach(
function(plugin) {
plugins.forEach(function(plugin) {
var group = groups[plugin.group];
if (!group) {
group = new PluginGroup(plugin.group);
Expand All @@ -239,8 +240,7 @@ exports = Class(squill.TabbedPane, function(supr) {
}

group.add(plugin);
}
);
});

groups.sort();

Expand Down
26 changes: 25 additions & 1 deletion src/shared/Version.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,32 @@ Version.sorterDesc = function (a, b) {
return Version.sorterAsc(b, a);
};

Version.sorterKey = function (a) {
return a.channel + ' ' + pad(a.major) + pad(a.minor) + pad(a.patch) + pad(a.build);
}


var LEN = 8;
var MAX = 99999999;
var MIN = -99999999;
var PAD = "00000000";

function pad (val) {
val = ~~val;

if (val < MIN) { val = MIN; }
if (val > MAX) { val = MAX; }
if (val < 0) {
val *= -1;
return '-' + PAD.substring(0, LEN - ('' + val).length) + val;
} else {
return PAD.substring(0, LEN - ('' + val).length) + val;
}
};


if(module && module.children) {
module.exports = Version;
module.exports = Version;
} else {
exports = Version;
}

0 comments on commit 08eee3b

Please sign in to comment.