parent
46fdced488
commit
c82338cbbe
@ -0,0 +1,41 @@ |
||||
Changelog |
||||
========= |
||||
|
||||
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-block-quote/compare/v0.2.0...v1.0.0-alpha.1) (2017-10-03) |
||||
|
||||
### Other changes |
||||
|
||||
* Improved default blockquote styling so it does not overlap with floated images. Closes [#12](https://github.com/ckeditor/ckeditor5-block-quote/issues/12). ([fb09418](https://github.com/ckeditor/ckeditor5-block-quote/commit/fb09418)) |
||||
|
||||
|
||||
## [0.2.0](https://github.com/ckeditor/ckeditor5-block-quote/compare/v0.1.1...v0.2.0) (2017-09-03) |
||||
|
||||
### Features |
||||
|
||||
* <kbd>Enter</kbd> in the block quote will scroll the viewport to the selection. See ckeditor/ckeditor5-engine#660. ([09dc740](https://github.com/ckeditor/ckeditor5-block-quote/commit/09dc740)) |
||||
|
||||
### Other changes |
||||
|
||||
* Aligned the implementation to the new Command API (see https://github.com/ckeditor/ckeditor5-core/issues/88). ([627510a](https://github.com/ckeditor/ckeditor5-block-quote/commit/627510a)) |
||||
|
||||
### BREAKING CHANGES |
||||
|
||||
* The command API has been changed. |
||||
|
||||
|
||||
## [0.1.1](https://github.com/ckeditor/ckeditor5-block-quote/compare/v0.1.0...v0.1.1) (2017-05-07) |
||||
|
||||
### Bug fixes |
||||
|
||||
* Block quote should not be applied to image's caption. Closes: [#10](https://github.com/ckeditor/ckeditor5-block-quote/issues/10). ([06de874](https://github.com/ckeditor/ckeditor5-block-quote/commit/06de874)) |
||||
|
||||
### Other changes |
||||
|
||||
* Updated translations. ([5e23f86](https://github.com/ckeditor/ckeditor5-block-quote/commit/5e23f86)) |
||||
|
||||
|
||||
## 0.1.0 (2017-04-05) |
||||
|
||||
### Features |
||||
|
||||
* Introduced the block quote feature. Closes [#1](https://github.com/ckeditor/ckeditor5-block-quote/issues/1). ([239015b](https://github.com/ckeditor/ckeditor5-block-quote/commit/239015b)) |
@ -0,0 +1,4 @@ |
||||
Contributing |
||||
======================================== |
||||
|
||||
Information about contributing can be found at the following page: <https://github.com/ckeditor/ckeditor5/blob/master/CONTRIBUTING.md>. |
@ -0,0 +1,23 @@ |
||||
Software License Agreement |
||||
========================== |
||||
|
||||
**CKEditor 5 Block Quote Feature** – https://github.com/ckeditor/ckeditor5-paragraph <br> |
||||
Copyright (c) 2003-2017, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved. |
||||
|
||||
Licensed under the terms of any of the following licenses at your choice: |
||||
|
||||
* [GNU General Public License Version 2 or later (the "GPL")](http://www.gnu.org/licenses/gpl.html) |
||||
* [GNU Lesser General Public License Version 2.1 or later (the "LGPL")](http://www.gnu.org/licenses/lgpl.html) |
||||
* [Mozilla Public License Version 1.1 or later (the "MPL")](http://www.mozilla.org/MPL/MPL-1.1.html) |
||||
|
||||
You are not required to, but if you want to explicitly declare the license you have chosen to be bound to when using, reproducing, modifying and distributing this software, just include a text file titled "legal.txt" in your version of this software, indicating your license choice. In any case, your choice will not restrict any recipient of your version of this software to use, reproduce, modify and distribute this software under any of the above licenses. |
||||
|
||||
Sources of Intellectual Property Included in CKEditor |
||||
----------------------------------------------------- |
||||
|
||||
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission. |
||||
|
||||
Trademarks |
||||
---------- |
||||
|
||||
**CKEditor** is a trademark of [CKSource](http://cksource.com) Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. |
@ -0,0 +1,19 @@ |
||||
CKEditor 5 block quote feature |
||||
======================================== |
||||
|
||||
[![Join the chat at https://gitter.im/ckeditor/ckeditor5](https://badges.gitter.im/ckeditor/ckeditor5.svg)](https://gitter.im/ckeditor/ckeditor5?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
||||
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-block-quote.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-block-quote) |
||||
[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-block-quote.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-block-quote) |
||||
[![Test Coverage](https://codeclimate.com/github/ckeditor/ckeditor5-block-quote/badges/coverage.svg)](https://codeclimate.com/github/ckeditor/ckeditor5-block-quote/coverage) |
||||
[![Dependency Status](https://david-dm.org/ckeditor/ckeditor5-block-quote/status.svg)](https://david-dm.org/ckeditor/ckeditor5-block-quote) |
||||
[![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-block-quote/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-block-quote?type=dev) |
||||
|
||||
This package implements block quote support for CKEditor 5. |
||||
|
||||
## Documentation |
||||
|
||||
See the [`@ckeditor/ckeditor5-block-quote` package](https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/api/block-quote.html) page in [CKEditor 5 documentation](https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/). |
||||
|
||||
## License |
||||
|
||||
Licensed under the GPL, LGPL and MPL licenses, at your choice. For full details about the license, please check the `LICENSE.md` file. |
@ -0,0 +1,41 @@ |
||||
{ |
||||
"requires": true, |
||||
"lockfileVersion": 1, |
||||
"dependencies": { |
||||
"husky": { |
||||
"version": "0.14.3", |
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-0.14.3.tgz", |
||||
"integrity": "sha512-e21wivqHpstpoiWA/Yi8eFti8E+sQDSS53cpJsPptPs295QTOQR0ZwnHo2TXy1XOpZFD9rPOd3NpmqTK6uMLJA==", |
||||
"requires": { |
||||
"is-ci": "1.0.10", |
||||
"normalize-path": "1.0.0", |
||||
"strip-indent": "2.0.0" |
||||
}, |
||||
"dependencies": { |
||||
"ci-info": { |
||||
"version": "1.1.1", |
||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.1.tgz", |
||||
"integrity": "sha512-vHDDF/bP9RYpTWtUhpJRhCFdvvp3iDWvEbuDbWgvjUrNGV1MXJrE0MPcwGtEled04m61iwdBLUIHZtDgzWS4ZQ==" |
||||
}, |
||||
"is-ci": { |
||||
"version": "1.0.10", |
||||
"resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz", |
||||
"integrity": "sha1-9zkzayYyNlBhqdSCcM1WrjNpMY4=", |
||||
"requires": { |
||||
"ci-info": "1.1.1" |
||||
} |
||||
}, |
||||
"normalize-path": { |
||||
"version": "1.0.0", |
||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-1.0.0.tgz", |
||||
"integrity": "sha1-MtDkcvkf80VwHBWoMRAY07CpA3k=" |
||||
}, |
||||
"strip-indent": { |
||||
"version": "2.0.0", |
||||
"resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", |
||||
"integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,58 @@ |
||||
{ |
||||
"name": "@ckeditor/ckeditor5-block-quote", |
||||
"version": "1.0.0-alpha.1", |
||||
"description": "Block quote feature for CKEditor 5.", |
||||
"keywords": [ |
||||
"ckeditor5", |
||||
"ckeditor5-feature" |
||||
], |
||||
"dependencies": { |
||||
"@ckeditor/ckeditor5-core": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-engine": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-ui": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-utils": "^1.0.0-alpha.1" |
||||
}, |
||||
"devDependencies": { |
||||
"@ckeditor/ckeditor5-editor-classic": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-enter": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-essentials": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-image": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-list": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-paragraph": "^1.0.0-alpha.1", |
||||
"@ckeditor/ckeditor5-typing": "^1.0.0-alpha.1", |
||||
"eslint": "^4.8.0", |
||||
"eslint-config-ckeditor5": "^1.0.6", |
||||
"husky": "^0.14.3", |
||||
"lint-staged": "^4.2.3" |
||||
}, |
||||
"engines": { |
||||
"node": ">=6.0.0", |
||||
"npm": ">=3.0.0" |
||||
}, |
||||
"author": "CKSource (http://cksource.com/)", |
||||
"license": "(GPL-2.0 OR LGPL-2.1 OR MPL-1.1)", |
||||
"homepage": "https://ckeditor5.github.io", |
||||
"bugs": "https://github.com/ckeditor/ckeditor5-block-quote/issues", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://github.com/ckeditor/ckeditor5-block-quote.git" |
||||
}, |
||||
"files": [ |
||||
"lang", |
||||
"src", |
||||
"theme" |
||||
], |
||||
"scripts": { |
||||
"lint": "eslint --quiet '**/*.js'", |
||||
"precommit": "lint-staged" |
||||
}, |
||||
"lint-staged": { |
||||
"**/*.js": [ |
||||
"eslint --quiet" |
||||
] |
||||
}, |
||||
"eslintIgnore": [ |
||||
"src/lib/**", |
||||
"packages/**" |
||||
] |
||||
} |
@ -0,0 +1,49 @@ |
||||
/** |
||||
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. |
||||
* For licensing, see LICENSE.md. |
||||
*/ |
||||
|
||||
/** |
||||
* @module block-quote/blockquote |
||||
*/ |
||||
|
||||
import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; |
||||
import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter'; |
||||
import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter'; |
||||
|
||||
export default class OpTableWidget extends Plugin { |
||||
static get pluginName() { |
||||
return 'OP-Table'; |
||||
} |
||||
|
||||
init() { |
||||
const editor = this.editor; |
||||
const data = editor.data; |
||||
const schema = editor.document.schema; |
||||
const editing = editor.editing; |
||||
|
||||
schema.registerItem( 'table' ); |
||||
schema.allow( { name: 'table', inside: '$root' } ); |
||||
// thead
|
||||
schema.allow( { name: 'thead', inside: 'table' } ); |
||||
schema.allow( { name: 'tr', inside: 'thead' } ); |
||||
schema.allow( { name: 'th', inside: 'tr' } ); |
||||
|
||||
// tbody
|
||||
schema.allow( { name: 'tbody', inside: 'table' } ); |
||||
schema.allow( { name: 'tr', inside: 'tbody' } ); |
||||
schema.allow( { name: 'td', inside: 'tr' } ); |
||||
// schema.allow( { name: '$block', inside: 'opTable' } );
|
||||
|
||||
|
||||
buildModelConverter().for( data.modelToView, editing.modelToView ) |
||||
.fromElement( 'opTable' ) |
||||
.toElement('div') |
||||
|
||||
// Build converter from view to model for data pipeline.
|
||||
buildViewConverter().for( data.viewToModel ) |
||||
.fromElement( 'div' ) |
||||
.fromAttribute( 'class', 'op-ckeditor-widget--table') |
||||
.toElement('opTable'); |
||||
} |
||||
} |
@ -1,54 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(Color) { |
||||
var examples = [ |
||||
{name: "pjBlack", hex: "#000000"}, |
||||
{name: "pjRed", hex: "#FF0013"}, |
||||
{name: "pjYellow", hex: "#FEFE56"}, |
||||
{name: "pjLime", hex: "#82FFA1"}, |
||||
{name: "pjAqua", hex: "#C0DDFC"}, |
||||
{name: "pjBlue", hex: "#1E16F4"}, |
||||
{name: "pjFuchsia", hex: "#FF7FF7"}, |
||||
{name: "pjWhite", hex: "#FFFFFF"}, |
||||
{name: "pjMaroon", hex: "#850005"}, |
||||
{name: "pjGreen", hex: "#008025"}, |
||||
{name: "pjOlive", hex: "#7F8027"}, |
||||
{name: "pjNavy", hex: "#09067A"}, |
||||
{name: "pjPurple", hex: "#86007B"}, |
||||
{name: "pjTeal", hex: "#008180"}, |
||||
{name: "pjGray", hex: "#808080"}, |
||||
{name: "pjSilver", hex: "#BFBFBF"} |
||||
]; |
||||
|
||||
Factory.define('Color', Color) |
||||
.sequence('id') |
||||
.sequence('name', function (i) {return given[i] || "Color No. " + i;}) |
||||
.sequence('position') |
||||
.sequence('hexcode', function (i) {return given[i] || "#000000";}); |
||||
})($injector.get('Color')); |
@ -1,29 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
Factory.define('options'); |
@ -1,47 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(PlanningElement) { |
||||
Factory.define('PlanningElement', PlanningElement) |
||||
.sequence('id') |
||||
.sequence('name', function (i) { |
||||
return "Project No. " + i; |
||||
}) |
||||
.after(function(PlanningElement, options) { |
||||
if(options && options.children) { |
||||
var i; |
||||
for (i = 0; i < options.children.length; i += 1) { |
||||
options.children[i].Project = PlanningElement.project; |
||||
options.children[i].parent = PlanningElement; |
||||
options.children[i] = Factory.build('PlanningElement', options.children[i]); |
||||
} |
||||
|
||||
PlanningElement.children = options.children; |
||||
} |
||||
}); |
||||
})($injector.get('PlanningElement')); |
@ -1,27 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
@ -1,34 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(ProjectAssociation) { |
||||
Factory.define('ProjectAssociation', ProjectAssociation) |
||||
.sequence('id') |
||||
.sequence("to_project_id") |
||||
.attr("description", ""); |
||||
})($injector.get('ProjectAssociation')); |
@ -1,95 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(Project, PlanningElement, Reporting) { |
||||
|
||||
function addProjectToOwnTimeline(Project) { |
||||
if (Project && Project.timeline) { |
||||
var t = Project.timeline; |
||||
t.projects = t.projects || {}; |
||||
|
||||
t.projects[Project.id] = Project; |
||||
} |
||||
} |
||||
|
||||
Factory.define('Project', Project) |
||||
.sequence('id') |
||||
.sequence('name', function (i) {return "Project No. " + i;}) |
||||
.sequence('identifier', function (i) {return "projectno" + i;}) |
||||
.attr('description', 'Description for Project') |
||||
.after(function(Project) { |
||||
if(Project && Project.planning_elements) { |
||||
var i; |
||||
for (i = 0; i < Project.planning_elements.length; i += 1) { |
||||
var current = Project.planning_elements[i]; |
||||
current.project = Project; |
||||
current.parent = Project; |
||||
current.timeline = Project.timeline; |
||||
|
||||
if (!PlanningElement.is(current)) { |
||||
Project.planning_elements[i] = Factory.build('PlanningElement', current); |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
.after(function(Project) { |
||||
if(Project && Project.children) { |
||||
var i; |
||||
for (i = 0; i < Project.children.length; i += 1) { |
||||
var current = Project.children[i]; |
||||
current.project = Project; |
||||
current.parent = Project; |
||||
current.timeline = Project.timeline; |
||||
|
||||
addProjectToOwnTimeline(current); |
||||
|
||||
if (!current.is(Project)) { |
||||
Project.children[i] = Factory.build('Project', current); |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
.after(function(Project) { |
||||
if(Project && Project.reporters) { |
||||
var i; |
||||
for (i = 0; i < Project.reporters.length; i += 1) { |
||||
var current = Project.reporters[i]; |
||||
current.timeline = Project.timeline; |
||||
addProjectToOwnTimeline(current); |
||||
|
||||
if (current.identifier !== Reporting.identifier) { |
||||
Project.reporters[i] = Factory.build('Reporting', current); |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
.after(function (Project) { |
||||
addProjectToOwnTimeline(Project); |
||||
}); |
||||
|
||||
})($injector.get('Project'), $injector.get('PlanningElement'), $injector.get('Reporting')); |
@ -1,37 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(ProjectType) { |
||||
Factory.define('ProjectType', ProjectType) |
||||
.sequence('id') |
||||
.sequence('name', function (i) {return "Project Type No. " + i;}) |
||||
.sequence('position') |
||||
.attr('allows_association', true) |
||||
.attr('created_at') |
||||
.attr('updated_at'); |
||||
})($injector.get('ProjectType')); |
@ -1,38 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(Reporting) { |
||||
Factory.define('Reporting', Reporting) |
||||
.sequence('id') |
||||
.attr("project", function () {return Factory.build("Project");}) |
||||
.attr("reporting_to_project", function () {return Factory.build("Project");}) |
||||
.attr("reported_project_status", function () {return {};}) |
||||
.attr("reported_project_status_comment", "") |
||||
.attr('created_at') |
||||
.attr('updated_at'); |
||||
})($injector.get('Reporting')); |
@ -1,36 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(Status) { |
||||
Factory.define('Status', Status) |
||||
.sequence('id') |
||||
.sequence('name', function (i) {return "Status No. " + i;}) |
||||
.sequence('is_default', function (i) {return i === 0;}) |
||||
.sequence('position') |
||||
.attr('is_closed', false); |
||||
})($injector.get('Status')); |
@ -1,38 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(PlanningElementType) { |
||||
Factory.define('PlanningElementType', PlanningElementType) |
||||
.sequence('id') |
||||
.sequence('name', function (i) {return "Type No. " + i;}) |
||||
.sequence('is_default', function (i) {return i === 0;}) |
||||
.sequence('position') |
||||
.attr('in_aggregation', false) |
||||
.attr('is_milestone', false) |
||||
.attr('is_closed', false); |
||||
})($injector.get('PlanningElementType')); |
@ -1,35 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
(function(User) { |
||||
Factory.define('User', User) |
||||
.sequence('id') |
||||
.sequence('name', function (i) {return "User No. " + i;}) |
||||
.sequence('firstname', function (i) {return "Firstname No." + i;}) |
||||
.sequence('lastname', function (i) {return "Lastname No." + i;}); |
||||
})($injector.get('User')); |
@ -1,152 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2017 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-2017 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.
|
||||
//++
|
||||
|
||||
var Factory = function(constructor) { |
||||
this.construct = constructor; |
||||
this.attrs = {}; |
||||
this.sequences = {}; |
||||
this.callbacks = []; |
||||
}; |
||||
|
||||
function extend(target, options) { |
||||
var name, src, copy; |
||||
// Extend the base object
|
||||
for (name in options) { |
||||
src = target[name]; |
||||
copy = options[name]; |
||||
|
||||
if (copy !== undefined) { |
||||
target[name] = copy; |
||||
} |
||||
} |
||||
|
||||
return target; |
||||
} |
||||
|
||||
Factory.prototype = { |
||||
attr: function(attr, value) { |
||||
var callback = typeof value == 'function' ? value : function() { return value; }; |
||||
this.attrs[attr] = callback; |
||||
return this; |
||||
}, |
||||
|
||||
sequence: function(attr, callback) { |
||||
var factory = this; |
||||
callback = callback || function(i) { return i; }; |
||||
this.attrs[attr] = function() { |
||||
factory.sequences[attr] = factory.sequences[attr] || 0; |
||||
return callback.call(this, ++factory.sequences[attr]); |
||||
}; |
||||
return this; |
||||
}, |
||||
|
||||
after: function(callback) { |
||||
this.callbacks.push(callback); |
||||
return this; |
||||
}, |
||||
|
||||
attributes: function(attrs) { |
||||
attrs = attrs || {}; |
||||
for(var attr in this.attrs) { |
||||
if(!attrs.hasOwnProperty(attr)) { |
||||
attrs[attr] = this.attrs[attr](); |
||||
} |
||||
} |
||||
return attrs; |
||||
}, |
||||
|
||||
build: function(attrs) { |
||||
var result = this.attributes(attrs); |
||||
if (typeof this.construct === "object") { |
||||
return extend(Object.create(this.construct), result); |
||||
} |
||||
|
||||
return this.construct ? new this.construct(result) : result; |
||||
}, |
||||
|
||||
extend: function(name) { |
||||
var factory = Factory.factories[name]; |
||||
// Copy the parent's constructor
|
||||
if (this.construct === undefined) { this.construct = factory.construct; } |
||||
for(var attr in factory.attrs) { |
||||
if(factory.attrs.hasOwnProperty(attr)) { |
||||
this.attrs[attr] = factory.attrs[attr]; |
||||
} |
||||
} |
||||
// Copy the parent's callbacks
|
||||
for(var i = 0; i < factory.callbacks.length; i++) { |
||||
this.callbacks.push(factory.callbacks[i]); |
||||
} |
||||
return this; |
||||
} |
||||
}; |
||||
|
||||
Factory.factories = {}; |
||||
Factory.builds = {}; |
||||
|
||||
Factory.define = function(name, constructor) { |
||||
var factory = new Factory(constructor); |
||||
if (this.factories[name]) { |
||||
console.log("Warning: Overwriting Factory for " + name); |
||||
} |
||||
this.factories[name] = factory; |
||||
return factory; |
||||
}; |
||||
|
||||
Factory.all = function (name) { |
||||
return this.builds[name] || []; |
||||
}; |
||||
|
||||
Factory.build = function(name, attrs, options) { |
||||
var obj = this.factories[name].build(attrs); |
||||
for(var i = 0; i < this.factories[name].callbacks.length; i++) { |
||||
this.factories[name].callbacks[i](obj, options); |
||||
} |
||||
this.builds[name] = this.builds[name] || []; |
||||
this.builds[name].push(obj); |
||||
return obj; |
||||
}; |
||||
|
||||
Factory.buildList = function(name, size, attrs, options) { |
||||
var objs = []; |
||||
for(var i = 0; i < size; i++) { |
||||
if (i%10000 === 9999) { |
||||
console.log(i + " builds done"); |
||||
} |
||||
objs.push(Factory.build(name, attrs, options)); |
||||
} |
||||
return objs; |
||||
}; |
||||
|
||||
Factory.attributes = function(name, attrs) { |
||||
return this.factories[name].attributes(attrs); |
||||
}; |
||||
|
||||
if (typeof exports != "undefined") { |
||||
exports.Factory = Factory; |
||||
} |
Loading…
Reference in new issue