Skip to content

Commit

Permalink
Merge branch 'master' into SWIK-1810_Refresh_JWT_token_with_up-to-dat…
Browse files Browse the repository at this point in the history
…e_user_info
  • Loading branch information
kadevgraaf authored Nov 9, 2017
2 parents 1b1a367 + cb38377 commit b45eed3
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 98 deletions.
92 changes: 59 additions & 33 deletions assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
font-size: 20px;
position: absolute;
right: 0;
width: 200px;
width: 150px;
height: 100vh;
}

Expand All @@ -50,7 +50,7 @@

.top-diff .reveal {
position: relative;
width: calc(100% - 200px);
width: calc(100% - 150px);
}

.top-diff .reveal .slides {
Expand Down Expand Up @@ -84,6 +84,8 @@

.top-diff .inlineContent {
padding: 2%;
display: flex;
flex-direction: column;
}

@media screen and (max-width: 900px) {
Expand All @@ -100,60 +102,76 @@
.top-diff .helpers {
width: 100vw;
position: relative;
height: 180px;
background-color: rgba(255,153,0,0.2);
}

.top-diff .helpers .inlineContent {
display: flex;
flex-direction: column;
}

.top-diff .helpers .checkbox {
flex: 1;
}

.top-diff .helpers .diff-header {
display: none
height: 240px;
}

}

/* HTML DOM Node related */
.diff-view .added, .modified, .deleted {
padding: 5px;
.diff-view .added,
.diff-view .modified,
.diff-view .deleted {
padding: 5px 5px 5px 5px;
margin: 0px -10px;
display: inline-block;
position: relative;
}

.diff-view .added::before,
.diff-view .modified::before,
.diff-view .deleted::before {
color: rgba(0,0,0,0.8);
position: absolute;
font-size: 20px;
right: 5px;
top: -3px;
font-weight: 700;
}

.diff-view ul, .diff-view ol {
display: flex;
flex-direction: column;
}

.diff-view ul .added,
.diff-view ul .modified,
.diff-view ul .deleted {
display: inline-table !important;
}

.diff-view p {
margin: 1em;
}

.diff-view .added {
border: 5px solid #93ca3b;
background-color: rgba(147,202,59,0.2);
border: 2px solid #2196F3;
background-color: rgba(0, 188, 212,0.2);
}
.diff-view .added::before { content: "+" }

.diff-view .modified {
border: 5px solid #FFCC00;
background-color: rgba(255,204,0,0.1);
border: 2px solid #FFCC00;
background-color: rgba(255,204,0,0.2);
}
.diff-view .modified::before { content: "+/-" }

.diff-view .deleted {
border: 5px solid #ff0030;
background-color: rgba(255,0,48,0.1);
border: 2px solid #ff0030;
background-color: rgba(255,0,48,0.2);
}
.diff-view .deleted::before { content: "x" }

.diff-view.inverse .added {
border: 5px solid #2ecc71;
border: 2px solid #2ecc71;
background-color: rgba(46,204,113,0.2);
}
.diff-view.inverse .modified {
border: 5px solid #FF9800;
background-color: rgba(255,152,0,0.1);
border: 2px solid #FF9800;
background-color: rgba(255,152,0,0.2);
}
.diff-view.inverse .deleted {
border: 5px solid #9C27B0;
background-color: rgba(156,39,176,0.1);
border: 2px solid #9C27B0;
background-color: rgba(156,39,176,0.2);
}

/* Text related */
Expand All @@ -171,12 +189,20 @@
line-height: 32px;
}

.diff-view.hide-add .added, .diff-view.hide-mod .modified, .diff-view.hide-del .deleted {
border: 5px solid transparent;
.diff-view.hide-add .added,
.diff-view.hide-mod .modified,
.diff-view.hide-del .deleted {
border: 2px solid transparent;
background-color: transparent;
}
.diff-view.hide-add .added::before,
.diff-view.hide-mod .modified::before,
.diff-view.hide-del .deleted::before {
display: none;
}

.diff-view.hide-text .ins, .diff-view.hide-text .del{
.diff-view.hide-text .ins,
.diff-view.hide-text .del{
color: #333;
background-color: transparent;
text-decoration: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,48 +51,51 @@ class ContentQuestionAnswersList extends React.Component {
let correctAnswers = this.props.items.filter((item) => item.correct).map((node, index) => {
return (
<div key={index}>
<a className="header">
{node.answer}
</a>
<div className="description">
<p>
<label><strong>Explanation:</strong></label> {node.explanation}
</p>
</div>
<a className="header">
{node.answer}
</a>
</div>
);
});

let explanation = (
<div className="description">
<p>
<label><strong>Explanation:</strong></label> {this.props.explanation}
</p>
</div>
);
let answers = (
<div className="ui two column stackable grid">
<div className="ui two column stackable grid">
<div className="column">
<div className="ui grouped fields">
<fieldset>
{list}
</fieldset>
</div>
<div className="ui grouped fields">
<fieldset>
{list}
</fieldset>
</div>
</div>
<div className="column">
<button className="ui compact button primary" onClick={this.handleButtonClick}>
<i className=" help circle icon" />
Show answer
</button>
{/*showEditButton()*/}
<div className="ui item">
<div className="content">
{this.state.showCorrect ? correctAnswers : null}
<button className="ui compact button primary" onClick={this.handleButtonClick}>
<i className=" help circle icon" />
Show answer
</button>
{/*showEditButton()*/}
<div className="ui item">
<div className="content">
{this.state.showCorrect ? correctAnswers : null}
{this.state.showCorrect ? explanation : null}
</div>
</div>
</div>
</div>
</div>
</div>
);

return (
<div ref="contentquestionanswersList">
<div className="ui relaxed list">
{answers}
</div>
</div>
</div>
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ContentQuestionsItem extends React.Component {
render() {
const question = this.props.question;
const answers = (
<ContentQuestionAnswersList items={question.answers} />
<ContentQuestionAnswersList items={question.answers} explanation={question.explanation} />
);

// const editIcon = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1217,9 +1217,9 @@ class SlideContentEditor extends React.Component {
//https://github.com/swisnl/jQuery-contextMenu
//http://swisnl.github.io/jQuery-contextMenu/
$('.pptx2html [style*="absolute"]').each(function () {
this.innerHTML = '<div tabIndex="-1" style="top: -32px; left: 0px; position: absolute; z-index: 90000000;" class="'+ $(this).attr('id')+'dragdiv dragdiv ui button orange outline"><i tabIndex="-1" class="move icon"></i></div>' + this.innerHTML;
this.innerHTML = '<div tabIndex="-1" style="top: -32px; left: -30px; right:-30px; bottom:-30px; position: absolute; z-index: -1; opacity: 0.1;" class="'+ $(this).attr('id')+'dragdiv dragdiv ui button orange outline"><i tabIndex="-1" class="move icon"></i></div>' + this.innerHTML;
$('.'+$(this).attr('id')+'dragdiv').hide();
this.innerHTML = '<div tabIndex="-1" style="top: -32px; left: 60px; position: absolute; z-index: 90000000;" class="context-menu-one ui button blue outline '+ $(this).attr('id')+'" id="'+ $(this).attr('id')+'"><i tabIndex="-1" class="tasks icon"></i></div>' + this.innerHTML;
this.innerHTML = '<div tabIndex="-1" style="top: -32px; left: 0px; position: absolute; z-index: 90000000;" class="context-menu-one ui button blue outline '+ $(this).attr('id')+'" id="'+ $(this).attr('id')+'"><i tabIndex="-1" class="tasks icon"></i></div>' + this.innerHTML;
$('.'+$(this).attr('id')).hide();
//this.innerHTML = '<div><button tabIndex="0" class="'+ $(this).attr('id')+'dragdiv ui button orange outline '+ $(this).attr('id')+'" style="left: 50px; position: absolute; z-index: 90000000;"><i class="move icon small"></i></button></div>' + this.innerHTML;
//let menuID = $(this).attr('id');
Expand Down
34 changes: 17 additions & 17 deletions components/Deck/Diffview/Diffview.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class DiffView extends Component {

//REDUCE complex Object into flat Array
const elements = Object.keys(diff_results).reduce((arr, key) => arr.concat(diff_results[key]), []);
console.log(elements);
// console.log(elements);

//LOG
// console.group();
Expand All @@ -123,16 +123,16 @@ class DiffView extends Component {
return (
<div className="fluid container top-diff">
<div className='helpers'>
<div className='diff-header'>
Settings
</div>
<div className='inlineContent'>
<Radio label='Change color palette' toggle onChange={this.toggleColor}/>
<Checkbox label='Show Addition' defaultChecked onChange={() => this.toggleVisibleChanges('add')} />
<Checkbox label='Show Mofidication' defaultChecked onChange={() => this.toggleVisibleChanges('mod')} />
<Checkbox label='Show Deletion' defaultChecked onChange={() => this.toggleVisibleChanges('del')} />
<Checkbox label='Show Text' defaultChecked onChange={() => this.toggleVisibleChanges('text')} />
</div>
<div className='diff-header'>
Settings
</div>
<div className='inlineContent'>
<Radio label='Change color' toggle onChange={this.toggleColor}/>
<Checkbox label='Additions' defaultChecked onChange={() => this.toggleVisibleChanges('add')} />
<Checkbox label='Modifications' defaultChecked onChange={() => this.toggleVisibleChanges('mod')} />
<Checkbox label='Deletions' defaultChecked onChange={() => this.toggleVisibleChanges('del')} />
<Checkbox label='Text' defaultChecked onChange={() => this.toggleVisibleChanges('text')} />
</div>
</div>

<div className='reveal'>
Expand All @@ -145,14 +145,14 @@ class DiffView extends Component {
${!show.text && 'hide-text'}
`}>
<div className='initVers' id='container'>
<div className='diff-header'>
Revision [ {base.id} ]
</div>
<div className='inlineContent' dangerouslySetInnerHTML={{__html: currContent}}></div>
<div className='diff-header'>
Revision [ {base.id} ]
</div>
<div className='inlineContent' dangerouslySetInnerHTML={{__html: currContent}}></div>
</div>
<div className='mergedVers'>
<div className='diff-header'>
Diff view changes between [ {base.id} ] and [ {diff.id} ]
<div className='diff-header'>
Diff View Changes Between Revisions [ {base.id} ] and [ {diff.id} ]
</div>
<div className='inlineContent' dangerouslySetInnerHTML={{__html: diffcontent}}></div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions components/Deck/Diffview/diff_funcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ const handleREMOVE = (el, source, finalsource) => {
} else {
if(_id){
let targetElement = $(root).find(`#${_id}`);
console.log(targetElement);
targetElement.addClass('deleted');
}
}
Expand Down Expand Up @@ -176,7 +175,6 @@ const handlePROPS = (node, patch, source, finalsource, vnode) => {
const preprocessSrc = (source, mode) => {

source = source
.replace(/&nbsp;/g, '')
.replace(/(?:\r\n|\r|\n)/g, '')
.replace(/&#8203;/g, '');

Expand All @@ -187,7 +185,7 @@ const preprocessSrc = (source, mode) => {

vTreeObject.length > 1 ? root = createElement(vTreeObject[0]) : root = createElement(vTreeObject);

$(root).find('br').remove();
// $(root).find('br').remove();
$(root).find('.drawing-container').remove();
$(root).find('p:empty').remove();
$(root).find('span:empty').remove();
Expand Down
34 changes: 17 additions & 17 deletions services/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ export default {
uri: 'https://questionservice.experimental.slidewiki.org/questions',
//uri: Microservices.questions.uri + '/' + args.stype + '/' + args.sid + '/' + 'questions',
}).then((res) => {
/* This is what we get from microservice */
/*
[{"related_object":"slide","related_object_id":"10678","question":"string","user_id":"17","difficulty":1,"choices":[{"choice":"string","is_correct":true,"explanation":"string"}],"id":10},
{"related_object":"slide","related_object_id":"1141","question":"question 2","user_id":"17","difficulty":2,"choices":[{"choice":"string","is_correct":true,"explanation":"string"},
{"choice":"string","is_correct":true,"explanation":"string"}],"id":11}]
*/
/* This is what we get from microservice */
/*
let q = [{'related_object':'slide','related_object_id':'10678','question':'string','user_id':'17','difficulty':1,'choices':[{'choice':'string','is_correct':true}],'explanation':'string explanation','id':10},
{'related_object':'slide','related_object_id':'1141','question':'question 2','user_id':'17','difficulty':2,'choices':[{'choice':'string1','is_correct':true},{'choice':'string2','is_correct':true},{'choice':'string3','is_correct':false}],'explanation':'string1 string2 explanation','id':11}];
*/
let questions = JSON.parse(res)
.map((item, index) => {
return {
id: item.id, title: item.question, difficulty: item.difficulty, relatedObject: item.related_object, relatedObjectId: item.related_object_id,
answers: item.choices
.map((ans, ansIndex) => {
return {answer: ans.choice, correct: ans.is_correct, explanation: ans.explanation};
}),
userId: item.user_id,
};
}
);
// let questions = q
.map((item, index) => {
return {
id: item.id, title: item.question, difficulty: item.difficulty, relatedObject: item.related_object, relatedObjectId: item.related_object_id,
answers: item.choices
.map((ans, ansIndex) => {
return {answer: ans.choice, correct: ans.is_correct};
}),
explanation: item.explanation,
userId: item.user_id,
};
});
callback(null, {questions: questions, totalLength: 2, selector: selector});
}).catch((err) => {
console.log('Questions get errored. Check via swagger for following object and id:', args.stype, args.sid);
Expand Down

0 comments on commit b45eed3

Please sign in to comment.