Skip to content

Commit

Permalink
Merge pull request #104 from ExtensionEngine/develop
Browse files Browse the repository at this point in the history
v2.4.3
  • Loading branch information
underscope committed Jun 13, 2018
2 parents bd8bbc7 + 2777ab1 commit 5eda17a
Show file tree
Hide file tree
Showing 79 changed files with 822 additions and 307 deletions.
1 change: 1 addition & 0 deletions .activities-rc.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "Example Course",
"structure": [{
"type": "GOAL",
"label": "Goal",
"color": "#ff6590",
"level": 1,
"meta":[{
Expand Down
5 changes: 0 additions & 5 deletions .bithoundrc

This file was deleted.

3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
9 changes: 1 addition & 8 deletions client/components/common/Meta/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div
:class="{ editing }"
@focusout="focusoutInput"
@mousedown="onEdit"
@mousedown.stop="focusInput"
class="input">
<label :for="meta.key">{{ meta.label }}</label>
<div
Expand Down Expand Up @@ -38,13 +38,6 @@ export default {
};
},
methods: {
onEdit(e) {
if (this.editing) {
e.preventDefault();
return;
}
this.focusInput();
},
focusInput() {
this.editing = true;
setTimeout(() => this.$refs[this.meta.key].focus(), 0);
Expand Down
14 changes: 9 additions & 5 deletions client/components/course/InsertActivity/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@

<script>
import { getLevel } from 'shared/activities';
import { getOutlineChildren } from 'utils/activity';
import { getOutlineChildren, getParent } from 'utils/activity';
import { mapActions, mapGetters } from 'vuex-module';
import ActivityBrowser from 'components/common/ActivityBrowser';
import calculatePosition from 'utils/calculatePosition';
import CreateActivity from './CreateActivity';
import filter from 'lodash/filter';
import find from 'lodash/find';
import findIndex from 'lodash/findIndex';
import get from 'lodash/get';
import map from 'lodash/map';
import SelectAction from './SelectAction';
export default {
Expand All @@ -56,9 +57,12 @@ export default {
...mapGetters(['structure'], 'course'),
supportedLevels() {
if (!this.parent) return filter(this.structure, { level: 1 });
const parentType = find(this.structure, { type: this.parent.type });
const { level, subLevels = [] } = parentType;
const cond = it => subLevels.includes(it.type) || (it.level === level);
const grandParent = getParent(this.activities, this.parent);
const { subLevels = [] } = find(this.structure, { type: this.parent.type });
const sameLevel = grandParent
? get(find(this.structure, { type: grandParent.type }), 'subLevels', [])
: map(filter(this.structure, { level: 1 }), 'type');
const cond = l => subLevels.includes(l.type) || sameLevel.includes(l.type);
return filter(this.structure, cond);
}
},
Expand Down
3 changes: 2 additions & 1 deletion client/components/course/Revisions/EntityRevisions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export default {
},
methods: {
getRevisions() {
const params = { entityId: this.revision.state.id };
const { entity, state } = this.revision;
const params = { entity, entityId: state.id };
return axios.get(this.baseUrl, { params }).then(({ data: { data } }) => {
data.forEach(it => {
if (includes(WITHOUT_STATICS, it.state.type)) it.resolved = true;
Expand Down
2 changes: 2 additions & 0 deletions client/components/course/Revisions/RevisionItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ export default {
.content {
flex: 1;
overflow: hidden;
.description {
font-size: 16px;
word-wrap: break-word;
}
.name {
Expand Down
8 changes: 4 additions & 4 deletions client/components/course/Revisions/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</template>

<script>
import { isSameInstance } from 'utils/revision';
import { mapActions, mapGetters } from 'vuex-module';
import CircularProgress from 'components/common/CircularProgress';
import InfiniteLoading from 'vue-infinite-loading';
Expand All @@ -41,10 +42,9 @@ export default {
...mapGetters(['hasMoreResults'], 'revisions'),
bundledRevisions() {
return reduce(this.revisions, (acc, it) => {
const previousRevision = last(acc);
const isSameEntity = previousRevision.state.id === it.state.id;
const isSameOperation = previousRevision.operation === it.operation;
if (!isSameEntity || !isSameOperation) acc.push(it);
const prevRevision = last(acc);
const isSameOperation = prevRevision.operation === it.operation;
if (!isSameInstance(prevRevision, it) || !isSameOperation) acc.push(it);
return acc;
}, [this.revisions[0]]);
}
Expand Down
8 changes: 5 additions & 3 deletions client/components/editor/structure/AddElement/SelectWidth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<div class="select-width">
<div
v-for="width in widths"
:key="width.value"
@click="$emit('selected', width.value)"
class="content-width">
<span :class="width.icon" class="mdi"></span>
<span>{{ width.label }} width</span>
</div>
</div>
</template>
Expand All @@ -15,8 +17,8 @@ export default {
data() {
return {
widths: [
{ value: 6, icon: 'mdi-view-agenda mdi-rotate-90' },
{ value: 12, icon: 'mdi-checkbox-blank' }
{ label: 'Half', value: 6, icon: 'mdi-page-layout-sidebar-left' },
{ label: 'Full', value: 12, icon: 'mdi-page-layout-body' }
]
};
}
Expand Down Expand Up @@ -44,7 +46,7 @@ export default {
}
.mdi {
font-size: 26px;
font-size: 36px;
}
}
</style>
4 changes: 4 additions & 0 deletions client/components/editor/structure/Exams/AssessmentGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ h4 {
margin: 30px 0;
padding: 15px 20px;
.assessment-item {
margin-bottom: 12px;
}
.well {
font-size: 16px;
}
Expand Down
5 changes: 4 additions & 1 deletion client/components/editor/teaching-elements/Embed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export default {
}
.overlay {
display: flex;
flex-flow: row;
align-items: center;
justify-content: center;
position: absolute;
z-index: 99;
width: 100%;
Expand All @@ -77,7 +81,6 @@ export default {
opacity: 0.9;
.message {
padding-top: 119px;
color: green;
font-size: 22px;
}
Expand Down
2 changes: 1 addition & 1 deletion client/components/editor/toolbar/EmbedToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
v-model="height"
v-validate="{
rules: {
required: true, numeric: true, min_value: 300, max_value: 3000
required: true, numeric: true, min_value: 50, max_value: 3000
}
}"
@input="onChange"
Expand Down
6 changes: 6 additions & 0 deletions client/utils/activity.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { getLevel } from 'shared/activities';
import filter from 'lodash/filter';
import find from 'lodash/find';
import get from 'lodash/get';
import sortBy from 'lodash/sortBy';

export function getParent(activities, activity) {
const id = get(activity, 'parentId', null);
return id && find(activities, { id });
}

export function getChildren(activities, parentId) {
return sortBy(filter(activities, { parentId }), 'position');
}
Expand Down
4 changes: 4 additions & 0 deletions client/utils/revision.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ function describeCourseRevision(rev) {
return `${getAction(rev.operation)} course`;
}

export function isSameInstance(a, b) {
return (a.entity === b.entity) && (a.state.id === b.state.id);
}

export function getFormatDescription(rev, activity) {
return describe[rev.entity](rev, activity);
}
Expand Down
2 changes: 2 additions & 0 deletions config/client/brand.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const brandConfig = require('rcfile')('brand-');
const map = require('lodash/map');
const merge = require('lodash/merge');
Expand Down
7 changes: 5 additions & 2 deletions config/client/poi.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const brand = require('./brand');
const Dotenv = require('dotenv-webpack');
const find = require('lodash/find');
Expand All @@ -19,7 +21,7 @@ const rules = [{
test: /bootstrap-sass[/\\]assets[/\\]javascripts[/\\]/,
use: 'imports-loader?jQuery=jquery'
}, {
test: /\.load.js$/,
test: /\.load\.js$/,
use: 'val-loader'
}];

Expand Down Expand Up @@ -68,10 +70,11 @@ module.exports = (options, req) => ({
sourceMap: options.mode === 'development',
hotEntry: 'app',
generateStats: true,
// Override using: `npm run dev:server -- --port <number>`
port: 8080,
devServer: {
proxy: {
'/api/v1': {
'/api': {
target: `http://127.0.0.1:${serverPort}`
}
}
Expand Down
2 changes: 2 additions & 0 deletions config/server/auth.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const corsAllowedOrigins = (process.env.CORS_ALLOWED_ORIGINS || '')
.split(',')
.filter(s => s)
Expand Down
2 changes: 2 additions & 0 deletions config/server/database.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

require('dotenv').load();

const config = {
Expand Down
2 changes: 2 additions & 0 deletions config/server/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
auth: require('./auth'),
storage: require('./storage'),
Expand Down
2 changes: 2 additions & 0 deletions config/server/storage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
amazon: {
key: process.env.STORAGE_KEY,
Expand Down
2 changes: 2 additions & 0 deletions config/shared/activities-rc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const CONTENT_CONTAINERS = [{
type: 'INTRO',
label: 'Introduction',
Expand Down
2 changes: 2 additions & 0 deletions config/shared/activities-rc.load.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
'use strict';

module.exports = require('../utils/configLoader')('activities');
2 changes: 2 additions & 0 deletions config/shared/activities.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const filter = require('lodash/filter');
const find = require('lodash/find');
const first = require('lodash/first');
Expand Down
2 changes: 2 additions & 0 deletions config/shared/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
role: require('./role')
};
2 changes: 2 additions & 0 deletions config/shared/role.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const values = require('lodash/values');

const userRoles = { USER: 'USER', ADMIN: 'ADMIN', INTEGRATION: 'INTEGRATION' };
Expand Down
2 changes: 2 additions & 0 deletions config/shared/schema-parser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const find = require('lodash/find');
const get = require('lodash/get');
const map = require('lodash/map');
Expand Down
2 changes: 2 additions & 0 deletions config/shared/schema-validation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const yup = require('yup');

const activityType = yup.string().min(2).max(50);
Expand Down
2 changes: 2 additions & 0 deletions config/utils/configLoader.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const readConfig = require('./readConfig');

module.exports = function configLoader(name) {
Expand Down
2 changes: 2 additions & 0 deletions config/utils/mergeConfig.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const flatMap = require('lodash/flatMap');
const groupBy = require('lodash/groupBy');
const keyBy = require('lodash/keyBy');
Expand Down
2 changes: 2 additions & 0 deletions config/utils/readConfig.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const argv = require('minimist')(process.argv.slice(2));
const path = require('path');
const rcfile = require('rcfile');
Expand Down
Loading

0 comments on commit 5eda17a

Please sign in to comment.