mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Merge pull request #506 from Ducz0r/lm-sci-1073-vol-2
Fix padding of state buttons [SCI-1073]
This commit is contained in:
commit
ce4afb49f1
6 changed files with 23 additions and 14 deletions
|
@ -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() {
|
||||
}
|
||||
|
|
|
@ -1949,3 +1949,7 @@ th.custom-field .modal-tooltiptext {
|
|||
.popover-remove {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.my_module-state-buttons {
|
||||
padding-top: 6px;
|
||||
}
|
|
@ -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',
|
||||
|
|
4
app/views/my_modules/_state_button_complete.html.erb
Normal file
4
app/views/my_modules/_state_button_complete.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<button class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-ok"></span>
|
||||
<%= t("my_modules.buttons.complete") %>
|
||||
</button>
|
4
app/views/my_modules/_state_button_uncomplete.html.erb
Normal file
4
app/views/my_modules/_state_button_uncomplete.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<button class="btn btn-greyed">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
<%= t("my_modules.buttons.uncomplete") %>
|
||||
</button>
|
|
@ -1,18 +1,12 @@
|
|||
<div class="pull-right">
|
||||
<div class="pull-right my_module-state-buttons">
|
||||
<div class="btn-group">
|
||||
<% if !@my_module.completed? %>
|
||||
<div data-action="complete-task" data-link-url="<%= toggle_task_state_my_module_path(@my_module) %>">
|
||||
<button class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-ok"></span>
|
||||
<%= t("my_modules.buttons.complete") %>
|
||||
</button>
|
||||
<%= render 'my_modules/state_button_complete.html.erb' %>
|
||||
</div>
|
||||
<% else @my_module.completed? %>
|
||||
<div data-action="uncomplete-task" data-link-url="<%= toggle_task_state_my_module_path(@my_module) %>">
|
||||
<button class="btn btn-greyed">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
<%= t("my_modules.buttons.uncomplete") %>
|
||||
</button>
|
||||
<%= render 'my_modules/state_button_uncomplete.html.erb' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue