Sha256: 3d2d618412ba9fe80152371f212134a22c3d56f8feb26540cb404e22424ad9f6

Contents?: true

Size: 753 Bytes

Versions: 18

Compression:

Stored size: 753 Bytes

Contents

module CurationConcerns
  class ApplyOrderActor < AbstractActor
    def update(attributes)
      ordered_member_ids = attributes.delete(:ordered_member_ids)
      apply_order(ordered_member_ids) && next_actor.update(attributes)
    end

    private

      def apply_order(new_order)
        return true unless new_order
        curation_concern.ordered_member_proxies.each_with_index do |proxy, index|
          unless new_order[index]
            proxy.prev.next = curation_concern.ordered_member_proxies.last.next
            break
          end
          proxy.proxy_for = ActiveFedora::Base.id_to_uri(new_order[index])
          proxy.target = nil
        end
        curation_concern.list_source.order_will_change!
        true
      end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
curation_concerns-1.0.0.beta1 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.14.0 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.14.0.pre4 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.14.0.pre3 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.14.0.pre2 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.14.0.pre1 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.13.1 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.13.0 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0.pre9 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0.pre8 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0.pre7 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0.pre6 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0.pre5 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0.pre4 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0.pre3 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-0.12.0.pre2 app/actors/curation_concerns/apply_order_actor.rb
curation_concerns-models-0.12.0.pre1 app/actors/curation_concerns/apply_order_actor.rb