Skip to content
Snippets Groups Projects
Commit de7e91f2 authored by François  LAURENT's avatar François LAURENT
Browse files

feat: disable download and delete buttons if no sequences

parent 6ba67e54
No related branches found
No related tags found
1 merge request!2UX improvements
...@@ -51,6 +51,7 @@ const bonito_app = NamedApp(:inherit, Backbone.app) ...@@ -51,6 +51,7 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
@out new_clipboard_item = false @out new_clipboard_item = false
@in delete_sequence_click = false @in delete_sequence_click = false
@out no_sequences_yet = true
@onchange isready begin @onchange isready begin
_, url = init_model(__model__) _, url = init_model(__model__)
...@@ -151,6 +152,8 @@ const bonito_app = NamedApp(:inherit, Backbone.app) ...@@ -151,6 +152,8 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
notify(start_time) notify(start_time)
notify(time_interval) notify(time_interval)
notify(series_length) notify(series_length)
# enable the download and delete buttons
no_sequences_yet = false
# toggle edit mode on # toggle edit mode on
editmode = true editmode = true
end end
...@@ -280,6 +283,8 @@ const bonito_app = NamedApp(:inherit, Backbone.app) ...@@ -280,6 +283,8 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
end end
# reset # reset
fileuploads = empty!(fileuploads) fileuploads = empty!(fileuploads)
# enable the download and delete buttons
no_sequences_yet = false
end end
end end
...@@ -309,6 +314,8 @@ const bonito_app = NamedApp(:inherit, Backbone.app) ...@@ -309,6 +314,8 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
selected_sequence_name = "" selected_sequence_name = ""
# update the view # update the view
sequence_name = "" sequence_name = ""
# disable the download and delete buttons (view)
no_sequences_yet = true
# update the model # update the model
model.sequence[] = sequence model.sequence[] = sequence
else else
...@@ -338,7 +345,7 @@ function muscle_view(bonito_url=""; channel=":channel") ...@@ -338,7 +345,7 @@ function muscle_view(bonito_url=""; channel=":channel")
label="Upload motor program(s)", autoupload=true, hideuploadbtn=true, label="Upload motor program(s)", autoupload=true, hideuploadbtn=true,
class="no-file-listing", id="uploader", url="/____/upload/$channel")), class="no-file-listing", id="uploader", url="/____/upload/$channel")),
item(btn("Download motor program", @click(:export_sequence_click), color="primary", item(btn("Download motor program", @click(:export_sequence_click), color="primary",
loading=:export_sequence_click, loading=:export_sequence_click, disable=:no_sequences_yet,
[tooltip("Download the current motor program as a JSON file")])), [tooltip("Download the current motor program as a JSON file")])),
dropdown(:selected_sequence_name, :sequence_names, "Motor program", dropdown(:selected_sequence_name, :sequence_names, "Motor program",
class="sequence-list"), class="sequence-list"),
...@@ -362,7 +369,8 @@ function muscle_view(bonito_url=""; channel=":channel") ...@@ -362,7 +369,8 @@ function muscle_view(bonito_url=""; channel=":channel")
textfield("Start time", :start_time, type="number", step="any", textfield("Start time", :start_time, type="number", step="any",
disable=:editmode_disable), disable=:editmode_disable),
]), ]),
item(btn("Delete motor program", @click(:delete_sequence_click), color="negative")), item(btn("Delete motor program", @click(:delete_sequence_click), color="negative",
disable=:no_sequences_yet)),
]) ])
Html.div(style=col, [ Html.div(style=col, [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment