Actualizar plugin Checklists a 3.1.18 light

This commit is contained in:
Manuel Cillero 2020-11-22 21:32:57 +01:00
parent a26f5567af
commit 24560c8598
55 changed files with 992 additions and 307 deletions

View file

@ -1,8 +1,11 @@
<li id="checklist_item_<%= checklist_item.id %>" <%= "class=is-done-checklist-item" if checklist_item.is_done %> >
<%= check_box_tag 'checklist_item', "", checklist_item.is_done,
:disabled => !User.current.allowed_to?(:done_checklists, checklist_item.issue.project) && !User.current.allowed_to?(:edit_checklists, checklist_item.issue.project),
:data_url => url_for( {:controller => "checklists", :action => "done", :id => checklist_item.id} ), :class => 'checklist-checkbox'
%>
<li id="checklist_item_<%= checklist_item.id %>" class="<%= 'is-done-checklist-item' if checklist_item.is_done %> <%= 'checklist-section' if checklist_item.is_section %>">
<% unless checklist_item.is_section %>
<%= check_box_tag 'checklist_item', '', checklist_item.is_done,
disabled: !User.current.allowed_to?(:done_checklists, checklist_item.issue.project) && !User.current.allowed_to?(:edit_checklists, checklist_item.issue.project),
data_url: url_for({ controller: 'checklists', action: 'done', id: checklist_item.id }),
class: 'checklist-checkbox',
id: "checklist-checkbox-#{checklist_item.id}"
%>
<% end %>
<%= textilizable(checklist_item, :subject).gsub(/<\/?(p|h\d+|li|ul)>/, '').strip.html_safe %>
</li>

View file

@ -2,3 +2,16 @@ $("#checklist_item_<%= @checklist_item.id %>").toggleClass('is-done-checklist-it
$('#checklist_form .checklist-item#<%= @checklist_item.id %> input[type=checkbox]').trigger('click');
$('.issue .attributes table.progress').parent().html('<%= j(progress_bar(@checklist_item.issue.done_ratio, :width => '80px', :legend => "#{@checklist_item.issue.done_ratio}%")) %>');
$('#issue_done_ratio').val('<%= @checklist_item.issue.done_ratio %>');
var checkedCheckboxes = $('.checklist-checkbox:checkbox:checked');
if(localStorage.getItem("hide_closed_checklists") === '0' && checkedCheckboxes.length > 0){
$("#checklist_item_<%= @checklist_item.id %>").fadeOut(1000).hide(15);
$('#switch_link').text('<%= l("label_checklist_show_closed") %>' + '(' + checkedCheckboxes.length + ')');
}
if(checkedCheckboxes.length < 1 && localStorage.getItem("hide_closed_checklists") === '1'){
$('#switch_link').hide();
}
if(checkedCheckboxes.length > 0){
$('#switch_link').show();
}

View file

@ -1,7 +1,9 @@
<% if !@issue.blank? && @issue.checklists.any? && User.current.allowed_to?(:view_checklists, @project) %>
<hr />
<div id="checklist">
<div class="contextual">
<%= link_to l("label_checklist_hide_closed"), '#', id: 'switch_link' %>
</div>
<p><strong><%=l(:label_checklist_plural)%></strong></p>
<ul id="checklist_items">
@ -11,6 +13,7 @@
<% end %>
</ul>
</div>
<%= javascript_tag do %>
new Redmine.ChecklistToggle('<%= l("label_checklist_show_closed") %>', '<%= l("label_checklist_hide_closed") %>');
<% end %>
<% end %>

View file

@ -1,21 +1,26 @@
<span class="checklist-item <%= new_or_show(f) %>" id = "<%=f.object.id%>">
<span class = "checklist-show-only checklist-checkbox"><%= f.check_box :is_done %></span>
<span class = "checklist-show checklist-subject <%= done_css(f) %>">
<%= f.object.subject %>
<span class="checklist-item <%= new_or_show(f) %> <%= 'checklist-section' if f.object.is_section %>" id="<%= f.object.id %>">
<% unless f.object.is_section %>
<span class="checklist-show-only checklist-checkbox"><%= f.check_box :is_done %></span>
<% end %>
<span class="checklist-show checklist-subject <%= done_css(f) %>">
<%= textilizable(f.object, :subject).gsub(/<\/?(p|h\d+|li|ul)>/, '').strip.html_safe %>
</span>
<span class = "checklist-edit checklist-new checklist-edit-box">
<%= text_field_tag nil, f.object.subject, :class => 'edit-box'%>
<%= f.hidden_field :subject, :class => 'checklist-subject-hidden' %>
<span class="checklist-edit checklist-new checklist-edit-box">
<%= text_field_tag nil, f.object.subject, class: 'edit-box' %>
<%= f.hidden_field :subject, class: 'checklist-subject-hidden' %>
</span>
<span class= "checklist-edit-only checklist-edit-save-button"><%= submit_tag l(:button_save), :type => "button", :class => "item item-save small"%> </span>
<span class= "checklist-edit-only checklist-edit-reset-button"><% concat l(:button_cancel)
%> </span>
<span class = "checklist-show-only checklist-remove"><%= link_to_remove_checklist_fields "", f,
:class => "icon icon-del" %></span>
<%= f.hidden_field :position, :class => 'checklist-item-position' %>
<%= f.hidden_field :id, :class => 'checklist-item-id' %>
<span class = "icon icon-add checklist-new-only save-new-by-button"></span>
<span class="checklist-edit-only checklist-edit-save-button"><%= submit_tag l(:button_save), type: 'button', class: 'item item-save small' %> </span>
<span class="checklist-edit-only checklist-edit-reset-button"><% concat l(:button_cancel) %> </span>
<span class="checklist-show-only checklist-remove"><%= link_to_remove_checklist_fields "", f, class: 'icon icon-del' %></span>
<%= f.hidden_field :position, class: 'checklist-item-position' %>
<%= f.hidden_field :is_section, class: 'checklist-item-is_section' %>
<%= f.hidden_field :id, class: 'checklist-item-id' %>
<span class="icon icon-add checklist-new-only save-new-by-button"></span>
<br>
</span>

View file

@ -5,3 +5,9 @@
<%= check_box_tag 'settings[issue_done_ratio]', 1, @settings["issue_done_ratio"].to_i > 0 %>
</p>
<% end %>
<p>
<label for="settings_block_issue_closing"><%= l(:label_checklist_block_issue_closing) %></label>
<%= hidden_field_tag 'settings[block_issue_closing]', 0, :id => nil %>
<%= check_box_tag 'settings[block_issue_closing]', 1, @settings["block_issue_closing"].to_i > 0 %>
</p>