Permalink
Browse files

Add alt text attribute to files

* Editable via settings dialog
* Display as meta data item
  • Loading branch information...
1 parent 1114ffb commit fd5d26e4c4e4765b4b2098bee154f34f8761772c @tf tf committed Dec 15, 2016
@@ -1,10 +1,4 @@
pageflow.app.addInitializer(function(options) {
- pageflow.editor.fileTypes.register('image_files', {
- model: pageflow.ImageFile,
- metaDataAttributes: ['dimensions'],
- matchUpload: /^image/
- });
-
var textTracksMetaDataAttribute = {
name: 'text_tracks',
valueView: pageflow.TextTracksFileMetaDataItemValueView,
@@ -23,15 +17,46 @@ pageflow.app.addInitializer(function(options) {
}
};
+ var altMetaDataAttribute = {
+ name: 'alt',
+ valueView: pageflow.TextFileMetaDataItemValueView,
+ valueViewOptions: {
+ fromConfiguration: true,
+ settingsDialogTabLink: 'general'
+ }
+ };
+
+ pageflow.editor.fileTypes.register('image_files', {
+ model: pageflow.ImageFile,
+ metaDataAttributes: [
+ 'dimensions',
+ altMetaDataAttribute
+ ],
+ matchUpload: /^image/,
+ configurationEditorInputs: [
+ {
+ name: 'alt',
+ inputView: pageflow.TextInputView
+ }
+ ]
+ });
+
pageflow.editor.fileTypes.register('video_files', {
model: pageflow.VideoFile,
metaDataAttributes: [
'format',
'dimensions',
'duration',
- textTracksMetaDataAttribute
+ textTracksMetaDataAttribute,
+ altMetaDataAttribute
],
matchUpload: /^video/,
+ configurationEditorInputs: [
+ {
+ name: 'alt',
+ inputView: pageflow.TextInputView
+ }
+ ],
settingsDialogTabs: [
textTracksSettingsDialogTab
]
@@ -42,9 +67,16 @@ pageflow.app.addInitializer(function(options) {
metaDataAttributes: [
'format',
'duration',
- textTracksMetaDataAttribute
+ textTracksMetaDataAttribute,
+ altMetaDataAttribute
],
matchUpload: /^audio/,
+ configurationEditorInputs: [
+ {
+ name: 'alt',
+ inputView: pageflow.TextInputView
+ }
+ ],
settingsDialogTabs: [
textTracksSettingsDialogTab
]
@@ -11,6 +11,15 @@
*/
pageflow.TextFileMetaDataItemValueView = pageflow.FileMetaDataItemValueView.extend({
getText: function() {
- return this.model.get(this.options.name);
+ var model;
+
+ if (this.options.fromConfiguration) {
+ model = this.model.configuration;
+ }
+ else {
+ model = this.model;
+ }
+
+ return model.get(this.options.name);
}
});
@@ -0,0 +1,8 @@
+de:
+ pageflow:
+ editor:
+ files:
+ common_attributes:
+ alt:
+ label: "Alt-Text"
+ inline_help: "Ein Hinweis darauf, was in dem dargestellten Element zum Ausdruck kommt."
@@ -0,0 +1,8 @@
+en:
+ pageflow:
+ editor:
+ files:
+ common_attributes:
+ alt:
+ label: "Alt-Text"
+ inline_help: "A hint describing the contents of the displayed element."

0 comments on commit fd5d26e

Please sign in to comment.