Merge pull request #586 from ZmagoD/zd_SCI_1228

adds asc order to checklists [fixes SCI-1228]
This commit is contained in:
Zmago Devetak 2017-05-05 10:11:24 +02:00 committed by GitHub
commit 6bee4cc05a
5 changed files with 5 additions and 4 deletions

View file

@ -105,7 +105,7 @@ module ReportActions
def generate_step_contents_json(step)
res = []
if in_params? :step_checklists
step.checklists.each do |checklist|
step.checklists.asc.each do |checklist|
res << generate_new_el(false)
res << generate_el(
'reports/elements/step_checklist_element.html.erb',

View file

@ -22,6 +22,7 @@ class Checklist < ActiveRecord::Base
reject_if: :all_blank,
allow_destroy: true
scope :asc, -> { order('checklists.created_at ASC') }
def self.search(user, include_archived, query = nil, page = 1)
step_ids =
Step

View file

@ -273,7 +273,7 @@ class Protocol < ActiveRecord::Base
step2.save
# Copy checklists
step.checklists.each do |checklist|
step.checklists.asc.each do |checklist|
checklist2 = Checklist.new(
name: checklist.name,
step: step2

View file

@ -160,7 +160,7 @@
<% unless step.checklists.blank? then %>
<div class="col-xs-12">
<% step.checklists.each do |checklist| %>
<% step.checklists.asc.each do |checklist| %>
<strong><%= checklist.name %></strong>
<% if checklist.checklist_items.empty? %>
</br>

View file

@ -132,7 +132,7 @@
<% unless step.checklists.blank? then %>
<div class="col-xs-12">
<% step.checklists.each do |checklist| %>
<% step.checklists.asc.each do |checklist| %>
<strong><%= custom_auto_link(checklist.name) %></strong>
<% if checklist.checklist_items.empty? %>
</br>