Browse Source

commit code refactoring

Laurent Laffont 13 years ago
parent
commit
ef7f17403a
3 changed files with 18 additions and 22 deletions
  1. 0 0
      js/IDE.deploy.js
  2. 0 0
      js/IDE.js
  3. 18 22
      st/IDE.st

File diff suppressed because it is too large
+ 0 - 0
js/IDE.deploy.js


File diff suppressed because it is too large
+ 0 - 0
js/IDE.js


+ 18 - 22
st/IDE.st

@@ -702,28 +702,15 @@ handleSourceAreaKeyDown: anEvent
 
 commitPackage
 	selectedPackage ifNotNil: [ |package|
-                package := Package named: selectedPackage.
-		jQuery 
-			ajax: package commitPathJs, '/', selectedPackage, '.js'
-			options: #{
-				'type' -> 'PUT'.
-				'data' -> (Exporter new exportPackage: selectedPackage).
-				'error' -> [window alert: 'Commit failed!!']
-			}.
-		jQuery 
-			ajax: package commitPathJs, '/', selectedPackage, '.deploy.js'
-			options: #{
-				'type' -> 'PUT'.
-				'data' -> (StrippedExporter new exportPackage: selectedPackage).
-				'error' -> [window alert: 'Commit failed!!']
-			}.
-		jQuery 
-			ajax: package commitPathSt, '/', selectedPackage, '.st'
-			options: #{
-				'type' -> 'PUT'.
-				'data' -> (ChunkExporter new exportPackage: selectedPackage).
-				'error' -> [window alert: 'Commit failed!!']
-			}]
+               						 package := Package named: selectedPackage.
+               						 {	Exporter 			-> (package commitPathJs, '/', selectedPackage, '.js').
+                        					StrippedExporter 	-> (package commitPathJs, '/', selectedPackage, '.deploy.js').
+                       						 ChunkExporter 		-> (package commitPathSt, '/', selectedPackage, '.st') 			} 
+                 
+                						do: [:commitStrategy| |fileContents|
+                                                                     	fileContents := (commitStrategy key new exportPackage: selectedPackage).
+                                                                     	self ajaxPutAt: commitStrategy value data:  fileContents]
+         						]
 !
 
 renamePackage
@@ -772,6 +759,15 @@ initialize
     unsavedChanges := false
 ! !
 
+!Browser methodsFor: 'network'!
+
+ajaxPutAt: anURL data: aString
+	jQuery 
+		ajax: anURL	options: #{	'type' -> 'PUT'.
+								'data' -> aString.
+								'error' -> [window alert: 'PUT request failed at:  ', anURL] }
+! !
+
 !Browser methodsFor: 'rendering'!
 
 renderBoxOn: html

Some files were not shown because too many files changed in this diff