Sha256: 5e087c5bca9b741f8d12ce485a782949ec74cddcf84558574d6d55731573ad43

Contents?: true

Size: 1.32 KB

Versions: 19

Compression:

Stored size: 1.32 KB

Contents

format :rss do
  def raw_feed_items
    [card]
  end
end
format :html do
  include AddHelp::HtmlFormat
end

event :update_structurees_references, :integrate,
      when: proc { |c| c.db_content_changed? || c.action == :delete } do
  return unless (query = structuree_query)
  Auth.as_bot do
    query.run.each(&:update_references_out)
  end
end

event :reset_cache_to_use_new_structure,
      before: :update_structurees_references do
  Card::Cache.reset_hard
  Card::Cache.reset_soft
end

event :update_structurees_type, :finalize,
      changed: :type_id, when: proc { |c| c.assigns_type? } do
  update_structurees type_id: type_id
end

def structuree_names
  return [] unless (query = structuree_query(return: :name))
  Auth.as_bot do
    query.run
  end
end

def update_structurees args
  # note that this is not smart about overriding templating rules
  # for example, if someone were to change the type of a
  # +*right+*structure rule that was overridden
  # by a +*type plus right+*structure rule, the override would not be respected.
  return unless (query = structuree_query(return: :id))

  Auth.as_bot do
    query.run.each_slice(100) do |id_batch|
      Card.where(id: id_batch).update_all args
    end
  end
end

def structuree_query args={}
  set_card = trunk
  return unless set_card.type_id == SetID
  set_card.fetch_query args
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
card-1.94.1 mod/settings/set/right/structure.rb
card-1.94.0 mod/settings/set/right/structure.rb
card-1.93.13 mod/settings/set/right/structure.rb
card-1.93.12 mod/settings/set/right/structure.rb
card-1.93.11 mod/settings/set/right/structure.rb
card-1.93.10 mod/settings/set/right/structure.rb
card-1.93.9 mod/settings/set/right/structure.rb
card-1.93.8 mod/settings/set/right/structure.rb
card-1.93.7 mod/settings/set/right/structure.rb
card-1.93.6 mod/settings/set/right/structure.rb
card-1.93.5 mod/settings/set/right/structure.rb
card-1.93.4 mod/settings/set/right/structure.rb
card-1.93.3 mod/settings/set/right/structure.rb
card-1.93.2 mod/settings/set/right/structure.rb
card-1.93.1 mod/settings/set/right/structure.rb
card-1.93.0 mod/settings/set/right/structure.rb
card-1.92.2 mod/settings/set/right/structure.rb
card-1.92.1 mod/settings/set/right/structure.rb
card-1.92 mod/settings/set/right/structure.rb