Skip to content

Commit

Permalink
Revert "Revert "Fix lint errors""
Browse files Browse the repository at this point in the history
This reverts commit 8ed65fd.
  • Loading branch information
stavmars authored and DaryaTarasowa committed Feb 23, 2017
1 parent fec56b9 commit c5db9e7
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 134 deletions.
6 changes: 3 additions & 3 deletions .eslintrc
Expand Up @@ -19,11 +19,11 @@
"arrow-spacing": [2, { "before": true, "after": true }],
"arrow-parens": [2, "always"],
"eqeqeq": [2, "smart"],
"indent": [2, 4, {SwitchCase: 1}],
"quotes": [2, 'single'],
"indent": [2, 4, {"SwitchCase": 1}],
"quotes": [2, "single"],
"linebreak-style": [2, "unix"],
"prefer-arrow-callback": 2,
"dot-notation": [2, {allowKeywords: true}], //some libraries use keywords like catch or delete
"dot-notation": [2, {"allowKeywords": true}], //some libraries use keywords like catch or delete
"no-use-before-define": 0,
"no-unused-vars": 0, // see https://github.com/babel/babel-eslint/issues/21
"semi": [2, "always"],
Expand Down
2 changes: 1 addition & 1 deletion actions/history/loadContentHistory.js
Expand Up @@ -2,7 +2,7 @@ import { shortTitle } from '../../configs/general';
import deckContentTypeError from '../error/deckContentTypeError';
import slideIdTypeError from '../error/slideIdTypeError';
import { AllowedPattern } from '../error/util/allowedPattern';
import DeckTreeStore from '../../stores/DeckTreeStore.js'
import DeckTreeStore from '../../stores/DeckTreeStore.js';
import { isEmpty } from '../../common.js';

export default function loadContentHistory(context, payload, done) {
Expand Down
47 changes: 23 additions & 24 deletions actions/user/userSignOut.js
@@ -1,31 +1,30 @@
import async from 'async';
import { navigateAction } from 'fluxible-router';
import {navigateAction} from 'fluxible-router';

export default function userSignOut(context, payload, done) {
async.series([
// (callback) => {
// context.dispatch('USER_SIGNOUT', payload);
// callback();
// },
(callback) => {
console.log(location.pathname.split('/')[location.pathname.split('/').length - 1]);
// (callback) => {
// context.dispatch('USER_SIGNOUT', payload);
// callback();
// },
(callback) => {
console.log(location.pathname.split('/')[location.pathname.split('/').length - 1]);

if(location.pathname.split('/').pop() !== payload.username && location.pathname.includes(payload.username))
context.executeAction(navigateAction, { url: '/' }, callback);
else if(location.pathname.split('/').pop() === 'edit') {
let newPath = location.pathname.substring(0,location.pathname.length - 4).concat('view');
context.executeAction(navigateAction, { url: newPath}, callback);
}
else
callback();
},
(callback) => {
context.deleteUser(); //clear user (is cookie) via userStoragePlugin
callback();
if (location.pathname.split('/').pop() !== payload.username && location.pathname.includes(payload.username))
context.executeAction(navigateAction, {url: '/'}, callback);
else if (location.pathname.split('/').pop() === 'edit') {
let newPath = location.pathname.substring(0, location.pathname.length - 4).concat('view');
context.executeAction(navigateAction, {url: newPath}, callback);
}
],
(err, result) => {
if(err) console.log(err);
done();
});
else
callback();
},
(callback) => {
context.deleteUser(); //clear user (is cookie) via userStoragePlugin
callback();
}
], (err, result) => {
if (err) console.log(err);
done();
});
}
6 changes: 3 additions & 3 deletions components/AddDeck/AddDeck.js
Expand Up @@ -270,9 +270,9 @@ class AddDeck extends React.Component {
if (this.props.ImportStore.deckId !== null &&
this.props.ImportStore.uploadProgress < 100 &&
this.props.ImportStore.error === null) {
setTimeout( () => {
this.context.executeAction(checkNoOfSlides, {id: this.props.ImportStore.deckId});
}, 100);
setTimeout( () => {
this.context.executeAction(checkNoOfSlides, {id: this.props.ImportStore.deckId});
}, 100);
}

return (
Expand Down
Expand Up @@ -7,9 +7,9 @@ class ContentQuestionAnswersItem extends React.Component {

let rightIcon = (<i className="icon"></i>);
switch (answer.correct) {
case true:
rightIcon = (<i className="checkmark icon teal"></i>);
break;
case true:
rightIcon = (<i className="checkmark icon teal"></i>);
break;
}

return (
Expand Down
Expand Up @@ -10,7 +10,7 @@ class ContentUsagePanel extends React.Component {
this {this.props.ContentUsageStore.selector.stype}.</div>;
const usageListComp = <div>
<ContentUsageList usage={this.props.ContentUsageStore.usage}
selector={this.props.ContentUsageStore.selector}/></div>
selector={this.props.ContentUsageStore.selector}/></div>;
return (
<div ref="contentUsagePanel" className="ui">
<div> {(this.props.ContentUsageStore.usage.length === 0) ? noUsageMessage : usageListComp}</div>
Expand Down
Expand Up @@ -7,8 +7,8 @@ class ContributorsUtil {
}

static contains(slides, slide) {
var found = false;
for (var i = 0; i < slides.length; i++) {
let found = false;
for (let i = 0; i < slides.length; i++) {
if (slides[i] === slide) {
found = true;
break;
Expand Down
Expand Up @@ -60,7 +60,7 @@ class ContentActionsFooter extends React.Component {

getExportHref(type){
if (type !== 'EPub' && type !== 'PDF') {
return;
return;
}
if (this.props.ContentStore.selector.id !== undefined && this.props.ContentStore.selector.id !== '' && this.props.ContentStore.selector.id !== 0)
{
Expand Down
Expand Up @@ -84,7 +84,7 @@ class DeckPropertiesEditor extends React.Component {
}

handleChange(fieldName, event) {
var stateChange = {};
let stateChange = {};
stateChange[fieldName] = event.target.value;
this.setState(stateChange);
}
Expand Down
Expand Up @@ -31,15 +31,7 @@ class SlideContentEditor extends React.Component {


handleSaveButton(){

if (this.props.UserProfileStore.username === '')
{
//TODO: show login modal via context action
alert('you need to login to save changes');
}
else
{

if (this.props.UserProfileStore.username !== '') {
// Replace the onbeforeunload function by a Blank Function because it is not neccesary when saved.
swal({
title: 'Saving Content...',
Expand All @@ -54,10 +46,10 @@ class SlideContentEditor extends React.Component {
//remove editing borders:
$('.pptx2html [style*="absolute"]')
.css({'borderStyle': '', 'borderColor': ''});
$(".pptx2html")
$('.pptx2html')
.css({'borderStyle': '', 'borderColor': '', 'box-shadow': ''});
//reset scaling of pptx2html element to get original size
$(".pptx2html").css({'transform': '', 'transform-origin': ''});
$('.pptx2html').css({'transform': '', 'transform-origin': ''});

//ReactDOM.findDOMNode(this.refs.inlineContent).attr('value');
//ReactDOM.findDOMNode(this.refs.inlineContent).getContent();
Expand Down Expand Up @@ -183,21 +175,20 @@ class SlideContentEditor extends React.Component {
//CKEDITOR.inline('inlineContent', {filebrowserUploadUrl: Microservices.import.uri + '/importImage/' + userId, customConfig: '../../../../../../custom_modules/ckeditor/config.js'});
CKEDITOR.inline('inlineContent', {
customConfig: '/assets/ckeditor_config.js',
filebrowserUploadUrl: Microservices.import.uri + '/importImage/' + userId}); //leave all buttons
filebrowserUploadUrl: Microservices.import.uri + '/importImage/' + userId}); //leave all buttons

}
this.currentcontent = this.props.content;

ReactDOM.findDOMNode(this.refs.container).addEventListener('resize', (evt) =>
{
if(process.env.BROWSER){
//this.resize();
//alert('resize');
this.forceUpdate();
}
ReactDOM.findDOMNode(this.refs.container).addEventListener('resize', (evt) => {
if(process.env.BROWSER){
//this.resize();
// alert('resize');
this.forceUpdate();
}
});

CKEDITOR.instances.inlineContent.on("instanceReady", function() {
CKEDITOR.instances.inlineContent.on('instanceReady', function() {
//needs copy of resize function == cannot find this.something in this context.
//tried ReactDOM.findDOMNode(this.refs.inlineContent).addEventListener('instanceReady', (evt) =>
//but did not work
Expand All @@ -207,13 +198,13 @@ class SlideContentEditor extends React.Component {
//this.forceUpdate();
//this.resize();
// }
if ($(".pptx2html [style*='absolute']").not('.drawing-container').css('borderStyle') !== 'dashed')
if ($('.pptx2html [style*="absolute"]').not('.drawing-container').css('borderStyle') !== 'dashed')
{
$(".pptx2html [style*='absolute']").not('.drawing-container').css({'borderStyle': 'dashed', 'borderColor': '#33cc33'});
$('.pptx2html [style*="absolute"]').not('.drawing-container').css({'borderStyle': 'dashed', 'borderColor': '#33cc33'});
}
let containerwidth = document.getElementById('container').offsetWidth;
let containerheight = document.getElementById('container').offsetHeight;
$(".pptx2html").css({'transform': '', 'transform-origin': ''});
$('.pptx2html').css({'transform': '', 'transform-origin': ''});
let pptxwidth = $('.pptx2html').width();
let pptxheight = $('.pptx2html').height();
if (containerwidth > pptxwidth)
Expand All @@ -222,25 +213,25 @@ class SlideContentEditor extends React.Component {
} else {
this.scaleratio = containerwidth / pptxwidth;
}
$(".pptx2html").css({'transform': '', 'transform-origin': ''});
$(".pptx2html").css({'transform': 'scale('+this.scaleratio+','+this.scaleratio+')', 'transform-origin': 'top left'});
$('.pptx2html').css({'transform': '', 'transform-origin': ''});
$('.pptx2html').css({'transform': 'scale('+this.scaleratio+','+this.scaleratio+')', 'transform-origin': 'top left'});
require('../../../../../custom_modules/simple-draggable/lib/index.js');

SimpleDraggable(".pptx2html [style*='absolute']", {
onlyX: false
, onlyY: false
, ratio: this.scaleratio
SimpleDraggable('.pptx2html [style*="absolute"]', {
onlyX: false,
onlyY: false,
ratio: this.scaleratio
});
SimpleDraggable(".pptx2html > [style*='absolute'] > [style*='absolute']", {
SimpleDraggable('.pptx2html > [style*="absolute"] > [style*="absolute"]', {
onlyX: false
, onlyY: false
, ratio: this.scaleratio
});
if(document.domain != "localhost")
if(document.domain !== 'localhost')
{
document.domain = 'slidewiki.org';
}
$(".pptx2html").css({'borderStyle': 'none none double none', 'borderColor': '#3366ff', 'box-shadow': '0px 100px 1000px #ff8787'});
$('.pptx2html').css({'borderStyle': 'none none double none', 'borderColor': '#3366ff', 'box-shadow': '0px 100px 1000px #ff8787'});
});


Expand All @@ -257,8 +248,7 @@ class SlideContentEditor extends React.Component {
this.resize();
}
}
resize()
{
resize() {
//if(process.env.BROWSER){
//require('../../../../../bower_components/reveal.js/css/reveal.css');
// Uncomment this to see with the different themes. Assuming testing for PPTPX2HTML for now
Expand All @@ -268,18 +258,17 @@ class SlideContentEditor extends React.Component {
//require('../../SetupReveal.css');
/*add border*/
//alert($(".pptx2html [style*='absolute']").css('borderStyle'));
if ($(".pptx2html [style*='absolute']").not('.drawing-container').css('borderStyle') !== 'dashed')
{
$(".pptx2html [style*='absolute']").not('.drawing-container').css({'borderStyle': 'dashed', 'borderColor': '#33cc33'});
}
if ($('.pptx2html [style*="absolute"]').not('.drawing-container').css('borderStyle') !== 'dashed') {
$('.pptx2html [style*="absolute"]').not('.drawing-container').css({'borderStyle': 'dashed', 'borderColor': '#33cc33'});
}
//}

let containerwidth = document.getElementById('container').offsetWidth;
let containerheight = document.getElementById('container').offsetHeight;
//console.log('Component has been resized! Width =' + containerwidth + 'height' + containerheight);

//reset scaling of pptx2html element to get original size
$(".pptx2html").css({'transform': '', 'transform-origin': ''});
$('.pptx2html').css({'transform': '', 'transform-origin': ''});

//Function to fit contents in edit and view component
//let pptxwidth = document.getElementByClassName('pptx2html').offsetWidth;
Expand All @@ -290,17 +279,17 @@ class SlideContentEditor extends React.Component {

this.scaleratio = containerwidth / pptxwidth;

$(".pptx2html").css({'transform': '', 'transform-origin': ''});
$(".pptx2html").css({'transform': 'scale('+this.scaleratio+','+this.scaleratio+')', 'transform-origin': 'top left'});
$('.pptx2html').css({'transform': '', 'transform-origin': ''});
$('.pptx2html').css({'transform': 'scale('+this.scaleratio+','+this.scaleratio+')', 'transform-origin': 'top left'});
require('../../../../../custom_modules/simple-draggable/lib/index.js');

//TODO: remove previous event listeners!
SimpleDraggable(".pptx2html [style*='absolute']", {
SimpleDraggable('.pptx2html [style*="absolute"]', {
onlyX: false
, onlyY: false
, ratio: this.scaleratio
});
SimpleDraggable(".pptx2html > [style*='absolute'] > [style*='absolute']", {
SimpleDraggable('.pptx2html > [style*="absolute"] > [style*="absolute"]', {
onlyX: false
, onlyY: false
, ratio: this.scaleratio
Expand All @@ -310,10 +299,10 @@ class SlideContentEditor extends React.Component {
this.refs.inlineContent.style.height = ((pptxheight + 0 + 20) * this.scaleratio) + 'px';

//show that content is outside of pptx2html box
$(".pptx2html").css({'borderStyle': 'none none double none', 'borderColor': '#3366ff', 'box-shadow': '0px 100px 1000px #ff8787'});
$('.pptx2html').css({'borderStyle': 'none none double none', 'borderColor': '#3366ff', 'box-shadow': '0px 100px 1000px #ff8787'});

//fix bug with speakernotes overlapping soure dialog/other elements - SWIK-832
$("#inlineSpeakerNotes [style*='absolute']").css({'position': 'relative', 'zIndex': '0'});
$('#inlineSpeakerNotes [style*="absolute"]').css({'position': 'relative', 'zIndex': '0'});
}

componentWillUnmount() {
Expand Down Expand Up @@ -405,7 +394,7 @@ class SlideContentEditor extends React.Component {
this.addBoxButtonHTML = <button tabIndex="0" ref="submitbutton" className="ui blue basic button" onClick={this.addAbsoluteDiv.bind(this)} onChange={this.addAbsoluteDiv.bind(this)}>
<i className="plus square outline icon"></i>
Add input box
</button>
</button>;
} else {this.addBoxButtonHTML = '';}

return (
Expand Down Expand Up @@ -440,12 +429,10 @@ class SlideContentEditor extends React.Component {
}*/

emitChange() {

window.onbeforeunload = () => {
return 'If you don\'t save the slide, it won\'t be updated. ' +
'Are you sure you want to exit this page?';

};
window.onbeforeunload = () => {
return 'If you don\'t save the slide, it won\'t be updated. ' +
'Are you sure you want to exit this page?';
};
}
/*
confirmExit() {
Expand Down

0 comments on commit c5db9e7

Please sign in to comment.