File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,8 +250,9 @@ var fileTypes = {
250250 "php" : "php" ,
251251 "sh" : "bash" ,
252252 "rb" : "ruby" ,
253- "html" : "html"
254- }
253+ "html" : "html" ,
254+ "py" : "python"
255+ } ;
255256
256257//editor settings
257258var textit = document . getElementById ( "textit" ) ;
@@ -1248,6 +1249,9 @@ ui.toolbar.import.snippet.click(function () {
12481249 return ( a . path_with_namespace < b . path_with_namespace ) ? - 1 : ( ( a . path_with_namespace > b . path_with_namespace ) ? 1 : 0 ) ;
12491250 } ) ;
12501251 data . projects . forEach ( function ( project ) {
1252+ if ( ! project . snippets_enabled ) {
1253+ return ;
1254+ }
12511255 $ ( '<option>' ) . val ( project . id ) . text ( project . path_with_namespace ) . appendTo ( "#snippetImportModalProjects" ) ;
12521256 } ) ;
12531257 $ ( "#snippetImportModalProjects" ) . prop ( 'disabled' , false ) ;
@@ -1484,13 +1488,18 @@ $("#snippetImportModalConfirm").click(function () {
14841488 . success ( function ( data ) {
14851489 var content = '# ' + ( data . title || "Snippet Import" ) ;
14861490 var fileInfo = data . file_name . split ( '.' ) ;
1491+ fileInfo [ 1 ] = ( fileInfo [ 1 ] ) ? fileInfo [ 1 ] : "md" ;
14871492 $ . get ( fullURL + '/raw' + accessToken )
14881493 . success ( function ( raw ) {
14891494 if ( raw ) {
1490- content += "\n\n```" ;
1491- content += fileTypes [ fileInfo [ 1 ] ] + "=\n" ;
1495+ content += "\n\n" ;
1496+ if ( fileInfo [ 1 ] != "md" ) {
1497+ content += "```" + fileTypes [ fileInfo [ 1 ] ] + "\n" ;
1498+ }
14921499 content += raw ;
1493- content += "\n```" ;
1500+ if ( fileInfo [ 1 ] != "md" ) {
1501+ content += "\n```" ;
1502+ }
14941503 replaceAll ( content ) ;
14951504 }
14961505 } )
You can’t perform that action at this time.
0 commit comments