Quellcode durchsuchen

added last version btn

Skylsmoi vor 6 Jahren
Ursprung
Commit
ea0a454d1a
3 geänderte Dateien mit 48 neuen und 23 gelöschten Zeilen
  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 Datei anzeigen

@@ -7,9 +7,14 @@ const HtmlDocument = props => {
7 7
     <div className='wsContentHtmlDocument__contentpage__textnote html-documents__contentpage__textnote'>
8 8
       {(props.mode === MODE.VIEW || props.mode === MODE.REVISION) &&
9 9
         <div>
10
-          <div className='html-documents__contentpage__textnote__latestversion'>
10
+          <div className='html-documents__contentpage__textnote__version'>
11 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 18
           </div>
14 19
           <div className='html-documents__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
15 20
         </div>

+ 37 - 20
src/container/HtmlDocument.jsx Datei anzeigen

@@ -236,6 +236,11 @@ class HtmlDocument extends React.Component {
236 236
     }))
237 237
   }
238 238
 
239
+  handleClickLastVersion = () => {
240
+    this.loadContent()
241
+    this.setState({mode: MODE.VIEW})
242
+  }
243
+
239 244
   render () {
240 245
     const { isVisible, loggedUser, content, timeline, newComment, timelineWysiwyg, config, mode } = this.state
241 246
 
@@ -252,21 +257,36 @@ class HtmlDocument extends React.Component {
252 257
         />
253 258
 
254 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 290
           </div>
271 291
         </PopinFixedOption>
272 292
 
@@ -276,11 +296,8 @@ class HtmlDocument extends React.Component {
276 296
             wysiwygNewVersion={'wysiwygNewVersion'}
277 297
             onClickCloseEditMode={this.handleCloseNewVersion}
278 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 301
             text={content.raw_content}
285 302
             onChangeText={this.handleChangeText}
286 303
             key={'html-documents'}

+ 4 - 1
src/css/index.styl Datei anzeigen

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