diff --git a/app/assets/javascripts/my_modules.js b/app/assets/javascripts/my_modules.js index bfb2d26c6..88ef0f5e0 100644 --- a/app/assets/javascripts/my_modules.js +++ b/app/assets/javascripts/my_modules.js @@ -239,7 +239,7 @@ function applyTaskCompletedCallBack() { } $('.task-due-date').html(data.module_header_due_date_label); $('.task-state-label').html(data.module_state_label); - button.find('button').html(data.new_title); + button.find('button').replaceWith(data.new_btn); }, error: function() { } diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 1fefcd286..3854bd91c 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -1949,3 +1949,7 @@ th.custom-field .modal-tooltiptext { .popover-remove { cursor: pointer; } + +.my_module-state-buttons { + padding-top: 6px; +} \ No newline at end of file diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index 870e07542..d4ce4358a 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -361,13 +361,16 @@ class MyModulesController < ApplicationController if @my_module.save task_completion_activity - # Create localized title for complete/uncomplete button - button_title = t('my_modules.buttons.complete') - button_title = t('my_modules.buttons.uncomplete') if completed + # Render new button HTML + if completed + new_btn_partial = 'my_modules/state_button_uncomplete.html.erb' + else + new_btn_partial = 'my_modules/state_button_complete.html.erb' + end format.json do render json: { - new_title: button_title, + new_btn: render_to_string(partial: new_btn_partial), completed: completed, module_header_due_date_label: render_to_string( partial: 'my_modules/module_header_due_date_label.html.erb', diff --git a/app/views/my_modules/_state_button_complete.html.erb b/app/views/my_modules/_state_button_complete.html.erb new file mode 100644 index 000000000..05bcc0953 --- /dev/null +++ b/app/views/my_modules/_state_button_complete.html.erb @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/app/views/my_modules/_state_button_uncomplete.html.erb b/app/views/my_modules/_state_button_uncomplete.html.erb new file mode 100644 index 000000000..86805dbf2 --- /dev/null +++ b/app/views/my_modules/_state_button_uncomplete.html.erb @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/app/views/my_modules/_state_buttons.html.erb b/app/views/my_modules/_state_buttons.html.erb index b4788f7b1..9d5ae8e8f 100644 --- a/app/views/my_modules/_state_buttons.html.erb +++ b/app/views/my_modules/_state_buttons.html.erb @@ -1,18 +1,12 @@ -