diff --git a/app/assets/javascripts/protocols/steps.js.erb b/app/assets/javascripts/protocols/steps.js.erb index 7315b5280..49547c3a5 100644 --- a/app/assets/javascripts/protocols/steps.js.erb +++ b/app/assets/javascripts/protocols/steps.js.erb @@ -39,28 +39,11 @@ dataType: "json", data: {completed: completed}, success: function (data) { - var icon_button; - var main_button; - if (completed) { - step.addClass("completed").removeClass("not-completed"); - - icon_button = step.find(".toggle-step-complete[data-action='complete-step']"); - main_button = step.find(".button-step-complete[data-action='complete-step']"); - icon_button.attr("data-action", "uncomplete-step"); - main_button.attr("data-action", "uncomplete-step"); - icon_button.html(''); - main_button.html(' ' + data.new_title); - } - else { - step.addClass("not-completed").removeClass("completed"); - - icon_button = step.find(".toggle-step-complete[data-action='uncomplete-step']"); - main_button = step.find(".button-step-complete[data-action='uncomplete-step']"); - icon_button.attr("data-action", "complete-step"); - main_button.attr("data-action", "complete-step"); - icon_button.html(''); - main_button.html(' ' + 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) { diff --git a/app/assets/stylesheets/steps.scss b/app/assets/stylesheets/steps.scss index 585771b83..1cd848d4c 100644 --- a/app/assets/stylesheets/steps.scss +++ b/app/assets/stylesheets/steps.scss @@ -90,7 +90,7 @@ max-width: 100%; min-height: inherit; overflow: hidden; - padding-left: 1px; + padding-left: .1em; padding-right: 15px; .toggle-step-complete { diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index ca599c46b..94351ef06 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -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; } diff --git a/app/controllers/steps_controller.rb b/app/controllers/steps_controller.rb index 820044161..fd10d4667 100644 --- a/app/controllers/steps_controller.rb +++ b/app/controllers/steps_controller.rb @@ -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 diff --git a/app/views/steps/_step.html.erb b/app/views/steps/_step.html.erb index ceab05c45..3fa4ec755 100644 --- a/app/views/steps/_step.html.erb +++ b/app/views/steps/_step.html.erb @@ -1,24 +1,23 @@ <% preview = (defined?(preview) ? preview : false) %> <% import = (defined?(import) ? import : false) %> -
" data-id="<%= step.id %>"> +
" data-id="<%= step.id %>">
- <% if step.completed? %> - - <% else %> - - <% end %> + +
+
<% if !preview && @protocol.my_module %> - <% if step.completed? %> - - <% else %> - - <% end %> + + <% end %> <% if (can_manage_protocol_in_module?(@protocol) || can_manage_protocol_in_repository?(@protocol)) && !(preview) %> <%= link_to(move_up_step_path(step),