Skip to content

Commit 694dc6f

Browse files
committed
Fix enter on edit, scroll on response
1 parent 29196c0 commit 694dc6f

File tree

8 files changed

+32
-19
lines changed

8 files changed

+32
-19
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 2013-2014 Go Daddy Operating Company, LLC
2-
Copyright (c) 2014-2015 Rancher Labs, Inc.
2+
Copyright (c) 2014-2016 Rancher Labs, Inc.
33

44
Permission is hereby granted, free of charge, to any person obtaining a
55
copy of this software and associated documentation files (the "Software"),

gulpfile.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var gulpGzip = require('gulp-gzip');
66
var gulpHint = require('gulp-jshint');
77
var gulpMap = require('gulp-sourcemaps');
88
var gulpRename = require('gulp-rename');
9+
var gulpReplace = require('gulp-replace');
910
var gulpSass = require('gulp-sass');
1011
var gulpTar = require('gulp-tar');
1112
var gulpUglify = require('gulp-uglify');
@@ -52,6 +53,7 @@ gulp.task('js', ['templates','partials'], function() {
5253
return gulp.src([
5354
'node_modules/jquery/dist/jquery.js',
5455
'vendor/jquery.scrollintoview.js',
56+
'node_modules/bootstrap/dist/js/bootstrap.js',
5557
'vendor/async.js',
5658
'vendor/json2.js',
5759
'vendor/polyfill.js',
@@ -99,7 +101,13 @@ gulp.task('partials', function() {
99101
});
100102

101103
gulp.task('css', function() {
102-
return gulp.src('styles/ui.scss')
104+
return gulp.src([
105+
'./node_modules/bootstrap/dist/css/bootstrap.css',
106+
'styles/main.scss',
107+
'styles/explorer.scss'
108+
])
109+
.pipe(gulpReplace("/*# sourceMappingURL=bootstrap.css.map */",""))
110+
.pipe(gulpConcat('ui.css'))
103111
.pipe(gulpMap.init())
104112
.pipe(gulpSass())
105113
.pipe(gulpMap.write('./'))

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "api-ui",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Embedded UI for any service that implements the Rancher API spec",
55
"contributors": [
66
"Go Daddy Operating Company, LLC. (http://godaddy.com)",
@@ -29,6 +29,7 @@
2929
"gulp-gzip": "^1.4.0",
3030
"gulp-jshint": "^1.9.0",
3131
"gulp-rename": "^1.2.0",
32+
"gulp-replace": "^0.5.4",
3233
"gulp-sass": "^2.3.2",
3334
"gulp-sourcemaps": "^1.6.0",
3435
"gulp-tar": "^1.9.0",

src/HTMLApi.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ HTMLApi.prototype.showModal = function(body,opt,cb)
9292
for (var i = 0 ; i < actions.length ; i++ )
9393
{
9494
if ( actions[i].primary )
95+
{
9596
self.modalAction(actions[i].id);
97+
return false;
98+
}
9699
}
97100
}
98101
else if ( e.keyCode == 27 )
@@ -101,7 +104,10 @@ HTMLApi.prototype.showModal = function(body,opt,cb)
101104
for (var i = 0 ; i < actions.length ; i++ )
102105
{
103106
if ( actions[i].cancel )
107+
{
104108
self.modalAction(actions[i].id);
109+
return false;
110+
}
105111
}
106112
}
107113

@@ -149,6 +155,7 @@ HTMLApi.prototype.modalAction = function(id) {
149155
if ( action && action.onClick)
150156
{
151157
action.onClick();
158+
return false;
152159
}
153160
else if ( action && action.cancel )
154161
{
@@ -178,13 +185,16 @@ HTMLApi.prototype.setModalActions = function(actions)
178185
var html = '';
179186

180187
actions.forEach(function(action) {
181-
color = 'btn-default';
182-
if ( action.primary )
188+
var color = 'btn-default';
189+
var btnType = 'button'
190+
if ( action.primary ) {
183191
color = 'btn-primary';
184-
else if ( action.cancel )
192+
btnType = 'submit';
193+
} else if ( action.cancel ) {
185194
color = 'btn-link';
195+
}
186196

187-
html += '<button type="button" class="btn '+color+'" onclick="htmlapi.modalAction(\''+ action.id +'\');">'+ action.text + '</button>';
197+
html += '<button type="'+btnType+'" class="btn '+color+'" onclick="htmlapi.modalAction(\''+ action.id +'\');">'+ action.text + '</button>';
188198
});
189199

190200
$('.modal-footer', this._reqModal).html(html);

src/init.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,7 @@ var explorer;
3636
if ( window.autoInit === false )
3737
return;
3838

39-
if ( window.bootstrap === false )
40-
{
41-
boostrapReady();
42-
}
43-
else
44-
{
45-
var url = baseUrl();
46-
$('head').append('<link rel="stylesheet" href="'+url+'/css/bootstrap.min.css" type="text/css" />');
47-
getScript(url+'/js/bootstrap.min.js', boostrapReady);
48-
}
39+
boostrapReady();
4940
}
5041

5142
function boostrapReady()
File renamed without changes.

styles/_main.scss renamed to styles/main.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
.modal {
2+
overflow: auto;
3+
position: absolute;
4+
}
5+
16
SELECT {
27
width: auto;
38
}

styles/ui.scss

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)