cleaned up code
This commit is contained in:
parent
6512b7be8a
commit
adcb46cb41
@ -18,7 +18,7 @@ class FontControl {
|
||||
}
|
||||
};
|
||||
|
||||
export function revertFontState(fs){
|
||||
export function handleRevertFontState(fs){
|
||||
localStorage.getItem('bbbSavedFontSize', fs);
|
||||
if(fs){
|
||||
this.setState({ currentFontSize: fs }, function () {
|
||||
@ -31,14 +31,14 @@ export function revertFontState(fs){
|
||||
}
|
||||
}
|
||||
|
||||
export function saveFontState(fs) {
|
||||
export function handleSaveFontState(fs) {
|
||||
localStorage.setItem('bbbSavedFontSize', fs);
|
||||
this.setState({ currentFontSize: fs }, function () {
|
||||
applyFontSize.call(this);
|
||||
});
|
||||
};
|
||||
|
||||
export function getFontSizeName() {
|
||||
export function handleGetFontSizeName() {
|
||||
return FontControl.fontSizeEnum.properties[this.state.currentFontSize].name;
|
||||
};
|
||||
|
||||
@ -54,12 +54,12 @@ function storeFontSize(fs) {
|
||||
});
|
||||
}
|
||||
|
||||
export function increaseFontSize() {
|
||||
export function handleIncreaseFontSize() {
|
||||
let fs = ( this.state.currentFontSize < 5) ? ++this.state.currentFontSize : 5;
|
||||
storeFontSize.call(this, fs);
|
||||
};
|
||||
|
||||
export function decreaseFontSize() {
|
||||
export function handleDecreaseFontSize() {
|
||||
let fs = ( this.state.currentFontSize > 1) ? --this.state.currentFontSize : 1;
|
||||
storeFontSize.call(this, fs);
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ import UsersMenu from './submenus/users/component';
|
||||
import classNames from 'classnames';
|
||||
import ReactDOM from 'react-dom';
|
||||
import styles from './styles.scss';
|
||||
import { saveFontState, revertFontState } from '/imports/api/FontControl';
|
||||
import { handleSaveFontState, handleRevertFontState } from '/imports/api/FontControl';
|
||||
|
||||
export default class Settings extends React.Component {
|
||||
constructor(props) {
|
||||
@ -192,7 +192,7 @@ export default class Settings extends React.Component {
|
||||
callback: (() => {
|
||||
this.setState({ activeSubmenu: 0, focusSubmenu: 0 });
|
||||
console.log('SHOULD APPLY SETTINGS CHANGES');
|
||||
saveFontState.call(this, localStorage.bbbFontSize);
|
||||
handleSaveFontState.call(this, localStorage.bbbFontSize);
|
||||
}),
|
||||
label: 'Save',
|
||||
description: 'Saves the changes and close the settings menu',
|
||||
@ -201,7 +201,7 @@ export default class Settings extends React.Component {
|
||||
callback: (() => {
|
||||
this.setState({ activeSubmenu: 0, focusSubmenu: 0 });
|
||||
console.log('SHOULD DISCART SETTINGS CHANGES');
|
||||
revertFontState.call(this, localStorage.bbbSavedFontSize);
|
||||
handleRevertFontState.call(this, localStorage.bbbSavedFontSize);
|
||||
}),
|
||||
label: 'Cancel',
|
||||
description: 'Discart the changes and close the settings menu',
|
||||
|
@ -1,8 +1,6 @@
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
|
||||
import FontControl from '/imports/api/FontControl';
|
||||
import { tester } from '/imports/api/FontControl';
|
||||
|
||||
import Settings from './component';
|
||||
import Service from './service';
|
||||
|
@ -6,8 +6,9 @@ import BaseMenu from '../base/component';
|
||||
import ReactDOM from 'react-dom';
|
||||
import FontControl from '/imports/api/FontControl';
|
||||
import styles from '../styles.scss';
|
||||
|
||||
import { getFontSizeName, increaseFontSize, decreaseFontSize } from '/imports/api/FontControl';
|
||||
import { handleGetFontSizeName } from '/imports/api/FontControl';
|
||||
import { handleIncreaseFontSize } from '/imports/api/FontControl';
|
||||
import { handleDecreaseFontSize } from '/imports/api/FontControl';
|
||||
|
||||
export default class ApplicationMenu extends BaseMenu {
|
||||
constructor(props) {
|
||||
@ -47,11 +48,11 @@ export default class ApplicationMenu extends BaseMenu {
|
||||
<p>Font size</p>
|
||||
</div>
|
||||
<div className={styles.fontBarMid}>
|
||||
<p>{getFontSizeName.call(this)}</p>
|
||||
<p>{handleGetFontSizeName.call(this)}</p>
|
||||
</div>
|
||||
<div className={styles.fontBarRight} role='presentation'>
|
||||
<Button
|
||||
onClick={increaseFontSize.bind(this)}
|
||||
onClick={handleIncreaseFontSize.bind(this)}
|
||||
icon={'circle-add'}
|
||||
circle={true}
|
||||
tabIndex={9}
|
||||
@ -64,7 +65,7 @@ export default class ApplicationMenu extends BaseMenu {
|
||||
<div id='sizeUpDesc' hidden>
|
||||
Increases the font size of the application.</div>
|
||||
<Button
|
||||
onClick={decreaseFontSize.bind(this)}
|
||||
onClick={handleDecreaseFontSize.bind(this)}
|
||||
icon={'circle-minus'}
|
||||
circle={true}
|
||||
tabIndex={10}
|
||||
|
Loading…
Reference in New Issue
Block a user