Remove bootstrap, use CDN

This commit is contained in:
Vincent Fiduccia 2014-05-09 17:26:11 -07:00
parent d782e5fbf7
commit f103b1108d
8 changed files with 59 additions and 7749 deletions

View File

@ -9,13 +9,11 @@
"base": {
"saveOutput": false,
"css": [
"bootstrap",
"main"
],
"js": [
"jquery",
"bootstrap",
"async", "json2", "polyfill",
"JSONFormatter", "URLParse", "Cookie",
"handlebars.runtime", "template"

View File

@ -1,6 +1,6 @@
{
"name": "gdapi-ui",
"version": "2.0.2",
"version": "2.0.3",
"description": "HTML UI for GDAPI-compliant APIs",
"author": {
"name": "Vincent Fiduccia",

5784
public/css/bootstrap.css vendored

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ Cookie.set = function(name,value,expire,path,domain,secure)
else if ( expire )
expire_date = new Date( (new Date()).getTime() + (86400000 * expire));
var str = name +'=' + escape(value);
var str = name +'=' + value.replace(/ /g,'%20').replace(/,/g,'%2C').replace(/;/g,'%3B');
if ( expire )
str += ';expires=' + expire_date.toGMTString();

View File

@ -585,14 +585,22 @@ HTMLApi.prototype.filterInit = function(cb)
$('#filters').html(html);
var $elem;
var options;
for ( var i = 0 ; i < filters.length ; i++ )
{
v = filters[i];
if ( schema.collectionFilters[v.name] && schema.collectionFilters[v.name].options )
options = schema.collectionFilters[v.name].options;
else if ( schema.resourceFields[v.name] && schema.resourceFields[v.name].options )
options = schema.resourceFields[v.name].options;
else
options = null;
html = Handlebars.templates['filter']({
allFilterSchema: schema.collectionFilters,
thisFilterSchema: schema.collectionFilters[v.name],
options: schema.collectionFilters[v.name].options || schema.resourceFields[v.name].options,
options: options,
cur: v
});
$elem = $(html);
@ -628,10 +636,18 @@ HTMLApi.prototype.filterAdd = function(name, modifier, value, before)
value: value || ''
};
var options = null;
if ( schema.collectionFilters[name] && schema.collectionFilters[name].options )
options = schema.collectionFilters[name].options;
else if ( schema.resourceFields[name] && schema.resourceFields[name].options )
options = schema.resourceFields[name].options;
else
options = null;
var html = Handlebars.templates['filter']({
allFilterSchema: schemaFilters,
thisFilterSchema: schemaFilters[name],
options: schemaFilters[name].options || schema.resourceFields[name].options,
options: options,
cur: cur
});
@ -1774,3 +1790,16 @@ HTMLApi.prototype.switchToTextarea = function(button)
$textarea.on('keydown', function(e) { if ( e.keyCode == 13 ) { e.stopPropagation(); return true; } });
$button.hide();
}
HTMLApi.prototype.setLocalCookie = function(on) {
if ( on === false )
{
Cookie.remove('js.url');
Cookie.remove('css.url');
}
else
{
Cookie.set('js.url','http://localhost:3000/ui.js',3650);
Cookie.set('css.url','http://localhost:3000/ui.css',3650);
}
}

1951
public/js/bootstrap.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -6,10 +6,26 @@ var explorer;
{
jQuery(window).load(jQueryReady);
function jQueryReady() {
function jQueryReady()
{
if ( window.autoInit === false )
return;
if ( window.bootstrap === false )
{
boostrapReady();
}
else
{
var url = (window.bootstrap || '//netdna.bootstrapcdn.com/bootstrap/3.1.1').replace(/\/+$/,'');
$('head').append('<link rel="stylesheet" href="'+url+'/css/bootstrap.min.css" type="text/css" />');
$.getScript(url+'/js/bootstrap.min.js', boostrapReady);
}
}
function boostrapReady()
{
document.body.innerHTML = '<div class="loading"></div>';
try {
htmlapi = new HTMLApi({
@ -28,12 +44,8 @@ var explorer;
}
}
function apiError(err)
function apiReady(err)
{
document.body.innerHTML = 'Error loading UI: '+ Handlebars.Utils.escapeExpression(err);
}
function apiReady(err) {
var view = Cookie.get('apiview') || 'browse';
if ( err )
view = 'browse';
@ -46,5 +58,11 @@ var explorer;
htmlapi.show();
}
function apiError(err)
{
document.body.innerHTML = 'Error loading UI: '+ Handlebars.Utils.escapeExpression(err);
}
})();

View File

@ -75,8 +75,8 @@ Handlebars.registerHelper('displayModifier', function(context, options) {
case "notnull": str = 'Not NULL'; break;
case "like" : str = 'Like'; break;
case "notlike": str = 'Not like'; break;
case "prefix" : str = 'starts with'; break;
case "suffix" : str = 'ends with'; break;
case "prefix" : str = 'Starts with'; break;
case "suffix" : str = 'Ends with'; break;
}
return new Handlebars.SafeString(str);