From bcdf37ec3b756c94fa6a8950d213b0c9825ada68 Mon Sep 17 00:00:00 2001 From: dpaun Date: Wed, 21 Nov 2018 08:14:59 +0100 Subject: [PATCH 01/57] SWIK-2431 allow deck datasources --- actions/datasource/updateDataSources.js | 12 +++++++++++- .../DataSourcePanel/DataSourceItem.js | 6 +++--- .../DataSourcePanel/DataSourcePanel.js | 5 ++--- .../DataSourcePanel/EditDataSource.js | 4 ++-- services/datasource.js | 2 +- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/actions/datasource/updateDataSources.js b/actions/datasource/updateDataSources.js index 96ebaf1ab..741e17da0 100644 --- a/actions/datasource/updateDataSources.js +++ b/actions/datasource/updateDataSources.js @@ -7,13 +7,23 @@ export default function updateDataSources(context, payload, done) { // enrich with jwt payload.jwt = context.getStore(UserProfileStore).jwt; + let dataSources = payload.dataSources; + if (payload.selector.stype === 'deck') {// leave only datasources for the selected deck (without slide and subdeck datasources) + let deckDataSources = []; + dataSources.forEach((dataSource) => { + if (dataSource.stype === 'deck' && dataSource.sid === payload.selector.sid) { + deckDataSources.push(dataSource); + } + }); + payload.dataSources = deckDataSources; + } context.service.update('datasource.array', payload, {timeout: 20 * 1000}, (err, res) => { if (err) { log.error(context, {filepath: __filename}); context.executeAction(serviceUnavailable, payload, done); //context.dispatch('UPDATE_DATASOURCES_FAILURE', err); } else { - context.dispatch('UPDATE_DATASOURCES_SUCCESS', res); + context.dispatch('UPDATE_DATASOURCES_SUCCESS', {dataSources: dataSources}); } done(); diff --git a/components/Deck/ContentModulesPanel/DataSourcePanel/DataSourceItem.js b/components/Deck/ContentModulesPanel/DataSourcePanel/DataSourceItem.js index b60555623..374b55d69 100644 --- a/components/Deck/ContentModulesPanel/DataSourcePanel/DataSourceItem.js +++ b/components/Deck/ContentModulesPanel/DataSourcePanel/DataSourceItem.js @@ -136,10 +136,10 @@ class DataSourceItem extends React.Component { const node = this.props.node; //append origin of the datasource const selector = this.props.selector; - const cheerioSlideName = (node.stitle !== undefined) ? cheerio.load(node.stitle).text() : ''; - const appendOrigin = (selector.stype === 'deck') ? (originally from slide {cheerioSlideName}) : ''; + const cheerioRefName = (node.stitle !== undefined) ? cheerio.load(node.stitle).text() : ''; + const appendOrigin = (selector.stype === 'deck' && (node.stype === 'slide' || node.sid !== selector.sid)) ? (originally from {node.stype} {cheerioRefName}) : ''; - const appendEdit = (this.props.editable) ? ( + const appendEdit = (this.props.editable && selector.stype === node.stype && selector.sid === node.sid) ? ( diff --git a/components/Deck/ContentModulesPanel/DataSourcePanel/DataSourcePanel.js b/components/Deck/ContentModulesPanel/DataSourcePanel/DataSourcePanel.js index 7db09d6ec..61fc53ed7 100644 --- a/components/Deck/ContentModulesPanel/DataSourcePanel/DataSourcePanel.js +++ b/components/Deck/ContentModulesPanel/DataSourcePanel/DataSourcePanel.js @@ -26,7 +26,7 @@ class DataSourcePanel extends React.Component { const dataSource = this.props.DataSourceStore.dataSource; const selector = this.props.DataSourceStore.selector; - let editPermission = (this.props.PermissionsStore.permissions.admin || this.props.PermissionsStore.permissions.edit) && (selector.stype === 'slide'); + let editPermission = (this.props.PermissionsStore.permissions.admin || this.props.PermissionsStore.permissions.edit); let newDataSourceButton = (editPermission) ? - diff --git a/components/Login/MigrateUser.js b/components/Login/MigrateUser.js index 7f1b9c7a0..05b05a76c 100644 --- a/components/Login/MigrateUser.js +++ b/components/Login/MigrateUser.js @@ -6,6 +6,8 @@ import ReactDOM from 'react-dom'; import ReviseUser from './ReviseUser'; let classNames = require('classnames'); import updateSSOData from '../../actions/user/updateSSOData'; +import {FormattedMessage, defineMessages} from 'react-intl'; + const MODI = 'sso_modi'; const NAME = 'sso_data'; @@ -43,10 +45,19 @@ class MigrateUser extends React.Component { onDeny : function(){ console.log('Modal closed'); swal({ - title: 'Modal closed', - text: 'The modal was closed. It is needed for completion, thus this page will be reloaded in order to show the modal again.', + title: this.context.intl.formatMessage({ + id: 'Migrate.closed', + defaultMessage: 'Modal closed' + }), + text: this.context.intl.formatMessage({ + id: 'Migrate.closed.text', + defaultMessage: 'The modal was closed. It is needed for completion, thus this page will be reloaded in order to show the modal again.' + }), type: 'warning', - confirmButtonText: 'Confirm', + confirmButtonText: this.context.intl.formatMessage({ + id: 'Migrate.confirm', + defaultMessage: 'Confirm' + }), confirmButtonClass: 'negative ui button', buttonsStyling: false }).then(() => {location.reload();}).catch(); @@ -60,10 +71,19 @@ class MigrateUser extends React.Component { } else { swal({ - title: 'Data Error', - text: 'There was an error with the URL data. Either you used the wrong URL or there was an implementation error. The window will be closed now.', + title: this.context.intl.formatMessage({ + id: 'Migrate.error', + defaultMessage: 'Data Error' + }), + text: this.context.intl.formatMessage({ + id: 'Migrate.error.text', + defaultMessage: 'There was an error with the URL data. Either you used the wrong URL or there was an implementation error. The window will be closed now.' + }), type: 'error', - confirmButtonText: 'Confirm', + confirmButtonText: this.context.intl.formatMessage({ + id: 'Migrate.confirm', + defaultMessage: 'Confirm' + }), confirmButtonClass: 'negative ui button', buttonsStyling: false }).then(() => { @@ -100,7 +120,10 @@ class MigrateUser extends React.Component { render() { return (
- We are merging your user account. This will take just a few seconds.
You will be directed to next view.
+ +
+ +
); diff --git a/components/Login/Social.js b/components/Login/Social.js index 3dd0f8005..6240687b1 100644 --- a/components/Login/Social.js +++ b/components/Login/Social.js @@ -4,6 +4,7 @@ import {connectToStores} from 'fluxible-addons-react'; import {navigateAction} from 'fluxible-router'; import ReactDOM from 'react-dom'; let classNames = require('classnames'); +import {FormattedMessage, defineMessages} from 'react-intl'; const NAME = 'sociallogin_data'; @@ -47,7 +48,10 @@ class Social extends React.Component { render() { return (
- We acquire your data. This will take just a few seconds.
This window will close automatically.
+ +
+ +
); } From 50a784538384f7161a34bb6a2778c81d6f633c78 Mon Sep 17 00:00:00 2001 From: Nicola Knight Date: Fri, 23 Nov 2018 01:32:20 +0000 Subject: [PATCH 05/57] registration components encoded + addDeck sr changes --- components/AddDeck/AddDeck.js | 6 ++-- .../User/UserRegistration/UserRegistration.js | 31 ++++++++++++++++--- .../UserRegistrationSocial.js | 8 +++-- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/components/AddDeck/AddDeck.js b/components/AddDeck/AddDeck.js index 94c64b7ac..1acceec94 100644 --- a/components/AddDeck/AddDeck.js +++ b/components/AddDeck/AddDeck.js @@ -599,9 +599,9 @@ class AddDeck extends React.Component {

-
Select education level of deck content
-
Select subject of deck content from autocomplete. Multiple subjects can be selected"
-
Add tags or keywords for your deck. Multiple tags can be provided.
+
+
+
diff --git a/components/User/UserRegistration/UserRegistration.js b/components/User/UserRegistration/UserRegistration.js index 4cff2f092..25647bafb 100644 --- a/components/User/UserRegistration/UserRegistration.js +++ b/components/User/UserRegistration/UserRegistration.js @@ -249,7 +249,28 @@ class UserRegistration extends React.Component { form_noAccess:{ id:'UserRegistration.noAccess', defaultMessage:'I can not access my account' - } + }, + emailToolTipp:{ + id:'UserRegistration.emailRegistered', + defaultMessage:'This E-Mail has already been registered by someone else. Please use another one.' + }, + usernameToolTipp:{ + id:'UserRegistration.usernameRegistered', + defaultMessage:'This Username has already been registered by someone else. Please choose another one.' + }, + usernameSuggest:{ + id:'UserRegistration.username.suggestion', + defaultMessage:'Here are some suggestions:' + }, + SSOtitle:{ + id:'UserRegistration.SSO.title', + defaultMessage:'Sign up with an account of another SlideWiki instance' + }, + SSOaria:{ + id:'UserRegistration.SSO.aria', + defaultMessage:'Sign up with another SlideWiki instance' + }, + }); } @@ -670,7 +691,7 @@ class UserRegistration extends React.Component { 'inverted circular red remove': (emailNotAllowed !== undefined) ? emailNotAllowed : false, 'inverted circular green checkmark': (emailNotAllowed !== undefined) ? !emailNotAllowed : false }); - let emailToolTipp = emailNotAllowed ? 'This E-Mail has already been registered by someone else. Please use another one.' : undefined; + let emailToolTipp = emailNotAllowed ? this.context.intl.formatMessage(this.messages.emailToolTipp) : undefined; const usernameNotAllowed = this.props.UserRegistrationStore.failures.usernameNotAllowed; let usernameClasses = classNames({ @@ -685,9 +706,9 @@ class UserRegistration extends React.Component { 'inverted circular red remove': (usernameNotAllowed !== undefined) ? usernameNotAllowed : false, 'inverted circular green checkmark': (usernameNotAllowed !== undefined) ? !usernameNotAllowed : false }); - let usernameToolTipp = usernameNotAllowed ? 'This Username has already been registered by someone else. Please choose another one.' : undefined; + let usernameToolTipp = usernameNotAllowed ? this.context.intl.formatMessage(this.messages.usernameToolTipp) : undefined; if (this.props.UserRegistrationStore.suggestedUsernames.length > 0) { - usernameToolTipp += '\n Here are some suggestions: ' + this.props.UserRegistrationStore.suggestedUsernames; + usernameToolTipp += '\n' + this.context.intl.formatMessage(this.messages.usernameSuggest) + this.props.UserRegistrationStore.suggestedUsernames; } let content =
@@ -695,7 +716,7 @@ class UserRegistration extends React.Component {

{this.context.intl.formatMessage(this.messages.modal_subtitle)}

{/**/} - {ssoEnabled ? : ''} + {ssoEnabled ? : ''} diff --git a/components/User/UserRegistration/UserRegistrationSocial.js b/components/User/UserRegistration/UserRegistrationSocial.js index a7ca08d50..4ec3c4dac 100644 --- a/components/User/UserRegistration/UserRegistrationSocial.js +++ b/components/User/UserRegistration/UserRegistrationSocial.js @@ -66,7 +66,7 @@ class UserRegistrationSocial extends React.Component { mailprompt3: { id: 'UserRegistrationSocial.mailprompt3', defaultMessage: 'The email address is already in use', - } + }, }); //Form validation const validationRules = { @@ -253,6 +253,10 @@ class UserRegistrationSocial extends React.Component { id: 'UserRegistrationSocial.usernameNotAllowed', defaultMessage: 'This Username has already been used by someone else. Please choose another one.', }, + usernameSuggest:{ + id: 'UserRegistrationSocial.usernamesuggestion', + defaultMessage: 'Here are some suggestions:' + } }); const signUpLabelStyle = {width: '150px'}; @@ -284,7 +288,7 @@ class UserRegistrationSocial extends React.Component { }); let usernameToolTipp = usernameNotAllowed ? this.context.intl.formatMessage(messages.usernameNotAllowed) : undefined; if (this.props.UserRegistrationStore.suggestedUsernames.length > 0) { - usernameToolTipp += '\n Here are some suggestions: ' + this.props.UserRegistrationStore.suggestedUsernames; + usernameToolTipp += '\n' + this.context.intl.formatMessage(messages.usernameSuggest) + this.props.UserRegistrationStore.suggestedUsernames; } return (
From b1a3872ff0e89c503f7664fa267616a3f27126c1 Mon Sep 17 00:00:00 2001 From: Russell Newman Date: Fri, 23 Nov 2018 16:34:23 +0000 Subject: [PATCH 06/57] Added replacement language menu Need to fix mobile menu, then clean and remove old menu and dependencies. --- components/LocaleSwitcher/LocaleSwitcher.js | 31 +++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/components/LocaleSwitcher/LocaleSwitcher.js b/components/LocaleSwitcher/LocaleSwitcher.js index 4c432819d..f88b3d56f 100644 --- a/components/LocaleSwitcher/LocaleSwitcher.js +++ b/components/LocaleSwitcher/LocaleSwitcher.js @@ -23,6 +23,26 @@ class LocaleSwitcher extends React.Component { window.location.reload(); } + handleLocaleChange(e, localeDropdown) { + console.log(e); + console.log(localeDropdown); + writeCookie('locale', localeDropdown.value, 365); + this.setState({currentLocale: localeDropdown.value}); + window.location.reload(); + } + + getLocaleOptions() { + return locales.map((locale) => { + let flag = flagForLocale(locale) || 'icon'; + let options = { + key: locale, + text: {getLanguageName(locale)}, + value: locale + }; + return options; + }); + } + renderLocaleLink(locale) { let flag = flagForLocale(locale); let className = (locale === this.state.currentLocale) ? 'active' : ''; @@ -72,11 +92,18 @@ class LocaleSwitcher extends React.Component { break; default: current_header = {current_header}{getLanguageName(this.state.currentLocale)}; - return ( + return (
{ locales.map(this.renderLocaleLink, this) } - ); + +
); } } } From 6ee725e755faa9099bb34ee40e2d1f23dba6d106 Mon Sep 17 00:00:00 2001 From: Nicola Knight Date: Fri, 23 Nov 2018 16:44:11 +0000 Subject: [PATCH 07/57] npm run langs and some syntax fixes --- components/Footer/Footer.js | 66 ++++++++++++----------- components/Home/Features.js | 5 ++ components/Home/Imprint.js | 6 ++- components/Login/LoginModal.js | 8 +-- components/Login/MigrateUser.js | 2 +- components/Login/UserMenuDropdown.js | 81 ++++++++++++++-------------- intl/default.json | 72 +++++++++++++++++++++++++ 7 files changed, 164 insertions(+), 76 deletions(-) diff --git a/components/Footer/Footer.js b/components/Footer/Footer.js index 993bbd1da..91434f295 100644 --- a/components/Footer/Footer.js +++ b/components/Footer/Footer.js @@ -1,6 +1,7 @@ import React from 'react'; import { NavLink } from 'fluxible-router'; import {FormattedMessage, defineMessages} from 'react-intl'; +import PropTypes from 'prop-types'; @@ -11,7 +12,22 @@ class Footer extends React.Component { this.openLinkedIn = this.openLinkedIn.bind(this); this.openTwitter = this.openTwitter.bind(this); - this.messages = defineMessages({ + } + + openFacebook() { + window.open('https://www.facebook.com/slidewiki/', '_blank'); + } + + openLinkedIn() { + window.open('https://www.linkedin.com/company/slidewiki-eu', '_blank'); + } + + openTwitter() { + window.open('https://twitter.com/slidewiki', '_blank'); + } + render() { + + const messages = defineMessages({ srHeader: { id: 'footer.sr.header', defaultMessage: 'Information about SlideWiki' @@ -38,7 +54,7 @@ class Footer extends React.Component { }, termsHeader: { id: 'footer.terms.header', - defaultMessage: 'Terms & Conditions' + defaultMessage: 'Terms \\u0026 Conditions' }, terms: { id: 'footer.terms', @@ -66,23 +82,10 @@ class Footer extends React.Component { }, copyright: { id: 'footer.copyright', - defaultMessage: 'Copyright © 2018 All Rights Reserved' + defaultMessage: 'Copyright \\u00A9 2018 All Rights Reserved' }, }); - } - - openFacebook() { - window.open('https://www.facebook.com/slidewiki/', '_blank'); - } - - openLinkedIn() { - window.open('https://www.linkedin.com/company/slidewiki-eu', '_blank'); - } - openTwitter() { - window.open('https://twitter.com/slidewiki', '_blank'); - } - render() { let rowClasses = {paddingTop: '0px', paddingBottom: '0px'}; return (