From 767179e21ae80db8969d5bd2d6648a8155ee9c58 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 11 May 2015 14:28:49 +0200 Subject: [PATCH] Removing unnecesary source file for projects --- app/coffee/modules/projects/main.coffee | 138 ------------------------ 1 file changed, 138 deletions(-) delete mode 100644 app/coffee/modules/projects/main.coffee diff --git a/app/coffee/modules/projects/main.coffee b/app/coffee/modules/projects/main.coffee deleted file mode 100644 index 69532457..00000000 --- a/app/coffee/modules/projects/main.coffee +++ /dev/null @@ -1,138 +0,0 @@ -### -# Copyright (C) 2014 Andrey Antukh -# Copyright (C) 2014 Jesús Espino Garcia -# Copyright (C) 2014 David Barragán Merino -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# File: modules/common/attachments.coffee -### - -taiga = @.taiga -module = angular.module("taigaProject") -bindOnce = @.taiga.bindOnce - -class ProjectsController extends taiga.Controller - @.$inject = [ - "$scope", - "$q", - "$tgResources", - "$rootScope", - "$tgNavUrls", - "$tgAuth", - "$tgLocation", - "$appTitle", - "$projectUrl", - "$tgConfig", - "tgLoader" - ] - - constructor: (@scope, @q, @rs, @rootscope, @navUrls, @auth, @location, @appTitle, @projectUrl, @config - tgLoader) -> - @appTitle.set("Projects") - - if !@auth.isAuthenticated() - @location.path(@navUrls.resolve("login")) - - @.user = @auth.getUser() - - @.projects = [] - promise = @.loadInitialData() - - promise.then () => - @scope.$emit("projects:loaded", @.projects) - - promise.then null, @.onInitialDataError.bind(@) - - # Finally - promise.finally tgLoader.pageLoaded - - loadInitialData: -> - return @rs.projects.listByMember(@rootscope.user?.id).then (projects) => - @.projects = {'recents': projects.slice(0, 8), 'all': projects} - for project in projects - project.url = @projectUrl.get(project) - - return projects - - logout: -> - @auth.logout() - @location.path(@navUrls.resolve("login")) - - isFeedbackEnabled: -> - return @config.get("feedbackEnabled") - - sendFeedback: -> - @rootscope.$broadcast("feedback:show") - -module.controller("ProjectsController", ProjectsController) - - -class ProjectController extends taiga.Controller - @.$inject = [ - "$scope", - "$tgResources", - "$tgRepo", - "$routeParams", - "$q", - "$rootScope", - "$appTitle", - "$tgLocation", - "$tgNavUrls" - ] - - constructor: (@scope, @rs, @repo, @params, @q, @rootscope, @appTitle, @location, @navUrls) -> - promise = @.loadInitialData() - - promise.then () => - @appTitle.set(@scope.project.name) - @scope.$emit("regenerate:project-pagination") - - promise.then null, @.onInitialDataError.bind(@) - - loadInitialData: -> - promise = @.loadProject() - promise.then(=> @.loadProjectStats()) - return promise - - loadProject: -> - return @rs.projects.getBySlug(@params.pslug).then (project) => - @scope.projectId = project.id - @scope.project = project - @scope.$emit("project:loaded", @scope.project) - return project - - loadProjectStats: -> - return @rs.projects.stats(@scope.projectId).then (stats) => - @scope.stats = stats - return stats - -module.controller("ProjectController", ProjectController) - -ProjectsListDirective = ($compile, $template) -> - template = $template.get('project/project-list.html', true) - - link = ($scope, $el, $attrs, $ctrls) -> - render = (projects) -> - $el.html($compile(template({projects: projects}))($scope)) - $scope.$emit("regenerate:project-pagination") - - $scope.$on "projects:loaded", (ctx, projects) -> - render(projects.all) if projects.all? - - return { - link: link - } - -module.directive("tgProjectsList", ["$compile", "$tgTemplate", ProjectsListDirective])