mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 23:54:43 +08:00
Merge pull request #2887 from mlorb/ml-sci-5033
Change Complete step button on task step [SCI-5033]
This commit is contained in:
commit
349e89eb28
6 changed files with 57 additions and 59 deletions
|
@ -39,21 +39,11 @@
|
|||
dataType: "json",
|
||||
data: {completed: completed},
|
||||
success: function (data) {
|
||||
var button;
|
||||
if (completed) {
|
||||
step.addClass("completed").removeClass("not-completed");
|
||||
|
||||
button = step.find("[data-action='complete-step']");
|
||||
button.attr("data-action", "uncomplete-step");
|
||||
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.html('<span class="fas fa-check"></span> ' + data.new_title);
|
||||
}
|
||||
step.toggleClass("completed");
|
||||
step.find(".toggle-step-complete[data-action='complete-step']").toggleClass('hidden');
|
||||
step.find(".toggle-step-complete[data-action='uncomplete-step']").toggleClass('hidden');
|
||||
step.find(".button-step-complete[data-action='complete-step']").toggleClass('hidden');
|
||||
step.find(".button-step-complete[data-action='uncomplete-step']").toggleClass('hidden');
|
||||
},
|
||||
error: function(response) {
|
||||
if (response.status === 403) {
|
||||
|
|
|
@ -47,6 +47,10 @@
|
|||
.step {
|
||||
.panel {
|
||||
margin-left: 0;
|
||||
|
||||
.panel-body {
|
||||
padding: 15px 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,8 +67,7 @@
|
|||
border: 0;
|
||||
display: flex;
|
||||
min-height: 46px;
|
||||
padding-bottom: 0;
|
||||
padding-top: 0;
|
||||
padding: 0 17px;
|
||||
|
||||
.panel-options {
|
||||
bottom: 0;
|
||||
|
@ -87,8 +90,22 @@
|
|||
max-width: 100%;
|
||||
min-height: inherit;
|
||||
overflow: hidden;
|
||||
padding-left: .1em;
|
||||
padding-right: 15px;
|
||||
|
||||
.toggle-step-complete {
|
||||
@include font-h1;
|
||||
padding: 5px;
|
||||
|
||||
.fas {
|
||||
color: $brand-success;
|
||||
}
|
||||
|
||||
.far {
|
||||
color: $color-alto;
|
||||
}
|
||||
}
|
||||
|
||||
.step-name-link {
|
||||
display: flex;
|
||||
flex-shrink: 1;
|
||||
|
|
|
@ -937,19 +937,6 @@ ul.content-activities {
|
|||
}
|
||||
}
|
||||
|
||||
.step {
|
||||
.panel-heading a[data-toggle] {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
&.not-completed {
|
||||
.badge-num > span.badge {
|
||||
background-color: $color-silver;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.well {
|
||||
background-color: $color-white;
|
||||
}
|
||||
|
|
|
@ -324,16 +324,7 @@ class StepsController < ApplicationController
|
|||
num_all: all_steps.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
# Create localized title for complete/uncomplete button
|
||||
localized_title = if !completed
|
||||
t('protocols.steps.options.complete_title')
|
||||
else
|
||||
t('protocols.steps.options.uncomplete_title')
|
||||
end
|
||||
format.json do
|
||||
render json: { new_title: localized_title }, status: :ok
|
||||
end
|
||||
format.json { render json: {}, status: :ok }
|
||||
else
|
||||
format.json { render json: {}, status: :unprocessable_entity }
|
||||
end
|
||||
|
|
|
@ -1,9 +1,24 @@
|
|||
<% preview = (defined?(preview) ? preview : false) %>
|
||||
<% import = (defined?(import) ? import : false) %>
|
||||
<div class ="step <%= step.completed? ? "completed" : "not-completed" %>" data-id="<%= step.id %>">
|
||||
<div class ="step <%= "completed" if step.completed? %>" data-id="<%= step.id %>">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading step-heading">
|
||||
<div class="left-floats">
|
||||
<button data-action="uncomplete-step"
|
||||
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
||||
class="btn icon-btn btn-light toggle-step-complete
|
||||
<%= 'hidden' unless step.completed? %>"
|
||||
<%= 'disabled' if !can_complete_or_checkbox_step?(@protocol) || preview %>>
|
||||
<span class="fas fa-check-circle"></span>
|
||||
</button>
|
||||
<button data-action="complete-step"
|
||||
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
||||
class="btn icon-btn btn-light toggle-step-complete
|
||||
<%= 'hidden' if step.completed? %>"
|
||||
<%= 'disabled' if !can_complete_or_checkbox_step?(@protocol) || preview %>>
|
||||
<span class="far fa-check-circle"></span>
|
||||
</button>
|
||||
|
||||
<a class="step-panel-collapse-link"
|
||||
href="#step-panel-<%= step.id || step.position %>"
|
||||
data-toggle="collapse"
|
||||
|
@ -26,25 +41,23 @@
|
|||
<% end %>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="panel-options pull-right">
|
||||
<% if !preview && @protocol.my_module %>
|
||||
<% if step.completed? %>
|
||||
<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 %>
|
||||
<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 %>
|
||||
<button data-action="uncomplete-step"
|
||||
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
||||
class="btn btn-secondary button-step-complete
|
||||
<%= 'hidden' if !step.completed? || !can_complete_or_checkbox_step?(@protocol) || preview %>">
|
||||
<span class="fas fa-undo"></span>
|
||||
<%= t("protocols.steps.options.uncomplete_title") %>
|
||||
</button>
|
||||
<button data-action="complete-step"
|
||||
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
||||
class="btn btn-secondary button-step-complete
|
||||
<%= 'hidden' if step.completed? || !can_complete_or_checkbox_step?(@protocol) || preview %>">
|
||||
<span class="far fa-check-circle"></span>
|
||||
<%= t("protocols.steps.options.complete_title") %>
|
||||
</button>
|
||||
<% end %>
|
||||
<% if (can_manage_protocol_in_module?(@protocol) || can_manage_protocol_in_repository?(@protocol)) && !(preview) %>
|
||||
<%= link_to(move_up_step_path(step),
|
||||
|
|
|
@ -1955,7 +1955,7 @@ en:
|
|||
delete_title: "Delete step"
|
||||
duplicate_title: "Duplicate step"
|
||||
complete_title: "Complete step"
|
||||
uncomplete_title: "Uncomplete step"
|
||||
uncomplete_title: "Restart step"
|
||||
attachments:
|
||||
modified_label: "Modified:"
|
||||
sort:
|
||||
|
|
Loading…
Add table
Reference in a new issue