-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Converted tabs to spaces, indentation amends * Naming refactor, spacing amends * Global attribution class * Removed empty less file * Attribution support * Bower, schema, example and readme updates * Updated license and cross platform coverage
- Loading branch information
Showing
7 changed files
with
102 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
{ | ||
"name": "adapt-contrib-graphic", | ||
"version": "3.0.0", | ||
"framework": ">=3.3", | ||
"version": "4.0.0", | ||
"framework": ">=5", | ||
"homepage": "https://github.com/adaptlearning/adapt-contrib-graphic", | ||
"issues": "https://github.com/adaptlearning/adapt_framework/issues/new", | ||
"displayName" : "Graphic", | ||
"component" : "graphic", | ||
"displayName" : "Graphic", | ||
"description": "Graphic component which dynamically displays small and large images of different resolutions based upon device width", | ||
"main": "/js/adapt-contrib-graphic.js", | ||
"assetFields" : [ | ||
"_graphic.small", | ||
"_graphic.large" | ||
], | ||
"description": "Graphic component which dynamically displays small and large images of different resolutions based upon device width", | ||
"main": "/js/adapt-contrib-graphic.js", | ||
"keywords": [ | ||
"adapt-plugin", | ||
"adapt-component" | ||
], | ||
"license": "GPLv3" | ||
"license": "GPL-3.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
{ | ||
"_id":"c-30", | ||
"_parentId":"b-15", | ||
"_type":"component", | ||
"_component":"graphic", | ||
"_classes":"", | ||
"_layout":"left", | ||
"title":"Here is a graphic object", | ||
"displayTitle":"Here is a graphic object", | ||
"body":"Hi everybody!", | ||
"instruction":"", | ||
"_id": "c-05", | ||
"_parentId": "b-05", | ||
"_type": "component", | ||
"_component": "graphic", | ||
"_classes": "", | ||
"_layout": "left", | ||
"title": "Here is a graphic object", | ||
"displayTitle": "Here is a graphic object", | ||
"body": "Hi everybody!", | ||
"instruction": "", | ||
"_graphic": { | ||
"alt": "alt text", | ||
"alt": "Placeholder graphic", | ||
"large": "https://github.com/adaptlearning/documentation/raw/master/04_wiki_assets/adapt_framework/adapt-logo_208x200.gif", | ||
"small": "http://minionslovebananas.com/images/check-in-minion.jpg", | ||
"attribution":"Copyright © 2015" | ||
"attribution": "Copyright © 2019" | ||
}, | ||
"_pageLevelProgress": { | ||
"_isEnabled": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
define([ | ||
'core/js/adapt', | ||
'core/js/views/componentView', | ||
'core/js/models/componentModel' | ||
'core/js/adapt', | ||
'core/js/views/componentView', | ||
'core/js/models/componentModel' | ||
], function(Adapt, ComponentView, ComponentModel) { | ||
|
||
var GraphicView = ComponentView.extend({ | ||
var GraphicView = ComponentView.extend({ | ||
|
||
preRender: function() { | ||
this.listenTo(Adapt, 'device:changed', this.resizeImage); | ||
preRender: function() { | ||
this.listenTo(Adapt, 'device:changed', this.resizeImage); | ||
|
||
this.checkIfResetOnRevisit(); | ||
}, | ||
this.checkIfResetOnRevisit(); | ||
}, | ||
|
||
postRender: function() { | ||
this.resizeImage(Adapt.device.screenSize, true); | ||
}, | ||
postRender: function() { | ||
this.resizeImage(Adapt.device.screenSize, true); | ||
}, | ||
|
||
checkIfResetOnRevisit: function() { | ||
var isResetOnRevisit = this.model.get('_isResetOnRevisit'); | ||
checkIfResetOnRevisit: function() { | ||
var isResetOnRevisit = this.model.get('_isResetOnRevisit'); | ||
|
||
if (isResetOnRevisit) { | ||
this.model.reset(isResetOnRevisit); | ||
} | ||
}, | ||
if (isResetOnRevisit) { | ||
this.model.reset(isResetOnRevisit); | ||
} | ||
}, | ||
|
||
resizeImage: function(width, setupInView) { | ||
var imageWidth = width === 'medium' ? 'small' : width; | ||
var imageSrc = (this.model.get('_graphic')) ? this.model.get('_graphic')[imageWidth] : ''; | ||
this.$('.graphic-widget img').attr('src', imageSrc); | ||
resizeImage: function(width, setupInView) { | ||
var imageWidth = width === 'medium' ? 'small' : width; | ||
var imageSrc = (this.model.get('_graphic')) ? this.model.get('_graphic')[imageWidth] : ''; | ||
this.$('.js-graphic-set-image-src').attr('src', imageSrc); | ||
|
||
this.$('.graphic-widget').imageready(function() { | ||
this.setReadyStatus(); | ||
this.$('.graphic__widget').imageready(function() { | ||
this.setReadyStatus(); | ||
|
||
if (setupInView) { | ||
this.setupInviewCompletion('.component-widget'); | ||
} | ||
}.bind(this)); | ||
if (setupInView) { | ||
this.setupInviewCompletion('.graphic__widget'); | ||
} | ||
}); | ||
|
||
return Adapt.register('graphic', { | ||
model: ComponentModel.extend({}),// create a new class in the inheritance chain so it can be extended per component type if necessary later | ||
view: GraphicView | ||
}); | ||
}.bind(this)); | ||
} | ||
}); | ||
|
||
return Adapt.register('graphic', { | ||
model: ComponentModel.extend({}),// create a new class in the inheritance chain so it can be extended per component type if necessary later | ||
view: GraphicView | ||
}); | ||
|
||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
<div class="graphic-inner component-inner"> | ||
{{> component this}} | ||
<div class="graphic-widget component-widget{{#if _graphic.attribution}} graphic-widget-attribution{{/if}}"> | ||
<img src="{{_graphic.src}}" data-large="{{_graphic.large}}" data-small="{{_graphic.small}}" {{#if _graphic.alt}}aria-label="{{_graphic.alt}}"{{else}}aria-hidden="true"{{/if}} /> | ||
<div class="component__inner graphic__inner"> | ||
|
||
{{> component this}} | ||
|
||
<div class="component__widget graphic__widget"> | ||
|
||
<div class="graphic__image-container{{#if _graphic.attribution}} has-attribution{{/if}}"> | ||
|
||
<img class="graphic__image js-graphic-set-image-src" src="{{_graphic.src}}" data-large="{{_graphic.large}}" data-small="{{_graphic.small}}" {{#if _graphic.alt}}aria-label="{{_graphic.alt}}"{{else}}aria-hidden="true"{{/if}}> | ||
|
||
{{#if _graphic.attribution}} | ||
<div class="component__attribution graphic__attribution"> | ||
<div class="component__attribution-inner graphic__attribution-inner"> | ||
{{{_graphic.attribution}}} | ||
</div> | ||
</div> | ||
{{/if}} | ||
|
||
</div> | ||
{{#if _graphic.attribution}} | ||
<div class="graphic-attribution">{{{_graphic.attribution}}}</div> | ||
{{/if}} | ||
|
||
</div> | ||
|
||
</div> |