@@ -57,24 +57,48 @@ define(function (require) {
5757 . addClass ( "btn-loading" )
5858 . prop ( "disabled" , true ) ;
5959
60- return Utils . askQuestion ( Strings . CREATE_GITFTP_NEW_REMOTE ,
61- Strings . ENTER_GITFTP_REMOTE_NAME ) . then ( function ( name ) {
62- return Utils . askQuestion ( Strings . CREATE_GITFTP_NEW_REMOTE ,
63- Strings . ENTER_GITFTP_REMOTE_URL ,
64- { defaultValue : "ftp://user:passwd@example.org/folder" } ) . then ( function ( url ) {
65-
66- return GitFtp . addScope ( name , url ) . then ( function ( ) {
67- // return handleGitFtpRemoteInit();
68- } ) . fail ( function ( err ) {
69- ErrorHandler . showError ( err , "Git-FTP remote creation failed" ) ;
70- } ) ;
71-
60+ return Utils . askQuestion ( Strings . CREATE_GITFTP_NEW_REMOTE , Strings . ENTER_GITFTP_REMOTE_NAME )
61+ . then ( function ( name ) {
62+ return Utils . askQuestion (
63+ Strings . CREATE_GITFTP_NEW_REMOTE ,
64+ Strings . ENTER_GITFTP_REMOTE_URL ,
65+ { defaultValue : "ftp://user:passwd@example.org/folder" }
66+ )
67+ . then ( function ( url ) {
68+ return GitFtp . addScope ( name , url ) . then ( function ( ) {
69+
70+ // Render the list element of the new remote
71+ // TODO: replace this part with a way to call `Remotes.refreshRemotesPicker()`
72+ var $newRemote = $ ( "<li/>" )
73+ . addClass ( "gitftp-remote" )
74+ . append ( "<a/>" )
75+ . find ( "a" )
76+ . attr ( { href : "#" , "data-remote-name" : name , "data-type" : "ftp" } )
77+ . addClass ( "remote-name" )
78+ . append ( "<span/>" )
79+ . find ( "span" )
80+ . addClass ( "trash-icon gitftp-remove-remote" )
81+ . html ( "×" )
82+ . end ( )
83+ . append ( "<span/>" )
84+ . find ( "span:nth-child(2)" )
85+ . addClass ( "change-remote" )
86+ . text ( name )
87+ . end ( )
88+ . end ( ) ;
89+
90+ $gitPanel . find ( ".git-remotes-dropdown .ftp-remotes-header" ) . after ( $newRemote ) ;
91+
92+ } ) . fail ( function ( err ) {
93+ ErrorHandler . showError ( err , "Git-FTP remote creation failed" ) ;
94+ } ) ;
95+ } ) ;
96+ } )
97+ . finally ( function ( ) {
98+ $gitPanel . find ( ".git-remotes" )
99+ . removeClass ( "btn-loading" )
100+ . prop ( "disabled" , false ) ;
72101 } ) ;
73- } ) . finally ( function ( ) {
74- $gitPanel . find ( ".git-remotes" )
75- . removeClass ( "btn-loading" )
76- . prop ( "disabled" , false ) ;
77- } ) ;
78102 }
79103
80104 function handleGitFtpRemoteRemove ( $this ) {
0 commit comments