Skip to content

Commit

Permalink
Merge branch 'master' into SWIK-2043------Improve-slide-title-change-…
Browse files Browse the repository at this point in the history
…in-slide-editor
  • Loading branch information
kadevgraaf authored Feb 26, 2018
2 parents 3ad4032 + b875593 commit 36cbcce
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 67 deletions.
13 changes: 13 additions & 0 deletions actions/user/userprofile/functionsForDeactivateAccountModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const log = require('../../log/clog');

export function showDeactivateAccountModal(context, payload, done) {
log.info(context);
context.dispatch('SHOW_DEACTIVATE_ACCOUNT_MODAL', {});
done();
}

export function hideDeactivateAccountModal(context, payload, done) {
log.info(context);
context.dispatch('HIDE_DEACTIVATE_ACCOUNT_MODAL', {});
done();
}
9 changes: 0 additions & 9 deletions components/Deck/ContentPanel/ContentPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@ import SlideEditPanel from './SlideModes/SlideEditPanel/SlideEditPanel';
import NoPermissionsModal from './NoPermissionsModal';

class ContentPanel extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
let samePropsState = this.props.ContentStore.selector.stype === nextProps.ContentStore.selector.stype &&
this.props.ContentStore.mode === nextProps.ContentStore.mode;
// Content should be updated only when properties have changed.
return !samePropsState;
}

componentDidUpdate() {
console.log('Updated ContentPanel.');
}

render() {
let targetComponent = '';
Expand Down
12 changes: 6 additions & 6 deletions components/Home/Features.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class features extends React.Component {
<div className="basic container">
<p>
<FormattedMessage id="features.p1"
defaultMessage="SlideWiki&apo;s goal is to revolutionise how educational materials can be authored, shared and reused. By enabling authors and students to create and share slide decks as HTML in an open platform, communities around the world can benefit from materials created by world-leading educators on a wide range of topics."/>
defaultMessage="The goal of SlideWiki is to revolutionise how educational materials can be authored, shared and reused. By enabling authors and students to create and share slide decks as HTML in an open platform, communities around the world can benefit from materials created by world-leading educators on a wide range of topics."/>
</p>
</div>
<div className="ui padded stackable grid">
Expand All @@ -21,19 +21,19 @@ class features extends React.Component {
</div>
<div className="ui attached fluid segment">
<div className="ui medium right floated image">
<FormattedMessage id="features." defaultMessage="screenshot of slide editor interface."/>
<FormattedMessage id="features.screenshot" defaultMessage="screenshot of slide editor interface.">
{
(alt) => <img src="assets/images/features/slide-edit.png" alt="{alt}"></img>
(alt) => <img alt={alt} src="assets/images/features/slide-edit.png"></img>
}
<FormattedMessage/>
</FormattedMessage>
</div>
<p>
<FormattedMessage id="features.1.p1"
defaultMessage="Create a new deck or import existing slides from PowerPoint (*.pptx) or OpenDocument Presentation (*.odp) files. Your imported slides will be converted into HTML to allow you to continue to edit and add new content."/>
</p>
<p>
<FormattedMessage id="features.1.p2"
defaultMessage="SlideWiki&apo;s editor offers many formatting tools, including being able to add images, videos, equations and code snippet."/>
defaultMessage="The SlideWiki editor offers many formatting tools, including being able to add images, videos, equations and code snippet."/>
</p>
</div>
</div>
Expand Down Expand Up @@ -110,7 +110,7 @@ class features extends React.Component {
<i className="large circle blue play middle aligned icon"></i>
<div className="content">
<div className="header"><FormattedMessage id="features.3.slideshow.header" defaultMessage="Slideshow mode"/></div>
<div className="description"><FormattedMessage id="features.3.slideshow.description" defaultMessage="Use the Slideshow mode to view a deck as a slideshow. Includes a timer and speaker notes&apo; view."/></div>
<div className="description"><FormattedMessage id="features.3.slideshow.description" defaultMessage="Use the Slideshow mode to view a deck as a slideshow. Includes a timer and speaker notes view."/></div>
</div>
</div>
</div>
Expand Down
113 changes: 68 additions & 45 deletions components/User/UserProfile/DeactivateAccount.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
import React from 'react';
import { FormattedMessage, defineMessages } from 'react-intl';
import removeUser from '../../../actions/user/userprofile/removeUser';
import {showDeactivateAccountModal, hideDeactivateAccountModal} from '../../../actions/user/userprofile/functionsForDeactivateAccountModal';
import FocusTrap from 'focus-trap-react';
import {Button, Icon, Modal, Header} from 'semantic-ui-react';

class DeactivateAccount extends React.Component {

constructor(props) {
super(props);

this.messages = defineMessages({
modalHeading: {
id: 'DeactivateAccount.modalHeading',
defaultMessage: 'Deactivate SlideWiki Account'
},
modalHeader: {
id: 'DeactivateAccount.modalHeader',
defaultMessage: 'Are you sure you want to deactivate your SlideWiki Account?'
},
modalContent: {
id: 'DeactivateAccount.modalContent',
defaultMessage: 'Deactivating your account will remove your profile and account from SlideWiki. The content you have added to SlideWiki will remain. Do you wish to continue?'
}
});
}

handleAccountDeactivate(e) {
e.preventDefault();
this.context.executeAction(hideDeactivateAccountModal, {});
this.context.executeAction(removeUser, {});
$(this.refs.modal1).modal('hide');
}

showConfirmDialog(e) {
$(this.refs.modal1).modal('show');
e.preventDefault();
this.context.executeAction(showDeactivateAccountModal, {});
}

hideModal(e) {
e.preventDefault();
this.context.executeAction(hideDeactivateAccountModal, {});
}

render() {
let header = this.context.intl.formatMessage(this.messages.modalHeading);
let text1 = this.context.intl.formatMessage(this.messages.modalHeader);
let text2 = this.context.intl.formatMessage(this.messages.modalContent);
let showModal = this.props.showModal;

return (
<div>
<div className="ui padded grid">
Expand All @@ -29,7 +63,7 @@ class DeactivateAccount extends React.Component {
/>
</strong>
</p>
<button className="ui centered red labeled icon button" onClick={ this.showConfirmDialog.bind(this) }>
<button className="ui centered red labeled icon button" onClick={ this.showConfirmDialog.bind(this) } role="button" tabIndex="0">
<i className="icon ban"/>
<FormattedMessage
id='DeactivateAccount.button1'
Expand All @@ -38,54 +72,43 @@ class DeactivateAccount extends React.Component {
</button>
</div>

<div className="ui modal" ref="modal1">
<div className="ui red header">
<FormattedMessage
id='DeactivateAccount.modalHeading'
defaultMessage='Deactivate SlideWiki Account'
/>
</div>
<div className="image content">
<i className="ui massive warning sign icon"/>
<div className="description">
<div className="ui header">
<FormattedMessage
id='DeactivateAccount.modalHeader'
defaultMessage='Are you sure you want to deactivate your SlideWiki Account?'
/>
</div>
<p>
<FormattedMessage
id='DeactivateAccount.modalContent'
defaultMessage='Deactivating your account will remove your profile and account from SlideWiki. The content you have added to SlideWiki will remain. Do you wish to continue?'
/>
</p>
</div>
</div>
<div className="actions">
<div className="ui green right labeled icon deny button">
<i className="checkmark icon"></i>
<FormattedMessage
id='DeactivateAccount.modalCancel'
defaultMessage=' Cancel'
/>
</div>
<div className="ui red right labeled icon button" onClick={ this.handleAccountDeactivate.bind(this) }>
<i className="sign out icon"></i>
<FormattedMessage
id='DeactivateAccount.modalSubmit'
defaultMessage=' Deactivate account'
/>
</div>
</div>
</div>
<Modal dimmer='blurring' ref="modal1" role='dialog' aria-labelledby='deactivateAccountModalHeader'
aria-describedby='deactivateAccountModalDesc' open={showModal} >
<Header color="red" content={header} id='deactivateAccountModalHeader'/>
<Modal.Content id='deactivateAccountModalDesc'>
<Header>
{text1}
</Header>
<p>
{text2}
</p>
</Modal.Content>
<Modal.Actions>
<FocusTrap focusTrapOptions={{clickOutsideDeactivates: true}} active={showModal}>
<Button primary role="button" tabIndex="0" onClick={ this.hideModal.bind(this) }>
<FormattedMessage
id='DeactivateAccount.modalCancel'
defaultMessage=' Cancel'
/>
</Button>
<Button icon labelPosition='right' onClick={ this.handleAccountDeactivate.bind(this) } role="button" tabIndex="0">
<Icon name='sign out' />
<FormattedMessage
id='DeactivateAccount.modalSubmit'
defaultMessage=' Deactivate account'
/>
</Button>
</FocusTrap>
</Modal.Actions>
</Modal>
</div>
);
}
}

DeactivateAccount.contextTypes = {
executeAction: React.PropTypes.func.isRequired
executeAction: React.PropTypes.func.isRequired,
intl: React.PropTypes.object.isRequired
};

export default DeactivateAccount;
2 changes: 1 addition & 1 deletion components/User/UserProfile/UserProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class UserProfile extends React.Component {
</div>

<div className="ui segment">
<DeactivateAccount />
<DeactivateAccount showModal={this.props.UserProfileStore.showDeactivateAccountModal} />
</div>
</div>
</div>);
Expand Down
10 changes: 5 additions & 5 deletions intl/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -589,17 +589,17 @@
"dataProtection.9.header": "9. Acceptance, validity and modification of data protection conditions",
"dataProtection.9.p1": "By using our Web site, you implicitly agree to accept the use of your personal data as specified above. This present statement of data protection conditions came into effect on October 1st, 2013. As our Web site evolves, and new technologies come into use, it may become necessary to amend the statement of data protection conditions. The Fraunhofer-Gesellschaft reserves the right to modify its data protection conditions at any time, with effect as of a future date. We recommend that you re-read the latest version from time to time.",
"featured.header": "Featured decks",
"features.screenshot": "screenshot of slide editor interface.",
"features.2.p1": "SlideWiki is built on the Open Educational Resources (OER) ethos and all content is published under {navLink}. This means you can reuse and repurpose content from SlideWiki decks. SlideWiki allows you to create your own slides based on decks that have been published on SlideWiki by:",
"features.4.shareDecks": "{strong} via social media or email.",
"features.4.comments": "Add {strong} to decks and slides to interact with other learners.",
"features.4.download": "{strong} decks in PDF, ePub or SCORM format.",
"features.4.findMore": "To find out more about how to use SlideWiki and its many features, view our {link}.",
"features.header": "Discover SlideWiki",
"features.p1": "SlideWiki&apo;s goal is to revolutionise how educational materials can be authored, shared and reused. By enabling authors and students to create and share slide decks as HTML in an open platform, communities around the world can benefit from materials created by world-leading educators on a wide range of topics.",
"features.p1": "The goal of SlideWiki is to revolutionise how educational materials can be authored, shared and reused. By enabling authors and students to create and share slide decks as HTML in an open platform, communities around the world can benefit from materials created by world-leading educators on a wide range of topics.",
"features.1.header": "Create online slide decks",
"features.": "screenshot of slide editor interface.",
"features.1.p1": "Create a new deck or import existing slides from PowerPoint (*.pptx) or OpenDocument Presentation (*.odp) files. Your imported slides will be converted into HTML to allow you to continue to edit and add new content.",
"features.1.p2": "SlideWiki&apo;s editor offers many formatting tools, including being able to add images, videos, equations and code snippet.",
"features.1.p2": "The SlideWiki editor offers many formatting tools, including being able to add images, videos, equations and code snippet.",
"features.2.header": "Reusable educational content",
"features.2.p1.licence": "Creative Commons licences",
"features.2.deckCopy.header": "Creating a copy of a deck",
Expand All @@ -617,7 +617,7 @@
"features.3.like.header": "Like decks and slides",
"features.3.like.description": "Encourage authors and students to see new content by liking useful decks and slides.",
"features.3.slideshow.header": "Slideshow mode",
"features.3.slideshow.description": "Use the Slideshow mode to view a deck as a slideshow. Includes a timer and speaker notes&apo; view.",
"features.3.slideshow.description": "Use the Slideshow mode to view a deck as a slideshow. Includes a timer and speaker notes view.",
"features.4.header": "Supporting Knowledge Communities",
"features.4.description": "Through a range of interactive and open tools, SlideWiki aims to nurture knowledge communities around the world. Our goal is to significantly increase content available to a world-wide audience. By involve peer-educators in improving and maintaining the quality and attractiveness of your e-learning content SlideWiki can give you a platform to support knowledge communities. With SlideWiki we aim to dramatically improve the efficiency and effectiveness of the collaborative creation of rich learning material for online and offline use.",
"features.4.shareDescks.strong": "Share decks",
Expand Down Expand Up @@ -1043,4 +1043,4 @@
"UserRegistrationSocial.signup": "Sign Up",
"UserRegistrationSocial.account": "I can not access my account",
"UserRegistrationSocial.cancel": "Cancel"
}
}
21 changes: 20 additions & 1 deletion stores/UserProfileStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class UserProfileStore extends BaseStore {

//LoginModal
this.showLoginModal = false;

//Deactivate account modal
this.showDeactivateAccountModal = false;
}

destructor() {
Expand Down Expand Up @@ -94,6 +97,8 @@ class UserProfileStore extends BaseStore {

//LoginModal
this.showLoginModal = false;

this.showDeactivateAccountModal = false;
}

getState() {
Expand Down Expand Up @@ -121,7 +126,8 @@ class UserProfileStore extends BaseStore {
saveUsergroupIsLoading: this.saveUsergroupIsLoading,
saveProfileIsLoading: this.saveProfileIsLoading,
deleteUsergroupError: this.deleteUsergroupError,
usergroupsViewStatus: this.usergroupsViewStatus,
usergroupsViewStatus: this.usergroupsViewStatus,
showDeactivateAccountModal: this.showDeactivateAccountModal
};
}

Expand Down Expand Up @@ -154,6 +160,7 @@ class UserProfileStore extends BaseStore {
this.saveProfileIsLoading = state.saveProfileIsLoading;
this.deleteUsergroupError = state.deleteUsergroupError;
this.usergroupsViewStatus = state.usergroupsViewStatus;
this.showDeactivateAccountModal = state.showDeactivateAccountModal;
}

changeTo(payload) {
Expand Down Expand Up @@ -363,6 +370,16 @@ class UserProfileStore extends BaseStore {
this.usergroupsViewStatus = 'pending';
this.emitChange();
}

showDeactivateModal() {
this.showDeactivateAccountModal = true;
this.emitChange();
}

hideDeactivateModal() {
this.showDeactivateAccountModal = false;
this.emitChange();
}
}

UserProfileStore.storeName = 'UserProfileStore';
Expand Down Expand Up @@ -401,6 +418,8 @@ UserProfileStore.handlers = {
'LEAVE_USERGROUP_FAILED': 'deleteUsergroupFailed',
'LEAVE_USERGROUP_SUCCESS': 'deleteUsergroupSuccess',
'SAVE_USERPROFILE_START': 'saveProfileStart',
'SHOW_DEACTIVATE_ACCOUNT_MODAL': 'showDeactivateModal',
'HIDE_DEACTIVATE_ACCOUNT_MODAL': 'hideDeactivateModal'
};

export default UserProfileStore;

0 comments on commit 36cbcce

Please sign in to comment.