mirror of https://github.com/rancher/api-ui.git
Fix enter on edit, scroll on response
This commit is contained in:
parent
29196c0476
commit
694dc6fe43
|
|
@ -1,5 +1,5 @@
|
||||||
Copyright (c) 2013-2014 Go Daddy Operating Company, LLC
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
||||||
10
gulpfile.js
10
gulpfile.js
|
|
@ -6,6 +6,7 @@ var gulpGzip = require('gulp-gzip');
|
||||||
var gulpHint = require('gulp-jshint');
|
var gulpHint = require('gulp-jshint');
|
||||||
var gulpMap = require('gulp-sourcemaps');
|
var gulpMap = require('gulp-sourcemaps');
|
||||||
var gulpRename = require('gulp-rename');
|
var gulpRename = require('gulp-rename');
|
||||||
|
var gulpReplace = require('gulp-replace');
|
||||||
var gulpSass = require('gulp-sass');
|
var gulpSass = require('gulp-sass');
|
||||||
var gulpTar = require('gulp-tar');
|
var gulpTar = require('gulp-tar');
|
||||||
var gulpUglify = require('gulp-uglify');
|
var gulpUglify = require('gulp-uglify');
|
||||||
|
|
@ -52,6 +53,7 @@ gulp.task('js', ['templates','partials'], function() {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'node_modules/jquery/dist/jquery.js',
|
'node_modules/jquery/dist/jquery.js',
|
||||||
'vendor/jquery.scrollintoview.js',
|
'vendor/jquery.scrollintoview.js',
|
||||||
|
'node_modules/bootstrap/dist/js/bootstrap.js',
|
||||||
'vendor/async.js',
|
'vendor/async.js',
|
||||||
'vendor/json2.js',
|
'vendor/json2.js',
|
||||||
'vendor/polyfill.js',
|
'vendor/polyfill.js',
|
||||||
|
|
@ -99,7 +101,13 @@ gulp.task('partials', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('css', 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(gulpMap.init())
|
||||||
.pipe(gulpSass())
|
.pipe(gulpSass())
|
||||||
.pipe(gulpMap.write('./'))
|
.pipe(gulpMap.write('./'))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "api-ui",
|
"name": "api-ui",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"description": "Embedded UI for any service that implements the Rancher API spec",
|
"description": "Embedded UI for any service that implements the Rancher API spec",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Go Daddy Operating Company, LLC. (http://godaddy.com)",
|
"Go Daddy Operating Company, LLC. (http://godaddy.com)",
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
"gulp-gzip": "^1.4.0",
|
"gulp-gzip": "^1.4.0",
|
||||||
"gulp-jshint": "^1.9.0",
|
"gulp-jshint": "^1.9.0",
|
||||||
"gulp-rename": "^1.2.0",
|
"gulp-rename": "^1.2.0",
|
||||||
|
"gulp-replace": "^0.5.4",
|
||||||
"gulp-sass": "^2.3.2",
|
"gulp-sass": "^2.3.2",
|
||||||
"gulp-sourcemaps": "^1.6.0",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"gulp-tar": "^1.9.0",
|
"gulp-tar": "^1.9.0",
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,10 @@ HTMLApi.prototype.showModal = function(body,opt,cb)
|
||||||
for (var i = 0 ; i < actions.length ; i++ )
|
for (var i = 0 ; i < actions.length ; i++ )
|
||||||
{
|
{
|
||||||
if ( actions[i].primary )
|
if ( actions[i].primary )
|
||||||
|
{
|
||||||
self.modalAction(actions[i].id);
|
self.modalAction(actions[i].id);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( e.keyCode == 27 )
|
else if ( e.keyCode == 27 )
|
||||||
|
|
@ -101,7 +104,10 @@ HTMLApi.prototype.showModal = function(body,opt,cb)
|
||||||
for (var i = 0 ; i < actions.length ; i++ )
|
for (var i = 0 ; i < actions.length ; i++ )
|
||||||
{
|
{
|
||||||
if ( actions[i].cancel )
|
if ( actions[i].cancel )
|
||||||
|
{
|
||||||
self.modalAction(actions[i].id);
|
self.modalAction(actions[i].id);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,6 +155,7 @@ HTMLApi.prototype.modalAction = function(id) {
|
||||||
if ( action && action.onClick)
|
if ( action && action.onClick)
|
||||||
{
|
{
|
||||||
action.onClick();
|
action.onClick();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else if ( action && action.cancel )
|
else if ( action && action.cancel )
|
||||||
{
|
{
|
||||||
|
|
@ -178,13 +185,16 @@ HTMLApi.prototype.setModalActions = function(actions)
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
actions.forEach(function(action) {
|
actions.forEach(function(action) {
|
||||||
color = 'btn-default';
|
var color = 'btn-default';
|
||||||
if ( action.primary )
|
var btnType = 'button'
|
||||||
|
if ( action.primary ) {
|
||||||
color = 'btn-primary';
|
color = 'btn-primary';
|
||||||
else if ( action.cancel )
|
btnType = 'submit';
|
||||||
|
} else if ( action.cancel ) {
|
||||||
color = 'btn-link';
|
color = 'btn-link';
|
||||||
|
}
|
||||||
|
|
||||||
html += '<button type="button" class="btn '+color+'" onclick="htmlapi.modalAction(\''+ action.id +'\');">'+ action.text + '</button>';
|
html += '<button type="'+btnType+'" class="btn '+color+'" onclick="htmlapi.modalAction(\''+ action.id +'\');">'+ action.text + '</button>';
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.modal-footer', this._reqModal).html(html);
|
$('.modal-footer', this._reqModal).html(html);
|
||||||
|
|
|
||||||
11
src/init.js
11
src/init.js
|
|
@ -36,16 +36,7 @@ var explorer;
|
||||||
if ( window.autoInit === false )
|
if ( window.autoInit === false )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( window.bootstrap === false )
|
boostrapReady();
|
||||||
{
|
|
||||||
boostrapReady();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var url = baseUrl();
|
|
||||||
$('head').append('<link rel="stylesheet" href="'+url+'/css/bootstrap.min.css" type="text/css" />');
|
|
||||||
getScript(url+'/js/bootstrap.min.js', boostrapReady);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function boostrapReady()
|
function boostrapReady()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
.modal {
|
||||||
|
overflow: auto;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
SELECT {
|
SELECT {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
@import "main.scss";
|
|
||||||
@import "explorer.scss";
|
|
||||||
Loading…
Reference in New Issue