Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ihor Kaharlichenko
swagger-ui-oms
Commits
df20d2bd
Commit
df20d2bd
authored
Jul 17, 2013
by
Tony Tam
Browse files
fix for #263
parent
e72dbd6b
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
dist/swagger-ui.js
View file @
df20d2bd
...
...
@@ -624,7 +624,7 @@ function program2(depth0,data) {
stack1
=
foundHelper
||
depth0
.
name
;
if
(
typeof
stack1
===
functionType
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:
{}
});
}
else
if
(
stack1
===
undef
)
{
stack1
=
helperMissing
.
call
(
depth0
,
"
name
"
,
{
hash
:
{}
});
}
buffer
+=
escapeExpression
(
stack1
)
+
"
'/>
\n
"
;
buffer
+=
escapeExpression
(
stack1
)
+
"
'/>
\n
<div class=
\"
parameter-content-type
\"
/>
\n
"
;
return
buffer
;}
function
program4
(
depth0
,
data
)
{
...
...
@@ -1492,11 +1492,16 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
};
SwaggerUi
.
prototype
.
load
=
function
()
{
var
_ref
;
var
url
,
_ref
;
if
((
_ref
=
this
.
mainView
)
!=
null
)
{
_ref
.
clear
();
}
this
.
headerView
.
update
(
this
.
options
.
url
);
url
=
this
.
options
.
url
;
if
(
url
.
indexOf
(
"
http
"
)
!==
0
)
{
url
=
this
.
buildUrl
(
window
.
location
.
href
.
toString
(),
url
);
}
this
.
options
.
url
=
url
;
this
.
headerView
.
update
(
url
);
this
.
api
=
new
SwaggerApi
(
this
.
options
);
this
.
api
.
build
();
return
this
.
api
;
...
...
@@ -1525,6 +1530,18 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
},
400
);
};
SwaggerUi
.
prototype
.
buildUrl
=
function
(
base
,
url
)
{
var
parts
;
console
.
log
(
"
base is
"
+
base
);
parts
=
base
.
split
(
"
/
"
);
base
=
parts
[
0
]
+
"
//
"
+
parts
[
2
];
if
(
url
.
indexOf
(
"
/
"
)
===
0
)
{
return
base
+
url
;
}
else
{
return
base
+
"
/
"
+
url
;
}
};
SwaggerUi
.
prototype
.
showMessage
=
function
(
data
)
{
if
(
data
==
null
)
{
data
=
''
;
...
...
@@ -1712,7 +1729,7 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
OperationView
.
prototype
.
initialize
=
function
()
{};
OperationView
.
prototype
.
render
=
function
()
{
var
contentTypeModel
,
isMethodSubmissionSupported
,
param
,
responseContentTypeView
,
responseSignatureView
,
signatureModel
,
statusCode
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
;
var
contentTypeModel
,
isMethodSubmissionSupported
,
param
,
responseContentTypeView
,
responseSignatureView
,
signatureModel
,
statusCode
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
,
_ref1
,
_ref2
;
isMethodSubmissionSupported
=
true
;
if
(
!
isMethodSubmissionSupported
)
{
this
.
model
.
isReadOnly
=
true
;
...
...
@@ -1737,18 +1754,29 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
};
contentTypeModel
.
consumes
=
this
.
model
.
consumes
;
contentTypeModel
.
produces
=
this
.
model
.
produces
;
_ref
=
this
.
model
.
parameters
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
param
=
_ref
[
_i
];
console
.
log
(
"
looking at
"
+
param
.
dataType
);
if
(
param
.
dataType
.
toLowerCase
()
===
'
file
'
)
{
if
(
!
contentTypeModel
.
consumes
)
{
console
.
log
(
"
set content type
"
);
contentTypeModel
.
consumes
=
'
multipart/form-data
'
;
}
}
}
responseContentTypeView
=
new
ResponseContentTypeView
({
model
:
contentTypeModel
});
$
(
'
.response-content-type
'
,
$
(
this
.
el
)).
append
(
responseContentTypeView
.
render
().
el
);
_ref
=
this
.
model
.
parameters
;
for
(
_
i
=
0
,
_len
=
_ref
.
length
;
_
i
<
_len
;
_
i
++
)
{
param
=
_ref
[
_
i
];
_ref
1
=
this
.
model
.
parameters
;
for
(
_
j
=
0
,
_len
1
=
_ref
1
.
length
;
_
j
<
_len
1
;
_
j
++
)
{
param
=
_ref
1
[
_
j
];
this
.
addParameter
(
param
,
contentTypeModel
.
consumes
);
}
_ref
1
=
this
.
model
.
responseMessages
;
for
(
_
j
=
0
,
_len
1
=
_ref
1
.
length
;
_
j
<
_len
1
;
_
j
++
)
{
statusCode
=
_ref
1
[
_
j
];
_ref
2
=
this
.
model
.
responseMessages
;
for
(
_
k
=
0
,
_len
2
=
_ref
2
.
length
;
_
k
<
_len
2
;
_
k
++
)
{
statusCode
=
_ref
2
[
_
k
];
this
.
addStatusCode
(
statusCode
);
}
return
this
;
...
...
@@ -1799,7 +1827,7 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
opts
=
{
parent
:
this
};
_ref
=
form
.
find
(
"
.body-textarea,.parameter
"
);
_ref
=
form
.
find
(
"
input
"
);
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
o
=
_ref
[
_i
];
if
((
o
.
value
!=
null
)
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
{
...
...
@@ -1997,7 +2025,7 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
if
(
this
.
model
.
paramType
===
'
body
'
)
{
this
.
model
.
isBody
=
true
;
}
if
(
this
.
model
.
dataType
===
'
file
'
)
{
if
(
this
.
model
.
dataType
.
toLowerCase
()
===
'
file
'
)
{
this
.
model
.
isFile
=
true
;
}
template
=
this
.
template
();
...
...
dist/swagger-ui.min.js
View file @
df20d2bd
This diff is collapsed.
Click to expand it.
src/main/coffeescript/SwaggerUi.coffee
View file @
df20d2bd
...
...
@@ -41,7 +41,12 @@ class SwaggerUi extends Backbone.Router
load
:
->
# Initialize the API object
@
mainView
?
.
clear
()
@
headerView
.
update
(
@
options
.
url
)
url
=
@
options
.
url
if
url
.
indexOf
(
"http"
)
isnt
0
url
=
@
buildUrl
(
window
.
location
.
href
.
toString
(),
url
)
@
options
.
url
=
url
@
headerView
.
update
(
url
)
@
api
=
new
SwaggerApi
(
@
options
)
@
api
.
build
()
@
api
...
...
@@ -62,6 +67,16 @@ class SwaggerUi extends Backbone.Router
400
)
buildUrl
:
(
base
,
url
)
->
console
.
log
"base is "
+
base
parts
=
base
.
split
(
"/"
)
base
=
parts
[
0
]
+
"//"
+
parts
[
2
]
if
url
.
indexOf
(
"/"
)
is
0
base
+
url
else
base
+
"/"
+
url
# Shows message on topbar of the ui
showMessage
:
(
data
=
''
)
->
$
(
'#message-bar'
).
removeClass
'message-fail'
...
...
src/main/coffeescript/view/OperationView.coffee
View file @
df20d2bd
...
...
@@ -31,6 +31,13 @@ class OperationView extends Backbone.View
contentTypeModel
.
consumes
=
@
model
.
consumes
contentTypeModel
.
produces
=
@
model
.
produces
for
param
in
@
model
.
parameters
console
.
log
"looking at "
+
param
.
dataType
if
param
.
dataType
.
toLowerCase
()
==
'file'
if
!
contentTypeModel
.
consumes
console
.
log
"set content type "
contentTypeModel
.
consumes
=
'multipart/form-data'
responseContentTypeView
=
new
ResponseContentTypeView
({
model
:
contentTypeModel
})
$
(
'.response-content-type'
,
$
(
@
el
)).
append
responseContentTypeView
.
render
().
el
...
...
@@ -74,7 +81,7 @@ class OperationView extends Backbone.View
#if(o.value? && jQuery.trim(o.value).length > 0)
#map[o.name] = o.value
for
o
in
form
.
find
(
"
.body-textarea,.parameter
"
)
for
o
in
form
.
find
(
"
input
"
)
if
(
o
.
value
?
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
map
[
o
.
name
]
=
encodeURI
(
o
.
value
)
...
...
src/main/coffeescript/view/ParameterView.coffee
View file @
df20d2bd
...
...
@@ -3,7 +3,7 @@ class ParameterView extends Backbone.View
render
:
->
@
model
.
isBody
=
true
if
@
model
.
paramType
==
'body'
@
model
.
isFile
=
true
if
@
model
.
dataType
==
'file'
@
model
.
isFile
=
true
if
@
model
.
dataType
.
toLowerCase
()
==
'file'
template
=
@
template
()
$
(
@
el
).
html
(
template
(
@
model
))
...
...
src/main/template/param.handlebars
View file @
df20d2bd
...
...
@@ -4,6 +4,7 @@
{{#if
isBody
}}
{{#if
isFile
}}
<input
type=
"file"
name=
'
{{
name
}}
'
/>
<div
class=
"parameter-content-type"
/>
{{else}}
{{#if
defaultValue
}}
<textarea
class=
'body-textarea'
name=
'
{{
name
}}
'
>
{{
defaultValue
}}
</textarea>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment