Browse Source

fixed html-document slug + fixed popup create content closing + fixed translation

Skylsmoi 6 years ago
parent
commit
78466f7d62

+ 1 - 1
frontend/dist/appInterface.js View File

3
 
3
 
4
   getSelectedApp = name => {
4
   getSelectedApp = name => {
5
     switch (name) {
5
     switch (name) {
6
-      case 'html-documents':
6
+      case 'html-document':
7
         return appHtmlDocument
7
         return appHtmlDocument
8
       case 'thread':
8
       case 'thread':
9
         return appThread
9
         return appThread

+ 2 - 1
frontend/src/appFactory.js View File

24
         domContainer: 'popupCreateContentContainer',
24
         domContainer: 'popupCreateContentContainer',
25
         apiUrl: FETCH_CONFIG.apiUrl,
25
         apiUrl: FETCH_CONFIG.apiUrl,
26
         mockApiUrl: FETCH_CONFIG.mockApiUrl,
26
         mockApiUrl: FETCH_CONFIG.mockApiUrl,
27
-        apiHeader: FETCH_CONFIG.headers // should this be used by app ? right now, apps have their own headers
27
+        apiHeader: FETCH_CONFIG.headers, // should this be used by app ? right now, apps have their own headers
28
+        translation: i18n.store.data
28
       },
29
       },
29
       idWorkspace,
30
       idWorkspace,
30
       idFolder: idFolder === 'null' ? null : idFolder
31
       idFolder: idFolder === 'null' ? null : idFolder

+ 1 - 1
frontend/src/component/Workspace/OpenContentApp.jsx View File

22
 
22
 
23
       if (appOpenedType === contentToOpen.type) { // app already open
23
       if (appOpenedType === contentToOpen.type) { // app already open
24
         GLOBAL_dispatchEvent({
24
         GLOBAL_dispatchEvent({
25
-          type: `${contentToOpen.type}_reloadContent`, // handled by html-documents:src/container/HtmlDocument.jsx
25
+          type: `${contentToOpen.type}_reloadContent`, // handled by html-document:src/container/HtmlDocument.jsx
26
           data: contentToOpen
26
           data: contentToOpen
27
         })
27
         })
28
       } else { // open another app
28
       } else { // open another app

+ 6 - 4
frontend/src/container/Header.jsx View File

1
 import React from 'react'
1
 import React from 'react'
2
 import { connect } from 'react-redux'
2
 import { connect } from 'react-redux'
3
 import i18n from '../i18n.js'
3
 import i18n from '../i18n.js'
4
+import appFactory from '../appFactory.js'
4
 import { translate } from 'react-i18next'
5
 import { translate } from 'react-i18next'
5
 import Cookies from 'js-cookie'
6
 import Cookies from 'js-cookie'
6
 import Logo from '../component/Header/Logo.jsx'
7
 import Logo from '../component/Header/Logo.jsx'
32
   handleChangeInput = e => this.setState({inputSearchValue: e.target.value})
33
   handleChangeInput = e => this.setState({inputSearchValue: e.target.value})
33
   handleClickSubmit = () => {}
34
   handleClickSubmit = () => {}
34
 
35
 
35
-  handleChangeLang = langId => {
36
-    this.props.dispatch(setUserLang(langId))
37
-    i18n.changeLanguage(langId)
36
+  handleChangeLang = idLang => {
37
+    this.props.dispatch(setUserLang(idLang))
38
+    i18n.changeLanguage(idLang)
39
+    this.props.emitEventApp('allApp_changeLang', idLang)
38
   }
40
   }
39
 
41
 
40
   handleClickHelp = () => {}
42
   handleClickHelp = () => {}
105
 }
107
 }
106
 
108
 
107
 const mapStateToProps = ({ lang, user }) => ({ lang, user })
109
 const mapStateToProps = ({ lang, user }) => ({ lang, user })
108
-export default connect(mapStateToProps)(translate()(Header))
110
+export default connect(mapStateToProps)(translate()(appFactory(Header)))

+ 1 - 1
frontend_app_html-document/dist/index.html View File

3
 <head>
3
 <head>
4
   <meta charset='utf-8' />
4
   <meta charset='utf-8' />
5
   <meta name="viewport" content="width=device-width, user-scalable=no" />
5
   <meta name="viewport" content="width=device-width, user-scalable=no" />
6
-  <title>Html-documents App Tracim</title>
6
+  <title>Html-document App Tracim</title>
7
   <link rel='shortcut icon' href='favicon.ico'>
7
   <link rel='shortcut icon' href='favicon.ico'>
8
 
8
 
9
   <link rel="stylesheet" type="text/css" href="./font/font-awesome-4.7.0/css/font-awesome.css">
9
   <link rel="stylesheet" type="text/css" href="./font/font-awesome-4.7.0/css/font-awesome.css">

+ 2 - 1
frontend_app_html-document/i18next.scanner/en/translation.json View File

1
 {
1
 {
2
-  "Last version": "Last version"
2
+  "Last version": "Last version",
3
+  "Validate and create": "Validate and create"
3
 }
4
 }

+ 2 - 1
frontend_app_html-document/i18next.scanner/fr/translation.json View File

1
 {
1
 {
2
-  "Last version": "Dernière version"
2
+  "Last version": "Dernière version",
3
+  "Validate and create": "Valider et créer"
3
 }
4
 }

+ 1 - 1
frontend_app_html-document/package.json View File

1
 {
1
 {
2
-  "name": "tracim_app_html-documents",
2
+  "name": "tracim_app_html-document",
3
   "version": "1.1.2",
3
   "version": "1.1.2",
4
   "description": "",
4
   "description": "",
5
   "main": "index.js",
5
   "main": "index.js",

+ 5 - 5
frontend_app_html-document/src/component/HtmlDocument.jsx View File

4
 
4
 
5
 const HtmlDocument = props => {
5
 const HtmlDocument = props => {
6
   return (
6
   return (
7
-    <div className='wsContentHtmlDocument__contentpage__textnote html-documents__contentpage__textnote'>
7
+    <div className='wsContentHtmlDocument__contentpage__textnote html-document__contentpage__textnote'>
8
       {(props.mode === MODE.VIEW || props.mode === MODE.REVISION) &&
8
       {(props.mode === MODE.VIEW || props.mode === MODE.REVISION) &&
9
         <div>
9
         <div>
10
-          <div className='html-documents__contentpage__textnote__version'>
10
+          <div className='html-document__contentpage__textnote__version'>
11
             version n°
11
             version n°
12
             <div dangerouslySetInnerHTML={{__html: props.mode === MODE.VIEW ? props.lastVersion : props.version}} />
12
             <div dangerouslySetInnerHTML={{__html: props.mode === MODE.VIEW ? props.lastVersion : props.version}} />
13
             {props.mode === MODE.REVISION &&
13
             {props.mode === MODE.REVISION &&
14
-              <div className='html-documents__contentpage__textnote__lastversion'>
14
+              <div className='html-document__contentpage__textnote__lastversion'>
15
                 (dernière version : {props.lastVersion})
15
                 (dernière version : {props.lastVersion})
16
               </div>
16
               </div>
17
             }
17
             }
18
           </div>
18
           </div>
19
           {/* need try to inject html in stateless component () => <span>{props.text}</span> */}
19
           {/* need try to inject html in stateless component () => <span>{props.text}</span> */}
20
-          <div className='html-documents__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
20
+          <div className='html-document__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
21
         </div>
21
         </div>
22
       }
22
       }
23
 
23
 
24
       {props.mode === MODE.EDIT &&
24
       {props.mode === MODE.EDIT &&
25
         <TextAreaApp
25
         <TextAreaApp
26
           id={props.wysiwygNewVersion}
26
           id={props.wysiwygNewVersion}
27
-          customClass={'html-documents__editionmode'}
27
+          customClass={'html-document__editionmode'}
28
           customColor={props.customColor}
28
           customColor={props.customColor}
29
           onClickCancelBtn={props.onClickCloseEditMode}
29
           onClickCancelBtn={props.onClickCloseEditMode}
30
           onClickValidateBtn={props.onClickValidateBtn}
30
           onClickValidateBtn={props.onClickValidateBtn}

+ 18 - 6
frontend_app_html-document/src/container/HtmlDocument.jsx View File

41
     }
41
     }
42
 
42
 
43
     // i18n has been init, add resources from frontend
43
     // i18n has been init, add resources from frontend
44
-    addAllResourceI18n(i18n, props.data ? props.data.config.translation : debug.config.translation)
44
+    addAllResourceI18n(i18n, this.state.config.translation)
45
+    i18n.changeLanguage(this.state.loggedUser.lang)
45
 
46
 
46
     document.addEventListener('appCustomEvent', this.customEventReducer)
47
     document.addEventListener('appCustomEvent', this.customEventReducer)
47
   }
48
   }
48
 
49
 
49
   customEventReducer = ({ detail: { type, data } }) => { // action: { type: '', data: {} }
50
   customEventReducer = ({ detail: { type, data } }) => { // action: { type: '', data: {} }
50
     switch (type) {
51
     switch (type) {
51
-      case 'html-documents_showApp':
52
+      case 'html-document_showApp':
52
         console.log('%c<HtmlDocument> Custom event', 'color: #28a745', type, data)
53
         console.log('%c<HtmlDocument> Custom event', 'color: #28a745', type, data)
53
         this.setState({isVisible: true})
54
         this.setState({isVisible: true})
54
         break
55
         break
55
-      case 'html-documents_hideApp':
56
+      case 'html-document_hideApp':
56
         console.log('%c<HtmlDocument> Custom event', 'color: #28a745', type, data)
57
         console.log('%c<HtmlDocument> Custom event', 'color: #28a745', type, data)
57
         this.setState({isVisible: false})
58
         this.setState({isVisible: false})
58
         break
59
         break
59
-      case 'html-documents_reloadContent':
60
+      case 'html-document_reloadContent':
60
         console.log('%c<HtmlDocument> Custom event', 'color: #28a745', type, data)
61
         console.log('%c<HtmlDocument> Custom event', 'color: #28a745', type, data)
61
         this.setState(prev => ({content: {...prev.content, ...data}, isVisible: true}))
62
         this.setState(prev => ({content: {...prev.content, ...data}, isVisible: true}))
63
+        break
64
+      case 'allApp_changeLang':
65
+        console.log('%c<HtmlDocument> Custom event', 'color: #28a745', type, data)
66
+        this.setState(prev => ({
67
+          loggedUser: {
68
+            ...prev.loggedUser,
69
+            lang: data
70
+          }
71
+        }))
72
+        i18n.changeLanguage(data)
73
+        break
62
     }
74
     }
63
   }
75
   }
64
 
76
 
322
 
334
 
323
               {mode === MODE.REVISION &&
335
               {mode === MODE.REVISION &&
324
                 <button
336
                 <button
325
-                  className='wsContentGeneric__option__menu__lastversion html-documents__lastversionbtn btn'
337
+                  className='wsContentGeneric__option__menu__lastversion html-document__lastversionbtn btn'
326
                   onClick={this.handleClickLastVersion}
338
                   onClick={this.handleClickLastVersion}
327
                   style={{backgroundColor: config.hexcolor, color: '#fdfdfd'}}
339
                   style={{backgroundColor: config.hexcolor, color: '#fdfdfd'}}
328
                 >
340
                 >
364
             lastVersion={timeline.filter(t => t.timelineType === 'revision').length}
376
             lastVersion={timeline.filter(t => t.timelineType === 'revision').length}
365
             text={content.raw_content}
377
             text={content.raw_content}
366
             onChangeText={this.handleChangeText}
378
             onChangeText={this.handleChangeText}
367
-            key={'html-documents'}
379
+            key={'html-document'}
368
           />
380
           />
369
 
381
 
370
           <Timeline
382
           <Timeline

+ 27 - 7
frontend_app_html-document/src/container/PopupCreateHtmlDocument.jsx View File

1
 import React from 'react'
1
 import React from 'react'
2
+import { translate } from 'react-i18next'
2
 import {
3
 import {
3
-  CardPopupCreateContent, handleFetchResult
4
+  CardPopupCreateContent,
5
+  handleFetchResult,
6
+  addAllResourceI18n
4
 } from 'tracim_frontend_lib'
7
 } from 'tracim_frontend_lib'
5
 import { postHtmlDocContent } from '../action.async.js'
8
 import { postHtmlDocContent } from '../action.async.js'
6
-import {addAllResourceForI18n, addAllResourceI18n} from '../../../frontend_lib'
7
 import i18n from '../i18n.js'
9
 import i18n from '../i18n.js'
8
 
10
 
9
 const debug = { // outdated
11
 const debug = { // outdated
10
   config: {
12
   config: {
11
     label: 'Text Document',
13
     label: 'Text Document',
12
-    slug: 'html-documents',
14
+    slug: 'html-document',
13
     faIcon: 'file-text-o',
15
     faIcon: 'file-text-o',
14
     hexcolor: '#3f52e3',
16
     hexcolor: '#3f52e3',
15
     creationLabel: 'Write a document',
17
     creationLabel: 'Write a document',
37
   constructor (props) {
39
   constructor (props) {
38
     super(props)
40
     super(props)
39
     this.state = {
41
     this.state = {
40
-      appName: 'html-documents',
42
+      appName: 'html-document', // must remain 'html-document' because it is the name of the react built app (which contains HtmlDocument and PopupCreateHtmlDocument)
41
       config: props.data ? props.data.config : debug.config,
43
       config: props.data ? props.data.config : debug.config,
42
       loggedUser: props.data ? props.data.loggedUser : debug.loggedUser,
44
       loggedUser: props.data ? props.data.loggedUser : debug.loggedUser,
43
       idWorkspace: props.data ? props.data.idWorkspace : debug.idWorkspace,
45
       idWorkspace: props.data ? props.data.idWorkspace : debug.idWorkspace,
46
     }
48
     }
47
 
49
 
48
     // i18n has been init, add resources from frontend
50
     // i18n has been init, add resources from frontend
49
-    addAllResourceI18n(i18n, props.data ? props.data.config.translation : debug.config.translation)
51
+    addAllResourceI18n(i18n, this.state.config.translation)
52
+    i18n.changeLanguage(this.state.loggedUser.lang)
53
+
54
+    document.addEventListener('appCustomEvent', this.customEventReducer)
55
+  }
56
+
57
+  customEventReducer = ({ detail: { type, data } }) => { // action: { type: '', data: {} }
58
+    switch (type) {
59
+      case 'allApp_changeLang':
60
+        console.log('%c<PopupCreateHtmlDocument> Custom event', 'color: #28a745', type, data)
61
+        this.setState(prev => ({
62
+          loggedUser: {
63
+            ...prev.loggedUser,
64
+            lang: data
65
+          }
66
+        }))
67
+        i18n.changeLanguage(data)
68
+        break
69
+    }
50
   }
70
   }
51
 
71
 
52
   handleChangeNewContentName = e => this.setState({newContentName: e.target.value})
72
   handleChangeNewContentName = e => this.setState({newContentName: e.target.value})
93
         faIcon={this.state.config.faIcon}
113
         faIcon={this.state.config.faIcon}
94
         contentName={this.state.newContentName}
114
         contentName={this.state.newContentName}
95
         onChangeContentName={this.handleChangeNewContentName}
115
         onChangeContentName={this.handleChangeNewContentName}
96
-        btnValidateLabel='Valider et créer'
116
+        btnValidateLabel={this.props.t('Validate and create')}
97
       />
117
       />
98
     )
118
     )
99
   }
119
   }
100
 }
120
 }
101
 
121
 
102
-export default PopupCreateHtmlDocument
122
+export default translate()(PopupCreateHtmlDocument)

+ 5 - 5
frontend_app_html-document/src/css/index.styl View File

1
 @import "../../node_modules/tracim_frontend_lib/src/css/Variable.styl"
1
 @import "../../node_modules/tracim_frontend_lib/src/css/Variable.styl"
2
 
2
 
3
-.html-documents
3
+.html-document
4
   width 70%
4
   width 70%
5
   &__header
5
   &__header
6
     &__editionmode
6
     &__editionmode
68
     background-color htmlColor
68
     background-color htmlColor
69
 
69
 
70
 @media (min-width: min-sm) and (max-width: max-lg)
70
 @media (min-width: min-sm) and (max-width: max-lg)
71
-  .html-documents
71
+  .html-document
72
     &__contentpage
72
     &__contentpage
73
       &__content
73
       &__content
74
         margin 10px
74
         margin 10px
77
 
77
 
78
 @media (min-width: min-md) and (max-width: max-md)
78
 @media (min-width: min-md) and (max-width: max-md)
79
 
79
 
80
-  .html-documents
80
+  .html-document
81
     top 68px
81
     top 68px
82
 
82
 
83
 @media (min-width: min-sm) and (max-width: max-sm)
83
 @media (min-width: min-sm) and (max-width: max-sm)
84
 
84
 
85
-  .html-documents
85
+  .html-document
86
     top 68px
86
     top 68px
87
     width 100%
87
     width 100%
88
 
88
 
89
 @media (max-width: max-xs)
89
 @media (max-width: max-xs)
90
 
90
 
91
-  .html-documents
91
+  .html-document
92
     top 68px
92
     top 68px
93
     width 100%
93
     width 100%
94
     &__contentpage
94
     &__contentpage

+ 4 - 3
frontend_app_html-document/src/helper.js View File

16
 export const debug = {
16
 export const debug = {
17
   config: {
17
   config: {
18
     label: 'Text Document',
18
     label: 'Text Document',
19
-    slug: 'html-documents',
19
+    slug: 'html-document',
20
     faIcon: 'file-text-o',
20
     faIcon: 'file-text-o',
21
     hexcolor: '#3f52e3',
21
     hexcolor: '#3f52e3',
22
     creationLabel: 'Write a document',
22
     creationLabel: 'Write a document',
71
     firstname: 'Côme',
71
     firstname: 'Côme',
72
     lastname: 'Stoilenom',
72
     lastname: 'Stoilenom',
73
     email: 'osef@algoo.fr',
73
     email: 'osef@algoo.fr',
74
+    lang: 'en',
74
     avatar_url: 'https://avatars3.githubusercontent.com/u/11177014?s=460&v=4',
75
     avatar_url: 'https://avatars3.githubusercontent.com/u/11177014?s=460&v=4',
75
     auth: btoa(`${'admin@admin.admin'}:${'admin@admin.admin'}`)
76
     auth: btoa(`${'admin@admin.admin'}:${'admin@admin.admin'}`)
76
   },
77
   },
81
       user_id: 1 // -1 or 1 for debug
82
       user_id: 1 // -1 or 1 for debug
82
     },
83
     },
83
     content_id: 22, // 1 or 22 for debug
84
     content_id: 22, // 1 or 22 for debug
84
-    content_type: 'html-documents',
85
+    content_type: 'html-document',
85
     created: '2018-06-18T14:59:26Z',
86
     created: '2018-06-18T14:59:26Z',
86
     current_revision_id: 11,
87
     current_revision_id: 11,
87
     is_archived: false,
88
     is_archived: false,
98
     show_in_ui: true,
99
     show_in_ui: true,
99
     slug: 'current-menu',
100
     slug: 'current-menu',
100
     status: 'open',
101
     status: 'open',
101
-    sub_content_types: ['thread', 'html-documents', 'file', 'folder'],
102
+    sub_content_types: ['thread', 'html-document', 'file', 'folder'],
102
     workspace_id: 1
103
     workspace_id: 1
103
   },
104
   },
104
   timeline: timelineDebugData
105
   timeline: timelineDebugData

+ 1 - 1
frontend_app_html-document/src/index.js View File

10
 require('./css/index.styl')
10
 require('./css/index.styl')
11
 
11
 
12
 const appInterface = {
12
 const appInterface = {
13
-  name: 'HtmlDocument',
13
+  name: 'html-document',
14
   isRendered: false,
14
   isRendered: false,
15
   renderAppFull: data => {
15
   renderAppFull: data => {
16
     return ReactDOM.render(
16
     return ReactDOM.render(

+ 3 - 1
frontend_app_thread/i18next.scanner/en/translation.json View File

1
-{}
1
+{
2
+  "Validate and create": "Validate and create"
3
+}

+ 3 - 1
frontend_app_thread/i18next.scanner/fr/translation.json View File

1
-{}
1
+{
2
+  "Validate and create": "Valider et créer"
3
+}

+ 26 - 6
frontend_app_thread/src/container/PopupCreateThread.jsx View File

1
 import React from 'react'
1
 import React from 'react'
2
+import { translate } from 'react-i18next'
2
 import {
3
 import {
3
   addAllResourceI18n,
4
   addAllResourceI18n,
4
   CardPopupCreateContent,
5
   CardPopupCreateContent,
5
   handleFetchResult
6
   handleFetchResult
6
 } from 'tracim_frontend_lib'
7
 } from 'tracim_frontend_lib'
7
 import { postThreadContent } from '../action.async.js'
8
 import { postThreadContent } from '../action.async.js'
9
+import i18n from '../i18n.js'
8
 
10
 
9
 const debug = { // outdated
11
 const debug = { // outdated
10
   config: {
12
   config: {
11
-    label: 'Thread',
13
+    label: 'PopupCreateThread',
12
     slug: 'thread',
14
     slug: 'thread',
13
     faIcon: 'file-text-o',
15
     faIcon: 'file-text-o',
14
     hexcolor: '#ad4cf9',
16
     hexcolor: '#ad4cf9',
42
   idFolder: null
44
   idFolder: null
43
 }
45
 }
44
 
46
 
45
-class PopupCreateHtmlDocument extends React.Component {
47
+class PopupCreateThread extends React.Component {
46
   constructor (props) {
48
   constructor (props) {
47
     super(props)
49
     super(props)
48
     this.state = {
50
     this.state = {
49
-      appName: 'thread',
51
+      appName: 'thread', // must remain 'thread' because it is the name of the react built app (which contains Threac and PopupCreateThread)
50
       config: props.data ? props.data.config : debug.config,
52
       config: props.data ? props.data.config : debug.config,
51
       loggedUser: props.data ? props.data.loggedUser : debug.loggedUser,
53
       loggedUser: props.data ? props.data.loggedUser : debug.loggedUser,
52
       idWorkspace: props.data ? props.data.idWorkspace : debug.idWorkspace,
54
       idWorkspace: props.data ? props.data.idWorkspace : debug.idWorkspace,
55
     }
57
     }
56
 
58
 
57
     // i18n has been init, add resources from frontend
59
     // i18n has been init, add resources from frontend
58
-    addAllResourceI18n(i18n, props.data ? props.data.config.translation : debug.config.translation)
60
+    addAllResourceI18n(i18n, this.state.config.translation)
61
+    i18n.changeLanguage(this.state.loggedUser.lang)
62
+
63
+    document.addEventListener('appCustomEvent', this.customEventReducer)
64
+  }
65
+
66
+  customEventReducer = ({ detail: { type, data } }) => { // action: { type: '', data: {} }
67
+    switch (type) {
68
+      case 'allApp_changeLang':
69
+        console.log('%c<PopupCreateThread> Custom event', 'color: #28a745', type, data)
70
+        this.setState(prev => ({
71
+          loggedUser: {
72
+            ...prev.loggedUser,
73
+            lang: data
74
+          }
75
+        }))
76
+        i18n.changeLanguage(data)
77
+        break
78
+    }
59
   }
79
   }
60
 
80
 
61
   handleChangeNewContentName = e => this.setState({newContentName: e.target.value})
81
   handleChangeNewContentName = e => this.setState({newContentName: e.target.value})
101
         faIcon={this.state.config.faIcon}
121
         faIcon={this.state.config.faIcon}
102
         contentName={this.state.newContentName}
122
         contentName={this.state.newContentName}
103
         onChangeContentName={this.handleChangeNewContentName}
123
         onChangeContentName={this.handleChangeNewContentName}
104
-        btnValidateLabel='Valider et créer'
124
+        btnValidateLabel={this.props.t('Validate and create')}
105
       />
125
       />
106
     )
126
     )
107
   }
127
   }
108
 }
128
 }
109
 
129
 
110
-export default PopupCreateHtmlDocument
130
+export default translate()(PopupCreateThread)

+ 13 - 1
frontend_app_thread/src/container/Thread.jsx View File

35
     }
35
     }
36
 
36
 
37
     // i18n has been init, add resources from frontend
37
     // i18n has been init, add resources from frontend
38
-    addAllResourceI18n(i18n, props.data ? props.data.config.translation : debug.config.translation)
38
+    addAllResourceI18n(i18n, this.state.config.translation)
39
+    i18n.changeLanguage(this.state.loggedUser.lang)
39
 
40
 
40
     document.addEventListener('appCustomEvent', this.customEventReducer)
41
     document.addEventListener('appCustomEvent', this.customEventReducer)
41
   }
42
   }
53
       case 'thread_reloadContent':
54
       case 'thread_reloadContent':
54
         console.log('%c<Thread> Custom event', 'color: #28a745', type, data)
55
         console.log('%c<Thread> Custom event', 'color: #28a745', type, data)
55
         this.setState(prev => ({content: {...prev.content, ...data}, isVisible: true}))
56
         this.setState(prev => ({content: {...prev.content, ...data}, isVisible: true}))
57
+        break
58
+      case 'allApp_changeLang':
59
+        console.log('%c<Thread> Custom event', 'color: #28a745', type, data)
60
+        this.setState(prev => ({
61
+          loggedUser: {
62
+            ...prev.loggedUser,
63
+            lang: data
64
+          }
65
+        }))
66
+        i18n.changeLanguage(data)
67
+        break
56
     }
68
     }
57
   }
69
   }
58
 
70
 

+ 2 - 2
frontend_app_thread/src/helper.js View File

5
   }
5
   }
6
 }
6
 }
7
 
7
 
8
-export const debug = { // copied from html-documents => outdated
8
+export const debug = { // copied from html-document => outdated
9
   config: {
9
   config: {
10
     label: 'Thread',
10
     label: 'Thread',
11
     slug: 'thread',
11
     slug: 'thread',
78
     show_in_ui: true,
78
     show_in_ui: true,
79
     slug: 'current-menu',
79
     slug: 'current-menu',
80
     status: 'open',
80
     status: 'open',
81
-    sub_content_types: ['thread', 'html-documents', 'file', 'folder'],
81
+    sub_content_types: ['thread', 'html-document', 'file', 'folder'],
82
     workspace_id: 1
82
     workspace_id: 1
83
   },
83
   },
84
   timeline: [] // timelineDebugData
84
   timeline: [] // timelineDebugData

+ 1 - 1
frontend_app_thread/src/index.js View File

6
 require('./css/index.styl')
6
 require('./css/index.styl')
7
 
7
 
8
 const appInterface = {
8
 const appInterface = {
9
-  name: 'Thread',
9
+  name: 'thread',
10
   isRendered: false,
10
   isRendered: false,
11
   renderAppFull: data => {
11
   renderAppFull: data => {
12
     return ReactDOM.render(
12
     return ReactDOM.render(