Skip to content

Commit

Permalink
Merge pull request #751 from adaptlearning/release/0.1.1
Browse files Browse the repository at this point in the history
Release/0.1.1
  • Loading branch information
brian-learningpool committed Jul 13, 2015
2 parents de1f2f2 + 783b7bc commit f61f9bf
Show file tree
Hide file tree
Showing 58 changed files with 1,659 additions and 1,175 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ conf/config.json
/plugins/content/theme/extensioncache/
/plugins/content/menu/versions/
/plugins/content/bower/bowercache/
/routes/lang/en.json
/master/
/frontend/src/adaptbuilder/css/adapt.css
/frontend/src/adaptbuilder/js/
.idea
*.iml
.vagrant
.env
version.json
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: node_js
node_js:
- "0.10.2"
- "0.10.33"
services: mongodb
before_install:
- "npm install adapt-cli -g"
- "npm install -g npm"
- "npm cache clean"
- "npm install -g adapt-cli"
8 changes: 7 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
"merge-json": {
en: {
src: ['routes/lang/en-application.json','frontend/src/plugins/**/lang/en.json'],
dest: 'routes/lang/en.json',
}
},
copy: {
main: {
files: [
Expand Down Expand Up @@ -156,7 +162,7 @@ module.exports = function(grunt) {
// Save the configuration
grunt.file.write(configFile, JSON.stringify(config, null, 2));

grunt.task.run(['requirePlugins', 'copy', 'less', 'handlebars', 'requirejs:'+ compilation]);
grunt.task.run(['requirePlugins', 'merge-json', 'copy', 'less', 'handlebars', 'requirejs:'+ compilation]);
} else {
grunt.task.run(['requirePlugins', 'copy', 'less', 'handlebars', 'requirejs:dev']);
}
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@ git config --global user.email "[email protected]"

#### MongoDB

[MongoDB](https://www.mongodb.org) is a document based database. Download and install the version appropriate for your system [here](https://www.mongodb.org/downloads).
[MongoDB](https://www.mongodb.org) is a document based database. Download and install the version appropriate for your system [here](https://www.mongodb.org/downloads).


#### NodeJS & NPM

[NodeJS](http://nodejs.org/) and [NPM](https://www.npmjs.org/) are required. Installing Node.js will also install NPM.

<<<<<<< HEAD
IMPORTANT: The NodeJS version should be 0.10.33. Earlier versions of NodeJS are less stable and the code currently has issues with 0.12.x.
=======
The NodeJS version should must be 0.10.33. Earlier versions of NodeJS are less stable and the code is currently not compatibile with 0.12.x.
>>>>>>> develop
You should use a NodeJS version manager. We recommend using [NVM](https://github.com/creationix/nvm) on non-Windows machines. On Windows, try [nodist](https://github.com/marcelklehr/nodist)

Expand All @@ -60,10 +65,10 @@ Install [grunt-cli](http://gruntjs.com/) and [adapt-cli](https://github.com/adap
npm install -g grunt-cli
npm install -g adapt-cli
```
Read more about [grunt](http://gruntjs.com/getting-started)
Read more about [Grunt](http://gruntjs.com/getting-started)


#### FFMPEG (optional)
#### FFMPEG (optional, but recommended)

[FFmpeg](https://www.ffmpeg.org/index.html) is not required to use the tool, but it will produce nice thumbnails for images and videos you upload.

Expand Down
Binary file added frontend/src/adaptbuilder/css/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions frontend/src/core/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require([
'coreJS/app/helpers',
'coreJS/app/contextMenu',
'coreJS/location/location',
'plugins/plugins',
'coreJS/notify/notify',
'coreJS/editingOverlay/editingOverlay',
'coreJS/options/options',
Expand All @@ -31,8 +32,7 @@ require([
'imageReady',
'mediaelement',
'velocity',
'scrollTo',
'plugins/plugins'
'scrollTo'
], function (
Templates,
Polyglot,
Expand Down
58 changes: 57 additions & 1 deletion frontend/src/core/app/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ define(function(require){

return hh + ':' + mm + ':' + ss;
},
if_value_equals: function(value, text, block) {
ifValueEquals: function(value, text, block) {
if (value === text) {
return block.fn(this);
} else {
Expand Down Expand Up @@ -170,7 +170,63 @@ define(function(require){
} else {
return block.inverse(this);
}
},

console: function(context) {
return console.log(context);
},

getAssetFromValue: function(url) {
var urlSplit = url.split('/')
var fileName = urlSplit[urlSplit.length - 1];
// Get courseAsset model
var courseAsset = Origin.editor.data.courseAssets.findWhere({_fieldName: fileName});
var courseAssetId = courseAsset.get('_assetId');

return '/api/asset/serve/' + courseAssetId;

},

getThumbnailFromValue: function(url) {

var urlSplit = url.split('/')
var fileName = urlSplit[urlSplit.length - 1];
// Get courseAsset model
var courseAsset = Origin.editor.data.courseAssets.findWhere({_fieldName: fileName});
if (courseAsset) {
var courseAssetId = courseAsset.get('_assetId');
return '/api/asset/thumb/' + courseAssetId;
} else {
return '/api/asset/thumb/' + url;
}

},

ifAssetIsExternal: function(url, block) {

var urlSplit = url.split('/')
// Could well be a hero image for the course
if (urlSplit.length === 1) {
return block.inverse(this);
}

if (urlSplit[0] != "course" && urlSplit[1] != "assets") {
return block.fn(this);
} else {
return block.inverse(this);
}

},

ifAssetIsHeroImage: function(url, block) {
var urlSplit = url.split('/')
if (urlSplit.length === 1) {
return block.fn(this);
} else {
return block.inverse(this);
}
}

};

for(var name in helpers) {
Expand Down
10 changes: 4 additions & 6 deletions frontend/src/core/app/views/originView.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,19 @@ define(function(require){
setUserPreference: function(key, value) {
if (this.settings.preferencesKey && typeof(Storage) !== "undefined") {
// Get preferences for this view
var preferences = localStorage.getItem(this.settings.preferencesKey);
// Convert string to JSON
var json = (JSON.parse(preferences) || {});
var preferences = (Origin.sessionModel.get(this.settings.preferencesKey) || {});
// Set key and value
json[key] = value;
preferences[key] = value;
// Store in localStorage
localStorage.setItem(this.settings.preferencesKey, JSON.stringify(json));
Origin.sessionModel.set(this.settings.preferencesKey, preferences);

}
},

getUserPreferences: function() {
if (this.settings.preferencesKey && typeof(Storage) !== "undefined"
&& localStorage.getItem(this.settings.preferencesKey)) {
return JSON.parse(localStorage.getItem(this.settings.preferencesKey));
return Origin.sessionModel.get(this.settings.preferencesKey);
} else {
return {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,57 @@

<div class="asset-management-list-item-icon">
<div class="asset-management-list-item-icon-inner">
{{#if_value_equals assetType "image"}}
{{#ifValueEquals assetType "image"}}
<i class="fa fa-file-image-o"></i>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "audio"}}
{{#ifValueEquals assetType "audio"}}
<i class="fa fa-file-audio-o"></i>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "video"}}
{{#ifValueEquals assetType "video"}}
<i class="fa fa-file-video-o"></i>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "other"}}
{{#ifValueEquals assetType "other"}}
<i class="fa fa-file-o"></i>
{{/if_value_equals}}
{{/ifValueEquals}}
</div>
</div>

{{#if_value_equals assetType "image"}}
<div class="asset-management-list-item-image" data-style="background-image:url(api/asset/thumb/{{_id}})">
{{#ifValueEquals assetType "image"}}
{{#if metadata}}
<div class="asset-management-list-item-image" data-style="background-image:url(api/asset/thumb/{{_id}})">
{{else}}
<div class="asset-management-list-item-image">
<i class="fa fa-file-image-o"></i>
</div>
{{/if}}
</div>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "video"}}
<div class="asset-management-list-item-image" data-style="background-image:url(api/asset/thumb/{{_id}})">
{{#ifValueEquals assetType "video"}}
{{#if metadata}}
<div class="asset-management-list-item-image" data-style="background-image:url(api/asset/thumb/{{_id}})"}>
{{else}}
<div class="asset-management-list-item-image">
<i class="fa fa-file-video-o"></i>
</div>
{{/if}}
</div>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "audio"}}
{{#ifValueEquals assetType "audio"}}
<div class="asset-management-list-item-image">
<i class="fa fa-file-audio-o"></i>
</div>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "other"}}
{{#ifValueEquals assetType "other"}}
<div class="asset-management-list-item-image">
<i class="fa fa-file-o"></i>
</div>
{{/if_value_equals}}
{{/ifValueEquals}}

<div class="asset-management-list-item-details">

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<i class="fa fa-magic"></i>Autofill
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<div class="asset-preview-details text-centered">
<div class="asset-preview-details-preview">
{{#if_value_equals assetType "image"}}
{{#ifValueEquals assetType "image"}}
<img src="api/asset/serve/{{_id}}"/>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "video"}}
{{#ifValueEquals assetType "video"}}
<video preload="none" width="640px" height="360px" poster="" style="width:100%; height:100%;">
<source src="api/asset/serve/{{_id}}" type="{{mimeType}}"/>
</video>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "audio"}}
{{#ifValueEquals assetType "audio"}}
<i class="fa fa-file-audio-o"></i>
<audio src="api/asset/serve/{{_id}}" type="{{mimeType}}" controls="controls" style="width:100%;"></audio>
{{/if_value_equals}}
{{/ifValueEquals}}

{{#if_value_equals assetType "other"}}
{{#ifValueEquals assetType "other"}}
<i class="fa fa-file-o"></i>
{{/if_value_equals}}
{{/ifValueEquals}}
</div>

<h1 class="asset-preview-title">{{title}}</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// LICENCE https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE
define(function(require) {

var Origin = require('coreJS/app/origin');
var Backbone = require('backbone');

var AssetManagementModalAutofillView = Backbone.View.extend({

className: 'asset-management-modal-autofill',

tagName: 'button',

events: {
'click': 'onAutofillClicked'
},

initialize: function(options) {
this.options = options;
this.listenTo(Origin, 'modal:closed', this.remove);
this.listenTo(Origin, 'remove:views', this.remove);
this.render();
},

render: function() {
var data = this.options;
var template = Handlebars.templates['assetManagementModalAutofill'];
this.$el.html(template(data)).prependTo('.model-popup-toolbar-buttons');
_.defer(_.bind(this.postRender, this));

return this;
},

postRender: function() {
},

onAutofillClicked: function(event) {
event.preventDefault();
// Sometimes the button can be clicked without selecting an asset
if (this.options.modalView.data) {
this.options.modalView.data._shouldAutofill = true;
Origin.trigger('modal:onUpdate');
} else {
Origin.trigger('modal:onCancel');
}
}

});

return AssetManagementModalAutofillView;

});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ define(function(require) {
var AssetManagementPreviewView = require('coreJS/assetManagement/views/assetManagementPreviewView');
var AssetManagementView = require('coreJS/assetManagement/views/assetManagementView');
var AssetManagementModalFiltersView = require('coreJS/assetManagement/views/assetManagementModalFiltersView');
var AssetManagementModelAutofillView = require('coreJS/assetManagement/views/assetManagementModalAutofillView');

var AssetManagementModalView = AssetManagementView.extend({

Expand All @@ -19,12 +20,16 @@ define(function(require) {
postRender: function() {
this.setupSubViews();
this.setupFilterAndSearchView();
if (this.options.assetType === "Asset:image" && Origin.scaffold.getCurrentModel().get('_component') === 'graphic') {
this.setupImageAutofillButton();
}
this.resizeAssetPanels();
},

setupSubViews: function() {
this.search = {};
var assetType = this.options.assetType.replace('Asset:', '');
// Replace Asset and : so we can have both filtered and all asset types
var assetType = this.options.assetType.replace('Asset', '').replace(':', '');
var filters = [assetType];
this.search.assetType = { $in: filters };
// Push collection through to collection view
Expand All @@ -35,6 +40,10 @@ define(function(require) {
new AssetManagementModalFiltersView(this.options);
},

setupImageAutofillButton: function() {
new AssetManagementModelAutofillView({modalView: this});
},

resizeAssetPanels: function() {
var navigationHeight = $('.navigation').outerHeight();
var windowHeight = $(window).height();
Expand Down
Loading

0 comments on commit f61f9bf

Please sign in to comment.