Skip to content

Commit

Permalink
!!! TASK: Upgrade for Neos 3.0 (#3)
Browse files Browse the repository at this point in the history
- Adjusts code to package renaming from "TYPO3.Neos" to "Neos.Neos"
- Adjusts code to package renaming from "TYPO3.TypoScript" to "Neos.Fusion" in Fusion files
- Moves fusion files from old path ``Resources/Private/TypoScript/`` to the new path
- Migrate usages of the Settings path Neos.Neos.typoScript to Neos.Neos.fusion
  • Loading branch information
ComiR authored and kdambekalns committed Jan 30, 2017
1 parent 5d74474 commit 8e462a5
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 52 deletions.
10 changes: 6 additions & 4 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
TYPO3:
Neos:
Neos:
typoScript:
fusion:
autoInclude:
Flownative.Anchorlinks: true
userInterface:
translation:
autoInclude:
'Flownative.Anchorlinks': ['Main', 'NodeTypes/*']
Flownative.Anchorlinks:
- Main
- 'NodeTypes/*'
requireJsPathMapping:
'Flownative.Anchorlinks/Views': 'resource://Flownative.Anchorlinks/Public/JavaScript/Inspector/Views'
Flownative.Anchorlinks/Views: 'resource://Flownative.Anchorlinks/Public/JavaScript/Inspector/Views'
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ Create anchor links to any content element on the page.
## Setup

```
composer require 'flownative/anchorlinks:@dev'
composer require 'flownative/anchorlinks'
```

Add `Flownative.Anchorlinks:AnchorMixin` mixin to any nodetype that you would want to link to.
Add the `Flownative.Anchorlinks:AnchorMixin` mixin to any nodetype that you would want to link to.

E.g. this code will add such ability to every Content nodetype:

```
'TYPO3.Neos:Content':
```yaml
'Neos.Neos:Content':
superTypes:
'Flownative.Anchorlinks:AnchorMixin': true
```
Add `Flownative.Anchorlinks:AnchorWrapper` processor to the same nodetype renderer to insert anchor tag with given id before it.
Add the `Flownative.Anchorlinks:AnchorWrapper` processor to the same nodetype renderer to insert an anchor tag with the given id before it.

E.g.:

```
prototype(TYPO3.Neos:Content) {
@process.appendAnchor = Flownative.Anchorlinks:AnchorWrapper
prototype(Neos.Neos:Content) {
@process.prependAnchor = Flownative.Anchorlinks:AnchorWrapper
}
```

## Usage

Choose some content node that you would like to link to, and fill in `sectionId` inspector property.
Choose some content node that you would like to link to, and fill in the `sectionId` property in the inspector.

After that you would see a button appear below to copy link to this node to clipboard.
After that you will see a button appear below the field to copy the link to this node to the clipboard.

When you click that button, the link to the given node will be copied to the clipboard. Paste it in insert link field in Aloha editor and you are done!
When you click that button, the link to the given node will be copied to the clipboard. Paste it in the "insert link" field in Aloha editor and you are done!
7 changes: 7 additions & 0 deletions Resources/Private/Fusion/Root.fusion
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Meant to be used as a processor. Prepends a tag with the sectionId
prototype(Flownative.Anchorlinks:AnchorWrapper) < prototype(Neos.Fusion:Value) {
anchor = Neos.Fusion:Tag {
attributes.id = ${q(node).property('sectionId')}
}
value = ${q(node).property('sectionId') ? this.anchor + value : value}
}
7 changes: 0 additions & 7 deletions Resources/Private/TypoScript/Root.ts2

This file was deleted.

54 changes: 27 additions & 27 deletions Resources/Public/JavaScript/Inspector/Views/AnchorView.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
define([
'emberjs',
'text!./AnchorView.html',
'Shared/I18n'
'emberjs',
'text!./AnchorView.html',
'Shared/I18n'
],
function(
Ember,
template,
I18n
Ember,
template,
I18n
) {
return Ember.View.extend({
template: Ember.Handlebars.compile(template),
buttonLabel: 'copy',
_buttonLabel: function() {
return I18n.translate('Flownative.Anchorlinks:Main:' + this.get('buttonLabel'), 'Copy link');
}.property('buttonLabel'),
_showButton: function() {
return this.get('inspector.nodeProperties.sectionId') ? true : false;
}.property('inspector.nodeProperties.sectionId'),
copyToClipboard: function () {
var documentNodeIdentifier = document.getElementById('neos-document-metadata').dataset['node-_identifier'];
var link = 'node://' + documentNodeIdentifier + '#' + this.get('inspector.nodeProperties.sectionId');
var textArea = document.createElement('textarea');
textArea.innerText = link;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
textArea.parentNode.removeChild(textArea);
this.set('buttonLabel', 'copied');
}
});
return Ember.View.extend({
template: Ember.Handlebars.compile(template),
buttonLabel: 'copy',
_buttonLabel: function() {
return I18n.translate('Flownative.Anchorlinks:Main:' + this.get('buttonLabel'), 'Copy link');
}.property('buttonLabel'),
_showButton: function() {
return !!this.get('inspector.nodeProperties.sectionId');
}.property('inspector.nodeProperties.sectionId'),
copyToClipboard: function () {
var documentNodeIdentifier = document.getElementById('neos-document-metadata').dataset['node-_identifier'];
var link = 'node://' + documentNodeIdentifier + '#' + this.get('inspector.nodeProperties.sectionId');
var textArea = document.createElement('textarea');
textArea.innerText = link;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
textArea.parentNode.removeChild(textArea);
this.set('buttonLabel', 'copied');
}
});
});
76 changes: 72 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,84 @@
"name": "flownative/anchorlinks",
"license": "LGPL-3.0+",
"require": {
"typo3/neos": "*"
"neos/fluid-adaptor": "^4.0",
"neos/fusion": "^3.0",
"neos/neos": "^3.0"
},
"autoload": {
"psr-0": {
"Flownative\\Anchorlinks": "Classes/"
"psr-4": {
"Flownative\\Anchorlinks\\": "Classes/"
}
},
"extra": {
"neos": {
"package-key": "Flownative.Anchorlinks"
}
},
"applied-flow-migrations": [
"TYPO3.FLOW3-201201261636",
"TYPO3.Fluid-201205031303",
"TYPO3.FLOW3-201205292145",
"TYPO3.FLOW3-201206271128",
"TYPO3.FLOW3-201209201112",
"TYPO3.Flow-201209251426",
"TYPO3.Flow-201211151101",
"TYPO3.Flow-201212051340",
"TYPO3.TypoScript-130516234520",
"TYPO3.TypoScript-130516235550",
"TYPO3.TYPO3CR-130523180140",
"TYPO3.Neos.NodeTypes-201309111655",
"TYPO3.Flow-201310031523",
"TYPO3.Flow-201405111147",
"TYPO3.Neos-201407061038",
"TYPO3.Neos-201409071922",
"TYPO3.TYPO3CR-140911160326",
"TYPO3.Neos-201410010000",
"TYPO3.TYPO3CR-141101082142",
"TYPO3.Neos-20141113115300",
"TYPO3.Fluid-20141113120800",
"TYPO3.Flow-20141113121400",
"TYPO3.Fluid-20141121091700",
"TYPO3.Neos-20141218134700",
"TYPO3.Fluid-20150214130800",
"TYPO3.Neos-20150303231600",
"TYPO3.TYPO3CR-20150510103823",
"TYPO3.Flow-20151113161300",
"TYPO3.Form-20160601101500",
"TYPO3.Flow-20161115140400",
"TYPO3.Flow-20161115140430",
"Neos.Flow-20161124204700",
"Neos.Flow-20161124204701",
"Neos.Twitter.Bootstrap-20161124204912",
"Neos.Form-20161124205254",
"Neos.Flow-20161124224015",
"Neos.Party-20161124225257",
"Neos.Eel-20161124230101",
"Neos.Setup-20161124230842",
"Neos.Imagine-20161124231742",
"Neos.Media-20161124233100",
"Neos.NodeTypes-20161125002300",
"Neos.Neos-20161125002322",
"Neos.ContentRepository-20161125012000",
"Neos.Fusion-20161125013710",
"Neos.Setup-20161125014759",
"Neos.Fusion-20161125104701",
"Neos.NodeTypes-20161125104800",
"Neos.Neos-20161125104802",
"Neos.Neos-20161125122412",
"Neos.Flow-20161125124112",
"Neos.SwiftMailer-20161130105617",
"TYPO3.FluidAdaptor-20161130112935",
"Neos.Fusion-20161201202543",
"Neos.Neos-20161201222211",
"Neos.Fusion-20161202215034",
"Neos.Fusion-20161219092345",
"Neos.ContentRepository-20161219093512",
"Neos.Media-20161219094126",
"Neos.Neos-20161219094403",
"Neos.Neos-20161219122512",
"Neos.Fusion-20161219130100",
"Neos.Neos-20161220163741",
"Neos.Fusion-20170120013047"
]
}
}

0 comments on commit 8e462a5

Please sign in to comment.