Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
Merge pull request #194 from learningequality/release-v1.1.x
Browse files Browse the repository at this point in the history
Release v1.1.x
  • Loading branch information
indirectlylit authored Jul 3, 2019
2 parents 264970c + ab08b8a commit ae234c2
Show file tree
Hide file tree
Showing 21 changed files with 12,189 additions and 815 deletions.
27 changes: 17 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,35 @@ clean-pyc:
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +

update-perseus:
# update the constants.js to store the mathjax config file name.
# Ben: This seems like it doesn't detect the file name?
# This doesn't work, but until we have to update perseus, this should
# is not important
> kolibri_exercise_perseus_plugin/assets/src/constants.js
config_file_name="$(basename kolibri_exercise_perseus_plugin/static/mathjax/2.1/config/*)"
file_content="const ConfigFileName = '${config_file_name}'; module.exports = { ConfigFileName };"
echo "${file_content}" >> kolibri_exercise_perseus_plugin/assets/src/constants.js
cd kolibri_exercise_perseus_plugin && yarn run extract-messages

dev:
cd kolibri_exercise_perseus_plugin && yarn run dev

assets:
# move mathjax to static folder for our hacky loading.
# move mathjax to static folder for our hacky loading
rm -r kolibri_exercise_perseus_plugin/static
mkdir kolibri_exercise_perseus_plugin/static
cp -r kolibri_exercise_perseus_plugin/node_modules/perseus/lib/mathjax kolibri_exercise_perseus_plugin/static/
mkdir kolibri_exercise_perseus_plugin/static/images
cp kolibri_exercise_perseus_plugin/node_modules/perseus/images/spinner.gif kolibri_exercise_perseus_plugin/static/images
cp -r kolibri_exercise_perseus_plugin/node_modules/perseus/lib/mathquill/fonts kolibri_exercise_perseus_plugin/static/

# update the constants.js to store the mathjax config file name.
# Ben: This seems like it doesn't detect the file name?
> kolibri_exercise_perseus_plugin/assets/src/constants.js
config_file_name="$(basename kolibri_exercise_perseus_plugin/static/mathjax/2.1/config/*)"
file_content="const ConfigFileName = '${config_file_name}'; module.exports = { ConfigFileName };"
echo "${file_content}" >> kolibri_exercise_perseus_plugin/assets/src/constants.js

cd kolibri_exercise_perseus_plugin && yarn run extract-messages
cd kolibri_exercise_perseus_plugin && yarn run clean && yarn run build

check-build:
[ -e kolibri_exercise_perseus_plugin/static/images/spinner.gif ] || ( echo "Please run: make assets" && exit 1 )

dist: clean check-build
dist: clean assets check-build
python setup.py bdist_wheel --universal

release:
Expand Down
22 changes: 8 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,13 @@ Getting started with development
pip install -e .
pip install -e <KOLIBRI-PERSEUS-PLUGIN-LOCAL-PATH>
kolibri plugin kolibri_exercise_perseus_plugin enable
yarn install

4. Make sure that this message **DID NOT** appear in your logging output of ``yarn install``::

WARNING assets/src/module.js not found for plugin exercise_perseus_render_module.

5. After cloning for the first time, or if you made any changes to the project,
you need to rebuild it::
4. Within the perseus plugin repo directory, run the following command, again using your kolibri dev virtualenv::

make assets
cd kolibri_exercise_perseus_plugin
yarn install
cd ..
make dist


Updating translation strings
Expand Down Expand Up @@ -85,19 +82,16 @@ Next, follow these steps carefully:
2. Run ``pip install twine``.
3. Update the version number in ``kolibri_exercise_perseus_plugin/__init__.py``. Commit it to the perseus release branch. Tag a new release using `github's web UI <https://github.com/learningequality/kolibri-exercise-perseus-plugin/releases>`__.
4. Check out the tagged commit and ensure that you have no local changes.
5. From the Kolibri repo (**NOT THE PERSEUS REPO**) run the frontend build command::

make assets

6. Change directory to the perseus repo. Build the .whl file by running::
5. Build the frontend assets and .whl file by running::

make dist

7. Check that there are CSS, JS, and JSON files when searching the wheel file for ``kolibri_exercise_perseus_plugin``::
6. Check that there are CSS, JS, and JSON files when searching the wheel file for ``kolibri_exercise_perseus_plugin``::

unzip -vl dist/[GENERATED WHEEL FILE NAME] | grep exercise_perseus_render_module

8. Sign and publish to PyPi::
7. Sign and publish to PyPi::

make release

Expand Down
2 changes: 1 addition & 1 deletion kolibri_exercise_perseus_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.2b1"
__version__ = "1.1.8"
8 changes: 5 additions & 3 deletions kolibri_exercise_perseus_plugin/assets/src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const getVarOptions = message => {
const reg = /(?:\{([^}]+)\})/g;
let match;
while ((match = reg.exec(message))) {
options[match[1]] = match[0];
options[match[1].trim()] = match[0];
}
return options;
};
Expand Down Expand Up @@ -92,8 +92,10 @@ const interpolateStringToFragment = (str, options = {}) => {
return createFragment(result);
};

export const $_ = (options, str) => {
if (arguments.length !== 2 || typeof str !== 'string') {
export const $_ = (...args) => {
const options = args[0];
const str = args[1];
if (args.length !== 2 || typeof str !== 'string') {
return '<$_> must have exactly one child, which must be a string';
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template v-if="itemId">

<div class="perseus-root bibliotron-exercise">
<div :class="{'framework-perseus':true, 'perseus-mobile': isMobile}">
<div ref="perseus" id="perseus">
<div class="framework-perseus" :class="{'perseus-mobile': isMobile}">
<div id="perseus" ref="perseus" style="background-color: white;">
<div class="loader-container">
<KLinearLoader
v-show="loading"
Expand All @@ -11,10 +11,10 @@
/>
</div>
<div
:dir="dir"
id="problem-area"
:dir="dir"
>
<div id="workarea" :style="isMobile ? { marginLeft: '0px' } : {}"></div>
<div id="workarea" style="margin-left: 0px"></div>
</div>

<div
Expand Down Expand Up @@ -46,18 +46,18 @@
</div>


<div :dir="dir" id="hintlabel" v-if="hinted">{{ $tr("hintLabel") }}</div>
<div :dir="dir" id="hintsarea" :style="isMobile ? { marginLeft: '0px' } : {}"></div>
<div v-if="hinted" id="hintlabel" :dir="dir">{{ $tr("hintLabel") }}</div>
<div id="hintsarea" :dir="dir" style="margin-left: 0px"></div>

<div style="clear: both;"></div>

</div>

<transition name="expand">
<div :dir="dir" id="message" v-show="message">{{ message }}</div>
<div v-show="message" id="message" :dir="dir">{{ message }}</div>
</transition>

<div :dir="dir" id="answer-area-wrap">
<div id="answer-area-wrap" :dir="dir" :style="background">
<div id="answer-area">
<div class="info-box">
<div id="solutionarea"></div>
Expand All @@ -67,23 +67,23 @@

<KButton
v-if="scratchpad"
id="scratchpad-show"
:primary="false"
:raised="false"
id="scratchpad-show"
:text="$tr('showScratch')"
/>
<KButton
v-else
id="scratchpad-not-available"
:primary="false"
:raised="false"
disabled
id="scratchpad-not-available"
:text="$tr('notAvailable')"
/>

<!-- Need a DOM mount point for reactDOM to attach to,
but Perseus renders weirdly so doesn't use this -->
<div :dir="dir" ref="perseusContainer" id="perseus-container"></div>
<div id="perseus-container" ref="perseusContainer" :dir="dir"></div>
</div>
</div>

Expand Down Expand Up @@ -458,27 +458,15 @@

<style lang="scss" scoped>
@import '~kolibri.styles.definitions';
@import '../../../node_modules/perseus/stylesheets/local-only/khan-exercise.css';
@import '../../../node_modules/perseus/lib/katex/katex.css';
@import '../../../node_modules/perseus/build/perseus.css';
@import '../../../node_modules/perseus/lib/mathquill/mathquill.css';
#perseus {
border-radius: 8px;
padding: 16px;
background-color: $core-bg-light;
overflow-x: auto;
}
#solutionarea {
border: none;
}
#answer-area-wrap {
background-color: $core-bg-light;
}
.bibliotron-exercise {
margin-bottom: 8px;
}
Expand Down Expand Up @@ -643,10 +631,34 @@
border-collapse: collapse;
border-spacing: 0;
}
.simple-button {
border-radius: 3px;
border: 1px solid #e6e6e6;
text-shadow: none;
background-color: #e7e7e7;
background-image: linear-gradient(to bottom,#eee,#dcdcdc);
background-repeat: repeat-x;
color: #444!important;
padding: 5px 10px;
cursor: pointer!important;
font-family: inherit;
line-height: 20px;
margin: 3px;
position: relative;
text-decoration: none!important;
text-shadow: none;
transition: box-shadow ease-in-out .15s;
}
}
.keypad-container {
direction: ltr;
}
// try to prevent nested scroll bars
.perseus-widget-container > div {
overflow: visible !important;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export default (widget, type, rubric) => {
}
try {
widgetSolvers[type](widget, rubric);
const blurWidget = widget.blurInputPath;
// Call blurWidget with an empty path
blurWidget && blurWidget('');
} catch (e) {
logging.debug('An error occurred while solving a problem', e);
}
Expand Down
2 changes: 1 addition & 1 deletion kolibri_exercise_perseus_plugin/getMessages.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const esprima = require('esprima');
const esprima = require('espree');
const walk = require('walk');
const path = require('path');
const fs = require('fs');
Expand Down
Loading

0 comments on commit ae234c2

Please sign in to comment.