Browse Source

added last version btn

Skylsmoi 6 years ago
parent
commit
ea0a454d1a
3 changed files with 48 additions and 23 deletions
  1. 7 2
      src/component/HtmlDocument.jsx
  2. 37 20
      src/container/HtmlDocument.jsx
  3. 4 1
      src/css/index.styl

+ 7 - 2
src/component/HtmlDocument.jsx View File

7
     <div className='wsContentHtmlDocument__contentpage__textnote html-documents__contentpage__textnote'>
7
     <div className='wsContentHtmlDocument__contentpage__textnote html-documents__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__latestversion'>
10
+          <div className='html-documents__contentpage__textnote__version'>
11
             version n°
11
             version n°
12
-            <div dangerouslySetInnerHTML={{__html: props.version}} />
12
+            <div dangerouslySetInnerHTML={{__html: props.mode === MODE.VIEW ? props.lastVersion : props.version}} />
13
+            {props.mode === MODE.REVISION &&
14
+              <div className='html-documents__contentpage__textnote__lastversion'>
15
+                (dernière version : {props.lastVersion})
16
+              </div>
17
+            }
13
           </div>
18
           </div>
14
           <div className='html-documents__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
19
           <div className='html-documents__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
15
         </div>
20
         </div>

+ 37 - 20
src/container/HtmlDocument.jsx View File

236
     }))
236
     }))
237
   }
237
   }
238
 
238
 
239
+  handleClickLastVersion = () => {
240
+    this.loadContent()
241
+    this.setState({mode: MODE.VIEW})
242
+  }
243
+
239
   render () {
244
   render () {
240
     const { isVisible, loggedUser, content, timeline, newComment, timelineWysiwyg, config, mode } = this.state
245
     const { isVisible, loggedUser, content, timeline, newComment, timelineWysiwyg, config, mode } = this.state
241
 
246
 
252
         />
257
         />
253
 
258
 
254
         <PopinFixedOption customClass={`${config.slug}`} i18n={i18n}>
259
         <PopinFixedOption customClass={`${config.slug}`} i18n={i18n}>
255
-          <div>
256
-            <NewVersionBtn onClickNewVersionBtn={this.handleClickNewVersion} disabled={mode === MODE.REVISION} />
257
-
258
-            <SelectStatus
259
-              selectedStatus={config.availableStatuses.find(s => s.slug === content.status)}
260
-              availableStatus={config.availableStatuses}
261
-              onChangeStatus={this.handleChangeStatus}
262
-              disabled={mode === MODE.REVISION}
263
-            />
264
-
265
-            <ArchiveDeleteContent
266
-              onClickArchiveBtn={this.handleClickArchive}
267
-              onClickDeleteBtn={this.handleClickDelete}
268
-              disabled={mode === MODE.REVISION}
269
-            />
260
+          <div /* this div in display flex, justify-content space-between */>
261
+            <div className='d-flex'>
262
+              <NewVersionBtn onClickNewVersionBtn={this.handleClickNewVersion} disabled={mode === MODE.REVISION} />
263
+
264
+              {mode === MODE.REVISION &&
265
+                <button
266
+                  className='wsContentGeneric__option__menu__lastversion html-documents__lastversionbtn btn btn-default'
267
+                  onClick={this.handleClickLastVersion}
268
+                  style={{backgroundColor: config.hexcolor, color: '#fdfdfd'}}
269
+                >
270
+                  <i className='fa fa-code-fork' />
271
+                  Dernière version
272
+                </button>
273
+              }
274
+            </div>
275
+
276
+            <div className='d-flex'>
277
+              <SelectStatus
278
+                selectedStatus={config.availableStatuses.find(s => s.slug === content.status)}
279
+                availableStatus={config.availableStatuses}
280
+                onChangeStatus={this.handleChangeStatus}
281
+                disabled={mode === MODE.REVISION}
282
+              />
283
+
284
+              <ArchiveDeleteContent
285
+                onClickArchiveBtn={this.handleClickArchive}
286
+                onClickDeleteBtn={this.handleClickDelete}
287
+                disabled={mode === MODE.REVISION}
288
+              />
289
+            </div>
270
           </div>
290
           </div>
271
         </PopinFixedOption>
291
         </PopinFixedOption>
272
 
292
 
276
             wysiwygNewVersion={'wysiwygNewVersion'}
296
             wysiwygNewVersion={'wysiwygNewVersion'}
277
             onClickCloseEditMode={this.handleCloseNewVersion}
297
             onClickCloseEditMode={this.handleCloseNewVersion}
278
             onClickValidateBtn={this.handleSaveHtmlDocument}
298
             onClickValidateBtn={this.handleSaveHtmlDocument}
279
-            version={
280
-              mode === MODE.REVISION
281
-                ? content.number
282
-                : timeline.filter(t => t.timelineType === 'revision').length
283
-            }
299
+            version={content.number}
300
+            lastVersion={timeline.filter(t => t.timelineType === 'revision').length}
284
             text={content.raw_content}
301
             text={content.raw_content}
285
             onChangeText={this.handleChangeText}
302
             onChangeText={this.handleChangeText}
286
             key={'html-documents'}
303
             key={'html-documents'}

+ 4 - 1
src/css/index.styl View File

54
       height 100%
54
       height 100%
55
       overflow-y auto
55
       overflow-y auto
56
       background-color off-white
56
       background-color off-white
57
-      &__latestversion
57
+      &__version
58
         display flex
58
         display flex
59
         justify-content flex-end
59
         justify-content flex-end
60
         align-items center
60
         align-items center
61
         text-align right
61
         text-align right
62
         opacity 0.7
62
         opacity 0.7
63
+      &__lastversion
64
+        margin-left 15px
65
+        font-weight bold
63
       &__text
66
       &__text
64
         font-size 14px
67
         font-size 14px
65
       &__edition
68
       &__edition