Browse Source

Fix the missing text configuration in Asset Manager (#26)

pull/36/head
Artur Arseniev 10 years ago
parent
commit
e064857382
  1. 3
      src/asset_manager/config/config.js
  2. 3
      src/asset_manager/main.js
  3. 4
      src/asset_manager/template/assets.html
  4. 3
      src/asset_manager/view/AssetsView.js
  5. 8
      src/asset_manager/view/FileUploader.js

3
src/asset_manager/config/config.js

@ -1,6 +1,5 @@
define(function () {
return {
// Default assets
assets: [],
@ -13,5 +12,7 @@ define(function () {
// Text on upload input
uploadText: 'Drop files here or click to upload',
// Label for the add button
addBtnText: 'Add image',
};
});

3
src/asset_manager/main.js

@ -16,6 +16,7 @@
* @param {Object} config Configurations
* @param {Array<Object>} [config.assets=[]] Default assets
* @param {String} [config.uploadText='Drop files here or click to upload'] Upload text
* @param {String} [config.addBtnText='Add image'] Text for the add button
* @param {String} [config.upload=''] Where to send upload data. Expects as return a JSON with asset/s object
* as: {data: [{src:'...'}, {src:'...'}]}
* @return {this}
@ -219,4 +220,4 @@ define(function(require) {
};
};
});
});

4
src/asset_manager/template/assets.html

@ -2,9 +2,9 @@
<div class="<%= pfx %>assets-header">
<form class="<%= pfx %>add-asset">
<div class="<%= ppfx %>field <%= pfx %>add-field">
<input placeholder="http://path/to/the/image.jpg" />
<input placeholder="http://path/to/the/image.jpg"/>
</div>
<button class="<%= ppfx %>btn-prim">Add image</button>
<button class="<%= ppfx %>btn-prim"><%= btnText %></button>
<div style="clear:both"></div>
</form>
<div class="<%= pfx %>dips" style="display:none">

3
src/asset_manager/view/AssetsView.js

@ -119,8 +119,9 @@ define(['backbone', './AssetView', './AssetImageView', './FileUploader', 'text!.
},this);
this.$el.html(this.template({
pfx: this.pfx,
pfx: this.pfx,
ppfx: this.ppfx,
btnText: this.config.addBtnText,
}));
this.$el.find('.'+this.pfx + 'assets').append(fragment);

8
src/asset_manager/view/FileUploader.js

@ -83,10 +83,10 @@ define(['backbone', 'text!./../template/fileUploader.html'],
render : function(){
this.$el.html( this.template({
title : this.config.uploadText,
uploadId : this.uploadId,
disabled : this.disabled,
pfx : this.pfx
title: this.config.uploadText,
uploadId: this.uploadId,
disabled: this.disabled,
pfx: this.pfx
}) );
this.initDrop();
this.$el.attr('class', this.pfx + 'file-uploader');

Loading…
Cancel
Save