Skip to content

Commit

Permalink
Merge branch 'release/0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
abought committed Dec 20, 2016
2 parents 1bb98bb + 8b29943 commit 76d694e
Show file tree
Hide file tree
Showing 126 changed files with 2,143 additions and 1,365 deletions.
2 changes: 1 addition & 1 deletion .env-travis
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OSF_CLIENT_ID=<CLIENT_ID>
OSF_SCOPE=osf.users.all_read
OSF_SCOPE=osf.users.profile_read
OSF_URL=https://staging.osf.io
OSF_AUTH_URL=https://staging-accounts.osf.io
JAMDB_NAMESPACE=experimenter
Expand Down
1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tmp/**
11 changes: 11 additions & 0 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* jshint node:true */
'use strict';

module.exports = {
extends: 'recommended',

rules: {
'bare-strings': false,
'block-indentation': 4
}
};
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ install:
- bower install

script:
- npm test
- npm run check-style && npm test
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ You will need the following things properly installed on your computer.
* [Ember CLI](http://www.ember-cli.com/)
* [PhantomJS](http://phantomjs.org/)

## Prepare JamDB instance
Experimenter is designed to talk to a [JamDB](https://github.com/CenterForOpenScience/jamdb) server for all
data storage. In most cases you will be provided a remote staging server for development purposes, but for advanced
development, [these setup scripts](https://github.com/samchrisinger/jam-setup) can help define a basic skeleton for
your project.

## Installation

* `git clone <repository-url>` this repository
Expand Down Expand Up @@ -52,9 +58,11 @@ To login via OSF:
* in .env file include:
```bash
OSF_CLIENT_ID="\<client ID for staging account\>"
OSF_SCOPE="osf.users.all_read"
OSF_SCOPE="osf.users.profile_read"
OSF_URL="https://staging-accounts.osf.io"
SENTRY_DSN=""
WOWZA_PHP='{}'
WOWZA_ASP='{}'
```

First:
Expand Down
6 changes: 3 additions & 3 deletions app/authorizers/osf-jwt.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Base from 'ember-simple-auth/authorizers/base';

export default Base.extend({
authorize(sessionData, setHeader) {
setHeader('Authorization', sessionData.token);
}
authorize(sessionData, setHeader) {
setHeader('Authorization', sessionData.token);
}
});
Empty file removed app/components/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions app/components/ace-editor/template.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{{! template-lint-disable style-concatenation }}
<div id="editor" style="position: relative; height: {{height}};"></div>
{{yield ctx}}
26 changes: 26 additions & 0 deletions app/components/bread-crumbs/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{! template-lint-disable block-indentation }}{{!-- linter seems to be having trouble parsing nested blocks --}}
<ol class="breadcrumb">
{{#each breadCrumbs as |crumb|}}
{{#if crumb.isCurrent}}
<li class="active">
{{crumb.label}}
</li>
{{else}}
<li>
{{#if crumb.linkable}}
{{#if crumb.model}}{{! to avoid null/undefined model in link-to }}
{{#link-to crumb.path crumb.model}}
{{crumb.label}}
{{/link-to}}
{{else}}
{{#link-to crumb.path}}
{{crumb.label}}
{{/link-to}}
{{/if}}
{{else}}
{{crumb.label}}
{{/if}}
</li>
{{/if}}
{{/each}}
</ol>
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,53 @@ export default Ember.Component.extend({
deleting: false,
showDeleteWarning: false,
actions: {
toggleEditing: function() {
toggleEditing() {
this.toggleProperty('editing');
if (!this.get('editing') && this.get('experiment.hasDirtyAttributes')) {
this.get('experiment').save().then(() => {
this.get('toast.info')('Experiment saved successfully.');
});
}
},
stop: function() {
stop() {
var exp = this.get('experiment');
exp.set('state', exp.ARCHIVED);
exp.save().then(() => {
return this.get('store').findRecord('collection', exp.get('sessionCollectionId')).then((collection) => {
exp.save().then(() => this.get('store').findRecord('collection', exp.get('sessionCollectionId'))
.then((collection) => {
collection.set('permissions', {});
return collection.save();
}).then(() => this.get('toast.info')('Experiment stopped successfully.'));
});
})
.then(() => this.get('toast.info')('Experiment stopped successfully.'))
);
},
start: function() {
start() {
var exp = this.get('experiment');
exp.set('state', exp.ACTIVE);
exp.save().then(() => {
return this.get('store').findRecord('collection', exp.get('sessionCollectionId')).then((collection) => {
exp.save().then(() => this.get('store').findRecord('collection', exp.get('sessionCollectionId'))
.then((collection) => {
collection.set('permissions', {
[`jam-${this.get('namespaceConfig').get('namespace')}:accounts-*`] : 'CREATE'
});
[`jam-${this.get('namespaceConfig').get('namespace')}:accounts-*`]: 'CREATE'
});
return collection.save();
}).then(() => this.get('toast.info')('Experiment started successfully.'));
});
})
.then(() => this.get('toast.info')('Experiment started successfully.'))
);
},
delete: function() {
delete() {
this.toggleProperty('showDeleteWarning');
this.set('deleting', true);

var exp = this.get('experiment');
exp.set('state', exp.DELETED);
exp.save().then(() => {
return this.get('store').findRecord('collection', exp.get('sessionCollectionId')).then((collection) => {
exp.save().then(() => this.get('store').findRecord('collection', exp.get('sessionCollectionId'))
.then((collection) => {
collection.set('permissions', {});
return collection.save();
}).then(() => this.sendAction('onDelete', exp));
});
})
.then(() => this.sendAction('onDelete', exp))
);
},
clone: function() {
clone() {
var exp = this.get('experiment');
var expData = exp.toJSON();
expData.title = `Copy of ${expData.title}`;
Expand All @@ -76,12 +79,11 @@ export default Ember.Component.extend({
expData.thumbnailId = thumbnail.get('id');
finish();
});
}
else {
} else {
finish();
}
},
onSetImage: function(thumbnail) {
onSetImage(thumbnail) {
var exp = this.get('experiment');
exp.set('thumbnail', thumbnail);
exp.save().then(() => {
Expand Down
165 changes: 165 additions & 0 deletions app/components/experiment-detail/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<div class="col-md-12">
{{#if (not editing) }}
<div class="row">
<h3> {{experiment.title}}</h3>
<button class="btn btn-default pull-right" {{ action 'toggleEditing' }}>
<i class="fa fa-pencil-square-o"></i> Edit Details
</button>
<br>
</div>
<div class="row">
{{img-selector thumbnail=experiment.thumbnail.raw edit=false}}
</div>
<br>
<div class="row">
<p> {{if experiment.description experiment.description 'No description'}} </p>
</div>
<div class="row">
<label>Purpose:</label>
<p> {{if experiment.purpose experiment.purpose 'None specified'}} </p>
</div>
<div class="row">
<label>Duration:</label> {{if experiment.duration experiment.duration 'Not specified'}}
</div>
<div class="row">
<label>Exit URL:</label> {{if experiment.exitUrl experiment.exitUrl 'Not specified'}}
</div>
<div class="row">
<label>Participant Eligibility: </label> {{experiment.eligibilityString}}
</div>
<div class="row">
<label>Minimum Age: </label> {{experiment.eligibilityMinAge}}
</div>
<div class="row">
<label>Maximum Age: </label> {{experiment.eligibilityMaxAge}}
</div>
{{/if}}
{{#if editing }}
<div class="form">
<div class="row">
<div class="col-xs-8">
{{input class="increase-4 form-control" value=experiment.title}}
</div>
<div class="col-xs-4">
<button class="btn btn-success pull-right" {{action 'toggleEditing'}}>
<i class="fa fa-save"></i> Save Details
</button>
</div>
</div>
<br>
<div class="row">
{{img-selector thumbnail=experiment.thumbnail.raw edit=true onSetImage=(action 'onSetImage')}}
</div>
<br>
<div class="row">
<p>
{{textarea value=experiment.description class="experiment-textarea form-control"
placeholder="Give your experiment a description here..."}}
</p>
</div>
<div class="row">
<label>Purpose: </label>
<p>
{{textarea value=experiment.purpose class="experiment-textarea form-control"
placeholder="Explain the purpose of your experiment here..."}}
</p>
</div>

<div class="row">
<label>Duration: </label> {{input value=experiment.duration
class="experiment-detail-wide form-control"}}
</div>
<div class="row">
<label>Exit URL: </label> {{input value=experiment.exitUrl class="experiment-detail-wide form-control"}}
</div>
<div class="row">
<label>Participant Eligibility: </label> {{input value=experiment.eligibilityString
class="experiment-detail-wide form-control"}}
</div>
<div class="row">
<label>Minimum age: </label> {{input value=experiment.eligibilityMinAge
class="experiment-detail-wide form-control"
placeholder="9 months"}}
</div>
<div class="row">
<label>Maximum age: </label> {{input value=experiment.eligibilityMaxAge
class="experiment-detail-wide form-control" placeholder="2 years"}}
</div>
</div>
{{/if}}
<div class="row">
<label>Last Edited: </label> {{moment-format experiment.lastEdited 'MMMM D, YYYY'}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<br>
</div>
<div class="row">
<label>Status:</label> {{experiment.state}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{{#if (eq experiment.state 'Active')}}
<button class="btn btn-danger" {{ action 'stop' }}> Stop Experiment Now</button>
{{/if}}
{{#if (eq experiment.state 'Draft') }}
<button class="btn btn-success" {{ action 'start' }}> Start Experiment Now</button>
{{/if}}
{{#if (eq experiment.state 'Archived') }}
<button class="btn btn-primary" {{ action 'start' }}> Re-run Experiment Now</button>
{{/if}}
<br>
<br>
<br>
</div>
<div class="row">
{{#link-to 'experiments.info.edit' tagName='div' class="btn col-md-4"}}
<div class="well">
<center>
<p><i class="increase-4 fa fa-list"></i></p>
<h4> Build Experiment </h4>
<p> Add/Modify experiment components </p>
</center>
</div>
{{/link-to}}
{{#link-to 'experiments.info.results' tagName='div' class="btn col-md-4"}}
<div class="well">
<center>
<p><i class="increase-4 fa fa-file-text-o"></i></p>
<h4> View <strong>{{sessions.length}}</strong> Responses </h4>
<p> Inspect responses from studies </p>
</center>
</div>
{{/link-to}}
<div class="btn col-md-4" role="button" {{action 'clone'}}>
<div class="well">
<center>
<p><i class="increase-4 fa fa-files-o"></i></p>
<h4> Clone Experiment </h4>
<p> Copy experiment structure and details </p>
</center>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<button class="btn btn-danger" disabled={{experiment.isActive}} {{action 'toggleDeleteWarning' }}>
Delete this Experiment
</button>
{{#if experiment.isActive }}&nbsp;&nbsp;You can't delete active experiments {{/if}}
</div>
</div>
</div>

{{#bs-modal open=showDeleteWarning title="Are you sure?" footer=false}}
{{#bs-modal-body}}
Deleting this experiment will remove it from your list of experiments. This action is irreversible.
{{/bs-modal-body}}
{{#bs-modal-footer as |footer|}}
<div class="row pull-right">
<div class="col-xs-4">
{{#bs-button action=(action "close" target=footer) type="default"}}Cancel{{/bs-button}}
</div>
<div class="col-xs-4">
{{#bs-button action=(action "delete") type="danger"}}Delete now{{/bs-button}}
</div>
</div>
{{/bs-modal-footer}}
{{/bs-modal}}

{{#bs-modal open=deleting footer=false closeButton=false title="Please wait"}}Deleting experiment...{{/bs-modal}}
4 changes: 0 additions & 4 deletions app/components/experiment-summary.js

This file was deleted.

File renamed without changes.
37 changes: 37 additions & 0 deletions app/components/experiment-summary/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<div class="col-md-12 well">
<div class="row table-block">
<div class="col-xs-8">
<strong>{{experiment.title}}</strong>
</div>
<div class="col-xs-2 text-center">
{{#if experiment.beginDate}}
<strong>{{moment-format experiment.beginDate 'MMMM D, YYYY'}}</strong>
{{else}}
n/a
{{/if}}
</div>
<div class="col-xs-2 text-center">
{{#if experiment.endDate}}
<strong>{{moment-format experiment.endDate 'MMMM D, YYYY'}}</strong>
{{else}}
n/a
{{/if}}
</div>
</div>
<div class="row table-block">
<div class="col-xs-12">
{{experiment.description}}
</div>
</div>
<div class="row table-block">
<div class="col-xs-2">
<strong>Status: </strong>{{experiment.state}}
</div>
<div class="col-xs-3">
<strong>Last Edited: </strong>{{moment-format experiment.modifiedOn 'M/D/YYYY'}}
</div>
<div class="col-xs-2 pull-right">
{{#link-to "experiments.info" experiment.id class="btn btn-default" }}Details{{/link-to}}
</div>
</div>
</div>
Loading

0 comments on commit 76d694e

Please sign in to comment.