Created
March 4, 2014 11:23
-
-
Save anonymous/9344689 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.saveCurrentHtmlTemplate = () -> | |
$scope.isEdited = true | |
$('#highlighter').empty() | |
$scope.currentHtmlTemplate.body = $scope.currentHtmlTemplate.edited_body | |
$scope.currentlySavedHtml = $scope.currentEditedHtmlFiles.filter (element) -> | |
element.file_name == $scope.currentHtmlTemplate.file_name | |
currentlySavedHtml = $scope.currentlySavedHtml[0] | |
console.log currentlySavedHtml | |
console.log "LINE 101" | |
if not currentlySavedHtml | |
#Check the current template is not in the $scope.currentEditedHtmlFiles array yet | |
$scope.currentEditedHtmlFiles.push $scope.currentHtmlTemplate | |
currentlySavedHtml = $scope.currentHtmlTemplate | |
console.log 'testinggggg' | |
else | |
console.log 'I am here' | |
$scope.currentEditedHtmlFiles[currentlySavedHtml.length] = $scope.currentHtmlTemplate | |
#So if we do have an existign file in the array then we want to modify it AND NOT push it | |
#to the array. The problem simply was that when you save a widget and then try to update some of the files | |
#It would the files to the array. | |
currentlySavedHtml.body = $scope.currentHtmlTemplate.body | |
console.log currentlySavedHtml.body | |
console.log "LINE 108" | |
for x in $scope.currentEditedHtmlFiles | |
$scope.saveTemplate(x) | |
getControllerScope "BBCtrl", (scope) -> | |
scope.current_page | |
scope.showPage scope.current_page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment