Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/sugar-web/activity/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define(["../../webL10n",

var presenceCallback = null;
var presenceResponse = null;

var activity = {};

activity.setup = function () {
Expand All @@ -25,7 +25,7 @@ define(["../../webL10n",
function sendPauseEvent() {
var pauseEvent = document.createEvent("CustomEvent");
pauseEvent.initCustomEvent('activityPause', false, false, {
'cancelable': true
'cancelable': true
});
window.dispatchEvent(pauseEvent);
}
Expand All @@ -38,7 +38,7 @@ define(["../../webL10n",
function sendStopEvent() {
var stopEvent = document.createEvent("CustomEvent");
stopEvent.initCustomEvent('activityStop', false, false, {
'cancelable': true
'cancelable': true
});
var result = window.dispatchEvent(stopEvent);
if (result) {
Expand Down Expand Up @@ -87,7 +87,7 @@ define(["../../webL10n",
presence.joinSharedActivity(environment.sharedId, function() {
var group_color = presence.getSharedInfo().colorvalue;
icon.colorize(activityButton, group_color);
datastoreObject.setMetadata({"buddy_color":group_color});
datastoreObject.setMetadata({"buddy_color":group_color});
datastoreObject.save(function() {});
});
}
Expand All @@ -103,6 +103,9 @@ define(["../../webL10n",
activityPalette.setTitleDescription(metadata);
});
});
if (environment.standAlone) {
document.getElementById("stop-button").style.visibility = "hidden";
};
});
};

Expand All @@ -119,7 +122,7 @@ define(["../../webL10n",
}
return presence;
};

activity.getXOColor = function (callback) {
function onResponseReceived(error, result) {
if (error === null) {
Expand Down
8 changes: 5 additions & 3 deletions src/containers/Builders/CLOZEForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ class CLOZEForm extends Component {
};

// submit and exercise and redirect
submitExercise = (bool) => {
submitExercise = (bool, e) => {
e.preventDefault();

let id = this.state.id;
if (this.state.id === -1) {
id = this.props.counter;
Expand Down Expand Up @@ -459,14 +461,14 @@ class CLOZEForm extends Component {
<br/>
<div className="justify-content-end">
<button
onClick={() => this.submitExercise(false)}
onClick={(e) => this.submitExercise(false, e)}
className={"btn button-finish"}
disabled={!this.state.isFormValid}
>
<FormattedMessage id={FINISH_EXERCISE}/>
</button>
<button
onClick={() => this.submitExercise(true)}
onClick={(e) => this.submitExercise(true, e)}
className={"btn button-finish"}
disabled={!this.state.isFormValid}
>
Expand Down
8 changes: 5 additions & 3 deletions src/containers/Builders/MCQForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ class MCQForm extends Component {
};

// submit exercise
submitExercise = (bool) => {
submitExercise = (bool,e) => {
e.preventDefault();

let id = this.state.id;
if (this.state.id === -1) {
id = this.props.counter;
Expand Down Expand Up @@ -429,14 +431,14 @@ class MCQForm extends Component {
</div>
<div className="form-group row justify-content-between">
<button
onClick={()=>this.submitExercise(false)}
onClick={(e)=>this.submitExercise(false,e)}
className={"btn button-finish"}
disabled={!this.state.noOfQuestions >= 1}
>
<FormattedMessage id={FINISH_EXERCISE}/>
</button>
<button
onClick={()=> this.submitExercise(true)}
onClick={(e)=> this.submitExercise(true,e)}
className={"btn button-finish"}
disabled={!this.state.noOfQuestions >= 1}
>
Expand Down
8 changes: 5 additions & 3 deletions src/containers/Builders/REORDERForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ class REORDERForm extends Component {

handleNewEvent = event => {
event.preventDefault();

};

submitExercise = (bool) => {
submitExercise = (bool, e) => {
e.preventDefault();
let id = this.state.id;

if (this.state.id === -1) {
Expand Down Expand Up @@ -307,14 +309,14 @@ class REORDERForm extends Component {
<br/>
<div className="justify-content-end">
<button
onClick={()=>this.submitExercise(false)}
onClick={(e)=>this.submitExercise(false,e)}
className={"btn button-finish"}
disabled={!this.state.isFormValid}
>
<FormattedMessage id={FINISH_EXERCISE}/>
</button>
<button
onClick={()=>this.submitExercise(true)}
onClick={(e)=>this.submitExercise(true, e)}
className={"btn button-finish"}
disabled={!this.state.isFormValid}
>
Expand Down
11 changes: 7 additions & 4 deletions src/containers/Builders/Template.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ class Template extends Component {
reorderSelected = () => {
this.props.history.push('/new/reorder')
};

;
render() {
let styles = { "background-color": this.props.current_user.colorvalue.stroke };
return (
<div className="template-container">
<div className="template-container" style={styles}>
<div className="col-md-10 mx-auto">
<div className="row justify-content-center align-self-center">
<div className="col-sm-4">
Expand Down Expand Up @@ -92,8 +93,10 @@ class Template extends Component {
}

function mapStateToProps(state) {
return {};
return {
current_user: state.current_user
};
}


export default withRouter(connect(mapStateToProps)(Template));
export default withRouter(connect(mapStateToProps)(Template));
5 changes: 3 additions & 2 deletions src/containers/ExerciseList.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class ExerciseList extends Component {
stroke = current_user.colorvalue.stroke;
fill = current_user.colorvalue.fill;
}
let styles = {"background-color": fill};

let userIcon="";

Expand Down Expand Up @@ -153,7 +154,7 @@ class ExerciseList extends Component {
}

return (
<div className="home-container">
<div className="home-container" style={styles}>
{userIcon}
{userAdmin}
<div className="exercise-list-container">
Expand Down Expand Up @@ -182,4 +183,4 @@ function MapStateToProps(state) {
export default withRouter(
connect(MapStateToProps,
{removeExercises, editExercise, addSharedExercise, removeSharedExercise}
)(ExerciseList));
)(ExerciseList));
6 changes: 3 additions & 3 deletions src/containers/Sugarizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import locale_es from 'react-intl/locale-data/es';
import default_activities from "../default_activities";

// Sugarizer Dependencies
import activity from 'lib/sugar-web/activity/activity'
import env from 'lib/sugar-web/env'
import presencepalette from 'lib/sugar-web/graphics/presencepalette'
import activity from '../lib/sugar-web/activity/activity'
import env from '../lib/sugar-web/env'
import presencepalette from '../lib/sugar-web/graphics/presencepalette'

//Components
import Main from "./Router";
Expand Down
1 change: 0 additions & 1 deletion src/css/ExerciseList.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@
.home-container{
height: auto;
min-height: 100%;
background-color: lightblue;
}
1 change: 0 additions & 1 deletion src/css/NewExerciseTemplate.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
.template-container{
height: 100%;
padding-top: 5%;
background-color: lightyellow;
}

.card-body{
Expand Down
1 change: 1 addition & 0 deletions src/lib