Просмотр исходного кода

Move template front end code to module

James Allen 11 лет назад
Родитель
Сommit
b44e9b1dcb

+ 1 - 4
services/web/app/views/project/editor/left-menu.jade

@@ -41,10 +41,7 @@ aside#left-menu.full-size(
 				)
 				)
 					i.fa.fa-fw.fa-copy
 					i.fa.fa-fw.fa-copy
 					|    #{translate("copy_project")}
 					|    #{translate("copy_project")}
-			li(ng-controller="TemplatesController", ng-show="permissions.admin")
-				a(ng-click="openPublishTemplateModal()")
-					i.fa.fa-external-link.fa-fw 
-					|    #{translate("publish_as_template")}
+			!{moduleIncludes("editorLeftMenu:actions", locals)}
 
 
 	if (moduleIncludesAvailable("editorLeftMenu:sync"))
 	if (moduleIncludesAvailable("editorLeftMenu:sync"))
 		div(ng-show="!anonymous")
 		div(ng-show="!anonymous")

+ 0 - 1
services/web/public/coffee/ide.coffee

@@ -12,7 +12,6 @@ define [
 	"ide/share/index"
 	"ide/share/index"
 	"ide/chat/index"
 	"ide/chat/index"
 	"ide/clone/index"
 	"ide/clone/index"
-	"ide/templates/index"
 	"ide/dropbox/index"
 	"ide/dropbox/index"
 	"ide/hotkeys/index"
 	"ide/hotkeys/index"
 	"ide/directives/layout"
 	"ide/directives/layout"

+ 0 - 84
services/web/public/coffee/ide/templates/controllers/TemplatesController.coffee

@@ -1,84 +0,0 @@
-define [
-	"base"
-	"ide/permissions/PermissionsManager"
-], (App, PermissionsManager) ->
-
-	App.controller "TemplatesController", ($scope, $modal, ide) ->
-		$scope.openPublishTemplateModal = () ->
-			resetState = ->
-				$scope.problemTalkingToTemplateApi = false
-
-			resetState()
-
-			modal = $modal.open {
-				templateUrl: "publishProjectAsTemplateModalTemplate"
-				controller: "PublishProjectAsTemplateModalController"
-				scope:$scope
-			}
-			modal.result.then(resetState, resetState)
-
-	App.controller "PublishProjectAsTemplateModalController", ($scope, $modalInstance, ide, $http) ->
-		user_id = ide.$scope.user.id
-		$scope.templateDetails = {exists:false}
-
-		$scope.state =
-			publishInflight: false
-			unpublishInflight: false
-
-		problemTalkingToTemplateApi = ->
-			$scope.problemTalkingToTemplateApi = true
-
-		refreshPublishedStatus = ->
-			$http.get("/project/#{ide.project_id}/template")
-				.success (data) ->
-					$scope.templateDetails = data
-					$scope.templateDetails.publishedDate = moment(data.publishedDate).format("Do MMM YYYY, h:mm a")
-					$scope.templateDetails.description = data.description
-				.error () ->
-					problemTalkingToTemplateApi()
-
-		refreshPublishedStatus()
-		$scope.$watch $scope.problemTalkingToTemplateApi, (value) ->
-			if value?
-				refreshPublishedStatus()
-
-		updateProjectDescription = ->
-			$http.post("/project/#{ide.project_id}/template/description", {
-				description: $scope.templateDetails.description
-				_csrf: window.csrfToken
-			})
-			
-		# Save the description on modal close
-		$modalInstance.result.finally () -> updateProjectDescription()
-
-		$scope.publishTemplate = ->
-			$scope.state.publishInflight = true
-			updateProjectDescription()
-				.error () ->
-					problemTalkingToTemplateApi()
-				.success () ->
-					$http
-						.post("/project/#{ide.project_id}/template/publish", {
-							_csrf: window.csrfToken
-						})
-						.error () ->
-							problemTalkingToTemplateApi()
-						.success () ->
-							refreshPublishedStatus()
-							$scope.state.publishInflight = false
-					
-
-		$scope.unpublishTemplate = ->
-			$scope.state.unpublishInflight = true
-			$http
-				.post("/project/#{ide.project_id}/template/unpublish", {
-					_csrf: window.csrfToken
-				})
-				.success () ->
-					refreshPublishedStatus()
-					$scope.state.unpublishInflight = false
-				.error () ->
-					problemTalkingToTemplateApi()
-
-		$scope.cancel = () ->
-			$modalInstance.dismiss()

+ 0 - 4
services/web/public/coffee/ide/templates/index.coffee

@@ -1,4 +0,0 @@
-define [
-	"ide/templates/controllers/TemplatesController"
-], () ->
-