-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of adapt-contrib-accordion
- Render a list of clickable titles, which reveal display text
- Loading branch information
Kevin Corry
committed
Nov 29, 2013
1 parent
771eb0d
commit a0df989
Showing
21 changed files
with
8,096 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"directory": "src/plugins", | ||
"registry": "http://adapt-bower-repository.herokuapp.com/" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- 0.10 |
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,4 +1,4 @@ | ||
adapt-contrib-accordion | ||
======================= | ||
=============== | ||
|
||
An accordion component that displays clickable titles, which reveal display text |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "adapt-contrib-accordion", | ||
"version": "0.0.1", | ||
"homepage": "https://github.com/adaptlearning/adapt-contrib-accordion", | ||
"authors": [ | ||
"Kevin Corry <[email protected]>" | ||
], | ||
"description": "An accordion component that displays clickable titles, which reveal display text", | ||
"main": "/js/adapt-contrib-accordion.js", | ||
"keywords": [ | ||
"adapt-plugin", | ||
"adapt-component" | ||
], | ||
"license": "GPLv3" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
define(function(require) { | ||
var ComponentView = require('coreViews/componentView'); | ||
var Adapt = require('coreJS/adapt'); | ||
|
||
var Accordion = ComponentView.extend({ | ||
|
||
postRender: function() { | ||
this.setReadyStatus(); | ||
this.setCompletionStatus(); | ||
}, | ||
|
||
events: { | ||
'click .item .title' : 'toggleItem' | ||
}, | ||
|
||
toggleItem: function (event) { | ||
event.preventDefault(); | ||
this.$('.item .body').stop(true,true).slideUp(); | ||
if (!$(event.currentTarget).hasClass('selected')) { | ||
this.$('.item .title').removeClass('selected'); | ||
$(event.currentTarget).addClass('selected visited').siblings('.body').slideToggle(); | ||
this.$('.icon').removeClass('minus').addClass('plus'); | ||
$('.icon', event.currentTarget).removeClass('plus').addClass('minus'); | ||
} else { | ||
this.$('.item .title').removeClass('selected'); | ||
$(event.currentTarget).removeClass('selected'); | ||
$('.icon', event.currentTarget).removeClass('minus').addClass('plus'); | ||
} | ||
if (this.$('.item .visited').length==this.$('.item').length && this.model.get('complete')==false) { | ||
this.model.set('complete',true); | ||
} | ||
} | ||
|
||
}); | ||
|
||
Adapt.register("accordion", Accordion); | ||
|
||
}); |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module.exports = function(config) { | ||
config.set({ | ||
// The root path location that will be used to resolve all relative paths | ||
// defined in files and exclude | ||
basePath: '', | ||
// List of files or patterns to load in the browser | ||
files: [ | ||
{ pattern: 'src/**/*.js', included: false }, | ||
{ pattern: 'test/spec/**/*.js', included: false }, | ||
'test/test-main.js' | ||
], | ||
// List of frameworks you want to use: jasmine, mocha, qunit | ||
frameworks: ['expect', 'mocha', 'requirejs'], | ||
// Enable or disable watching files and executing the tests | ||
// whenever one of these files changes. | ||
autoWatch: false, | ||
// Chrome (comes installed with Karma) | ||
// ChromeCanary (comes installed with Karma) | ||
// PhantomJS (comes installed with Karma) | ||
// Firefox (requires karma-firefox-launcher plugin) | ||
// Opera (requires karma-opera-launcher plugin) | ||
// Internet Explorer (requires karma-ie-launcher plugin) | ||
// Safari (requires karma-safari-launcher plugin) | ||
browsers: ['Chrome', 'PhantomJS', 'Firefox'], | ||
// If singleRun is set to true, Karma will start and capture all | ||
// configured browsers, run tests and then exit with an exit code of 0 or 1. | ||
singleRun: false | ||
}); | ||
}; |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "adapt-contrib-accordion", | ||
"version": "0.0.1", | ||
"description": "An accordion component that displays clickable titles, which reveal display text", | ||
"main": "", | ||
"scripts": { | ||
"test": "./node_modules/.bin/karma start --single-run --browsers PhantomJS" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/adaptlearning/adapt-contrib-accordion.git" | ||
}, | ||
"author": "AdaptLearning", | ||
"license": "GPL v3", | ||
"bugs": { | ||
"url": "https://github.com/adaptlearning/adapt-contrib-accordion/issues" | ||
}, | ||
"devDependencies": { | ||
"karma": "~0.9", | ||
"karma-mocha": "*", | ||
"karma-expect": "*" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<div class="inner"> | ||
{{#if title}} | ||
<div class="title"> | ||
<h4 class="inner"> | ||
{{{title}}} | ||
</h4> | ||
</div> | ||
{{/if}} | ||
{{#if body}} | ||
<div class="body"> | ||
<p class="inner"> | ||
{{{body}}} | ||
</p> | ||
</div> | ||
{{/if}} | ||
<div class="widget"> | ||
{{#each items}} | ||
<div class="item"> | ||
<a href="#" class="title" title="{{alt}}"> | ||
<div class="icon plus"></div> | ||
<h5 class="inner"> | ||
{{{title}}} | ||
</h5> | ||
</a> | ||
<div class="body clearfix"> | ||
<p class="inner"> | ||
{{{body}}} | ||
</p> | ||
</div> | ||
</div> | ||
{{/each}} | ||
</div> | ||
</div> |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Adapt Spec Runner</title> | ||
<link rel="stylesheet" href="libraries/mocha.css"> | ||
<script src="libraries/expect.js"></script> | ||
<script src="libraries/mocha.js"></script> | ||
<script> | ||
var require = { | ||
baseUrl: '../src', | ||
paths: { | ||
jquery: 'core/js/libraries/jquery', | ||
underscore: 'core/js/libraries/underscore', | ||
backbone: 'core/js/libraries/backbone', | ||
modernizr: 'core/js/libraries/modernizr', | ||
handlebars: 'core/js/libraries/handlebars', | ||
imageReady: 'core/js/libraries/imageReady', | ||
inview: 'core/js/libraries/inview', | ||
scrollTo: 'core/js/libraries/scrollTo', | ||
coreJS: 'core/js', | ||
coreViews: 'core/js/views', | ||
coreModels: 'core/js/models', | ||
coreCollections: 'core/js/collections', | ||
templates: 'templates/templates', | ||
components: 'components', | ||
spec: '../test/spec', | ||
expect: '../test/libraries/expect', | ||
mocha: '../test/libraries/mocha' | ||
}, | ||
shim: { | ||
jquery: [], | ||
backbone: { | ||
deps: [ | ||
'underscore', | ||
'jquery' | ||
], | ||
exports: 'Backbone' | ||
}, | ||
underscore: { | ||
exports: '_' | ||
}, | ||
handlebars: { | ||
exports: 'Handlebars' | ||
} | ||
} | ||
} | ||
</script> | ||
<script src="../src/core/js/libraries/require.js"></script> | ||
<script type="text/javascript"> | ||
require(['require', 'expect', 'mocha'], function(require, expect, chai) { | ||
|
||
mocha.setup('bdd'); | ||
mocha.checkLeaks(); | ||
mocha.globals(['jQuery']); | ||
// Require test specs here | ||
// Change componentName to your test file | ||
require([ | ||
'spec/componentName' | ||
], function(capitalize){ | ||
mocha.run(); | ||
}); | ||
|
||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="mocha"></div> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[ | ||
{ | ||
"_id":"a-05", | ||
"_parentId":"co-05", | ||
"_type":"article", | ||
"title":"Article first title" | ||
}, | ||
{ | ||
"_id":"a-10", | ||
"_parentId":"co-05", | ||
"_type":"article", | ||
"title":"Article second title" | ||
}, | ||
{ | ||
"_id":"a-15", | ||
"_parentId":"co-15", | ||
"_type":"article", | ||
"title":"Article third title" | ||
}, | ||
{ | ||
"_id":"a-20", | ||
"_parentId":"co-20", | ||
"_type":"article", | ||
"title":"Article fourth title" | ||
} | ||
] |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"_id":"b-05", | ||
"_parentId":"a-05", | ||
"_type":"block", | ||
"title":"Title of first block" | ||
}, | ||
{ | ||
"_id":"b-10", | ||
"_parentId":"a-05", | ||
"_type":"block", | ||
"title":"Title of second block" | ||
}, | ||
{ | ||
"_id":"b-15", | ||
"_parentId":"a-10", | ||
"_type":"block", | ||
"title":"Title of third block" | ||
}, | ||
{ | ||
"_id":"b-20", | ||
"_parentId":"a-15", | ||
"_type":"block", | ||
"title":"Title of fourth block" | ||
}, | ||
{ | ||
"_id":"b-25", | ||
"_parentId":"a-20", | ||
"_type":"block", | ||
"title":"Title of fifth block" | ||
} | ||
] |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[ | ||
{ | ||
"_id":"c-05", | ||
"_parentId":"b-05", | ||
"_type":"component", | ||
"_component":"text", | ||
"_classes":"", | ||
"title":"Title of our very first component", | ||
"body":"Whoo - if we get this rendering we've made the big time" | ||
}, | ||
{ | ||
"_id":"c-10", | ||
"_parentId":"b-05", | ||
"_type":"component", | ||
"_component":"text", | ||
"_classes":"", | ||
"title":"Title of our very second component", | ||
"body":"Whoo - if we get this rendering we've made the big time" | ||
}, | ||
{ | ||
"_id":"c-15", | ||
"_parentId":"b-10", | ||
"_type":"component", | ||
"_component":"text", | ||
"_classes":"", | ||
"title":"Title of our very third component", | ||
"body":"Whoo - if we get this rendering we've made the big time" | ||
}, | ||
{ | ||
"_id":"c-20", | ||
"_parentId":"b-10", | ||
"_type":"component", | ||
"_component":"text", | ||
"_classes":"", | ||
"title":"Title of our very fourth component", | ||
"body":"Whoo - if we get this rendering we've made the big time" | ||
}, | ||
{ | ||
"_id":"c-25", | ||
"_parentId":"b-15", | ||
"_type":"component", | ||
"_component":"text", | ||
"_classes":"", | ||
"title":"Title of our very fifth component", | ||
"body":"Whoo - if we get this rendering we've made the big time" | ||
} | ||
] |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[ | ||
{ | ||
"_id":"co-05", | ||
"_parentId":"course", | ||
"_type":"page", | ||
"title":"Title of first page model" | ||
}, | ||
{ | ||
"_id":"co-10", | ||
"_parentId":"course", | ||
"_type":"menu", | ||
"title":"Title of second page model" | ||
}, | ||
{ | ||
"_id":"co-15", | ||
"_parentId":"co-10", | ||
"_type":"page", | ||
"title":"Title of third page model" | ||
}, | ||
{ | ||
"_id":"co-20", | ||
"_parentId":"course", | ||
"_type":"page", | ||
"title":"Title of fourth page model" | ||
} | ||
] |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"_id":"course", | ||
"_type":"course", | ||
"title":"Adapt", | ||
"body":"This is the first version of the open source re-architecture" | ||
} |
Oops, something went wrong.