File tree Expand file tree Collapse file tree 3 files changed +9
-23
lines changed
rest_framework_docs/static/rest_framework_docs Expand file tree Collapse file tree 3 files changed +9
-23
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ $( document ).ready(function() {
3131
3232 var cleanResponse = function ( ) {
3333 $ ( '#responseStatusCode' ) . removeClass ( function ( index , css ) {
34- return ( css . match ( / ( ^ | \s ) l a b e l - \S + / g) || [ ] ) . join ( ' ' ) ;
34+ return ( css . match ( / ( ^ | \s ) s t a t u s - c o d e - \S + / g) || [ ] ) . join ( ' ' ) ;
3535 } ) ;
3636 $ ( '#responseStatusText' ) . hide ( ) ;
3737 $ ( '#responseStatusText' ) . find ( 'span' ) . text ( '' ) ;
@@ -41,30 +41,10 @@ $( document ).ready(function() {
4141 } ;
4242
4343 var setResponse = function ( response ) {
44- // Status Code
4544 var statusCodeFirstChar = String ( response . status ) . charAt ( 0 ) ;
46- var statusCodeClass ;
47-
48- switch ( parseInt ( statusCodeFirstChar ) ) {
49- case 1 :
50- statusCodeClass = 'label-info' ;
51- break ;
52- case 2 :
53- statusCodeClass = 'label-success' ;
54- break ;
55- case 3 :
56- statusCodeClass = 'label-warning' ;
57- break ;
58- case 4 :
59- statusCodeClass = 'label-danger' ;
60- break ;
61- case 5 :
62- statusCodeClass = 'label-primary' ;
63- break ;
64- }
6545
6646 $ ( '#responseStatusCode' ) . text ( response . status ) ;
67- $ ( '#responseStatusCode' ) . addClass ( statusCodeClass ) ;
47+ $ ( '#responseStatusCode' ) . addClass ( 'status-code-' + statusCodeFirstChar ) ;
6848
6949 $ ( '#responseStatusText' ) . show ( ) ;
7050 $ ( '#responseStatusText' ) . find ( 'span' ) . text ( response . statusText . toLowerCase ( ) ) ;
Original file line number Diff line number Diff line change @@ -218,6 +218,12 @@ body {
218218 .response {
219219 .status-code {
220220 font-weight : 300 ;
221+
222+ & .status-code-1 { background-color : @brand-info ; }
223+ & .status-code-2 { background-color : @brand-success ; }
224+ & .status-code-3 { background-color : @brand-warning ; }
225+ & .status-code-4 { background-color : @brand-danger ; }
226+ & .status-code-5 { background-color : @brand-primary ; }
221227 }
222228
223229 .status-text {
You can’t perform that action at this time.
0 commit comments