Merge pull request #506 from Ducz0r/lm-sci-1073-vol-2

Fix padding of state buttons [SCI-1073]
This commit is contained in:
Luka Murn 2017-03-08 16:09:17 +01:00 committed by GitHub
commit ce4afb49f1
6 changed files with 23 additions and 14 deletions

View file

@ -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() {
}

View file

@ -1949,3 +1949,7 @@ th.custom-field .modal-tooltiptext {
.popover-remove {
cursor: pointer;
}
.my_module-state-buttons {
padding-top: 6px;
}

View file

@ -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',

View file

@ -0,0 +1,4 @@
<button class="btn btn-primary">
<span class="glyphicon glyphicon-ok"></span>
<%= t("my_modules.buttons.complete") %>
</button>

View file

@ -0,0 +1,4 @@
<button class="btn btn-greyed">
<span class="glyphicon glyphicon-remove"></span>
<%= t("my_modules.buttons.uncomplete") %>
</button>

View file

@ -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>