1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00

Hide PlantUML sample diagrams when you have content

Closes #346
This commit is contained in:
HarveyKandola 2019-12-06 10:13:15 +00:00
parent 51a25adbdb
commit 5aaa9f874d
2 changed files with 29 additions and 25 deletions

View file

@ -30,6 +30,9 @@ export default Component.extend({
let page = this.get('page'); let page = this.get('page');
return `plantuml-preview-${page.id}`; return `plantuml-preview-${page.id}`;
}), }),
emptyDiagram: computed('diagramText', function () {
return _.isEmpty(this.get('diagramText'));
}),
generatePreview() { generatePreview() {
this.set('waiting', true); this.set('waiting', true);
@ -50,7 +53,7 @@ export default Component.extend({
}); });
}); });
}, },
didReceiveAttrs() { didReceiveAttrs() {
this._super(...arguments); this._super(...arguments);
this.set('waiting', false); this.set('waiting', false);
@ -96,20 +99,20 @@ title Servlet Container
if "Page.onSecurityCheck" then if "Page.onSecurityCheck" then
->[true] "Page.onInit()" ->[true] "Page.onInit()"
if "isForward?" then if "isForward?" then
->[no] "Process controls" ->[no] "Process controls"
if "continue processing?" then if "continue processing?" then
-->[yes] ===RENDERING=== -->[yes] ===RENDERING===
else else
-->[no] ===REDIRECT_CHECK=== -->[no] ===REDIRECT_CHECK===
endif endif
else else
-->[yes] ===RENDERING=== -->[yes] ===RENDERING===
endif endif
if "is Post?" then if "is Post?" then
-->[yes] "Page.onPost()" -->[yes] "Page.onPost()"
--> "Page.onRender()" as render --> "Page.onRender()" as render
@ -118,7 +121,7 @@ if "Page.onSecurityCheck" then
-->[no] "Page.onGet()" -->[no] "Page.onGet()"
--> render --> render
endif endif
else else
-->[false] ===REDIRECT_CHECK=== -->[false] ===REDIRECT_CHECK===
endif endif
@ -243,7 +246,7 @@ if (Page.onSecurityCheck) then (true)
if (continue processing?) then (no) if (continue processing?) then (no)
stop stop
endif endif
if (isPost?) then (yes) if (isPost?) then (yes)
:Page.onPost(); :Page.onPost();
else (no) else (no)
@ -280,11 +283,11 @@ package "Some Group" {
HTTP - [First Component] HTTP - [First Component]
[Another Component] [Another Component]
} }
node "Other Groups" { node "Other Groups" {
FTP - [Second Component] FTP - [Second Component]
[First Component] --> FTP [First Component] --> FTP
} }
cloud { cloud {
[Example 1] [Example 1]
@ -331,11 +334,11 @@ state State3 {
State3 --> State3 : Failed State3 --> State3 : Failed
State3 --> [*] : Succeeded / Save Result State3 --> [*] : Succeeded / Save Result
State3 --> [*] : Aborted State3 --> [*] : Aborted
@enduml`; @enduml`;
this.set('diagramText', txt); this.set('diagramText', txt);
this.generatePreview(); this.generatePreview();
} }
} }
}); });

View file

@ -10,24 +10,25 @@
<div class="form-group"> <div class="form-group">
<label><a href="http://plantuml.com/" target="_blank">PlantUML Diagram</a></label> <label><a href="http://plantuml.com/" target="_blank">PlantUML Diagram</a></label>
<Ui::UiSpacer @size="200" /> <Ui::UiSpacer @size="200" />
<div>
<p>Insert sample diagrams:</p>
<p>
{{ui/ui-button color=constants.Color.Gray light=true label="Sequence" onClick=(action "onInsertSequence")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Use Case" onClick=(action "onInsertUseCase")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Class" onClick=(action "onInsertClass")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Activity" onClick=(action "onInsertActivity")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Activity (new syntax)" onClick=(action "onInsertActivityNew")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Component" onClick=(action "onInsertComponent")}}
{{ui/ui-button color=constants.Color.Gray light=true label="State" onClick=(action "onInsertState")}}
</p>
</div>
{{focus-textarea value=diagramText rows=30 id=editorId class="diagram-editor form-control mousetrap"}} {{focus-textarea value=diagramText rows=30 id=editorId class="diagram-editor form-control mousetrap"}}
{{#if emptyDiagram}}
<div>
<Ui::UiSpacer @size="100" />
<p>Insert sample diagrams:</p>
<p>
{{ui/ui-button color=constants.Color.Gray light=true label="Sequence" onClick=(action "onInsertSequence")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Use Case" onClick=(action "onInsertUseCase")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Class" onClick=(action "onInsertClass")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Activity" onClick=(action "onInsertActivity")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Activity (new syntax)" onClick=(action "onInsertActivityNew")}}
{{ui/ui-button color=constants.Color.Gray light=true label="Component" onClick=(action "onInsertComponent")}}
{{ui/ui-button color=constants.Color.Gray light=true label="State" onClick=(action "onInsertState")}}
</p>
</div>
{{/if}}
</div> </div>
</div> </div>
<Ui::UiSpacer @size="200" />
{{ui/ui-button color=constants.Color.Yellow light=true label=previewButtonCaption onClick=(action "onPreview")}} {{ui/ui-button color=constants.Color.Yellow light=true label=previewButtonCaption onClick=(action "onPreview")}}
<Ui::UiSpacer @size="200" /> <Ui::UiSpacer @size="200" />