mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-26 16:53:12 +08:00
Refactor complete step button
This commit is contained in:
parent
eeb8f4a97a
commit
fe7d922cc5
4 changed files with 16 additions and 37 deletions
|
@ -77,21 +77,14 @@
|
|||
|
||||
button = step.find("[data-action='complete-step']");
|
||||
button.attr("data-action", "uncomplete-step");
|
||||
button.find(".btn").removeClass("btn-toggle").addClass("btn-default");
|
||||
button.find("button").html('<span class="fas fa-times"></span> ' + data.new_title);
|
||||
|
||||
if (data.task_ready_to_complete) {
|
||||
$('#completed-task-modal').modal('show');
|
||||
complete_my_module_actions();
|
||||
}
|
||||
button.html('<span class="fas fa-times"></span> ' + data.new_title);
|
||||
}
|
||||
else {
|
||||
step.addClass("not-completed").removeClass("completed");
|
||||
|
||||
button = step.find("[data-action='uncomplete-step']");
|
||||
button.attr("data-action", "complete-step");
|
||||
button.find(".btn").removeClass("btn-default").addClass("btn-toggle");
|
||||
button.find("button").html('<span class="fas fa-check"></span> ' + data.new_title);
|
||||
button.html('<span class="fas fa-check"></span> ' + data.new_title);
|
||||
}
|
||||
},
|
||||
error: function(response) {
|
||||
|
|
|
@ -166,10 +166,6 @@
|
|||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
max-width: 100%;
|
||||
|
||||
.complete-step-btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,14 +58,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.complete-step-btn {
|
||||
display: inline-block;
|
||||
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.step-heading {
|
||||
align-items: center;
|
||||
border: 0;
|
||||
|
|
|
@ -28,23 +28,21 @@
|
|||
</div>
|
||||
<div class="panel-options pull-right">
|
||||
<% if step.completed? %>
|
||||
<div data-action="uncomplete-step"
|
||||
class="complete-step-btn <%= 'disabled' unless can_complete_or_checkbox_step?(@protocol) && !(preview) %>"
|
||||
data-link-url="<%= toggle_step_state_step_path(step)%>">
|
||||
<button class="btn btn-secondary btn-block <%= 'disabled' unless can_complete_or_checkbox_step?(@protocol) && !(preview) %>">
|
||||
<span class="fas fa-times"></span>
|
||||
<%= t("protocols.steps.options.uncomplete_title") %>
|
||||
</button>
|
||||
</div>
|
||||
<button data-action="uncomplete-step"
|
||||
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
||||
class="btn btn-secondary"
|
||||
<%= 'disabled' if !can_complete_or_checkbox_step?(@protocol) || preview %>>
|
||||
<span class="fas fa-times"></span>
|
||||
<%= t("protocols.steps.options.uncomplete_title") %>
|
||||
</button>
|
||||
<% else %>
|
||||
<div data-action="complete-step"
|
||||
class="complete-step-btn <%= 'disabled' unless can_complete_or_checkbox_step?(@protocol) && !(preview) %>"
|
||||
data-link-url="<%= toggle_step_state_step_path(step)%>">
|
||||
<button class="btn btn-secondary btn-block <%= 'disabled' unless can_complete_or_checkbox_step?(@protocol) && !(preview) %>">
|
||||
<span class="fas fa-check"></span>
|
||||
<%= t("protocols.steps.options.complete_title") %>
|
||||
</button>
|
||||
</div>
|
||||
<button data-action="complete-step"
|
||||
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
||||
class="btn btn-secondary"
|
||||
<%= 'disabled' if !can_complete_or_checkbox_step?(@protocol) || preview %>>
|
||||
<span class="fas fa-check"></span>
|
||||
<%= t("protocols.steps.options.complete_title") %>
|
||||
</button>
|
||||
<% end %>
|
||||
|
||||
<% if (can_manage_protocol_in_module?(@protocol) ||
|
||||
|
|
Loading…
Reference in a new issue