From e326db05b30c982d0cc773f28ed246e6b128e6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 2 Nov 2016 13:15:41 +0100 Subject: [PATCH] Remove wp-upload-buttton --- .../wp-upload-button-create.directive.html | 8 -- .../wp-upload-button-toolbar.directive.html | 7 -- .../wp-upload-button.directive.test.ts | 93 ------------------- .../wp-upload-button.directive.ts | 52 ----------- 4 files changed, 160 deletions(-) delete mode 100644 frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button-create.directive.html delete mode 100644 frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button-toolbar.directive.html delete mode 100644 frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button.directive.test.ts delete mode 100644 frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button.directive.ts diff --git a/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button-create.directive.html b/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button-create.directive.html deleted file mode 100644 index 749eba521d..0000000000 --- a/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button-create.directive.html +++ /dev/null @@ -1,8 +0,0 @@ -
- - - - -
- - diff --git a/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button-toolbar.directive.html b/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button-toolbar.directive.html deleted file mode 100644 index 3edf50f8b9..0000000000 --- a/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button-toolbar.directive.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button.directive.test.ts b/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button.directive.test.ts deleted file mode 100644 index fb95c307aa..0000000000 --- a/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button.directive.test.ts +++ /dev/null @@ -1,93 +0,0 @@ -//-- copyright -// OpenProject is a project management system. -// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// See doc/COPYRIGHT.rdoc for more details. -//++ - -import {opApiModule} from '../../../angular-modules'; -import IAugmentedJQuery = angular.IAugmentedJQuery; -import IProvideService = angular.auto.IProvideService; -import I18n = op.I18n; - -describe('wpUploadButton directive', () => { - var workPackage; - - var I18n; - var compile; - var scope; - - var element: IAugmentedJQuery; - var button: any; - - var uploadsDirectiveScope; - - beforeEach(angular.mock.module('openproject.templates')); - - beforeEach(angular.mock.module(opApiModule.name, ($provide: IProvideService) => { - $provide.decorator('wpAttachmentsUploadDirective', () => { - return { - scope: { - workPackage: '=' - } - }; - }); - })); - - beforeEach(angular.mock.inject(function ($rootScope, $compile, _I18n_) { - I18n = _I18n_; - const html = ''; - workPackage = {}; - scope = $rootScope.$new(); - scope.workPackage = workPackage; - - sinon.stub(I18n, 't').returns('add attachments'); - - compile = () => { - element = $compile(html)(scope); - scope.$digest(); - - button = element.find('.button'); - uploadsDirectiveScope = button.scope(); - }; - - compile(); - })); - - afterEach(function() { - I18n.t.restore(); - }); - - it('should have the add attachment tooltip', () => { - expect(button.attr('title')).to.equal('add attachments'); - }); - - it('should pass the work package to the upload directive', () => { - expect(uploadsDirectiveScope.workPackage).to.equal(workPackage); - }); - - it('should have the attachment icon as icon', () => { - expect(button.find('.icon-attachment')).to.have.length(1); - }); -}); diff --git a/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button.directive.ts b/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button.directive.ts deleted file mode 100644 index 96f4193139..0000000000 --- a/frontend/app/components/wp-attachments/wp-upload-button/wp-upload-button.directive.ts +++ /dev/null @@ -1,52 +0,0 @@ -//-- copyright -// OpenProject is a project management system. -// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// See doc/COPYRIGHT.rdoc for more details. -//++ - -import {opApiModule} from '../../../angular-modules'; -import IDirective = angular.IDirective; - -function wpUploadButtonDirective(I18n): IDirective { - return { - restrict: 'E', - templateUrl: (element, attrs) => { - return '/components/wp-attachments/wp-upload-button/' + attrs.template + '.directive.html'; - }, - - scope: { - workPackage: '=', - template: '@' - }, - - link(scope: any) { - scope.text = { - addAttachments: I18n.t('js.label_add_attachments') - }; - } - }; -} - -opApiModule.directive('wpUploadButton', wpUploadButtonDirective);