Browse Source

bugfix + PopinFixedOption now accepts childrens + added disabled btn props for PopinFixed

Skylsmoi 6 years ago
parent
commit
ee19021d98

+ 1 - 0
src/component/Input/SelectStatus/SelectStatus.jsx View File

17
         aria-haspopup='true'
17
         aria-haspopup='true'
18
         aria-expanded='false'
18
         aria-expanded='false'
19
         style={{color: props.selectedStatus ? props.selectedStatus.hexcolor : 'transparent'}}
19
         style={{color: props.selectedStatus ? props.selectedStatus.hexcolor : 'transparent'}}
20
+        disabled={props.disabled}
20
       >
21
       >
21
         {props.selectedStatus ? props.selectedStatus.label : ''}
22
         {props.selectedStatus ? props.selectedStatus.label : ''}
22
         <div className='selectStatus__dropdownbtn__icon'>
23
         <div className='selectStatus__dropdownbtn__icon'>

src/component/OptionComponent/EditContent.jsx → src/component/OptionComponent/ArchiveDeleteContent.jsx View File

1
 import React from 'react'
1
 import React from 'react'
2
 
2
 
3
-const EditContent = props => {
3
+const ArchiveDeleteContent = props => {
4
   return (
4
   return (
5
     <div className='d-flex align-items-center'>
5
     <div className='d-flex align-items-center'>
6
       <button
6
       <button
7
         type='button'
7
         type='button'
8
         className='wsContentGeneric__option__menu__action optionicon d-none d-sm-block'
8
         className='wsContentGeneric__option__menu__action optionicon d-none d-sm-block'
9
         onClick={props.onClickArchiveBtn}
9
         onClick={props.onClickArchiveBtn}
10
+        disabled={props.disabled}
10
       >
11
       >
11
         <i className='fa fa-fw fa-archive' />
12
         <i className='fa fa-fw fa-archive' />
12
       </button>
13
       </button>
14
         type='button'
15
         type='button'
15
         className='wsContentGeneric__option__menu__action optionicon d-none d-sm-block'
16
         className='wsContentGeneric__option__menu__action optionicon d-none d-sm-block'
16
         onClick={props.onClickDeleteBtn}
17
         onClick={props.onClickDeleteBtn}
18
+        disabled={props.disabled}
17
       >
19
       >
18
         <i className='fa fa-fw fa-trash' />
20
         <i className='fa fa-fw fa-trash' />
19
       </button>
21
       </button>
21
   )
23
   )
22
 }
24
 }
23
 
25
 
24
-export default EditContent
26
+export default ArchiveDeleteContent

+ 3 - 2
src/component/OptionComponent/NewVersionBtn.jsx View File

2
 
2
 
3
 const NewVersionBtn = props => {
3
 const NewVersionBtn = props => {
4
   return (
4
   return (
5
-    <div
5
+    <button
6
       className='wsContentGeneric__option__menu__addversion newversionbtn btn btn-outline-primary mr-auto'
6
       className='wsContentGeneric__option__menu__addversion newversionbtn btn btn-outline-primary mr-auto'
7
       onClick={props.onClickNewVersionBtn}
7
       onClick={props.onClickNewVersionBtn}
8
+      disabled={props.disabled}
8
     >
9
     >
9
       Nouvelle version
10
       Nouvelle version
10
       <i className='fa fa-plus-circle ml-3' />
11
       <i className='fa fa-plus-circle ml-3' />
11
-    </div>
12
+    </button>
12
   )
13
   )
13
 }
14
 }
14
 
15
 

+ 3 - 2
src/component/PopinFixed/PopinFixed.styl View File

57
       font-size 25px
57
       font-size 25px
58
       cursor pointer
58
       cursor pointer
59
     &__menu
59
     &__menu
60
-      display flex
61
-      align-items center
60
+      & > div
61
+        display flex
62
+        align-items center
62
       &__addversion
63
       &__addversion
63
         display flex
64
         display flex
64
         align-items center
65
         align-items center

+ 1 - 17
src/component/PopinFixed/PopinFixedOption.jsx View File

3
 import PropTypes from 'prop-types'
3
 import PropTypes from 'prop-types'
4
 import { translate } from 'react-i18next'
4
 import { translate } from 'react-i18next'
5
 import i18n from '../../i18n.js'
5
 import i18n from '../../i18n.js'
6
-import NewVersionBtn from '../OptionComponent/NewVersionBtn.jsx'
7
-import EditContent from '../OptionComponent/EditContent.jsx'
8
-import SelectStatus from '../Input/SelectStatus/SelectStatus.jsx'
9
 
6
 
10
 const PopinFixedOption = props => {
7
 const PopinFixedOption = props => {
11
   translate.setI18n(props.i18n ? props.i18n : i18n) // mandatory to allow Apps to overrides trad
8
   translate.setI18n(props.i18n ? props.i18n : i18n) // mandatory to allow Apps to overrides trad
13
   return (
10
   return (
14
     <div className={classnames('wsContentGeneric__option', `${props.customClass}__option`)}>
11
     <div className={classnames('wsContentGeneric__option', `${props.customClass}__option`)}>
15
       <div className={classnames('wsContentGeneric__option__menu', `${props.customClass}__option__menu`)}>
12
       <div className={classnames('wsContentGeneric__option__menu', `${props.customClass}__option__menu`)}>
16
-
17
-        <NewVersionBtn onClickNewVersionBtn={props.onClickNewVersionBtn} />
18
-
19
-        <SelectStatus
20
-          selectedStatus={props.selectedStatus}
21
-          availableStatus={props.availableStatus}
22
-          onChangeStatus={props.onChangeStatus}
23
-        />
24
-
25
-        <EditContent
26
-          onClickArchiveBtn={props.onClickArchive}
27
-          onClickDeleteBtn={props.onClickDelete}
28
-        />
29
-
13
+        {props.children}
30
       </div>
14
       </div>
31
     </div>
15
     </div>
32
   )
16
   )

+ 6 - 2
src/component/Timeline/Revision.jsx View File

3
 
3
 
4
 const Revision = props => (
4
 const Revision = props => (
5
   <li className={classnames(`${props.customClass}__messagelist__version`, 'timeline__messagelist__version')} >
5
   <li className={classnames(`${props.customClass}__messagelist__version`, 'timeline__messagelist__version')} >
6
-    <div className={classnames(`${props.customClass}__messagelist__version__btn`, 'timeline__messagelist__version__btn btn')}>
6
+    <button
7
+      type='button'
8
+      className={classnames(`${props.customClass}__messagelist__version__btn`, 'timeline__messagelist__version__btn btn')}
9
+      onClick={props.onClickRevision}
10
+    >
7
       <i className='fa fa-code-fork' />
11
       <i className='fa fa-code-fork' />
8
       version {props.number}
12
       version {props.number}
9
-    </div>
13
+    </button>
10
 
14
 
11
     <div className={classnames(`${props.customClass}__messagelist__version__date`, 'timeline__messagelist__version__date')}>
15
     <div className={classnames(`${props.customClass}__messagelist__version__date`, 'timeline__messagelist__version__date')}>
12
       Créer le {props.createdAt}
16
       Créer le {props.createdAt}

+ 9 - 2
src/component/Timeline/Timeline.jsx View File

48
                 return <Revision
48
                 return <Revision
49
                   customClass={props.customClass}
49
                   customClass={props.customClass}
50
                   createdAt={content.created}
50
                   createdAt={content.created}
51
-                  number={props.timelineData.filter(c => c.timelineType === 'revision' && c.revision_id <= content.revision_id).length}
51
+                  number={content.number}
52
                   key={`revision_${content.revision_id}`}
52
                   key={`revision_${content.revision_id}`}
53
+                  onClickRevision={() => props.onClickRevisionBtn(content)}
53
                 />
54
                 />
54
             }
55
             }
55
           })}
56
           })}
63
               placeholder='Taper votre message ici'
64
               placeholder='Taper votre message ici'
64
               value={props.newComment}
65
               value={props.newComment}
65
               onChange={props.onChangeNewComment}
66
               onChange={props.onChangeNewComment}
67
+              disabled={props.disableComment}
66
             />
68
             />
67
           </div>
69
           </div>
68
 
70
 
74
                   `${props.customClass}__texteditor__advancedtext__btn timeline__texteditor__advancedtext__btn btn btn-outline-primary`
76
                   `${props.customClass}__texteditor__advancedtext__btn timeline__texteditor__advancedtext__btn btn btn-outline-primary`
75
                 )}
77
                 )}
76
                 onClick={props.onClickWysiwygBtn}
78
                 onClick={props.onClickWysiwygBtn}
79
+                disabled={props.disableComment}
77
               >
80
               >
78
                 {props.wysiwyg ? 'Text Simple' : 'Texte Avancé'}
81
                 {props.wysiwyg ? 'Text Simple' : 'Texte Avancé'}
79
               </button>
82
               </button>
84
                 type='button'
87
                 type='button'
85
                 className={classnames(`${props.customClass}__texteditor__submit__btn`, 'timeline__texteditor__submit__btn btn')}
88
                 className={classnames(`${props.customClass}__texteditor__submit__btn`, 'timeline__texteditor__submit__btn btn')}
86
                 onClick={props.onClickValidateNewCommentBtn}
89
                 onClick={props.onClickValidateNewCommentBtn}
90
+                disabled={props.disableComment}
87
               >
91
               >
88
                 Envoyer
92
                 Envoyer
89
                 <div
93
                 <div
106
   newComment: PropTypes.string.isRequired,
110
   newComment: PropTypes.string.isRequired,
107
   onChangeNewComment: PropTypes.func.isRequired,
111
   onChangeNewComment: PropTypes.func.isRequired,
108
   onClickValidateNewCommentBtn: PropTypes.func.isRequired,
112
   onClickValidateNewCommentBtn: PropTypes.func.isRequired,
113
+  disableComment: PropTypes.bool,
109
   customClass: PropTypes.string,
114
   customClass: PropTypes.string,
110
   loggedUser: PropTypes.object,
115
   loggedUser: PropTypes.object,
111
   wysiwyg: PropTypes.bool,
116
   wysiwyg: PropTypes.bool,
112
-  onClickWysiwygBtn: PropTypes.func
117
+  onClickWysiwygBtn: PropTypes.func,
118
+  onClickRevisionBtn: PropTypes.func
113
 }
119
 }
114
 
120
 
115
 Timeline.defaultProps = {
121
 Timeline.defaultProps = {
122
+  disableComment: false,
116
   customClass: '',
123
   customClass: '',
117
   loggedUser: {
124
   loggedUser: {
118
     id: '',
125
     id: '',

+ 8 - 0
src/index.js View File

17
 import libCardPopup from './component/CardPopup/CardPopup.jsx'
17
 import libCardPopup from './component/CardPopup/CardPopup.jsx'
18
 import libCardPopupCreateContent from './component/CardPopup/CardPopupCreateContent.jsx'
18
 import libCardPopupCreateContent from './component/CardPopup/CardPopupCreateContent.jsx'
19
 
19
 
20
+import libNewVersionBtn from './component/OptionComponent/NewVersionBtn.jsx'
21
+import libArchiveDeleteContent from './component/OptionComponent/ArchiveDeleteContent.jsx'
22
+import libSelectStatus from './component/Input/SelectStatus/SelectStatus.jsx'
23
+
20
 export const langFr = fr
24
 export const langFr = fr
21
 export const langEn = en
25
 export const langEn = en
22
 
26
 
36
 
40
 
37
 export const CardPopup = libCardPopup
41
 export const CardPopup = libCardPopup
38
 export const CardPopupCreateContent = libCardPopupCreateContent
42
 export const CardPopupCreateContent = libCardPopupCreateContent
43
+
44
+export const NewVersionBtn = libNewVersionBtn
45
+export const ArchiveDeleteContent = libArchiveDeleteContent
46
+export const SelectStatus = libSelectStatus