Skip to content

Commit

Permalink
fixes linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sdellis committed Dec 15, 2015
1 parent 175ba87 commit 108fbbc
Show file tree
Hide file tree
Showing 15 changed files with 3,037 additions and 2,982 deletions.
5,812 changes: 2,938 additions & 2,874 deletions public/tabula.1.0.0.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import babelPolyfill from 'babel-polyfill'
import 'babel-polyfill'
import app from 'ampersand-app'
import pageLabels from 'page-label-generator'
import styles from './styles/main.styl'
Expand Down
4 changes: 2 additions & 2 deletions src/components/slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default React.createClass({
},

getInitialState () {
const {name, payload} = this.props.slide
const {name} = this.props.slide
return {
name: name
}
Expand Down Expand Up @@ -55,7 +55,7 @@ export default React.createClass({

render () {
const {slide} = this.props
const {name, payload} = this.state
const {name} = this.state
let markup

if (slide.editing) {
Expand Down
12 changes: 6 additions & 6 deletions src/models/presentation/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export default Model.extend({
type: 'string',
required: 'true',
default: 'oa:Annotation',
test: function(value){
test: function (value) {
if (value !== 'oa:Annotation') {
return "Value must equal 'oa:Annotation'.";
return "Value must equal 'oa:Annotation'."
}
return false;
return false
}
},
motivation: 'string',
Expand All @@ -41,12 +41,12 @@ export default Model.extend({
return !this.saved
},

parse: function(response){
response.about = response.on //remap an oddly named attribute
parse: function (response) {
response.about = response.on // remap an oddly named attribute
delete response.on

response.resources = []
if(!Array.isArray(response.resource)){
if (!Array.isArray(response.resource)) {
response.resources.push(response.resource)
} else {
response.resources = response.resource
Expand Down
20 changes: 10 additions & 10 deletions src/models/presentation/annotationlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ export default Model.extend({
'@id': 'string',
'@context': 'string',
'@type': {
type : 'string',
required : 'true',
default : 'sc:AnnotationList',
test: function(value){
if (value !== 'sc:AnnotationList') {
return "Value must equal 'sc:AnnotationList'.";
}
return false;
}
},
type: 'string',
required: 'true',
default: 'sc:AnnotationList',
test: function (value) {
if (value !== 'sc:AnnotationList') {
return "Value must equal 'sc:AnnotationList'."
}
return false
}
}
},

collections: {
Expand Down
20 changes: 10 additions & 10 deletions src/models/presentation/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ export default Model.extend({
'@id': 'string',
'@context': 'string',
'@type': {
type : 'string',
required : 'true',
default : 'sc:Canvas',
test: function(value){
if (value !== 'sc:Canvas') {
return "Value must equal 'sc:Canvas'.";
}
return false;
}
},
type: 'string',
required: 'true',
default: 'sc:Canvas',
test: function (value) {
if (value !== 'sc:Canvas') {
return "Value must equal 'sc:Canvas'."
}
return false
}
},
label: 'string',
height: 'number',
width: 'number'
Expand Down
9 changes: 3 additions & 6 deletions src/models/presentation/collection-collection.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import Collection from 'ampersand-rest-collection'
import iiifCollection from './collection'
import githubMixin from '../helpers/github-mixin'
import config from '../config'
import IIIFCollection from './collection'

//export default Collection.extend(githubMixin, {
export default Collection.extend({
url: '', // some collection store

model: iiifCollection,
model: IIIFCollection,

getById (id) {
let model = this.findWhere({_id: id})

if (!model) {
model = new iiifCollection({_id: id})
model = new IIIFCollection({_id: id})
}

model.fetch()
Expand Down
26 changes: 13 additions & 13 deletions src/models/presentation/collection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Model from 'ampersand-model'
import ManifestCollection from './manifest-collection'
import iiifCollection from './collection-collection'
import IIIFCollection from './collection-collection'
import ServiceCollection from './service-collection'
import config from '../config'

Expand All @@ -20,16 +20,16 @@ export default Model.extend({
_id: 'string',
'@id': 'string',
'@type': {
type : 'string',
required : 'true',
default : 'sc:Collection',
test: function(value){
if (value !== 'sc:Collection') {
return "Value must equal 'sc:Collection'.";
}
return false;
}
},
type: 'string',
required: 'true',
default: 'sc:Collection',
test: function (value) {
if (value !== 'sc:Collection') {
return "Value must equal 'sc:Collection'."
}
return false
}
},
label: 'string',
logo: 'string',
license: 'string',
Expand All @@ -45,7 +45,7 @@ export default Model.extend({

collections: {
manifests: ManifestCollection,
collections: iiifCollection,
collections: IIIFCollection,
services: ServiceCollection
},

Expand All @@ -56,5 +56,5 @@ export default Model.extend({
return 'collections/' + this._id
}
}

}
})
50 changes: 25 additions & 25 deletions src/models/presentation/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ export default Model.extend({
'@id': 'string',
'@context': 'string',
'@type': {
type : 'string',
required : 'true',
default : 'sc:Manifest',
test: function(value){
if (value !== 'sc:Manifest') {
return "Value must equal 'sc:Manifest'.";
}
return false;
}
},
type: 'string',
required: 'true',
default: 'sc:Manifest',
test: function (value) {
if (value !== 'sc:Manifest') {
return "Value must equal 'sc:Manifest'."
}
return false
}
},
label: 'string',
thumbnail: 'string',
viewingHint: 'string',
Expand All @@ -52,34 +52,34 @@ export default Model.extend({
fn () {
var s = ''

if( this.metadata ) {
this.metadata.forEach(function(md) {
if(md.label === 'Subjects'){
s = md.value.join(', ')
}
})
if (this.metadata) {
this.metadata.forEach(function (md) {
if (md.label === 'Subjects') {
s = md.value.join(', ')
}
})
}

return s
}
},
/****
/* ***
// The getManifest() method is for demo purposes, showing how one can use
// the Manifesto library within this app by attaching a Manifesto object,
// with all its methods to this model.
// i.e. this.manifest.getLabel()
****/
*** */
getManifest: {
deps: ['_id'],
fn () {
var _this = this
manifesto.loadManifest(config.manifestStore + '/' + this._id).then(function(manifest) {
_this.manifest = manifesto.create(manifest)
return _this.manifest
},
function(error) {
console.error("Failed!", error);
});
manifesto.loadManifest(config.manifestStore + '/' + this._id).then(function (manifest) {
_this.manifest = manifesto.create(manifest)
return _this.manifest
},
function (error) {
console.error('Failed!', error)
})
this.manifest = _this.manifest
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/models/presentation/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ export default Model.extend({
return !this.saved
},

parse: function(response){

parse: function (response) {
response.services = []
if(!Array.isArray(response.service)){
if (!Array.isArray(response.service)) {
response.services.push(response.service)
} else {
response.services = response.service
Expand Down
20 changes: 10 additions & 10 deletions src/models/presentation/sequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ export default Model.extend({
'@id': 'string',
'@context': 'string',
'@type': {
type : 'string',
required : 'true',
default : 'sc:Sequence',
test: function(value){
if (value !== 'sc:Sequence') {
return "Value must equal 'sc:Sequence'.";
}
return false;
}
},
type: 'string',
required: 'true',
default: 'sc:Sequence',
test: function (value) {
if (value !== 'sc:Sequence') {
return "Value must equal 'sc:Sequence'."
}
return false
}
},
label: 'string',
viewingDirection: 'string',
viewingHint: 'string',
Expand Down
2 changes: 1 addition & 1 deletion src/models/presentation/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export default Model.extend({
isNew () {
return !this.saved
}

})
16 changes: 8 additions & 8 deletions src/models/presentation/test/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';
'use strict'

import test from 'tape';
import Manifest from '../manifest.js';
import test from 'tape'
import Manifest from '../manifest.js'

test('manifest @type must equal sc:Manifest', function (assert) {
assert.plan(1);
assert.plan(1)

var m = Manifest;
var m = Manifest
m['@type'] = 'sc:Sequence'

assert.equal(m['@type'], 'sc:Manifest', 'should generate 1');
assert.equal(m['@type'], 'sc:Manifest', 'should generate 1')

assert.end();
});
assert.end()
})
8 changes: 3 additions & 5 deletions src/pages/presentation-detail.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react'
import ampersandMixin from 'ampersand-react-mixin'
import manifesto from '../../node_modules/manifesto.js/dist/server/manifesto.js'
// import Slide from '../components/slide'

export default React.createClass({
mixins: [ampersandMixin],
Expand Down Expand Up @@ -31,7 +29,7 @@ export default React.createClass({
<ul>
{presentation.manifest.getSequences().map((sequence) => {
let label = 'Untitled Slide Group'
if ( !sequence.getLabel() === 'undefined' ) { label = sequence.getLabel() }
if (!sequence.getLabel() === 'undefined') { label = sequence.getLabel() }
return (
<li><strong>{label}</strong> : {sequence.getTotalCanvases()} slides</li>
)
Expand All @@ -40,10 +38,10 @@ export default React.createClass({
<p>
<button onClick={this.onAddClick} className='button'>Add a Slide</button>
</p>
<ul className="sequence">
<ul className='sequence'>
{presentation.manifest.getSequences()[0].getThumbs(200).map((thumb) => {
return (
<li className="slide"><img src={thumb.uri}/></li>
<li className='slide'><img src={thumb.uri}/></li>
)
})}
</ul>
Expand Down
13 changes: 5 additions & 8 deletions src/pages/presentations.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@ export default React.createClass({

render () {
const {presentations} = this.props

return (
<div>
<h1>Presentations Gallery</h1>
<div>
{presentations.map((presentation) => {
//if (presentation.name.startsWith('tabula-')) {
return (
<div key={presentation._id}>
<a href={presentation.app_url}><span className='octicon octicon-repo'></span> {presentation.label}</a>
</div>
)
//}
return (
<div key={presentation._id}>
<a href={presentation.app_url}><span className='octicon octicon-repo'></span> {presentation.label}</a>
</div>
)
})}
</div>
</div>
Expand Down

0 comments on commit 108fbbc

Please sign in to comment.