diff --git a/LICENSE.txt b/LICENSE.txt index 8409e1a..04ae7c9 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ Copyright (c) 2013-2014 Go Daddy Operating Company, LLC -Copyright (c) 2014-2015 Rancher Labs, Inc. +Copyright (c) 2014-2016 Rancher Labs, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/gulpfile.js b/gulpfile.js index ce6ebb4..898ae9a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,6 +6,7 @@ var gulpGzip = require('gulp-gzip'); var gulpHint = require('gulp-jshint'); var gulpMap = require('gulp-sourcemaps'); var gulpRename = require('gulp-rename'); +var gulpReplace = require('gulp-replace'); var gulpSass = require('gulp-sass'); var gulpTar = require('gulp-tar'); var gulpUglify = require('gulp-uglify'); @@ -52,6 +53,7 @@ gulp.task('js', ['templates','partials'], function() { return gulp.src([ 'node_modules/jquery/dist/jquery.js', 'vendor/jquery.scrollintoview.js', + 'node_modules/bootstrap/dist/js/bootstrap.js', 'vendor/async.js', 'vendor/json2.js', 'vendor/polyfill.js', @@ -99,7 +101,13 @@ gulp.task('partials', function() { }); gulp.task('css', function() { - return gulp.src('styles/ui.scss') + return gulp.src([ + './node_modules/bootstrap/dist/css/bootstrap.css', + 'styles/main.scss', + 'styles/explorer.scss' + ]) + .pipe(gulpReplace("/*# sourceMappingURL=bootstrap.css.map */","")) + .pipe(gulpConcat('ui.css')) .pipe(gulpMap.init()) .pipe(gulpSass()) .pipe(gulpMap.write('./')) diff --git a/package.json b/package.json index 881fb90..c57b3ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "api-ui", - "version": "1.0.7", + "version": "1.0.8", "description": "Embedded UI for any service that implements the Rancher API spec", "contributors": [ "Go Daddy Operating Company, LLC. (http://godaddy.com)", @@ -29,6 +29,7 @@ "gulp-gzip": "^1.4.0", "gulp-jshint": "^1.9.0", "gulp-rename": "^1.2.0", + "gulp-replace": "^0.5.4", "gulp-sass": "^2.3.2", "gulp-sourcemaps": "^1.6.0", "gulp-tar": "^1.9.0", diff --git a/src/HTMLApi.js b/src/HTMLApi.js index cbd3ca6..58d4478 100644 --- a/src/HTMLApi.js +++ b/src/HTMLApi.js @@ -92,7 +92,10 @@ HTMLApi.prototype.showModal = function(body,opt,cb) for (var i = 0 ; i < actions.length ; i++ ) { if ( actions[i].primary ) + { self.modalAction(actions[i].id); + return false; + } } } else if ( e.keyCode == 27 ) @@ -101,7 +104,10 @@ HTMLApi.prototype.showModal = function(body,opt,cb) for (var i = 0 ; i < actions.length ; i++ ) { if ( actions[i].cancel ) + { self.modalAction(actions[i].id); + return false; + } } } @@ -149,6 +155,7 @@ HTMLApi.prototype.modalAction = function(id) { if ( action && action.onClick) { action.onClick(); + return false; } else if ( action && action.cancel ) { @@ -178,13 +185,16 @@ HTMLApi.prototype.setModalActions = function(actions) var html = ''; actions.forEach(function(action) { - color = 'btn-default'; - if ( action.primary ) + var color = 'btn-default'; + var btnType = 'button' + if ( action.primary ) { color = 'btn-primary'; - else if ( action.cancel ) + btnType = 'submit'; + } else if ( action.cancel ) { color = 'btn-link'; + } - html += ''; + html += ''; }); $('.modal-footer', this._reqModal).html(html); diff --git a/src/init.js b/src/init.js index 695f5b1..d036d78 100644 --- a/src/init.js +++ b/src/init.js @@ -36,16 +36,7 @@ var explorer; if ( window.autoInit === false ) return; - if ( window.bootstrap === false ) - { - boostrapReady(); - } - else - { - var url = baseUrl(); - $('head').append(''); - getScript(url+'/js/bootstrap.min.js', boostrapReady); - } + boostrapReady(); } function boostrapReady() diff --git a/styles/_explorer.scss b/styles/explorer.scss similarity index 100% rename from styles/_explorer.scss rename to styles/explorer.scss diff --git a/styles/_main.scss b/styles/main.scss similarity index 98% rename from styles/_main.scss rename to styles/main.scss index e840719..06760c6 100644 --- a/styles/_main.scss +++ b/styles/main.scss @@ -1,3 +1,8 @@ +.modal { + overflow: auto; + position: absolute; +} + SELECT { width: auto; } diff --git a/styles/ui.scss b/styles/ui.scss deleted file mode 100644 index ae07ba0..0000000 --- a/styles/ui.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "main.scss"; -@import "explorer.scss";