diff --git a/set/mod001-admin/self/admin.rb b/set/mod001-admin/self/admin.rb
deleted file mode 100644
index 1043947..0000000
--- a/set/mod001-admin/self/admin.rb
+++ /dev/null
@@ -1,155 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Admin"
-#
-# collect arrays of the form
-module Admin;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/admin/set/self/admin.rb"; end
-# [task symbol, { execute_policy: block, stats_policy: block }]
-basket :tasks
-
-def run_task_from_task_basket task
- task = task.to_sym
- task_data = tasks.find { |h| h[:name].to_sym == task.to_sym }
- if !irreversibles_tasks_allowed? && task_data[:irreversible]
- not_allowed task_data[:stats][:link_text]
- elsif task_data
- task_data[:execute_policy].call
- end
-end
-
-event :admin_tasks, :initialize, on: :update do
- return unless (task = Env.params[:task])
- raise Card::Error::PermissionDenied, self unless Auth.always_ok?
-
- case task.to_sym
- when :clear_cache then Card::Cache.reset_all
- when :repair_references then Card::Reference.repair_all
- when :repair_permissions then Card.repair_all_permissions
- when :clear_solid_cache then Card.clear_solid_cache
- when :clear_machine_cache then Card.reset_all_machines
- when :clear_script_cache then Card.reset_script_machine
- when :clear_history
- not_allowed "clear history" unless irreversibles_tasks_allowed?
- Card::Action.delete_old
- else
- run_task_from_task_basket task
- end
- abort :success
-end
-
-def not_allowed task
- raise Card::Error::PermissionDenied,
- "The admin task '#{task}' is disabled for security reasons. "\
- "You can enable it with the config option 'allow_irreversible_admin_tasks'"
-end
-
-def irreversibles_tasks_allowed?
- Cardio.config.allow_irreversible_admin_tasks
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core, cache: :never do
- stats = card_stats
- stats += cache_stats
- stats += memory_stats
- card.tasks.each do |task|
- stats += Array.wrap task[:stats]
- end
- table_content = stats.map { |args| stat_row(args) }
- table table_content, header: %w[Stat Value Action]
- end
-
- def card_stats
- [
- { title: "cards",
- count: Card.where(trash: false) },
- { title: "actions",
- count: Card::Action },
- # link_text: "clear history",
- # task: "clear_history" },
- { title: "references",
- count: Card::Reference }
- # link_text: "repair all",
- # task: "repair_references" }
- ]
- end
-
- def cache_stats
- [
- { title: "solid cache",
- count: solid_cache_count, unit: " cards",
- link_text: "clear solid cache",
- task: "clear_solid_cache" },
- { title: "machine cache",
- count: machine_cache_count, unit: " cards",
- link_text: "clear machine cache",
- task: "clear_machine_cache" }
- ]
- # return stats unless Card.config.view_cache#
- # stats << { title: "view cache",
- # count: Card::View,
- # link_text: "clear view cache",
- # task: "clear_view_cache" }
- end
-
- def memory_stats
- oldmem = session[:memory]
- session[:memory] = newmem = card.profile_memory
- stats = [
- { title: "memory now",
- count: newmem, unit: "M",
- link_text: "clear cache", task: "clear_cache" }
- ]
- return stats unless oldmem
-
- stats << { title: "memory prev", count: oldmem, unit: "M" }
- stats << { title: "memory diff", count: newmem - oldmem, unit: "M" }
- stats
- end
-
- def stat_row args={}
- res = [(args[:title] || "")]
- res << "#{count(args[:count])}#{args[:unit]}"
- return res unless args[:task]
-
- res << link_to_card(:admin, (args[:link_text] || args[:task]),
- path: { action: :update, task: args[:task] })
- res
- end
-
- def count counter
- counter = counter.call if counter.is_a?(Proc)
- counter.respond_to?(:count) ? counter.count : counter
- end
-
- def solid_cache_count
- Card.search right: { codename: "solid_cache" }, return: "count"
- end
-
- def machine_cache_count
- Card::Virtual.where(right_id: MachineCacheID).count
- end
-
- def delete_sessions_link months
- link_to_card :admin, months, path: { action: :update, months: months,
- task: "delete_old_sessions" }
- end
-end
-
-def current_memory_usage
- `ps -o rss= -p #{Process.pid}`.to_i
-end
-
-def profile_memory &block
- before = current_memory_usage
- if block_given?
- instance_eval(&block)
- else
- before = 0
- end
- (current_memory_usage - before) / 1024.to_i
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/admin/set/self/admin.rb ~~
diff --git a/set/mod001-admin/self/admin_info.rb b/set/mod001-admin/self/admin_info.rb
deleted file mode 100644
index a44d5d3..0000000
--- a/set/mod001-admin/self/admin_info.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "AdminInfo"
-#
-module AdminInfo;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/admin/set/self/admin_info.rb"; end
-basket :warnings
-
-# For each warning in the basket (eg :my_warning), the core view
-# will run a test by appending a question mark (eg #my_warning?).
-# If it fails it will generate a message by appending message
-# (eg #my_warning_message).
-
-add_to_basket :warnings, :no_email_delivery
-
-def no_email_delivery?
- Card.config.action_mailer.perform_deliveries == false
-end
-
-def clean_html?
- false
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- warnings = card.warnings.map do |warning|
- card.send("#{warning}?") ? send("#{warning}_message") : nil
- end
- warnings.compact!
- warnings.empty? ? "" : warning_alert(warnings)
- end
-
- def warning_alert warnings
- # 'ADMINISTRATOR WARNING'
- alert :warning, true do
- "
#{t :admin_warn} " + list_tag(warnings)
- end
- end
-
- def no_email_delivery_message
- # "Email delivery is turned off."
- # "Change settings in config/application.rb to send sign up notifications."
- t :admin_email_off, path: "config/application.rb"
- end
-
- def warning_list_with_auto_scope warnings
- "#{t :admin_warn} " + warnings.join("\n")
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/admin/set/self/admin_info.rb ~~
diff --git a/set/mod001-admin/self/debugger.rb b/set/mod001-admin/self/debugger.rb
deleted file mode 100644
index b847006..0000000
--- a/set/mod001-admin/self/debugger.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Debugger"
-#
-module Debugger;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/admin/set/self/debugger.rb"; end
-def raw_help_text
- "show more useful error pages"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/admin/set/self/debugger.rb ~~
diff --git a/set/mod002-core/all/abort.rb b/set/mod002-core/all/abort.rb
deleted file mode 100644
index e0fd39c..0000000
--- a/set/mod002-core/all/abort.rb
+++ /dev/null
@@ -1,85 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Abort)
-#
-# The Card#abort method is for cleanly exiting an action without continuing
-# to process any further events.
-#
-# Three statuses are supported:
-#
-module Abort;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/abort.rb"; end
-# failure: adds an error, returns false on save
-# success: no error, returns true on save
-# triumph: similar to success, but if called on a subcard
-# it causes the entire action to abort (not just the subcard)
-def abort status, msg="action canceled"
- director.abort
- if status == :failure && errors.empty?
- errors.add :abort, msg
- elsif status.is_a?(Hash) && status[:success]
- success << status[:success]
- status = :success
- end
- raise Card::Error::Abort.new(status, msg)
-end
-
-def aborting
- yield
- errors.any? ? abort(:failure) : abort(:success)
-end
-
-def abortable
- yield
-rescue Card::Error::Abort => e
- handle_abort_error e
-end
-
-private
-
-def handle_abort_error e
- case e.status
- when :triumph
- @supercard ? raise(e) : true
- when :success
- abort_success
- end
-end
-
-def abort_success
- if @supercard
- @supercard.subcards.delete key
- @supercard.director.subdirectors.delete self
- expire :soft
- end
- true
-end
-
-# this is an override of standard rails behavior that rescues abort
-# makes it so that :success abortions do not rollback
-def with_transaction_returning_status &block
- status = nil
- self.class.transaction do
- add_to_transaction
- remember_transaction_record_state
- status = abortable(&block)
- raise ActiveRecord::Rollback unless status
- end
- status
-end
-
-# FIXME: these two do not belong here!
-
-public
-
-event :notable_exception_raised do
- error = Card::Error.current
- Rails.logger.debug "#{error.message}\n#{error.backtrace * "\n "}"
-end
-
-def success
- Env.success(name)
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/abort.rb ~~
diff --git a/set/mod002-core/all/assign_attributes.rb b/set/mod002-core/all/assign_attributes.rb
deleted file mode 100644
index 8b9e588..0000000
--- a/set/mod002-core/all/assign_attributes.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (AssignAttributes)
-#
-module AssignAttributes;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/assign_attributes.rb"; end
-include Card::Subcards::Args
-
-def assign_attributes args={}
- args = prepare_assignment_args args
-
- assign_with_subcards args do
- assign_with_set_modules args do
- super prepare_assignment_params(args)
- end
- end
-end
-
-def assign_set_specific_attributes
- set_specific.each_pair do |name, value|
- send "#{name}=", value
- end
-end
-
-protected
-
-module ClassMethods
- def assign_or_newish name, attributes, fetch_opts={}
- if (known_card = Card.fetch(name, fetch_opts))
- known_card.refresh.newish attributes
- known_card
- else
- Card.new attributes.merge(name: name)
- end
- end
-end
-
-def prepare_assignment_params args
- args = args.to_unsafe_h if args.respond_to?(:to_unsafe_h)
- params = ActionController::Parameters.new(args)
- params.permit!
- params[:db_content] = standardize_content(params[:db_content]) if params[:db_content]
- params
-end
-
-def prepare_assignment_args args
- return {} unless args
-
- args = args.symbolize_keys
- normalize_type_attributes args
- stash_set_specific_attributes args
- args
-end
-
-def assign_with_set_modules args
- return yield unless args[:name] || args[:type_id]
-
- refresh_set_modules { yield }
-end
-
-def assign_with_subcards args
- subcard_args = extract_subcard_args! args
- yield
- subcards.add subcard_args if subcard_args.present?
-end
-
-def refresh_set_modules
- reinclude_set_modules = @set_mods_loaded
- yield
- reset_patterns
- include_set_modules if reinclude_set_modules
-end
-
-def stash_set_specific_attributes args
- @set_specific = {}
- Card.set_specific_attributes.each do |key|
- set_specific[key] = args.delete(key) if args.key?(key)
- end
-end
-
-def normalize_type_attributes args
- new_type_id = extract_type_id! args unless args.delete(:type_lookup) == :skip
- args[:type_id] = new_type_id if new_type_id
-end
-
-def extract_type_id! args={}
- case
- when (type_id = args.delete(:type_id)&.to_i)
- type_id.zero? ? nil : type_id
- when (type_code = args.delete(:type_code)&.to_sym)
- type_id_from_codename type_code
- when (type_name = args.delete :type)
- type_id_from_cardname type_name
- end
-end
-
-def type_id_from_codename type_code
- type_id_or_error(type_code) { Card::Codename.id type_code }
-end
-
-def type_id_from_cardname type_name
- type_id_or_error(type_name) { type_name.card_id }
-end
-
-def type_id_or_error val
- type_id = yield
- return type_id if type_id
-
- errors.add :type, "#{val} is not a known type."
- nil
-end
-
-# 'set' refers to the noun not the verb
-def set_specific
- @set_specific ||= {}
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/assign_attributes.rb ~~
diff --git a/set/mod002-core/all/autoname.rb b/set/mod002-core/all/autoname.rb
deleted file mode 100644
index e5315c3..0000000
--- a/set/mod002-core/all/autoname.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Autoname)
-#
-module Autoname;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/autoname.rb"; end
-event :set_autoname, :prepare_to_store, on: :create, when: :autoname? do
- self.name = autoname rule(:autoname)
- autoname_card = rule_card :autoname
- autoname_card.update_column :db_content, name
- autoname_card.expire
- pull_from_trash!
- Card.write_to_soft_cache self
-end
-
-def no_autoname?
- !autoname?
-end
-
-def autoname?
- name.blank? &&
- (@autoname_rule.nil? ? (@autoname_rule = rule(:autoname).present?) : @autoname_rule)
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/autoname.rb ~~
diff --git a/set/mod002-core/all/codename.rb b/set/mod002-core/all/codename.rb
deleted file mode 100644
index e351b4e..0000000
--- a/set/mod002-core/all/codename.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Codename)
-#
-module Codename;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/codename.rb"; end
-def codename
- super&.to_sym
-end
-
-event :validate_codename, :validate, on: :update, changed: :codename do
- validate_codename_permission
- validate_codename_uniqueness
-end
-
-event :reset_codename_cache, :integrate, changed: :codename do
- return if action == :create && codename.nil?
-
- Card::Codename.reset_cache
- Card::Codename.generate_id_constants
-end
-
-private
-
-def validate_codename_permission
- return if Auth.always_ok? || Auth.as_id == creator_id
-
- errors.add :codename, t(:core_only_admins_codename)
-end
-
-def validate_codename_uniqueness
- return (self.codename = nil) if codename.blank?
- return if errors.present? || !Card.find_by_codename(codename)
-
- errors.add :codename, t(:core_error_code_in_use, codename: codename)
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/codename.rb ~~
diff --git a/set/mod002-core/all/collection.rb b/set/mod002-core/all/collection.rb
deleted file mode 100644
index 1ff0e03..0000000
--- a/set/mod002-core/all/collection.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Collection)
-#
-# shared methods for card collections (Pointers, Searches, Sets, etc.)
-module Collection;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/collection.rb"; end
-module ClassMethods
- def search spec, comment=nil, &block
- results = ::Card::Query.run(spec, comment)
- results.each(&block) if block_given? && results.is_a?(Array)
- results
- end
-
- def count_by_cql spec
- spec = spec.clone
- spec.delete(:offset)
- search spec.merge(return: "count")
- end
-
- def find_each options={}, &block
- # this is a copy from rails (3.2.16) and is needed because this
- # is performed by a relation (ActiveRecord::Relation)
- find_in_batches(options) do |records|
- records.each(&block)
- end
- end
-
- def find_in_batches options={}
- if block_given?
- super(options) do |records|
- yield(records)
- Card::Cache.reset_soft
- end
- else
- super(options)
- end
- end
-end
-
-def collection?
- item_cards != [self]
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :count do
- card.item_names.size
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :carousel do
- bs_carousel unique_id, 0 do
- nest_item_array.each do |rendered_item|
- item(rendered_item)
- end
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/collection.rb ~~
diff --git a/set/mod002-core/all/content.rb b/set/mod002-core/all/content.rb
deleted file mode 100644
index 5c96421..0000000
--- a/set/mod002-core/all/content.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Content)
-#
-module Content;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/content.rb"; end
-event :set_content, :store, on: :save do
- self.db_content = prepare_db_content
- @selected_action_id = @selected_content = nil
- clear_drafts
-end
-
-event :save_draft, :store, on: :update, when: :draft? do
- save_content_draft content
- abort :success
-end
-
-event :set_default_content,
- :prepare_to_validate,
- on: :create, when: :use_default_content? do
- self.db_content = template.db_content
-end
-
-def draft?
- Env.params["draft"] == "true"
-end
-
-def clean_html?
- true
-end
-
-def use_default_content?
- !db_content_changed? && template && template.db_content.present?
-end
-
-def unfilled?
- blank_content? && blank_comment? && !subcards?
-end
-
-def blank_comment?
- comment.blank? || comment.strip.blank?
-end
-
-def prepare_db_content
- cont = standard_db_content || "" # necessary?
- clean_html? ? Card::Content.clean!(cont) : cont
-end
-
-def standard_db_content
- if structure
- # do not override db_content with content from structure
- db_content
- else
- standard_content
- end
-end
-
-# seems like this should be moved to format so we can fall back on title
-# rather than name. (In fact, name, title, AND label is a bit much.
-# Trim to 2?)
-def label
- name
-end
-
-def creator
- Card[creator_id]
-end
-
-def updater
- Card[updater_id]
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/content.rb ~~
diff --git a/set/mod002-core/all/debug.rb b/set/mod002-core/all/debug.rb
deleted file mode 100644
index ba8507b..0000000
--- a/set/mod002-core/all/debug.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Debug)
-#
-module Debug;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/debug.rb"; end
-def to_s
- "#<#{self.class.name}[#{debug_type}]#{attributes['name']}>"
-end
-
-def inspect
- error_messages = errors.any? ? "" : ""
- "# 255
- errors.add :name, t(:core_error_too_long, length: name.length)
- elsif name.blank?
- errors.add :name, t(:core_error_blank_name)
- elsif name_incomplete?
- errors.add :name, t(:core_is_incomplete)
- elsif !name.valid?
- errors.add :name, t(:core_error_banned_characters,
- banned: Card::Name.banned_array * " ")
- elsif changing_existing_tag_to_compound?
- errors.add :name, t(:core_error_name_tag, name: name)
- end
-end
-
-event :validate_key, after: :validate_name, on: :save, when: :no_autoname? do
- if key.empty?
- errors.add :key, t(:core_error_blank_key) if errors.empty?
- elsif key != name.key
- errors.add :key, t(:core_error_wrong_key, key: key, name: name)
- end
-end
-
-event :validate_renaming, :validate, on: :update, changed: :name, skip: :allowed do
- return if name_before_act&.to_name == name # just changing to new variant
-
- errors.add :content, t(:core_cannot_change_content) if content_is_changing?
- errors.add :type, t(:core_cannot_change_type) if type_is_changing?
- detect_illegal_compound_names
-end
-
-# STAGE: store
-
-event :expire_old_name, :store, changed: :name, on: :update do
- Director.expirees << name_before_act
-end
-
-event :rename_in_trash, after: :expire_old_name, on: :update do
- existing_card = Card.find_by_key_and_trash name.key, true
- return if !existing_card || existing_card == self
-
- existing_card.rename_as_trash_obstacle
-end
-
-event :prepare_left_and_right, :store, changed: :name, on: :save do
- return if name.simple?
-
- prepare_side :left
- prepare_side :right
-end
-
-event :update_lexicon, :finalize, changed: :name, on: :save do
- lexicon_action = @action == :create ? :add : :update
- Card::Lexicon.send lexicon_action, self
-end
-
-event :cascade_name_changes, :finalize, on: :update, changed: :name do
- each_descendant { |d| d.rename_as_descendant update_referers }
-end
-
-protected
-
-def rename_as_trash_obstacle
- self.name = "#{name}*trash"
- rename_in_trash_without_callbacks
- save!
-end
-
-def rename_as_descendant referers=true
- self.action = :update
- referers ? update_referers : update_referer_references_out
- refresh_references_in
- refresh_references_out
- expire
- Card::Lexicon.update self
-end
-
-private
-
-def name_incomplete?
- name.parts.include?("") && !superleft&.autoname?
-end
-
-def changed_from_simple_to_compound?
- name.compound? && name_before_act.to_name.simple?
-end
-
-def detect_illegal_compound_names
- return unless changed_from_simple_to_compound? && child_ids(:right).present?
-
- errors.add :name, "illegal name change; existing names end in +#{name_before_act}"
-end
-
-def changing_existing_tag_to_compound?
- return false unless changing_name_to_compound?
-
- name_in_use_as_tag?
-end
-
-def name_in_use_as_tag?
- !Card.where(right_id: id, trash: false).take.nil?
-end
-
-def changing_name_to_compound?
- name.compound? && simple?
-end
-
-def old_name_in_way? sidecard
- real? && sidecard&.simple? && id == sidecard&.id
-end
-
-def clear_name name
- # move the current card out of the way, in case the new name will require
- # re-creating a card with the current name, ie. A -> A+B
- Card.where(id: id).update_all(name: nil, key: nil, left_id: nil, right_id: nil)
- Card.expire name
- Card::Lexicon.cache.reset # probably overkill, but this for an edge case...
- # Card::Lexicon.delete id, key
-end
-
-def prepare_side side
- side_id = send "#{side}_id"
- sidename = name.send "#{side}_name"
- prepare_obstructed_side(side, side_id, sidename) ||
- prepare_new_side(side, side_id, sidename)
-end
-
-def prepare_new_side side, side_id, sidename
- return unless side_id == -1 || !Card[side_id]&.real?
-
- sidecard = Director.card(sidename) || add_subcard(sidename)
- send "#{side}_id=", sidecard
-end
-
-def prepare_obstructed_side side, side_id, sidename
- return unless side_id && side_id == id
-
- clear_name sidename
- send "#{side}_id=", add_subcard(sidename)
- true
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/name_events.rb ~~
diff --git a/set/mod002-core/all/reference_events.rb b/set/mod002-core/all/reference_events.rb
deleted file mode 100644
index 664aa75..0000000
--- a/set/mod002-core/all/reference_events.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (ReferenceEvents)
-#
-# test for updating referer content
-module ReferenceEvents;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/reference_events.rb"; end
-event :prepare_referer_update, :validate, on: :update, changed: :name do
- self.update_referers = ![nil, false, "false"].member?(update_referers)
-end
-
-# on rename, update names in cards that refer to self by name (as directed)
-event :update_referer_content, :finalize, on: :update, when: :update_referers do
- referers.each do |card|
- next if card.structure
-
- card.skip_event! :validate_renaming, :check_permissions
- card.content = card.replace_references name_before_act, name
- attach_subcard card
- end
-end
-
-# on rename, when NOT updating referer content, update references to ensure
-# that partial references are correctly tracked
-# eg. A links to X+Y. if X+Y is renamed and we're not updating the link in A,
-# then we need to be sure that A has a partial reference
-event :update_referer_references_out, :finalize,
- changed: :name, on: :update, when: :not_update_referers do
- referers.map(&:update_references_out)
-end
-
-# when name changes, update references to card
-event :refresh_references_in, :finalize, changed: :name, on: :save do
- Reference.unmap_referees id if action == :update && !update_referers
- Reference.map_referees key, id
-end
-
-# when content changes, update references to other cards
-event :refresh_references_out, :finalize, on: :save, changed: :content do
- update_references_out
-end
-
-# clean up reference table when card is deleted
-event :clear_references, :finalize, on: :delete do
- delete_references_out
- Reference.unmap_referees id
-end
-
-# replace references in card content
-def replace_references old_name, new_name
- cont = content_object
- cont.find_chunks(:Reference).each do |chunk|
- next unless replace_reference chunk, old_name, new_name
- end
- cont.to_s
-end
-
-protected
-
-def not_update_referers
- !update_referers
-end
-
-private
-
-def replace_reference chunk, old_name, new_name
- return unless (old = chunk.referee_name) && (new = old.swap old_name, new_name)
-
- chunk.referee_name = chunk.replace_reference old_name, new_name
- update_reference old.key, new.key
-end
-
-def update_reference old_key, new_key
- Reference.where(referee_key: old_key).update_all referee_key: new_key
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/reference_events.rb ~~
diff --git a/set/mod002-core/all/states.rb b/set/mod002-core/all/states.rb
deleted file mode 100644
index f3f0174..0000000
--- a/set/mod002-core/all/states.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (States)
-#
-# All cards have one (and only one) of these three states: real, virtual, and unknown.
-#
-# - *real* cards are stored in the database (but not in the trash) and have a unique id.
-# - *virtual* cards are not real, but they act real based on rules. For example,
-# Home+*editors does a search for all the users who have edited the "Home" card.
-# There are many other similar cards that search for things like references, children,
-# etc. But we don't store all these cards in the database; we generate them dynamically
-module States;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/states.rb"; end
-# based on the names.
-# - *unknown* cards are everything else.
-#
-# These states are frequently grouped as follows:
-#
-# - *known* cards are either _real_ or _virtual_
-# - *new* (or *unreal*) cards are either _unknown_ or _virtual_
-
-module ClassMethods
- def real? mark
- quick_fetch(mark).present?
- end
- alias_method :exist?, :real?
- alias_method :exists?, :real?
-
- def known? mark
- fetch(mark).present?
- end
-end
-
-# @return [Symbol] :real, :virtual, or :unknown
-def state anti_fishing=true
- case
- when !known? then :unknown
- when anti_fishing && !ok?(:read) then :unknown
- when real? then :real
- when virtual? then :virtual
- else :wtf
- end
-end
-
-# @return [True/False]
-def real?
- !unreal?
-end
-
-# Virtual cards are structured, compound cards that are not stored in the database. You
-# can create virtual cards with structure rules.
-#
-# Some cards with hard-coded content will also override the #virtual? method. This
-# is established practice, but it is NOT advisable to override any of the other
-# state methods.
-#
-# @return [True/False]
-def virtual?
- if @virtual.nil?
- @virtual = real? || name.simple? ? false : structure.present?
- end
- @virtual
-end
-
-# @return [True/False]
-def unknown?
- !known?
-end
-
-# @return [True/False]
-def known?
- real? || virtual?
-end
-
-# @return [True/False]
-def new?
- new_record? || # not yet in db (from ActiveRecord)
- !@from_trash.nil? # in process of restoration from trash
-end
-alias_method :new_card?, :new?
-alias_method :unreal?, :new?
-
-# has not been edited directly by human users. bleep blorp.
-def pristine?
- new_card? || !user_changes?
-end
-
-def user_changes?
- actions.joins(:act).where("card_acts.actor_id != ?", WagnBotID).exists?
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/states.rb ~~
diff --git a/set/mod002-core/all/subcards.rb b/set/mod002-core/all/subcards.rb
deleted file mode 100644
index 45070aa..0000000
--- a/set/mod002-core/all/subcards.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Subcards)
-#
-module Subcards;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/subcards.rb"; end
-event :reject_empty_subcards, :prepare_to_validate do
- subcards.each_with_key do |subcard, key|
- next unless subcard.new? && subcard.unfilled?
-
- remove_subcard(key)
- director.subdirectors.delete(subcard)
- end
-end
-
-# check when deleting field that left has not also been deleted
-def trashed_left?
- l = left
- !l || l.trash
-end
-
-# check when renaming field that it is not actually the same field
-# (eg on a renamed trunk)
-def same_field?
- (left_id == left_id_before_act) && (right_id == right_id_before_act)
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/subcards.rb ~~
diff --git a/set/mod002-core/all/trash.rb b/set/mod002-core/all/trash.rb
deleted file mode 100644
index b2bc9d4..0000000
--- a/set/mod002-core/all/trash.rb
+++ /dev/null
@@ -1,142 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Trash)
-#
-module Trash;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/trash.rb"; end
-Self::Admin.add_to_basket(
- :tasks,
- name: :empty_trash,
- irreversible: true,
- execute_policy: -> { Card.empty_trash },
- stats: {
- title: "trashed cards",
- count: -> { Card.where(trash: true) },
- link_text: "empty trash",
- task: "empty_trash"
- }
-)
-
-module ClassMethods
- def empty_trash
- Card.delete_trashed_files
- Card.where(trash: true).in_batches.update_all(left_id: nil, right_id: nil)
- Card.where(trash: true).in_batches.delete_all
- Card::Action.delete_cardless
- Card::Change.delete_actionless
- Card::Act.delete_actionless
- Card::Reference.unmap_if_referee_missing
- Card::Reference.delete_if_referer_missing
- end
-
- # deletes any file not associated with a real card.
- def delete_trashed_files
- dir = Cardio.paths["files"].existent.first
- # TODO: handle cloud files
- return unless dir
-
- (all_trashed_card_ids & all_file_ids).each do |file_id|
- delete_files_with_id dir, file_id
- end
- end
-
- def delete_files_with_id dir, file_id
- raise Card::Error, t(:core_exception_almost_deleted) if Card.exists?(file_id)
-
- ::FileUtils.rm_rf "#{dir}/#{file_id}", secure: true
- end
-
- def all_file_ids
- dir = Card.paths["files"].existent.first
- Dir.entries(dir)[2..-1].map(&:to_i)
- end
-
- def all_trashed_card_ids
- trashed_card_sql = %( select id from cards where trash is true )
- sql_results = Card.connection.select_all(trashed_card_sql)
- sql_results.map(&:values).flatten.map(&:to_i)
- end
-end
-
-def trash?
- trash
-end
-
-def delete args={}
- add_to_trash args do |delete_args|
- update delete_args
- end
-end
-
-def delete! args={}
- add_to_trash args do |delete_args|
- update! delete_args
- end
-end
-
-def add_to_trash args
- return if new_card?
-
- yield args.merge trash: true
-end
-
-event :manage_trash, :prepare_to_store, on: :create do
- pull_from_trash!
- self.trash = false
- true
-end
-
-def pull_from_trash!
- return unless (id = Card::Lexicon.id key) # name is already known
- return unless (trashed_card = Card.where(id: id).take)&.trash
-
- # confirm name is actually in trash
-
- db_attributes["id"] = trashed_card.db_attributes["id"]
- # id_in_database returns existing card id
-
- @from_trash = true
- @new_record = false
-end
-
-def db_attributes
- send(:mutations_from_database).send :attributes
-end
-
-event :validate_delete, :validate, on: :delete do
- unless codename.blank?
- errors.add :delete, t(:core_error_system_card, name: name, codename: codename)
- end
-
- undeletable_all_rules_tags =
- %w[default style layout create read update delete]
- # FIXME: HACK! should be configured in the rule
-
- if compound? && left&.codename == :all &&
- undeletable_all_rules_tags.member?(right.codename.to_s)
- errors.add :delete, t(:core_error_indestructible, name: name)
- end
-
- errors.add :delete, t(:core_error_user_edits, name: name) if account && has_edits?
-end
-
-event :validate_delete_children, after: :validate_delete, on: :delete do
- return if errors.any?
-
- each_child do |child|
- child.include_set_modules
- delete_as_subcard child
- # next if child.valid?
- # child.errors.each do |field, message|
- # errors.add field, "can't delete #{child.name}: #{message}"
- # end
- end
-end
-
-def delete_as_subcard subcard
- subcard.trash = true
- add_subcard subcard
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/trash.rb ~~
diff --git a/set/mod002-core/all/type.rb b/set/mod002-core/all/type.rb
deleted file mode 100644
index 8dd205d..0000000
--- a/set/mod002-core/all/type.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Type)
-#
-module Type;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/type.rb"; end
-module ClassMethods
- def default_type_id
- @@default_type_id ||= Card[:all].fetch(:default, skip_modules: true).type_id
- end
-end
-
-def type_card
- return if type_id.nil?
-
- Card.quick_fetch type_id.to_i
-end
-
-def type_code
- Card::Codename[type_id.to_i]
-end
-
-def type_name
- type_card.try :name
-end
-
-alias_method :type, :type_name
-
-def type_name_or_default
- type_card.try(:name) || Card.quick_fetch(Card.default_type_id).name
-end
-
-def type_cardname
- type_card.try :name
-end
-
-def type= type_name
- self.type_id = type_name.card_id
-end
-
-def type_id= card_or_id
- write_card_or_id :type_id, card_or_id
-end
-
-def type_id_from_template
- return unless name && (t = template)
-
- reset_patterns # still necessary even with new template handling?
- self.type_id = t.type_id
-end
-
-event :validate_type_change, :validate, on: :update, changed: :type_id do
- return unless (c = dup) && c.action == :create && !c.valid?
-
- errors.add :type, t(:core_error_cant_change_errors,
- name: name,
- type_id: type_id,
- error_messages: c.errors.full_messages)
-end
-
-event :validate_type, :validate, changed: :type_id, on: :save do
- errors.add :type, t(:core_error_no_such_type) unless type_name
-
- if (rt = structure) && rt.assigns_type? && type_id != rt.type_id
- errors.add :type, t(:core_error_hard_templated, name: name, type_name: rt.type_name)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/type.rb ~~
diff --git a/set/mod002-core/all/utils.rb b/set/mod002-core/all/utils.rb
deleted file mode 100644
index 32e7bff..0000000
--- a/set/mod002-core/all/utils.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Utils)
-#
-module Utils;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/utils.rb"; end
-module ClassMethods
- def merge_list attribs, opts={}
- unmerged = []
- attribs.each do |row|
- if merge row["name"], row, opts
- Rails.logger.info "merged #{row['name']}"
- else
- unmerged.push row
- end
- end
-
- if unmerged.empty?
- Rails.logger.info "successfully merged all!"
- else
- unmerged_json = JSON.pretty_generate unmerged
- report_unmerged_json unmerged_json, opts[:output_file]
- end
- unmerged
- end
-
- def report_unmerged_json unmerged_json, output_file
- if output_file
- ::File.open output_file, "w" do |f|
- f.write unmerged_json
- end
- else
- Rails.logger.info "failed to merge:\n\n#{unmerged_json}"
- end
- end
-
- def merge name, attribs={}, opts={}
- # puts "merging #{name}"
- card = fetch name, new: {}
- return unless mergeable? card, opts[:pristine]
-
- resolve_file_attributes! attribs
- card.safe_update! attribs
- end
-
- private
-
- def resolve_file_attributes! attribs
- %i[image file].each do |attach|
- next unless attribs[attach].is_a?(String)
-
- attribs[attach] = ::File.open(attribs[attach])
- end
- end
-
- def mergeable? card, pristine_only
- return true unless pristine_only
-
- !card.pristine?
- end
-end
-
-# separate name and other attributes
-def safe_update! attribs
- separate_name_update! attribs.delete("name") unless new?
- update! attribs if attribs.present?
-end
-
-def separate_name_update! new_name
- return if new_name.to_s == name.to_s
-
- update! name: new_name
-end
-
-# rubocop:disable Style/GlobalVars
-def measure desc
- $times ||= {}
- res = nil
- t = Benchmark.measure do
- res = yield
- end
- $times[desc] = $times.key?(desc) ? t + $times[desc] : t
- puts "#{desc}: #{t}".red
- res
-end
-# rubocop:enable Style/GlobalVars
-
-def mod_root modname
- if (spec = Gem::Specification.find_by_name "card-mod-#{modname}")
- spec.full_gem_path
- else
- "#{Cardio.gem_root}/mod/#{modname}"
- end
-end
-
-delegate :t, to: Cardio
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- delegate :t, to: Cardio
- delegate :measure, to: :card
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/utils.rb ~~
diff --git a/set/mod002-core/right/autoname.rb b/set/mod002-core/right/autoname.rb
deleted file mode 100644
index f61a2a9..0000000
--- a/set/mod002-core/right/autoname.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Autoname" cards
-#
-module Autoname;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/right/autoname.rb"; end
-def history?
- false
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/right/autoname.rb ~~
diff --git a/set/mod002-core/self/autoname.rb b/set/mod002-core/self/autoname.rb
deleted file mode 100644
index 2693a81..0000000
--- a/set/mod002-core/self/autoname.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Autoname"
-#
-module Autoname;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/self/autoname.rb"; end
-setting_opts group: :templating, position: 4,
- help_text: "Autogenerate name for new cards by incrementing this value. "\
- "[[http://decko.org/autonaming|more]]"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/self/autoname.rb ~~
diff --git a/set/mod002-core/self/trash.rb b/set/mod002-core/self/trash.rb
deleted file mode 100644
index b1f43ea..0000000
--- a/set/mod002-core/self/trash.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Trash"
-#
-module Trash;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/self/trash.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- rows = trashed_cards.map { |tc| trash_table_row(tc) }
- output [
- restored,
- (empty_trash_link if rows.present?),
- table(rows, header: ["card", "deleted", "by", ""])
- ]
- end
-
- def trashed_cards
- Card.where(trash: true).order(updated_at: :desc)
- end
-
- def trash_table_row card
- [
- card.name,
- "#{time_ago_in_words(card.updated_at)} ago",
- Card[card.updater_id].name,
- "#{history_link(card)} | #{restore_link(card)}"
- ]
- end
-
- def restored
- return unless (res_id = Env.params[:restore]) &&
- (res_card = Card[res_id.to_i])
-
- alert :success, true do
- wrap_with(:h5, "restored") + subformat(res_card).render_bar
- end
- end
-
- def empty_trash_link
- wrap_with(
- :p,
- button_link("empty trash",
- btn_type: :default,
- path: { mark: :admin, action: :update, task: :empty_trash,
- success: { mark: "~#{card.id}" } },
- "data-confirm" => "Are you sure you want to delete "\
- "all cards in the trash?")
- )
- end
-
- def history_link trashed_card
- link_to_card trashed_card, "history",
- path: { view: :history, look_in_trash: true }
- end
-
- def restore_link trashed_card
- before_delete = trashed_card.actions[-2]
- link_to "restore", method: :post,
- rel: "nofollow",
- remote: true,
- class: "slotter",
- path: { id: trashed_card.id,
- view: :open,
- look_in_trash: true,
- action: :update,
- restore: trashed_card.id,
- action_ids: [before_delete],
- success: { mark: "~#{card.id}" } }
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/self/trash.rb ~~
diff --git a/set/mod002-core/self/version.rb b/set/mod002-core/self/version.rb
deleted file mode 100644
index 9a12698..0000000
--- a/set/mod002-core/self/version.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Version"
-#
-# -*- encoding : utf-8 -*-
-module Version;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/self/version.rb"; end
-
-def ok_to_read
- true
-end
-
-def content
- Card::Version.release
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/self/version.rb ~~
diff --git a/set/mod002-core/type/cardtype.rb b/set/mod002-core/type/cardtype.rb
deleted file mode 100644
index 3b17f72..0000000
--- a/set/mod002-core/type/cardtype.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Cardtype" cards
-#
-module Cardtype;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/type/cardtype.rb"; end
-def cards_of_type_exist?
- !new_card? && Card.where(trash: false, type_id: id).exists?
-end
-
-def create_ok?
- Card.new(type_id: id).ok? :create
-end
-
-def was_cardtype?
- type_id_before_act == Card::CardtypeID
-end
-
-event :check_for_cards_of_type, after: :validate_delete do
- errors.add :cardtype, t(:core_cards_exist, cardname: name) if cards_of_type_exist?
-end
-
-event :check_for_cards_of_type_when_type_changed,
- :validate, changing: :type, when: :was_cardtype? do
- if cards_of_type_exist?
- errors.add :cardtype, t(:core_error_cant_alter, name: name_before_act)
- end
-end
-
-event :validate_cardtype_name, :validate, on: :save, changed: :name do
- if %r{[<>/]}.match?(name)
- errors.add :name, t(:core_error_invalid_character_in_cardtype, banned: "<, >, /")
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/type/cardtype.rb ~~
diff --git a/set/mod004-email/abstract/email_field.rb b/set/mod004-email/abstract/email_field.rb
deleted file mode 100644
index 45d7899..0000000
--- a/set/mod004-email/abstract/email_field.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (EmailField)
-#
-module EmailField;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/abstract/email_field.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- # turn off autodetection of uri's
- def chunk_list
- :references
- end
-end
-
-# format :html do
-# def pointer_items args
-# card.item_names(context: :raw).map do |iname|
-# wrap_item iname, args
-# end
-# end
-# end#
-
-module EmailTextFormat; module_parent.send :register_set_format, Card::Format::EmailTextFormat, self; extend Card::Set::AbstractFormat
- def email_addresses context
- context ||= self
- card.item_names(context: context.name).map do |name|
- # FIXME: context is processed twice here because pointers absolutize
- # item_names by default while other types can return relative names.
- # That's poor default behavior and should be fixed!
- name = name.to_name.absolute context
- email_address?(name) ? name : email_address_from_card(name, context)
- end.flatten.compact.join(", ")
- end
-
- def email_address? string
- string =~ /.+@.+\..+/
- end
-
- def email_address_from_card name, context
- card = Card.fetch name
- card.account&.email || email_addresses_from_card_content(card, context)
- end
-
- def email_addresses_from_card_content card, context
- subformat(card).contextual_content(context).split(/[,\n]/)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/abstract/email_field.rb ~~
diff --git a/set/mod004-email/abstract/test_context.rb b/set/mod004-email/abstract/test_context.rb
deleted file mode 100644
index 181581a..0000000
--- a/set/mod004-email/abstract/test_context.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (TestContext)
-#
-module TestContext;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/abstract/test_context.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- return super() if voo.hide? :test_context
-
- card.with_context test_context_card do
- super()
- end
- end
-
- def test_context_card
- card.left.fetch(:test_context)&.item_card
- end
-end
-
-module EmailHtmlFormat; module_parent.send :register_set_format, Card::Format::EmailHtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- voo.hide! :test_context
- super()
- end
-end
-
-module EmailTextFormat; module_parent.send :register_set_format, Card::Format::EmailTextFormat, self; extend Card::Set::AbstractFormat
- view :core do
- voo.hide! :test_context
- super()
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/abstract/test_context.rb ~~
diff --git a/set/mod004-email/all/email_html.rb b/set/mod004-email/all/email_html.rb
deleted file mode 100644
index f340b34..0000000
--- a/set/mod004-email/all/email_html.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (EmailHtml)
-#
-module EmailHtml;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/all/email_html.rb"; end
-module EmailHtmlFormat; module_parent.send :register_set_format, Card::Format::EmailHtmlFormat, self; extend Card::Set::AbstractFormat
- view :unknown do
- ""
- end
-
- view :compact_missing do
- ""
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/all/email_html.rb ~~
diff --git a/set/mod004-email/all/email_text.rb b/set/mod004-email/all/email_text.rb
deleted file mode 100644
index c7df4fc..0000000
--- a/set/mod004-email/all/email_text.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (EmailText)
-#
-module EmailText;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/all/email_text.rb"; end
-module EmailTextFormat; module_parent.send :register_set_format, Card::Format::EmailTextFormat, self; extend Card::Set::AbstractFormat
- view :unknown do
- ""
- end
-
- view :compact_missing do
- ""
- end
-
- view :last_action, perms: :none, cache: :never do
- _render_last_action_verb
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/all/email_text.rb ~~
diff --git a/set/mod004-email/right/bcc.rb b/set/mod004-email/right/bcc.rb
deleted file mode 100644
index 20546b5..0000000
--- a/set/mod004-email/right/bcc.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Bcc" cards
-#
-module Bcc;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/right/bcc.rb"; end
-include_set Abstract::EmailField
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/right/bcc.rb ~~
diff --git a/set/mod004-email/right/cc.rb b/set/mod004-email/right/cc.rb
deleted file mode 100644
index e9437e0..0000000
--- a/set/mod004-email/right/cc.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Cc" cards
-#
-module Cc;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/right/cc.rb"; end
-include_set Abstract::EmailField
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/right/cc.rb ~~
diff --git a/set/mod004-email/right/from.rb b/set/mod004-email/right/from.rb
deleted file mode 100644
index b722af2..0000000
--- a/set/mod004-email/right/from.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+From" cards
-#
-module From;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/right/from.rb"; end
-include_set Abstract::EmailField
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/right/from.rb ~~
diff --git a/set/mod004-email/right/html_message.rb b/set/mod004-email/right/html_message.rb
deleted file mode 100644
index 9fdd26a..0000000
--- a/set/mod004-email/right/html_message.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+HtmlMessage" cards
-#
-module HtmlMessage;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/right/html_message.rb"; end
-include_set Abstract::TestContext
-
-def clean_html?
- false
-end
-
-module EmailHtmlFormat; module_parent.send :register_set_format, Card::Format::EmailHtmlFormat, self; extend Card::Set::AbstractFormat
- def email_content context
- content = contextual_content context
- return unless content.present?
-
- Card::Mailer.layout content
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/right/html_message.rb ~~
diff --git a/set/mod004-email/right/subject.rb b/set/mod004-email/right/subject.rb
deleted file mode 100644
index f92cfdc..0000000
--- a/set/mod004-email/right/subject.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Subject" cards
-#
-module Subject;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/right/subject.rb"; end
-include_set Abstract::TestContext
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/right/subject.rb ~~
diff --git a/set/mod004-email/right/text_message.rb b/set/mod004-email/right/text_message.rb
deleted file mode 100644
index 70a4ee7..0000000
--- a/set/mod004-email/right/text_message.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+TextMessage" cards
-#
-module TextMessage;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/right/text_message.rb"; end
-include_set Abstract::TestContext
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/right/text_message.rb ~~
diff --git a/set/mod004-email/right/to.rb b/set/mod004-email/right/to.rb
deleted file mode 100644
index 39a4916..0000000
--- a/set/mod004-email/right/to.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+To" cards
-#
-module To;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/right/to.rb"; end
-include_set Abstract::EmailField
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/right/to.rb ~~
diff --git a/set/mod004-email/type/email_template.rb b/set/mod004-email/type/email_template.rb
deleted file mode 100644
index 16231b3..0000000
--- a/set/mod004-email/type/email_template.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "EmailTemplate" cards
-#
-module EmailTemplate;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/type/email_template.rb"; end
-def clean_html?
- false
-end
-
-def deliver context=nil, fields={}, opts={}
- mail = format.mail context, fields, opts
- mail.deliver
-rescue Net::SMTPError => e
- errors.add :exception, e.message
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def mail context=nil, fields={}, opts={}
- config = card.email_config context, fields, opts
- fmt = self # self is within the new_mail block
- Card::Mailer.new_mail config do
- fmt.message_body self, config
- fmt.add_attachments self, config.delete(:attach)
- end
- end
-
- def message_body mail, config
- config[:html_message] &&= config[:html_message].call mail
- method, args = body_method_and_args config[:html_message].present?,
- config[:text_message].present?
- args = Array.wrap(args).map { |arg| config[arg] }
- send method, mail, *args
- end
-
- def body_method_and_args html, text
- if html && text
- [:text_and_html_message, %i[text_message html_message attach]]
- elsif html
- %i[html_body html_message]
- else
- %i[text_body text_message]
- end
- end
-
- def text_and_html_message mail, text_message, html_message, attachment_list=nil
- fmt = self
- if attachment_list&.any?
- mail.multipart_mixed text_message, html_message
- else
- mail.text_part { body text_message }
- mail.html_part { fmt.html_body self, html_message }
- end
- end
-
- def multipart_mixed mail, text_message, html_message
- mail.content_type "multipart/mixed"
- mail.part content_type: "multipart/alternative" do |copy|
- copy.part content_type: "text/plain" do |plain|
- plain.body = text_message
- end
- copy.part content_type: "text/html" do |html|
- html.body = html_message
- end
- end
- end
-
- def html_body mail, message
- mail.content_type "text/html; charset=UTF-8"
- mail.body message
- end
-
- def text_body mail, message
- mail.content_type "text/plain; charset=UTF-8"
- mail.text_part { body message }
- end
-
- def add_attachments mail, list
- return unless list.present?
-
- each_valid_attachment list do |file, index|
- mail.add_file filename: attachment_name(file, index),
- content: File.read(file.path)
- end
- end
-
- def each_valid_attachment list
- list.each_with_index do |cardname, index|
- next unless (file = Card[cardname]&.try(:attachment))
-
- yield file, index
- end
- end
-
- def attachment_name file, number
- "attachment-#{number + 1}.#{file.extension}"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/type/email_template.rb ~~
diff --git a/set/mod004-email/type/email_template/email_config.rb b/set/mod004-email/type/email_template/email_config.rb
deleted file mode 100644
index c40e700..0000000
--- a/set/mod004-email/type/email_template/email_config.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type; module EmailTemplate;
-# Set: All "EmailTemplate+EmailConfig" cards (EmailConfig)
-#
-module EmailConfig;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/email/set/type/email_template/email_config.rb"; end
-EMAIL_FIELDS =
- %i[to from cc bcc attach subject text_message html_message].freeze
-
-EMAIL_FIELD_METHODS =
- { subject: :contextual_content,
- text_message: :contextual_content,
- attach: :extended_item_contents }.freeze
-
-# @param [Card] context the card in whose context all email fields will be interpreted
-# @param [Hash] fields override any templated field configurations with hash values
-# @param [Hash] opts options for rendering. unknown options become format options
-# @option opts [Card, String, Integer] :auth user identifier. render as this user
-def email_config context, fields={}, opts={}
- @active_email_context = context || self
- auth = opts.delete :auth
- config = EMAIL_FIELDS.each_with_object({}) do |field, conf|
- conf[field] = fields[field] || email_field_from_card(field, auth, opts)
- end
- safe_from_and_reply_to! config
- config.select { |_k, v| v.present? }
-end
-
-def email_field_from_card field, auth, format_opts
- return unless (field_card = fetch(field))
-
- auth ||= field_card.updater
- special_email_field_method(field, field_card, auth, format_opts) ||
- standard_email_field(field, field_card, auth, format_opts)
-end
-
-def special_email_field_method field, field_card, auth, format_opts
- method = "email_#{field}_field"
- return unless respond_to? method
-
- send method, field_card, auth, format_opts
-end
-
-def standard_email_field field, field_card, auth, format_opts
- method = EMAIL_FIELD_METHODS[field] || :email_addresses
- format_opts = format_opts.merge format: :email_text
- Auth.as auth do
- field_card.format(format_opts).send method, @active_email_context
- end
-end
-
-# html messages return procs because image attachments can't be properly rendered
-# without a mail object. (which isn't available at initial config time)
-def email_html_message_field message_card, auth, format_opts
- proc do |mail|
- Auth.as auth do
- format_opts = format_opts.merge format: :email_html, active_mail: mail
- message_card.format(format_opts).email_content @active_email_context
- end
- end
-end
-
-# whenever a default "from" field is configured in Card::Mailer, emails are always
-# actually "from" that address
-def safe_from_and_reply_to! config
- conf_name, conf_email = configured_from_name_and_email config[:from]
- actual_email = Card::Mailer.default[:from] || conf_email
- config[:from] = email_from_field_value conf_name, conf_email, actual_email
- config[:reply_to] ||= actual_email
-end
-
-def email_from_field_value conf_name, conf_email, actual_email
- conf_text = conf_name || conf_email
- if conf_text != actual_email
- %("#{conf_text}" <#{actual_email}>)
- elsif actual_email.present?
- actual_email
- else
- Card[WagnBotID].account.email
- end
-end
-
-def configured_from_name_and_email raw_string
- if raw_string =~ /(.*)<(.*)>/
- [Regexp.last_match(1).strip, Regexp.last_match(2)]
- else
- [nil, raw_string]
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/email/set/type/email_template/email_config.rb ~~
diff --git a/set/mod005-collection/abstract/items.rb b/set/mod005-collection/abstract/items.rb
deleted file mode 100644
index c26ba4a..0000000
--- a/set/mod005-collection/abstract/items.rb
+++ /dev/null
@@ -1,215 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Items)
-#
-# ~~~~~~~~~~~~ READING ITEMS ~~~~~~~~~~~~
-
-module Items;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/collection/set/abstract/items.rb"; end
-# While each of the three main methods for returning lists of items can handle arguments,
-# they are most commonly used without them.
-
-# @return [Array] list of Card::Name objects
-# @param args [Hash]
-# @option args [String] :content override card content
-# @option args [String, Card::Name, Symbol] :context name in whose context relative items
-# will be interpreted. For example. +A in context of B is interpreted as B+A
-# context defaults to pointer card's name. If value is `:raw`, then name is not
-# contextualized
-# @option args [String, Integer] :limit max number of cards to return
-# @option args [String, Integer] :offset begin after the offset-th item
-def item_names args={}
- context = args[:context]
- item_strings(args).map do |item|
- clean_item_name item, context
- end.compact
-end
-
-def first_name args={}
- item_names(args).first
-end
-
-def first_card args={}
- return unless (name = first_name)
-
- fetch_item_card name, args
-end
-
-def first_code
- first_card&.codename
-end
-
-def first_id
- first_card&.id
-end
-
-# @return [Array] list of integers (card ids of items)
-# @param args [Hash] see #item_names
-def item_ids args={}
- item_names(args).map(&:card_id).compact
-end
-
-# @return [Array] list of Card objects
-# @param args [Hash] see #item_names for additional options
-# @option args [String] :complete keyword to use in searching among items
-# @option args [True/False] :known_only if true, return only known cards
-# @option args [String] :type name of type to be used for unknown cards
-def item_cards args={}
- return item_cards_search(args) if args[:complete]
- return known_item_cards(args) if args[:known_only]
-
- all_item_cards args
-end
-
-# #item_name, #item_id, and #item_card each return a single item, rather than an array.
-%i[name id card].each do |obj|
- define_method "item_#{obj}" do |args={}|
- send("item_#{obj}s", args.merge(limit: 1)).first
- end
-end
-
-# for override, eg by json
-def item_value item_name
- item_name
-end
-
-# ~~~~~~~~~~~~ ALTERING ITEMS ~~~~~~~~~~~~
-
-# set card content based on array and save card
-# @param array [Array] list of strings/names (Cardish)
-def items= array
- items_to_content array
- save!
-end
-
-# append item to list (does not save)
-# @param cardish [Cardish]
-def << cardish
- add_item cardish
-end
-
-# append item to list (does not save)
-# @param cardish [String, Card::Name] item name
-# @param allow_duplicates [True/False] permit duplicate items (default is False)
-def add_item cardish, allow_duplicates=false
- return if !allow_duplicates && include_item?(cardish)
-
- items = item_strings << cardish
- items_to_content items
-end
-
-# append item to list and save card
-# @param name [String, Card::Name] item name
-def add_item! name
- add_item(name) && save!
-end
-
-# remove item from list
-# @param cardish [String, Card::Name] item to drop
-def drop_item cardish
- drop_item_name = Card::Name[cardish]
- items_to_content(item_names.reject { |item_name| item_name == drop_item_name })
-end
-
-# remove item from list and save card
-# @param cardish [String, Card::Name] item to drop
-def drop_item! cardish
- drop_item cardish
- save!
-end
-
-# insert item into list at specified location
-# @param index [Integer] Array index in which to insert item (0 is first)
-# @param name [String, Card::Name] item name
-def insert_item index, name
- new_names = item_names
- new_names.delete name
- new_names.insert index, name
- items_to_content new_names
-end
-
-# insert item into list at specified location and save
-# @param index [Integer] Array index in which to insert item (0 is first)
-# @param name [String, Card::Name] item name
-def insert_item! index, name
- insert_item index, name
- save!
-end
-
-# ~~~~~~~~~~~~ READING ITEM HELPERS ~~~~~~~~~~~~
-
-# Warning: the following methods, while available for use, may be subject to change
-
-# #item_cards helpers
-
-def item_cards_search query
- Card::Query.run query.reverse_merge(referred_to_by: name, limit: 0)
-end
-
-def known_item_cards args={}
- item_names(args).map { |name| Card.fetch name }.compact
-end
-
-def all_item_cards args={}
- names = args[:item_names] || item_names(args)
- names.map { |name| fetch_item_card name, args }
-end
-
-# TODO: support type_code and type_id. (currently type)
-# uses name, because its most common use is from CQL
-def item_type
- opt = options_rule_card
- # FIXME: need better recursion prevention
- return if !opt || opt == self
-
- opt.item_type
-end
-
-def item_strings args={}
- items = raw_item_strings(args[:content] || content)
- return items unless args.present?
-
- filtered_items items, limit: args[:limit], offset: args[:offset]
-end
-
-def raw_item_strings content
- content.to_s.split(/\n+/).map { |i| strip_item i }
-end
-
-private
-
-def filtered_items items, limit: 0, offset: 0
- limit = limit.to_i
- offset = offset.to_i
- return items unless limit.positive? || offset.positive?
-
- items[offset, (limit.zero? ? items.size : limit)] || []
-end
-
-def fetch_item_card name, args={}
- Card.fetch name, new: new_unknown_item_args(args)
-end
-
-def new_unknown_item_args args
- itype = args[:type] || item_type
- itype ? { type: itype } : {}
-end
-
-def clean_item_name item, context
- item = item.to_name
- return item if context == :raw
-
- context ||= context_card.name
- item.absolute_name context
-rescue Card::Error::NotFound
- # eg for invalid ids or codenames
- # "Invalid Item: #{item}".to_name
- nil
-end
-
-def strip_item item
- item.gsub(/\[\[|\]\]/, "").strip
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/collection/set/abstract/items.rb ~~
diff --git a/set/mod005-collection/abstract/paging.rb b/set/mod005-collection/abstract/paging.rb
deleted file mode 100644
index 7e787c4..0000000
--- a/set/mod005-collection/abstract/paging.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Paging)
-#
-module Paging;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/collection/set/abstract/paging.rb"; end
-MAX_ANONYMOUS_SEARCH_PARAM = 1000
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def limit
- @limit ||= contextual_param(:limit) || default_limit
- end
-
- def offset
- @offset ||= contextual_param(:offset) || 0
- end
-
- def search_with_params
- @search_with_params ||= card.item_names
- end
-
- def count_with_params
- @count_with_params ||= card.item_names.count
- end
-
- def total_pages
- return 1 if limit.zero?
-
- ((count_with_params - 1) / limit).to_i
- end
-
- def current_page
- (offset / limit).to_i
- end
-
- # for override
- def extra_paging_path_args
- {}
- end
-
- private
-
- def contextual_param param
- env_search_param(param) || voo_search_param(param)
- end
-
- def env_search_param param
- enforcing_legal_limit param do
- val = Env.params[param]
- val.to_i if focal? && val.present?
- end
- end
-
- def enforcing_legal_limit param
- yield.tap do |val|
- enforce_legal_limit! val if param == :limit
- end
- end
-
- def enforce_legal_limit! val
- return if Card::Auth.signed_in? || !val || val <= MAX_ANONYMOUS_SEARCH_PARAM
-
- raise Card::Error::PermissionDenied,
- "limit parameter exceeds maximum for anonymous users " \
- "(#{MAX_ANONYMOUS_SEARCH_PARAM})"
- end
-
- def voo_search_param param
- voo&.cql&.dig(param)&.to_i
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/collection/set/abstract/paging.rb ~~
diff --git a/set/mod005-collection/abstract/paging/paging_links.rb b/set/mod005-collection/abstract/paging/paging_links.rb
deleted file mode 100644
index 99b7b70..0000000
--- a/set/mod005-collection/abstract/paging/paging_links.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Paging)
-#
-#! no set module
-
-module Paging;
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/collection/set/abstract/paging/paging_links.rb"; end
-# render paging links
-class PagingLinks
- def initialize total_pages, current_page
- @total = total_pages
- @current = current_page
- end
-
- # @param window [integer] number of page links shown left and right
- # of the current page
- # @example: current page = 5, window = 2
- # |<<|1|...|3|4|[5]|6|7|...|10|>>|
- # @yield [text, page, status, options] block to build single paging link
- # @yieldparam status [Symbol] :active (for current page) or :disabled
- # @yieldparam page [Integer] page number, first page is 0
- # @return [Array]
- def build window=2, &block
- @render_item = block
- links window
- end
-
- private
-
- def links window
- @window_start = [@current - window, 0].max
- @window_end = [@current + window, @total].min
- left_part + window_part + right_part
- end
-
- # the links around the current page
- def window_part
- (@window_start..@window_end).map do |page|
- direct_page_link page
- end.compact
- end
-
- def left_part
- [
- previous_page_link,
- (direct_page_link 0 if @window_start.positive?),
- (ellipse if @window_start > 1)
- ].compact
- end
-
- def right_part
- [
- (ellipse if @total > @window_end + 1),
- (direct_page_link @total if @total > @window_end),
- next_page_link
- ].compact
- end
-
- def previous_page_link
- paging_item '« ', previous_page,
- "aria-label" => "Previous", status: :previous
- end
-
- def next_page_link
- paging_item '» ', next_page,
- "aria-label" => "Next", status: :next
- end
-
- def direct_page_link page
- return unless page >= 0 && page <= @total
-
- paging_item page + 1, page
- end
-
- def ellipse
- paging_item "... ", nil, status: :ellipses
- end
-
- def paging_item text, page, options={}
- status =
- if page == @current
- :current
- else
- options.delete :status
- end
- @render_item.call text, page, status, options
- end
-
- def previous_page
- @current.positive? ? @current - 1 : false
- end
-
- def next_page
- @current < @total ? @current + 1 : false
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/collection/set/abstract/paging/paging_links.rb ~~
diff --git a/set/mod005-collection/abstract/paging/paging_views.rb b/set/mod005-collection/abstract/paging/paging_views.rb
deleted file mode 100644
index 96c2cad..0000000
--- a/set/mod005-collection/abstract/paging/paging_views.rb
+++ /dev/null
@@ -1,121 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Paging;
-# Set: Abstract (Paging, PagingViews)
-#
-module PagingViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/collection/set/abstract/paging/paging_views.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- PAGE_LI_CLASS = { ellipses: "disabled", current: "active" }.freeze
-
- def with_paging path_args={}
- with_paging_path_args path_args do
- output [yield(@paging_path_args), _render_paging]
- end
- end
-
- view :paging, cache: :never do
- return "" unless paging_needed?
-
- <<-HTML
-
-
-
- HTML
- end
-
- def paging_links
- PagingLinks.new(total_pages, current_page).build do |text, page, status, options|
- page_link_li text, page, status, options
- end
- end
-
- # First page is 0 (not 1)
- def page_link_li text, page, status, options={}
- wrap_with :li, class: page_link_li_class(status) do
- page_link text, page, options
- end
- end
-
- def page_link_li_class status
- ["page-item", PAGE_LI_CLASS[status]].compact.join " "
- end
-
- def page_link text, page, options
- return content_tag(:div, text.html_safe, class: "page-link") unless page
-
- options.merge! class: "card-paging-link slotter page-link",
- remote: true,
- path: page_link_path_args(page)
- link_to raw(text), options
- end
-
- def with_paging_path_args args
- tmp = @paging_path_args
- @paging_path_args = paging_path_args args
- yield
- ensure
- @paging_path_args = tmp
- end
-
- def paging_path_args local_args={}
- @paging_path_args ||= {}
- @paging_path_args.reverse_merge!(limit: limit, offset: offset)
- @paging_path_args.merge! extra_paging_path_args
- @paging_path_args.merge local_args
- end
-
- def page_link_path_args page
- paging_path_args.merge offset: page * limit
- end
-
- def paging_needed?
- return false if limit < 1
- return false if fewer_results_than_limit? # avoid extra count search
-
- # count search result instead
- limit < count_with_params
- end
-
- # clear we don't need paging even before running count query
- def fewer_results_than_limit?
- return false unless offset.zero?
-
- limit > offset + search_with_params.length
- end
-end
-
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- def page_link_path_args page
- {
- limit: limit,
- offset: page * limit,
- item: default_item_view, # hack. need standard voo handling
- format: :json
- }.merge extra_paging_path_args
- end
-
- view :paging_urls, cache: :never do
- return {} unless total_pages > 1
-
- { paging: paging_urls_hash }
- end
-
- def paging_urls_hash
- hash = {}
- PagingLinks.new(total_pages, current_page).build do |_text, page, status, _options|
- add_paging_url hash, page, status
- end
- hash
- end
-
- def add_paging_url hash, page, status
- return unless page && status.in?(%i[next previous])
-
- hash[status] = path page_link_path_args(page)
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/collection/set/abstract/paging/paging_views.rb ~~
diff --git a/set/mod005-collection/all/extended.rb b/set/mod005-collection/all/extended.rb
deleted file mode 100644
index fed199b..0000000
--- a/set/mod005-collection/all/extended.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Extended)
-#
-module Extended;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/collection/set/all/extended.rb"; end
-def extended_item_cards context=nil
- items = item_cards limit: "", context: (context || self).name
- list = []
- book = ::Set.new # avoid loops
- extend_item_list items, list, book until items.empty?
- list
-end
-
-def extended_item_contents context=nil
- extended_item_cards(context).map(&:item_names).flatten
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- delegate :extended_item_contents, to: :card
-end
-
-private
-
-def extend_item_list items, list, book
- item = items.shift
- return if already_extended? item, book
-
- if item.collection?
- # keep items in order
- items.unshift(*item.item_cards)
- else # no further level of items
- list << item
- end
-end
-
-def already_extended? item, book
- return true if book.include? item
-
- book << item
- false
-end
-
-# def extended_list context=nil
-# context = (context ? context.name : name)
-# args = { limit: "" }
-# item_cards(args.merge(context: context)).map do |x|
-# x.item_cards(args)
-# end.flatten.map do |x|
-# x.item_cards(args)
-# end.flatten.map do |y|
-# y.item_names(args)
-# end.flatten
-# # this could go on and on. more elegant to recurse until you don't have
-# # a collection
-# end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/collection/set/all/extended.rb ~~
diff --git a/set/mod005-collection/all/item.rb b/set/mod005-collection/all/item.rb
deleted file mode 100644
index d204f96..0000000
--- a/set/mod005-collection/all/item.rb
+++ /dev/null
@@ -1,145 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Item)
-#
-module Item;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/collection/set/all/item.rb"; end
-def item_names _args={}
- format._render_raw.split(/[,\n]/)
-end
-
-# FIXME: this is inconsistent with item_names
-def item_cards _args={}
- [self]
-end
-
-def item_type
- nil
-end
-
-def item_keys args={}
- item_names(args).map do |item|
- item.to_name.key
- end
-end
-
-def item_count args={}
- item_names(args).size
-end
-
-def items_to_content array
- items = array.map { |i| standardize_item i }.reject(&:blank?)
- self.content = items.to_pointer_content
-end
-
-def standardize_item item
- Card::Name[item]
-end
-
-def include_item? item
- item_names.include? Card::Name[item]
-end
-
-def add_item item
- return if include_item? item
-
- items_to_content(items_strings << item)
-end
-
-def drop_item item
- item = Card::Name[item]
- return unless include_item? item
-
- items_to_content(item_names.reject { |i| i == item })
-end
-
-def insert_item index, name
- new_names = item_names
- new_names.delete name
- new_names.insert index, name
- items_to_content new_names
-end
-
-def replace_item old, new
- return unless include_item? old
-
- drop_item old
- add_item new
-end
-
-# I think the following should work as add_item...
-#
-def add_id id
- add_item "~#{id}"
-end
-
-def drop_id id
- drop_item "~#{id}"
-end
-
-def insert_id index, id
- insert_item index, "~#{id}"
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def item_links _args={}
- raw(render_core).split(/[,\n]/)
- end
-
- def nest_item cardish, options={}, &block
- options = item_view_options options
- options[:nest_name] = Card::Name[cardish].s
- nest cardish, options, &block
- end
-
- def implicit_item_view
- view = voo_items_view || default_item_view
- Card::View.normalize view
- end
-
- def voo_items_view
- return unless voo && (items = voo.items)
-
- items[:view]
- end
-
- def default_item_view
- :name
- end
-
- def item_view_options new_options={}
- options = (voo.items || {}).clone
- options = options.merge new_options
- options[:view] ||= implicit_item_view
- determine_item_view_options_type options
- options
- end
-
- def determine_item_view_options_type options
- return if options[:type]
-
- type_from_rule = card.item_type
- options[:type] = type_from_rule if type_from_rule
- end
-
- def listing listing_cards, item_args={}
- listing_cards.map do |item_card|
- nest_item item_card, item_args do |rendered, item_view|
- wrap_item rendered, item_view
- end
- end
- end
-
- def wrap_item item, _args={}
- item # no wrap in base
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def wrap_item rendered, item_view
- %(#{rendered}
)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/collection/set/all/item.rb ~~
diff --git a/set/mod006-content/abstract/00_sources.rb b/set/mod006-content/abstract/00_sources.rb
deleted file mode 100644
index 9354e7f..0000000
--- a/set/mod006-content/abstract/00_sources.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Sources)
-#
-module Sources;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/abstract/00_sources.rb"; end
-def source_paths
- []
-end
-
-def find_file file_path
- unknown_file?(file_path) ? nil : file_path
-end
-
-def unknown_file? file_path
- return false if File.exist? file_path
-
- Rails.logger.info "couldn't locate file #{file_path}"
- true
-end
-
-def existing_source_paths
- Array.wrap(source_paths).reject do |file_path|
- unknown_file?(file_path)
- end.compact
-end
-
-def source_changed? since:
- existing_source_paths.any? { |path| ::File.mtime(path) > since }
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/abstract/00_sources.rb ~~
diff --git a/set/mod006-content/abstract/01_code_file.rb b/set/mod006-content/abstract/01_code_file.rb
deleted file mode 100644
index 6ff33e0..0000000
--- a/set/mod006-content/abstract/01_code_file.rb
+++ /dev/null
@@ -1,94 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (CodeFile)
-#
-module CodeFile;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/abstract/01_code_file.rb"; end
-include_set Abstract::Sources
-
-class << self
-
- def included host_class
- track_mod_name host_class, caller
- end
-
- def track_mod_name host_class, caller
- host_class.mattr_accessor :file_content_mod_name
- host_class.file_content_mod_name = Card::Set.mod_name(caller)
- end
-end
-
-# FIXME: these should abstracted and configured on the types
-# (same codes for `rake card:create:codefile`)
-
-# @return [Array, String] the name of file(s) to be loaded
-def source_files
- case type_id
- when CoffeeScriptID then "#{codename}.js.coffee"
- when JavaScriptID then "#{codename}.js"
- when CssID then "#{codename}.css"
- when ScssID then "#{codename}.scss"
- end
-end
-
-def source_dir
- case type_id
- when CoffeeScriptID, JavaScriptID then "lib/javascript"
- when CssID, ScssID then "lib/stylesheets"
- else
- "lib"
- end
-end
-
-def mod_path
- modname = file_content_mod_name
- if (match = modname.match(/^card-mod-(\w*)/))
- modname = match[1]
- end
- Cardio::Mod.dirs.path modname
-end
-
-def source_paths
- Array.wrap(source_files).map do |filename|
- ::File.join mod_path, source_dir, filename
- end
-end
-
-def content
- Array.wrap(source_files).map do |filename|
- if (source_path = find_file filename)
- Rails.logger.debug "reading file: #{source_path}"
- ::File.read source_path
- end
- end.compact.join "\n"
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :input do
- "Content is stored in file and can't be edited."
- end
-
- view :file_size do
- "#{card.name}: #{number_to_human_size card.content.bytesize}"
- end
-
- def short_content
- fa_icon("exclamation-circle", class: "text-muted pr-2") +
- wrap_with(:span, "file", class: "text-muted")
- end
-
- def standard_submit_button
- multi_card_editor? ? super : ""
- end
-end
-
-def coffee_files files
- files.map { |f| "script_#{f}.js.coffee" }
-end
-
-def scss_files files
- files.map { |f| "style_#{f}.scss" }
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/abstract/01_code_file.rb ~~
diff --git a/set/mod006-content/abstract/asset_file.rb b/set/mod006-content/abstract/asset_file.rb
deleted file mode 100644
index 8ff95b6..0000000
--- a/set/mod006-content/abstract/asset_file.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (AssetFile)
-#
-module AssetFile;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/abstract/asset_file.rb"; end
-include_set Abstract::CodeFile
-
-def source_path
- db_content
-end
-
-def source_files
- db_content
-end
-
-def find_file path
- path.tap do |file_path|
- return nil if unknown_file? file_path
- end
-end
-
-def unknown_file? file_path
- return false if ::File.exist? file_path
-
- Rails.logger.info "couldn't locate #{file_path}"
- true
-end
-
-
-def virtual?
- true
-end
-
-def new?
- false
-end
-
-def compress_js?
- @minimize
-end
-
-def minimize
- @minimze = true
-end
-
-def local
- @local = true
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :core do
- if (source_path = find_file source_path)
- Rails.logger.debug "reading file: #{source_path}"
- ::File.read source_path
- end
- end
-
- def link_view opts={}
- opts[:path] = { card: { type: card.type, content: card.db_content}}
- link_to_card card.name, _render_title, opts
- end
-
- def link_to_view view, text=nil, opts={}
- opts[:path] = { card: { type: card.type, content: card.db_content}}
- super view, (text || view), opts
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :include_tag do
- card.existing_source_paths.map do |path|
- javascript_include_tag(path)
- end.join "\n"
- end
-
- def short_content
- fa_icon("exclamation-circle", class: "text-muted pr-2") +
- wrap_with(:span, "asset file", class: "text-muted")
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/abstract/asset_file.rb ~~
diff --git a/set/mod006-content/abstract/haml_file.rb b/set/mod006-content/abstract/haml_file.rb
deleted file mode 100644
index 724ecbf..0000000
--- a/set/mod006-content/abstract/haml_file.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (HamlFile)
-#
-module HamlFile;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/abstract/haml_file.rb"; end
-def self.included host_class
- host_class.mattr_accessor :template_path
- host_class.extend Card::Set::Format::HamlPaths
- host_class.template_path = host_class.haml_template_path
-end
-
-def content
- File.read template_path
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :input do
- "Content is managed by code and cannot be edited"
- end
-
- def haml_locals
- {}
- end
-
- view :core do
- haml card.content, haml_locals
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/abstract/haml_file.rb ~~
diff --git a/set/mod006-content/abstract/lock.rb b/set/mod006-content/abstract/lock.rb
deleted file mode 100644
index 6656fe1..0000000
--- a/set/mod006-content/abstract/lock.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Lock)
-#
-module Lock;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/abstract/lock.rb"; end
-def lock
- was_already_locked = locked?
- return if was_already_locked
-
- Auth.as_bot do
- lock!
- yield
- end
-ensure
- unlock! unless was_already_locked
-end
-
-def lock_cache_key
- "UPDATE-LOCK:#{key}"
-end
-
-def locked?
- Card.cache.read lock_cache_key
-end
-
-def lock!
- Card.cache.write lock_cache_key, true
-end
-
-def unlock!
- Card.cache.write lock_cache_key, false
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/abstract/lock.rb ~~
diff --git a/set/mod006-content/abstract/read_only.rb b/set/mod006-content/abstract/read_only.rb
deleted file mode 100644
index 0428b4d..0000000
--- a/set/mod006-content/abstract/read_only.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (ReadOnly)
-#
-module ReadOnly;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/abstract/read_only.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :input do
- "Content can't be edited."
- end
-
- def short_content
- fa_icon("exclamation-circle", class: "text-muted pr-2") +
- wrap_with(:span, "read-only", class: "text-muted")
- end
-
- def standard_submit_button
- multi_card_editor? ? super : ""
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/abstract/read_only.rb ~~
diff --git a/set/mod006-content/abstract/templated_nests.rb b/set/mod006-content/abstract/templated_nests.rb
deleted file mode 100644
index a29b89c..0000000
--- a/set/mod006-content/abstract/templated_nests.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (TemplatedNests)
-#
-module TemplatedNests;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/abstract/templated_nests.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- with_nest_mode :template do
- super()
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/abstract/templated_nests.rb ~~
diff --git a/set/mod006-content/abstract/vendor_code_file.rb b/set/mod006-content/abstract/vendor_code_file.rb
deleted file mode 100644
index 8fe1c53..0000000
--- a/set/mod006-content/abstract/vendor_code_file.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (VendorCodeFile)
-#
-module VendorCodeFile;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/abstract/vendor_code_file.rb"; end
-include_set Abstract::CodeFile
-
-def self.included host_class
- Abstract::CodeFile.track_mod_name host_class, caller
-end
-
-def source_dir
- "vendor"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/abstract/vendor_code_file.rb ~~
diff --git a/set/mod006-content/all/chunk.rb b/set/mod006-content/all/chunk.rb
deleted file mode 100644
index c4936ae..0000000
--- a/set/mod006-content/all/chunk.rb
+++ /dev/null
@@ -1,151 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Chunk)
-#
-module Chunk;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/all/chunk.rb"; end
-def chunks content, type=nil, named=false
- content ||= self.content
- all_chunks = Card::Content.new(content, self).find_chunks type
- named ? all_chunks.select(&:referee_name) : all_chunks
-end
-
-def reference_chunks content=nil, named=true
- chunks content, :Reference, named
-end
-
-# named=true rejects commented nests
-def nest_chunks content=nil, named=true
- chunks content, :Nest, named
-end
-
-# named=true rejects external links (since the don't refer to a card name)
-def link_chunks content=nil, named=false
- chunks content, :Link, named
-end
-
-def each_item_name_with_options content=nil
- reference_chunks(content).each do |chunk|
- options = chunk.respond_to?(:options) ? chunk.options : {}
- yield chunk.referee_name, options
- end
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def nest_chunks content=nil
- content ||= _render_raw
- card.nest_chunks content
- end
-
- def nested_cards content=nil
- nest_chunks(content).map(&:referee_card).uniq
- end
-
- def edit_fields
- voo.edit_structure || []
- end
-
- def nested_field_names content=nil
- nest_chunks(content).map(&:referee_name).select { |n| field_name? n }
- end
-
- def nested_field_cards content=nil
- nested_cards(content).select { |c| field_name? c.name }
- end
-
- def field_name? name
- name.field_of? card.name
- end
-
- # @return [Array] of Arrays. each is [nest_name, nest_options_hash]
- def edit_field_configs fields_only=false
- if edit_fields.present?
- explicit_edit_fields_config # explicitly configured in voo or code
- else
- implicit_edit_fields_config fields_only # inferred from nests
- end
- end
-
- def implicit_edit_fields_config fields_only
- result = []
- each_nested_chunk(fields: fields_only) do |chunk|
- result << [chunk.options[:nest_name], chunk.options]
- end
- result
- end
-
- def each_nested_field_chunk &block
- each_nested_chunk fields: true, &block
- end
-
- def each_nested_chunk content: nil, fields: false, uniq: true, virtual: true, &block
- return unless block_given?
-
- chunks = prepare_nested_chunks content, fields, uniq
- process_nested_chunks chunks, virtual, &block
- end
-
- def uniq_chunks chunks
- processed = ::Set.new [card.key]
- chunks.select do |chunk|
- key = chunk.referee_name.key
- ok = !processed.include?(key)
- processed << key
- ok
- end
- end
-
- def field_chunks chunks
- chunks.select { |chunk| field_name?(chunk.referee_name) }
- end
-
- private
-
- def prepare_nested_chunks content, fields, uniq
- chunks = nest_chunks content
- chunks = field_chunks chunks if fields
- chunks = uniq_chunks chunks if uniq
- chunks
- end
-
- def process_nested_chunks chunks, virtual, &block
- chunks.each do |chunk|
- process_nested_chunk chunk, virtual, &block
- end
- end
-
- def process_nested_chunk chunk, virtual, &block
- if chunk.referee_card&.virtual?
- process_nested_virtual_chunk chunk, &block unless virtual
- else
- yield chunk
- end
- end
-
- def process_virtual_chunk chunk, &block
- subformat(chunk.referee_card).each_nested_field_chunk(&block)
- end
-
- def explicit_edit_fields_config
- edit_fields.map do |cardish, options|
- field_mark = normalized_edit_field_mark cardish, options
- options = normalized_edit_field_options options, Card::Name[field_mark]
- [field_mark, options]
- end
- end
-
- def normalized_edit_field_options options, cardname
- options ||= cardname
- options.is_a?(String) ? { title: options } : options
- end
-
- def normalized_edit_field_mark cardish, options
- return cardish if cardish.is_a?(Card) ||
- (options.is_a?(Hash) && options.delete(:absolute))
-
- card.name.field cardish
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/all/chunk.rb ~~
diff --git a/set/mod006-content/all/contextual_content.rb b/set/mod006-content/all/contextual_content.rb
deleted file mode 100644
index add7233..0000000
--- a/set/mod006-content/all/contextual_content.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (ContextualContent)
-#
-module ContextualContent;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/all/contextual_content.rb"; end
-def context_card
- @context_card || self
-end
-
-def with_context context_card
- old_context = @context_card
- @context_card = context_card if context_card
- yield
-ensure
- @context_card = old_context
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- delegate :context_card, :with_context, to: :card
-
- def contextual_content context_card, options={}
- view = options.delete(:view) || :core
- with_context(context_card) { render! view, options }
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/all/contextual_content.rb ~~
diff --git a/set/mod006-content/all/templating.rb b/set/mod006-content/all/templating.rb
deleted file mode 100644
index bacb3ea..0000000
--- a/set/mod006-content/all/templating.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Templating)
-#
-module Templating;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/all/templating.rb"; end
-def is_template?
- return @is_template unless @is_template.nil?
-
- @is_template = name.trait_name? :structure, :default
-end
-
-def is_structure?
- return @is_structure unless @is_structure.nil?
-
- @is_structure = name.trait_name? :structure
-end
-
-def template
- # currently applicable templating card.
- # note that a *default template is never returned for an existing card.
- @template ||= begin
- @virtual = false
-
- if new_card?
- new_card_template
- else
- structure_rule_card
- end
- end
-end
-
-def default_type_id
- Card.default_type_id
-end
-
-def new_card_template
- default = rule_card :default, skip_modules: true
- return default unless (structure = dup_structure default&.type_id)
-
- @virtual = true if compound?
- self.type_id = structure.type_id if assign_type_to?(structure)
- structure
-end
-
-def dup_structure type_id
- dup_card = dup
- dup_card.type_id = type_id || default_type_id
- dup_card.structure_rule_card
-end
-
-def assign_type_to? structure
- return if type_id == structure.type_id
-
- structure.assigns_type?
-end
-
-def assigns_type?
- # needed because not all *structure templates govern the type of set members
- # for example, X+*type+*structure governs all cards of type X,
- # but the content rule does not (in fact cannot) have the type X.
- pattern_code = Card.quick_fetch(name.trunk_name.tag_name)&.codename
- return unless pattern_code && (set_class = Set::Pattern.find pattern_code)
-
- set_class.assigns_type
-end
-
-def structure
- template&.is_structure? ? template : nil
-end
-
-def structure_rule_card
- return unless (card = rule_card :structure, skip_modules: true)
-
- card.db_content&.strip == "_self" ? nil : card
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/all/templating.rb ~~
diff --git a/set/mod006-content/right/default.rb b/set/mod006-content/right/default.rb
deleted file mode 100644
index feae6e9..0000000
--- a/set/mod006-content/right/default.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Default" cards
-#
-module Default;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/right/default.rb"; end
-include_set Abstract::TemplatedNests
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :one_line_content do
- raw = _render_raw
- "#{card.type_name} : #{raw.present? ? raw : 'empty '}"
- end
-
- def quick_form_opts
- super.merge "data-update-foreign-slot":
- ".card-slot.quick_edit-view.RIGHT-Xinput_type,"\
- ".card-slot.quick_edit-view.RIGHT-Xcontent_option"\
- ".card-slot.quick_edit-view.RIGHT-Xcontent_option_view"
- end
-
- def quick_editor
- wrap_type_formgroup do
- type_field class: "type-field rule-type-field _submit-on-select"
- end +
- wrap_content_formgroup do
- text_field :content, class: "d0-card-content _submit-after-typing"
- end
- end
-
- def visible_cardtype_groups
- hash = ::Card::Set::Self::Cardtype::GROUP.slice("Text", "Data", "Upload")
- hash["Organize"] = ["List", "Pointer", "Link list", "Nest list"]
- hash
- end
-end
-
-def empty_ok?
- true
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/right/default.rb ~~
diff --git a/set/mod006-content/right/structure.rb b/set/mod006-content/right/structure.rb
deleted file mode 100644
index 8ac5fa6..0000000
--- a/set/mod006-content/right/structure.rb
+++ /dev/null
@@ -1,85 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Structure" cards
-#
-module Structure;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/right/structure.rb"; end
-include_set Abstract::TemplatedNests
-
-def item_names args={}
- item_strings(args).compact.map(&:to_name)
-end
-
-module RssFormat; module_parent.send :register_set_format, Card::Format::RssFormat, self; extend Card::Set::AbstractFormat
- def raw_feed_items
- [card]
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :one_line_content do
- "#{_render_type} : #{_render_raw}"
- end
-
- def visible_cardtype_groups
- hash = ::Card::Set::Self::Cardtype::GROUP.slice("Text")
- hash["Organize"] = ["Search", "Nest list"]
- hash
- end
-end
-
-event :update_structurees_references, :integrate,
- when: :update_structurees_references? do
- return unless (query = structuree_query)
-
- Auth.as_bot do
- query.run.each(&:update_references_out)
- end
-end
-
-def update_structurees_references?
- db_content_changed? || action == :delete
-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
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/right/structure.rb ~~
diff --git a/set/mod006-content/self/default.rb b/set/mod006-content/self/default.rb
deleted file mode 100644
index e4f2952..0000000
--- a/set/mod006-content/self/default.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Default"
-#
-module Default;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/self/default.rb"; end
-setting_opts group: :templating, position: 2, rule_type_editable: true,
- short_help_text: "type/content template for new cards"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/self/default.rb ~~
diff --git a/set/mod006-content/self/structure.rb b/set/mod006-content/self/structure.rb
deleted file mode 100644
index bfaea82..0000000
--- a/set/mod006-content/self/structure.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Structure"
-#
-module Structure;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/content/set/self/structure.rb"; end
-setting_opts group: :templating, position: 2, rule_type_editable: true,
- short_help_text: "control card's content / structure",
- help_text: "Controls cards' content / structure. "\
- "[[http://decko.org/formatting|more]]"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/content/set/self/structure.rb ~~
diff --git a/set/mod007-format/all/active_card.rb b/set/mod007-format/all/active_card.rb
deleted file mode 100644
index e3748fa..0000000
--- a/set/mod007-format/all/active_card.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (ActiveCard)
-#
-# FIXME: -this needs a better home!
-module ActiveCard;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/active_card.rb"; end
-def format opts={}
- opts = { format: opts.to_sym } if [Symbol, String].member? opts.class
- Card::Format.new self, opts
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/active_card.rb ~~
diff --git a/set/mod007-format/all/base.rb b/set/mod007-format/all/base.rb
deleted file mode 100644
index 5494cff..0000000
--- a/set/mod007-format/all/base.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Base)
-#
-module Base;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/base.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def show view, args
- view ||= :core
- render! view, args.merge(main_nest_options)
- end
-
- # NAME VIEWS
-
- view :name, compact: true, perms: :none do
- name_variant safe_name
- end
-
- def safe_name
- card&.name
- end
-
- def name_variant name
- voo.variant ? name.to_name.vary(voo.variant) : name
- end
-
- view(:key, compact: true, perms: :none) { card.key }
- view(:linkname, compact: true, perms: :none) { card.name.url_key }
- view(:url, compact: true, perms: :none) { card_url _render_linkname }
-
- view :url_link, compact: true, perms: :none do
- link_to_resource card_url(_render_linkname)
- end
-
- view :link, compact: true, perms: :none do
- link_view
- end
-
- view :nav_link, compact: true, perms: :none do
- link_view class: "nav-link"
- end
-
- def link_view opts={}
- opts[:known] = card.known?
- specify_type_in_link! opts
- link_to_card card.name, _render_title, opts
- end
-
- def specify_type_in_link! opts
- return if opts[:known] || !voo.type
-
- opts[:path] = { card: { type: voo.type } }
- end
-
- view(:codename, compact: true) { card.codename.to_s }
- view(:id, compact: true) { card.id }
- view(:type, compact: true) { card.type_name }
-
- # DATE VIEWS
-
- view(:created_at, compact: true) { date_view card.created_at }
- view(:updated_at, compact: true) { date_view card.updated_at }
- view(:acted_at, compact: true) { date_view card.acted_at }
-
- def date_view date
- if voo.variant
- date.strftime voo.variant
- else
- time_ago_in_words date
- end
- end
-
- # CONTENT VIEWS
-
- view :raw do
- structure_card&.content || _render_blank
- end
-
- def structure_card
- return nil if voo.structure == true
-
- voo.structure ? Card[voo.structure] : card
- end
-
- view :core, compact: true do
- process_content _render_raw
- end
-
- view :content do
- _render_core
- end
-
- view :open_content do
- _render_core
- end
-
- view :one_line_content, compact: true do
- with_nest_mode :compact do
- Card::Content.smart_truncate _render_core
- end
- end
-
- view :labeled_content, unknown: :mini_unknown do
- render_core
- end
-
- view :titled_content, unknown: :blank do
- render_core
- end
-
- view :blank, compact: true, perms: :none do
- ""
- end
-
- # NOTE: content and open_content may look like they should be aliased to
- # core, but it's important that they render core explicitly so that core view
- # overrides work. the titled and labeled views below, however, are not
- # intended for frequent override, so this shortcut is fine.
-
- # NAME + CONTENT VIEWS
-
- view :titled do
- "#{card.name}\n\n#{_render_core}"
- end
- view :open, :titled
-
- view :labeled do
- "#{card.name}: #{_render_labeled_content}"
- end
- view :closed, :labeled
-
- # SPECIAL VIEWS
-
- view :array, cache: :never do
- card.item_cards(limit: 0).map do |item_card|
- subformat(item_card)._render_core
- end.inspect
- end
-
- # DEPRECATED
- view :naked do
- Rails.logger.info "DEPRECATED: naked view (used with #{card.name} card)"
- render_core
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/base.rb ~~
diff --git a/set/mod007-format/all/content.rb b/set/mod007-format/all/content.rb
deleted file mode 100644
index 880cb97..0000000
--- a/set/mod007-format/all/content.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Content)
-#
-module Content;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/content.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- ONE_LINE_CHARACTER_LIMIT = 60
-
- # override to customize by set
- def chunk_list
- :default
- end
-
- view :one_line_content do
- with_nest_mode :compact do
- one_line_content
- end
- end
-
- # DEPRECATED
- view :closed_content, :one_line_content
-
- view :raw_one_line_content do
- raw_one_line_content
- end
-
- view :label do
- card.label.to_s
- end
-
- view :smart_label, cache: :never, unknown: true do
- label_with_description render_label, label_description
- end
-
- def label_with_description label, description
- return label unless description
-
- "#{label} #{popover_link description}"
- end
-
- # TODO: move this into a nest once popovers are stub safe
- def label_description
- return unless (desc = card.field :description)
-
- desc.format.render_core
- end
-
- def raw_one_line_content
- cut_with_ellipsis render_raw
- end
-
- def one_line_content
- Content.smart_truncate render_core
- end
-
- def cut_with_ellipsis text, limit=one_line_character_limit
- if text.size <= limit
- text
- else
- "#{text[0..(limit - 3)]}..."
- end
- end
-
- def one_line_character_limit
- voo.size || ONE_LINE_CHARACTER_LIMIT
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :hidden_content_field, unknown: true, cache: :never do
- hidden_field :content, class: "d0-card-content"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/content.rb ~~
diff --git a/set/mod007-format/all/css.rb b/set/mod007-format/all/css.rb
deleted file mode 100644
index e04ad4f..0000000
--- a/set/mod007-format/all/css.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Css)
-#
-module Css;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/css.rb"; end
-module CssFormat; module_parent.send :register_set_format, Card::Format::CssFormat, self; extend Card::Set::AbstractFormat
- def default_nest_view
- :raw
- end
-
- def show view, args
- view ||= :content
- render! view, args
- end
-
- view :titled do
- major_comment(%( Style Card: \\"#{card.name}\\" )) + _render_core
- end
-
- view :content do
- _render_core
- end
-
- view :unknown do
- major_comment "MISSING Style Card: #{card.name}"
- end
-
- view :import do
- _render_core
- end
-
- view :url, perms: :none do
- path mark: card.name, format: :css
- end
-
- def major_comment comment, char="-"
- edge = %(/* #{char * (comment.length + 4)} */)
- main = %(/* #{char} #{comment} #{char} */)
- "#{edge}\n#{main}\n#{edge}\n\n"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/css.rb ~~
diff --git a/set/mod007-format/all/csv.rb b/set/mod007-format/all/csv.rb
deleted file mode 100644
index 06cf45a..0000000
--- a/set/mod007-format/all/csv.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Csv)
-#
-module Csv;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/csv.rb"; end
-require "csv"
-
-module CsvFormat; module_parent.send :register_set_format, Card::Format::CsvFormat, self; extend Card::Set::AbstractFormat
- def default_nest_view
- :core
- end
-
- def default_item_view
- depth.zero? ? :csv_row : :name
- end
-
- view :core do
- if (item_view_options[:view] == :name_with_fields) && focal?
- title_row("item name") + name_with_field_rows
- else
- super()
- end
- end
-
- view :csv_row do
- array = _render_raw.scan(/\{\{[^}]*\}\}/).map do |inc|
- process_content(inc).strip
- end
-
- CSV.generate_line(array).strip
- # strip is because search already joins with newlines
- end
-
- view :unknown do
- ""
- end
-
- view :name_with_fields do
- CSV.generate_line name_with_fields_row
- end
-
- def name_with_fields_row
- nested_field_names.each_with_object([card.name]) do |field_name, row|
- row << nest(field_name)
- end
- end
-
- def name_with_field_rows
- return [] unless row_card_names.present?
-
- row_card_names.map do |item_name|
- CSV.generate_line row_from_field_names(item_name, columns)
- end.join
- end
-
- def row_card_names
- @row_cards ||= card.item_names
- end
-
- def columns
- csv_structure_card.format.nested_field_names.map(&:tag)
- end
-
- def csv_structure_card
- card.rule_card(:csv_structure) || Card.fetch(row_card_names.first)
- end
-
- def row_from_field_names parent_name, field_names, view=:core
- field_names.each_with_object([parent_name]) do |field, row|
- row << nest([parent_name, field], view: view)
- end
- end
-
- def title_row extra_titles=nil
- titles = column_titles extra_titles
- return "" unless titles.present?
-
- CSV.generate_line titles.map(&:upcase)
- end
-
- def column_titles extra_titles=nil
- res = Array extra_titles
- card1 = Card.fetch card.item_names(limit: 1).first
- card1.nest_chunks.each do |chunk|
- res << column_title(chunk.options)
- end
- res.compact
- end
-
- def column_title opts
- if opts[:title]
- opts[:title]
- elsif %w[name link].member? opts[:view]
- opts[:view]
- else
- opts[:nest_name].to_name.tag
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/csv.rb ~~
diff --git a/set/mod007-format/all/demo.rb b/set/mod007-format/all/demo.rb
deleted file mode 100644
index 471d65a..0000000
--- a/set/mod007-format/all/demo.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Demo)
-#
-module Demo;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/demo.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :demo do
- frame do
- [view_select, wrap_with(:div, view_demo, class: "demo-slot")]
- end
- end
-
- view :view_list do
- %i[bar box info_bar open closed titled labeled content content_panel].map do |v|
- wrap_with :p, [content_tag(:h3, v), render(v, show: :menu)]
- end.flatten.join ""
- end
-
- def demo_view
- Env.params[:demo_view] || :core
- end
-
- def view_demo
- wrap(true) do
- render demo_view
- end
- end
-
- def view_select
- card_form :get, success: { view: :demo } do
- select_tag :demo_view,
- options_for_select(all_views, demo_view),
- class: "_submit-on-select"
- end
- end
-
- def all_views
- Card::Set::Format::AbstractFormat::ViewDefinition
- .views.slice(*self.class.ancestors).values.map(&:keys).flatten.uniq
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/demo.rb ~~
diff --git a/set/mod007-format/all/error.rb b/set/mod007-format/all/error.rb
deleted file mode 100644
index 871f25e..0000000
--- a/set/mod007-format/all/error.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Error)
-#
-module Error;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/error.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :compact_missing, perms: :none, compact: true do
- ""
- end
-
- view :unknown, perms: :none, cache: :never do
- ""
- end
-
- view :server_error, perms: :none do
- t(:format_server_error)
- end
-
- view :denial, perms: :none do
- focal? ? t(:format_denial) : ""
- end
-
- view :not_found, perms: :none do
- error_name = card.name.present? ? safe_name : t(:format_not_found_no_name)
- t(:format_not_found_named, cardname: error_name)
- end
-
- view :bad_address, perms: :none do
- root.error_status = 404
- t(:format_bad_address)
- end
-
- view :errors do
- ["Problem:", "", error_messages].flatten.join "\n"
- end
-
- def error_messages
- card.errors.map do |error|
- if error.attribute == :abort
- simple_error_message error.message
- else
- standard_error_message error
- end
- end
- end
-
- # for override
- def simple_error_message message
- message
- end
-
- # for override
- def standard_error_message error
- "#{error.attribute.to_s.upcase}: #{error.message}"
- end
-
- def unsupported_view_error_message view
- t(:format_unsupported_view, view: view, cardname: card.name)
- end
-end
-
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- view :errors do
- {
- error_status: error_status,
- errors: card.errors.each_with_object({}) { |e, h| h[e.attribute] = e.message }
- }
- end
-
- view :server_error, :errors
- view :denial, :errors
- view :not_found, :errors
- view :bad_address do
- card.errors.add :address, super()
- render_error
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/error.rb ~~
diff --git a/set/mod007-format/all/export.rb b/set/mod007-format/all/export.rb
deleted file mode 100644
index 1e88534..0000000
--- a/set/mod007-format/all/export.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Export)
-#
-module Export;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/export.rb"; end
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- # returns an array of Hashes (each in export_item view)
- view :export, cache: :never do
- exporting_uniques do
- Array.wrap(render_export_item).concat(export_items_in_view(:export)).flatten
- end
- end
-
- def max_export_depth
- Env.params[:max_export_depth].present? ? Env.params[:max_export_depth].to_i : 2
- end
-
- # returns an array of Hashes (each in export_item view)
- view :export_items, cache: :never do
- exporting_uniques do
- export_items_in_view(:export).flatten
- end
- end
-
- # returns Hash with the essentials needed to import a card into a new database
- view :export_item do
- item = { name: card.name, type: card.type_name, content: card.content }
- item[:codename] = card.codename if card.codename
- track_exporting card
- item
- end
-
- def export_items_in_view view
- within_max_depth do
- valid_items_for_export.map do |item|
- nest item, view: view
- end
- end
- end
-
- def track_exporting card
- return unless @exported_keys
-
- @exported_keys << card.key
- end
-
- def exporting_uniques
- @exported_keys ||= inherit(:exported_keys) || ::Set.new
- yield
- end
-
- # prevent recursion
- def within_max_depth
- @export_depth ||= inherit(:export_depth).to_i + 1
- @export_depth > max_export_depth ? [] : yield
- end
-
- def items_for_export
- nest_chunks.map do |chunk|
- next if chunk.try :main?
-
- chunk.referee_card
- end.compact
- end
-
- def valid_items_for_export
- items_for_export.flatten.reject(&:blank?).uniq.find_all do |card|
- valid_export_card? card
- end
- end
-
- def valid_export_card? ecard
- ecard.real? && !@exported_keys.include?(ecard.key)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/export.rb ~~
diff --git a/set/mod007-format/all/file.rb b/set/mod007-format/all/file.rb
deleted file mode 100644
index b3319ba..0000000
--- a/set/mod007-format/all/file.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (File)
-#
-module File;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/file.rb"; end
-module FileFormat; module_parent.send :register_set_format, Card::Format::FileFormat, self; extend Card::Set::AbstractFormat
- view :core do
- "File rendering of this card not yet supported"
- end
-
- view :style do
- nil
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/file.rb ~~
diff --git a/set/mod007-format/all/frame.rb b/set/mod007-format/all/frame.rb
deleted file mode 100644
index 8c92c8b..0000000
--- a/set/mod007-format/all/frame.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Frame)
-#
-module Frame;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/frame.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :flash, cache: :never, unknown: true, perms: :none do
- flash_notice = params[:flash] || Env.success.flash
- return "" unless flash_notice.present? && focal?
-
- Array(flash_notice).join "\n"
- end
-
- def frame &block
- standard_frame(&block)
- end
-
- def standard_frame slot=true, &block
- with_frame slot do
- wrap_body(&block) if block_given?
- end
- end
-
- def with_frame slot=true, header=frame_header, slot_opts={}
- voo.hide :help
- add_name_context
- wrap slot, slot_opts do
- panel do
- [header, frame_help, render_flash, (yield if block_given?)]
- end
- end
- end
-
- def frame_header
- _render_header
- end
-
- def frame_help
- with_class_up "help-text", "alert alert-info" do
- _render :help
- end
- end
-
- def frame_and_form action, form_opts={}, &block
- form_opts ||= {}
- frame do
- card_form action, form_opts, &block
- end
- end
-
- def panel &block
- wrap_with :div, class: classy("d0-card-frame"), &block
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/frame.rb ~~
diff --git a/set/mod007-format/all/haml.rb b/set/mod007-format/all/haml.rb
deleted file mode 100644
index da7d934..0000000
--- a/set/mod007-format/all/haml.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Haml)
-#
-module Haml;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/haml.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- include Card::Set::Format::HamlPaths
-
- define_method :the_scope do
- set_scope
- end
-
- define_method :haml_scope do
- set_scope
- end
-
- # Renders haml templates. The haml template can be passed as string or
- # block or a symbol that refers to a view template.
- # @param args [Hash, String, Symbol]
- # If a symbol is given then a template is expected in the corresponding view
- # directory.
- # @return [String] rendered haml as HTML
- # @example render a view template
- # # view/type/basic/my_template.haml:
- # %p
- # Hi
- # = name
- #
- # # set/type/basic.rb:
- # view :my_view do
- # haml :my_template, name: "Joe: # => "Hi Joe
"
- # end
- # @example use a block to pass haml
- # haml name: "Joe" do
- # <<-HAML.strip_heredoc
- # %p
- # Hi
- # = name
- # HAML
- # # => Hi Joe
- # @example create a slot in haml code
- # - haml_wrap do
- # %p
- # some haml
-
- def haml *args, &block
- if args.first.is_a? Symbol
- process_haml_template(*args)
- else
- process_haml(*args, &block)
- end
- end
-
- def haml_partial partial, locals={}
- locals[:template_path] ||= @template_path
- process_haml_template "_#{partial}".to_sym, locals
- end
-
- private
-
- def process_haml *args
- args.unshift yield if block_given?
- haml_to_html(*args)
- end
-
- def process_haml_template template_name, *args
- locals = args.first || {}
- path = identify_template_path template_name, locals
- with_template_path path do
- haml_to_html ::File.read(path), *args
- end
- # rescue => e
- # raise Card::Error, "HAML error #{template_name}: #{e.message}\n#{e.backtrace}"
- end
-
- def identify_template_path view, locals={}
- base_path = locals.delete(:template_path) || caller_locations[2].path
- haml_template_path view, base_path
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/haml.rb ~~
diff --git a/set/mod007-format/all/head.rb b/set/mod007-format/all/head.rb
deleted file mode 100644
index e2d36a9..0000000
--- a/set/mod007-format/all/head.rb
+++ /dev/null
@@ -1,170 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Head)
-#
-module Head;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/head.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :page_title, unknown: true, perms: :none do
- title_parts = [Card::Rule.global_setting(:title)]
- title_parts.unshift safe_name if card.name.present?
- title_parts.join " - "
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # add tuples containing a
- # - the codename of a card with javascript config (usually in json format)
- # - the name of a javascript method that handles the config
- basket :mod_js_config
-
- view :head, unknown: true, perms: :none do
- views_in_head.map { |viewname| render viewname }.flatten.compact.join "\n"
- end
-
- def views_in_head
- %i[meta_tags page_title_tag favicon_tag head_stylesheet
- decko_script_variables head_javascript html5shiv_tag
- script_config_and_initiation
- universal_edit_button rss_links]
- end
-
- # FIXME: tags not working with `template: :haml`
- view :meta_tags, unknown: true, perms: :none do
- haml :meta_tags
- end
-
- view :html5shiv_tag, unknown: true, perms: :none do
- nest :script_html5shiv_printshiv, view: :script_tag
- end
-
- view :page_title_tag, unknown: true, perms: :none do
- content_tag(:title) { render :page_title }
- end
-
- view :favicon_tag, unknown: true, perms: :none do
- nest :favicon, view: :link_tag
- end
-
- view :universal_edit_button, unknown: true, denial: :blank, perms: :update do
- return if card.new?
-
- tag "link", rel: "alternate", type: "application/x-wiki",
- title: "Edit this page!", href: path(view: :edit)
- end
-
- # these should render a view of the rule card
- # it would then be safe to cache if combined with param handling
- # (but note that machine clearing would need to reset card cache...)
- view :head_stylesheet, unknown: true, cache: :never, perms: :none do
- return unless (href = head_stylesheet_path)
-
- tag "link", href: href, media: "all", rel: "stylesheet", type: "text/css"
- end
-
- view :head_javascript, unknown: true, cache: :never, perms: :none do
- Array.wrap(head_javascript_paths).reject { |p| p.empty? }.join("\n")
- end
-
- view :decko_script_variables, unknown: true, cache: :never, perms: :none do
- string = ""
- decko_script_variables.each do |k, v|
- string += "#{k}=#{script_variable_to_js v};\n"
- end
- javascript_tag { string }
- end
-
- def decko_script_variables
- {
- "window.decko": { rootUrl: card_url("") },
- "decko.doubleClick": Card.config.double_click,
- "decko.cssPath": head_stylesheet_path,
- "decko.currentUserId": (Auth.current_id if Auth.signed_in?)
-
- }
- end
-
- def script_variable_to_js value
- if value.is_a? Hash
- string = "{"
- value.each { |k, v| string += "#{k}:#{script_variable_to_js v}" }
- "#{string}}"
- else
- "'#{value}'"
- end
- end
-
- def param_or_rule_card setting
- if params[setting]
- Card[params[setting]]
- else
- root.card.rule_card setting
- end
- end
-
- def debug_or_machine_path setting, debug_lambda, machine_path_lambda
- return unless (asset_card = param_or_rule_card setting)
- debug_path(setting, asset_card, &debug_lambda) ||
- machine_path_lambda.call(asset_card.machine_output_url)
- end
-
- def debug_path setting, asset_card
- return unless params[:debug] == setting.to_s
-
- yield asset_card
- end
-
- def head_stylesheet_path
- debug_or_machine_path :style,
- ->(style_card) { path mark: style_card.name, item: :import, format: :css },
- ->(machine_path) { machine_path }
- end
-
- def head_javascript_paths
- return unless (asset_card = param_or_rule_card :script)
- asset_card.item_cards.map do |script|
- script.format(:html).render :javascript_include_tag
- end
-
- # debug_or_machine_path(
- # :script,
- # ->(script_card) {
- # script_card.item_cards.map do |script|
- # script.format(:html).render :javascript_include_tag
- # end
- # },
- # ->(machine_path) {
- # javascript_include_tag machine_path
- # }
- # )
- end
-
- view :script_config_and_initiation, unknown: true, perms: :none do
- javascript_tag do
- (mod_js_configs << trigger_slot_ready).join "\n\n"
- end
- end
-
- def mod_js_configs
- mod_js_config.map do |codename, js_decko_function|
- config_json = escape_javascript Card::Rule.global_setting(codename)
- "decko.#{js_decko_function}('#{config_json}')"
- end
- end
-
- def trigger_slot_ready
- "$('document').ready(function() { $('.card-slot').trigger('slotReady'); })"
- end
-
- # TODO: move to rss mod
- view :rss_links, unknown: true, perms: :none do
- render :rss_link_tag if rss_link?
- end
-
- def rss_link?
- Card.config.rss_enabled && respond_to?(:rss_link_tag)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/head.rb ~~
diff --git a/set/mod007-format/all/header.rb b/set/mod007-format/all/header.rb
deleted file mode 100644
index a011c98..0000000
--- a/set/mod007-format/all/header.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Header)
-#
-# LOCALIZE first item
-module Header;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/header.rb"; end
-TOGGLE_MAP = { close: %w[open open], open: %w[close closed] }.freeze
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :header, perms: :none do
- main_header
- end
-
- def main_header
- header_wrap _render_header_title
- end
-
- def header_wrap content=nil
- haml :header_wrap, content: (block_given? ? yield : output(content))
- end
-
- view :header_title, perms: :none do
- header_title_elements
- end
-
- def header_title_elements
- voo.hide :title_toggle if show_view?(:icon_toggle, :hide)
- title_view = show_view?(:title_toggle, :hide) ? :title_toggle : :title
- [_render_icon_toggle(optional: :hide), _render(title_view)]
- end
-
- def show_draft_link?
- card.drafts.present? && @slot_view == :edit
- end
-
- view :title_toggle, perms: :none do
- content_toggle(_render_title(hide: :title_link))
- end
-
- view :icon_toggle, perms: :none do
- direction = @toggle_mode == :close ? :expand : :collapse_down
- content_toggle icon_tag(direction)
- end
-
- view :toggle, :icon_toggle # deprecated; use icon_toggle
-
- def content_toggle text=""
- return if text.nil?
-
- verb, adjective = toggle_verb_adjective
- link_to_view adjective, text, title: "#{verb} #{card.name}", # LOCALIZE
- class: "toggle-#{adjective} toggler nodblclick"
- end
-
- def toggle_view
- toggle_verb_adjective.last
- end
-
- def toggle_verb_adjective
- TOGGLE_MAP[@toggle_mode || :open] ||
- raise(Card::Error, "invalid toggle mode: #{@toggle_mode}")
- end
-
- def structure_editable?
- card.structure && card.template.ok?(:update)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/header.rb ~~
diff --git a/set/mod007-format/all/html_content.rb b/set/mod007-format/all/html_content.rb
deleted file mode 100644
index f2e016e..0000000
--- a/set/mod007-format/all/html_content.rb
+++ /dev/null
@@ -1,178 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (HtmlContent)
-#
-module HtmlContent;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/html_content.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def prepare_content_slot
- class_up "card-slot", "d0-card-content"
- voo.hide :menu
- end
-
- before(:content) { prepare_content_slot }
-
- view :content do
- voo.hide :edit_button
- wrap do
- [_render_menu, _render_core, _render_edit_button(edit: :inline)]
- end
- end
-
- before(:content_with_edit_button) do
- prepare_content_slot
- end
-
- view :content_with_edit_button, unknown: true do
- wrap do
- [_render_menu, _render_core, _render_edit_button(edit: :inline)]
- end
- end
-
- view :short_content, wrap: { div: { class: "text-muted" } } do
- short_content
- end
-
- view :raw_one_line_content, unknown: :mini_unknown,
- wrap: { div: { class: "text-muted" } } do
- raw_one_line_content
- end
-
- view :one_line_content, unknown: :mini_unknown,
- wrap: { div: { class: "text-muted" } } do
- one_line_content
- end
-
- before(:content_with_title) { prepare_content_slot }
-
- view :content_with_title do
- wrap true, title: card.format(:text).render_core do
- [_render_menu, _render_core]
- end
- end
-
- before :content_panel do
- prepare_content_slot
- class_up "card-slot", "card"
- end
-
- view :content_panel do
- wrap do
- wrap_with :div, class: "card-body" do
- [_render_menu, _render_core]
- end
- end
- end
-
- view :titled do
- @content_body = true
- wrap do
- [
- naming { render_header },
- render_flash,
- wrap_body { render_titled_content },
- render_comment_box(optional: :hide)
- ]
- end
- end
-
- view :labeled, unknown: true do
- @content_body = true
- wrap(true, class: "row") do
- labeled(render_title, wrap_body { "#{render_menu}#{render_labeled_content}" })
- end
- end
-
- def labeled label, content
- haml :labeled, label: label, content: content
- end
-
- def labeled_field field, item_view=:name, opts={}
- opts[:title] ||= Card.fetch_name field
- field_nest field, opts.merge(view: :labeled,
- items: (opts[:items] || {}).merge(view: item_view))
- end
-
- view :open do
- toggle_logic
- @toggle_mode = :open
- @content_body = true
- frame do
- [_render_open_content, render_comment_box(optional: :hide)]
- end
- end
-
- view :closed do
- with_nest_mode :compact do
- toggle_logic
- class_up "d0-card-body", "closed-content"
- @content_body = false
- @toggle_mode = :close
- frame
- end
- end
-
- def toggle_logic
- show_view?(:title_link, :hide) ? voo.show(:icon_toggle) : voo.show(:title_toggle)
- end
-
- def current_set_card
- set_name = params[:current_set]
- set_name ||= "#{card.name}+*type" if card.known? && card.type_id == Card::CardtypeID
- set_name ||= "#{card.name}+*self"
- Card.fetch(set_name)
- end
-
- def raw_one_line_content
- cleaned = Card::Content.clean! render_raw, {}
- cut_with_ellipsis cleaned
- end
-
- def one_line_content
- # TODO: use a version of Card::Content.smart_truncate
- # that counts characters instead of clean!
- cleaned = Card::Content.clean! render_core, {}
- cut_with_ellipsis cleaned
- end
-
- # LOCALIZE
- def short_content
- short_content_items || short_content_fields || short_content_from_core
- end
-
- def short_content_items
- return unless card.respond_to? :count
-
- "#{count} #{'item'.pluralize count}"
- end
-
- def short_content_fields
- with_short_content_fields do |num_fields|
- "#{num_fields} #{'field'.pluralize num_fields}" if num_fields.positive?
- end
- end
-
- def with_short_content_fields
- yield nested_field_names.size if voo.structure || card.structure
- end
-
- def short_content_from_core
- content = render_core
- if content.blank?
- "empty"
- elsif content.size <= 5
- content
- elsif content.count("\n") < 2
- "#{content.size} characters"
- else
- "#{content.count("\n") + 1} lines"
- end
- end
-
- def count
- @count ||= card.count
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/html_content.rb ~~
diff --git a/set/mod007-format/all/html_error.rb b/set/mod007-format/all/html_error.rb
deleted file mode 100644
index 3f73ba0..0000000
--- a/set/mod007-format/all/html_error.rb
+++ /dev/null
@@ -1,217 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (HtmlError)
-#
-module HtmlError;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/html_error.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :server_error, template: :haml
-
- view :debug_server_error, wrap: { modal: { size: :full } } do
- error_page = BetterErrors::ErrorPage.new Card::Error.current,
- "PATH_INFO" => request.env["REQUEST_URI"]
- haml :debug_server_error, {}, error_page
- end
-
- view :unknown do
- createable { wrap { unknown_link "#{unknown_icon} #{render_title}" } }
- end
-
- # icon only, no wrap
- view :mini_unknown, unknown: true, cache: :never do
- createable { unknown_link unknown_icon }
- end
-
- def createable
- card.ok?(:create) ? yield : ""
- end
-
- def unknown_link text
- path_opts = voo.type ? { card: { type: voo.type } } : {}
- link_to_view :new_in_modal, text, path: path_opts, class: classy("unknown-link")
- end
-
- def unknown_icon
- fa_icon "plus-square"
- end
-
- view :compact_missing, perms: :none do
- wrap_with :span, h(title_in_context), class: "text-muted"
- end
-
- view :conflict, cache: :never do
- actor_link = link_to_card card.last_action.act.actor.name
- class_up "card-slot", "error-view"
- wrap do # LOCALIZE
- alert "warning" do
- %(
- Conflict!
- #{card.last_action_id}
- #{actor_link} has also been making changes.
- Please examine below, resolve above, and re-submit.
- #{render_act}
- )
- end
- end
- end
-
- view :errors, perms: :none do
- return if card.errors.empty?
-
- voo.title = if card.name.blank?
- "Problems"
- else
- t(:format_problems_name,
- cardname: card.name)
- end
- voo.hide! :menu
- class_up "alert", "card-error-msg"
- standard_errors voo.title
- end
-
- view :not_found do
- voo.hide! :menu
- voo.title = "Not Found"
- frame do
- [not_found_errors, sign_in_or_up_links("to create it")]
- end
- end
-
- view :denial do
- focal? ? loud_denial : quiet_denial
- end
-
- def view_for_unknown view
- main? && ok?(:create) ? :new : super
- end
-
- def show_all_errors?
- # make configurable by env
- Auth.always_ok? || Rails.env.development?
- end
-
- def error_cardname exception
- cardname = super
- show_all_errors? ? backtrace_link(cardname, exception) : cardname
- end
-
- def rendering_error exception, view
- wrap_with(:span, class: "render-error alert alert-danger") { super }
- end
-
- def error_modal_id
- @error_modal_id ||= unique_id
- end
-
- def error_message exception
- %{
- Error message (visible to admin only)
- #{CGI.escapeHTML exception.message}
- #{exception.backtrace * " \n"}
- }
- end
-
- def backtrace_link cardname, exception
- # TODO: make this a modal link after new modal handling is merged in
- wrap_with(:span, title: error_message(exception)) { cardname }
- end
-
- def standard_errors heading=nil
- alert "warning", true do
- [
- (wrap_with(:h4, heading, class: "alert-heading error") if heading),
- error_messages.join(" ")
- ]
- end
- end
-
- def simple_error_message message
- h message
- end
-
- def standard_error_message error
- "#{h error.attribute.to_s.upcase}: #{h error.message}
"
- end
-
- def not_found_errors
- if card.errors.any?
- standard_errors
- else
- haml :not_found
- end
- end
-
- def sign_in_or_up_links to_task
- return if Auth.signed_in?
-
- links = [signin_link, signup_link].compact.join " #{t(:format_or)} "
- wrap_with(:div) do
- "#{[t(:format_please), links, to_task].join(' ')}."
- end
- end
-
- def signin_link
- link_to_card :signin, t(:account_sign_in)&.downcase,
- class: "signin-link", slotter: true, path: { view: :open }
- end
-
- def signup_link
- return unless signup_ok?
-
- link_to_card :signup, t(:account_sign_up)&.downcase,
- class: "signup-link", slotter: true, path: { action: :new }
- end
-
- def signup_ok?
- Card.new(type_id: Card::SignupID).ok? :create
- end
-
- def quiet_denial
- wrap_with :span, class: "denied" do
- ""
- end
- end
-
- def loud_denial
- voo.hide :menu
- frame do
- [wrap_with(:h1, t(:format_sorry)),
- wrap_with(:div, loud_denial_message)]
- end
- end
-
- def loud_denial_message
- to_task = if @denied_task
- t(:format_denied_task,
- denied_task: @denied_task)
- else
- t(:format_to_do_that)
- end
-
- case
- when not_denied_task_read?
- t(:format_read_only)
- when Auth.signed_in?
- t(:format_need_permission_task, task: to_task)
- else
- Env.save_interrupted_action request.env["REQUEST_URI"]
- sign_in_or_up_links to_do_unauthorized_task
- end
- end
-
- def not_denied_task_read?
- @denied_task != :read && Card.config.read_only
- end
-
- def to_do_unauthorized_task
- if @denied_task
- t(:format_denied_task,
- denied_task: @denied_task)
- else
- t(:format_to_do_that)
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/html_error.rb ~~
diff --git a/set/mod007-format/all/html_show.rb b/set/mod007-format/all/html_show.rb
deleted file mode 100644
index 7521b2d..0000000
--- a/set/mod007-format/all/html_show.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (HtmlShow)
-#
-module HtmlShow;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/html_show.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def show view, args
- capture_the_freak do
- content = send show_method, view, args
- show_full_page? ? wrap_with_html_page(content) : content
- end
- end
-
- def show_method
- "show_#{show_layout? ? :with : :without}_page_layout"
- end
-
- def show_without_page_layout view, args
- @main = true if params[:is_main] || args[:main]
- args.delete(:layout)
- view ||= args[:home_view] || :open # default_nest_view
- render! view, args
- end
-
- def show_full_page?
- !Env.ajax?
- end
-
- wrapper :html_page do
- <<-HTML.strip_heredoc
-
-
-
- #{head_content}
-
- #{interior}
-
- HTML
- end
-
- def head_content
- nest card.rule_card(:head), view: :head_content
- end
-
- private
-
- # this is a temporary fix to try to debug a recurring encoding-related error
- # TODO: remove the following after tracking down wikirate encoding bug
- def capture_the_freak
- yield
- rescue Card::Error::ServerError => e
- if e.message.match?(/invalid byte sequence/)
- Card::Lexicon.cache.reset
- Rails.logger.info "reset name cache to prevent encoding freakiness"
- end
- raise e
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/html_show.rb ~~
diff --git a/set/mod007-format/all/html_title.rb b/set/mod007-format/all/html_title.rb
deleted file mode 100644
index b8c1854..0000000
--- a/set/mod007-format/all/html_title.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (HtmlTitle)
-#
-module HtmlTitle;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/html_title.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :title, compact: true, perms: :none do
- standard_title
- end
-
- def standard_title
- name_variant title_in_context(voo.title)
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :title do
- show_view?(:title_link, :hide) ? render_title_link : render_title_no_link
- end
-
- view :title_link, compact: true, perms: :none do
- link_to_card card.name, render_title_no_link
- end
-
- view :title_no_link, compact: true, perms: :none do
- wrapped_title standard_title
- end
-
- def title_with_link link_text
- link_to_card card.name, link_text
- end
-
- def safe_name
- h super
- end
-
- def title_in_context title=nil
- title = title&.html_safe
- # escape titles generated from card names, but not those set explicitly
- h super(title)
- end
-
- def wrapped_title title
- wrap_with :span, class: classy("card-title"), title: title do
- title.to_name.parts.join wrapped_joint
- end
- end
-
- def wrapped_joint
- wrap_with :span, "+", classy("joint")
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/html_title.rb ~~
diff --git a/set/mod007-format/all/html_wrapper.rb b/set/mod007-format/all/html_wrapper.rb
deleted file mode 100644
index d9095ee..0000000
--- a/set/mod007-format/all/html_wrapper.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (HtmlWrapper)
-#
-module HtmlWrapper;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/html_wrapper.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # Does two main things:
- # (1) gives CSS classes for styling and
- # (2) adds card data for javascript - including the "card-slot" class,
- # which in principle is not supposed to be in styles
- def wrap slot=true, slot_attr={}, tag=:div, &block
- attrib = slot_attributes slot, slot_attr
- method_wrap :wrap_with, tag, attrib, &block
- end
-
- wrapper :slot do |opts|
- class_up "card-slot", opts[:class] if opts[:class]
- attrib = slot_attributes true, opts
- method_wrap(:wrap_with, :div, attrib) { interior }
- end
-
- def haml_wrap slot=true, slot_attr={}, tag=:div, &block
- attrib = slot_attributes slot, slot_attr
- method_wrap :haml_tag, tag, attrib, &block
- end
-
- def method_wrap method, tag, attrib, &block
- @slot_view = @current_view
- debug_slot { send method, tag, attrib, &block }
- end
-
- def slot_attributes slot, slot_attr
- { id: slot_id, class: wrap_classes(slot), data: wrap_data }.tap do |hash|
- add_class hash, slot_attr.delete(:class)
- hash.deep_merge! slot_attr
- end
- end
-
- def slot_id
- "#{card.name.safe_key}-#{@current_view}-view"
- end
-
- def wrap_data slot=true
- with_slot_data slot do
- {
- "card-id": card.id,
- "card-name": slot_cardname,
- "card-link-name": card.name.url_key,
- "slot-id": SecureRandom.hex(10)
- }
- end
- end
-
- def slot_cardname
- name = card.name
- name = card.new? && name.compound? ? name.url_key : name
- h name
- end
-
- def with_slot_data slot
- hash = yield
- # rails helper convert slot hash to json
- # but haml joins nested keys with a dash
- hash[:slot] = slot_options_json if slot
- hash
- end
-
- def slot_options_json
- html_escape_except_quotes JSON(slot_options)
- end
-
- def slot_options
- options = voo ? voo.slot_options : {}
- name_context_slot_option options
- options
- end
-
- def name_context_slot_option opts
- return unless initial_context_names.present?
-
- opts[:name_context] = initial_context_names.map(&:key) * ","
- end
-
- def debug_slot &block
- debug_slot? ? debug_slot_wrap(&block) : yield
- end
-
- def debug_slot?
- params[:debug] == "slot"
- end
-
- def debug_slot_wrap
- pre = ""
- [pre, "BEGIN", post, yield, pre, "END", post].join
- end
-
- def wrap_classes slot
- list = slot ? ["card-slot"] : []
- list += ["#{@current_view}-view", card.safe_set_keys]
- list << "STRUCTURE-#{voo.structure.to_name.key}" if voo&.structure
- classy list
- end
-
- def wrap_body &block
- wrap_with(:div, class: body_css_classes, &block)
- end
-
- def haml_wrap_body &block
- wrap_body do
- capture_haml(&block)
- end
- end
-
- def body_css_classes
- css_classes = ["d0-card-body"]
- css_classes += ["d0-card-content", card.safe_set_keys] if @content_body
- classy(*css_classes)
- end
-
- def wrap_main
- return yield if no_main_wrap?
-
- wrap_with :div, yield, id: "main"
- end
-
- def no_main_wrap?
- Env.ajax? || params[:layout] == "none"
- end
-
- def wrap_with tag, content_or_args={}, html_args={}, &block
- tag_args = block_given? ? content_or_args : html_args
- content_tag(tag, tag_args) { content_within_wrap content_or_args, &block }
- end
-
- def wrap_each_with tag, content_or_args={}, args={}, &block
- tag_args = block_given? ? content_or_args : args
- content_items_within_wrap(content_or_args, args, &block).map do |item|
- wrap_with(tag, tag_args) { item }
- end.join "\n"
- end
-
- private
-
- def content_items_within_wrap content, args
- content = block_given? ? yield(args) : content
- content.compact
- end
-
- def content_within_wrap content
- content = block_given? ? yield : content
- output(content).to_s.html_safe
- end
-
- def html_escape_except_quotes string
- # to be used inside single quotes (makes for readable json attributes)
- string.to_s.gsub(/&/, "&")
- .gsub(/'/, "'")
- .gsub(/>/, ">")
- .gsub(/, "<")
- end
-
- wrapper :div, :div
- wrapper :em, :em
-
- wrapper :none do
- interior
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/html_wrapper.rb ~~
diff --git a/set/mod007-format/all/js.rb b/set/mod007-format/all/js.rb
deleted file mode 100644
index ce8282a..0000000
--- a/set/mod007-format/all/js.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Js)
-#
-module Js;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/js.rb"; end
-module JsFormat; module_parent.send :register_set_format, Card::Format::JsFormat, self; extend Card::Set::AbstractFormat
- def default_item_view
- :core
- end
-
- view :source do
- path format: :js
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/js.rb ~~
diff --git a/set/mod007-format/all/json.rb b/set/mod007-format/all/json.rb
deleted file mode 100644
index 99a4292..0000000
--- a/set/mod007-format/all/json.rb
+++ /dev/null
@@ -1,174 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Json)
-#
-module Json;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/json.rb"; end
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- # because card.item_cards returns "[[#{self}]]"
- def item_cards
- nested_cards
- end
-
- def default_nest_view
- :atom
- end
-
- def default_item_view
- params[:item] || :name
- end
-
- def max_depth
- params[:max_depth].present? ? params[:max_depth].to_i : 1
- end
-
- # TODO: support layouts in json
- # eg layout=stamp gives you the metadata currently in "page" view
- # and layout=none gives you ONLY the requested view (default atom)
- def show view, args
- view ||= :molecule
- string_with_page_details do
- render! view, args
- end
- end
-
- def string_with_page_details
- raw = yield
- return raw if raw.is_a? String
-
- stringify page_details(raw)
- end
-
- def stringify raw
- method = params[:compress] ? :generate : :pretty_generate
- JSON.send method, raw
- end
-
- def page_details obj
- return obj unless obj.is_a? Hash
-
- obj.merge url: request_url, timestamp: Time.now.to_s
- end
-
- view :status, unknown: true, perms: :none do
- { key: card.key,
- url_key: card.name.url_key,
- status: card.state }.tap do |h|
- h[:id] = card.id if h[:status] == :real
- end
- end
-
- def request_url
- controller.request&.original_url || path
- end
-
- view :core, unknown: true do
- card.known? ? render_content : nil
- end
-
- view :content do
- card.content
- end
-
- view :nucleus do
- nucleus
- end
-
- # TODO: add simple values for fields
- view :atom, unknown: true do
- atom
- end
-
- view :molecule do
- molecule
- end
-
- view :page, cache: :never do
- page_details card: render_atom
- end
-
- # NOCACHE because sometimes item_cards is dynamic.
- # could be safely cached for non-dynamic lists
- view :items, cache: :never do
- listing item_cards, view: :atom
- end
-
- view :links do
- card.link_chunks.map do |chunk|
- if chunk.referee_name
- path mark: chunk.referee_name, format: :json
- else
- link_to_resource chunk.link_target
- end
- end
- end
-
- view :ancestors do
- card.name.ancestors.map do |name|
- nest name, view: :nucleus
- end
- end
-
- # minimum needed to re-fetch card
- view :cast do
- card.cast
- end
-
- ## DEPRECATED
- view :marks do
- {
- id: card.id,
- name: card.name,
- key: card.key,
- url: path
- }
- end
-
- view :essentials do
- if voo.show? :marks
- render_marks.merge(essentials)
- else
- essentials
- end
- end
-
- def essentials
- return {} if card.structure
-
- { content: card.db_content }
- end
-
- # NOTE: moving these to methods prevents potential caching problems, because other
- # views manipulate their hashes.
- #
- def nucleus
- { id: card.id,
- name: card.name,
- type: card.type_name,
- url: path(format: :json) }.tap do |h|
- h[:codename] = card.codename if card.codename
- end
- end
-
- def atom
- nucleus.tap do |h|
- h[:content] = render_content if card.known? && !card.structure
- end
- end
-
- def molecule
- atom.merge items: _render_items,
- links: _render_links,
- ancestors: _render_ancestors,
- html_url: path,
- type: nest(card.type_card, view: :nucleus)
- end
-end
-
-# TODO: perhaps this should be in a general "data" module.
-def cast
- real? ? { id: id } : { name: name, type_id: type_id, content: db_content }
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/json.rb ~~
diff --git a/set/mod007-format/all/links.rb b/set/mod007-format/all/links.rb
deleted file mode 100644
index 2420406..0000000
--- a/set/mod007-format/all/links.rb
+++ /dev/null
@@ -1,160 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Links)
-#
-module Links;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/links.rb"; end
-RESOURCE_TYPE_REGEXP = /^([a-zA-Z][\-+.a-zA-Z\d]*):/
-
-# The #link_to methods support smart formatting of links in multiple formats.
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- # Creates a "link", the meaning of which depends upon the format. In this base
- # format, the link looks like [text][absolute path]
- #
- # @param text [String] optional string associated with link
- # @param opts [Hash] optional Hash. In simple formats, :path is usually the only key
- def link_to text=nil, opts={}
- path = path((opts.delete(:path) || {}))
- if text && path != text
- "#{text}[#{path}]"
- else
- path
- end
- end
-
- # link to a different view of the current card
- # @param view [Symbol,String]
- # @param text [String]
- # @param opts [Hash]
- def link_to_view view, text=nil, opts={}
- add_to_path opts, view: view unless view == :home
- link_to text, opts
- end
-
- # link to a card other than the current card.
- # @param cardish [Integer, Symbol, String, Card] a card identifier
- # @param text [String]
- # @param opts [Hash]
- def link_to_card cardish, text=nil, opts={}
- add_to_path opts, mark: Card::Name[cardish]
- link_to text, opts
- end
-
- # a "resource" is essentially a reference to something that
- # decko doesn't recognize to be a card. Can be a remote url,
- # a local url (that decko hasn't parsed) or a local path.
- # @param resource [String]
- # @param text [String]
- # @param opts [Hash]
- def link_to_resource resource, text=nil, opts={}
- resource = clean_resource resource, resource_type(resource)
- link_to text, opts.merge(path: resource)
- end
-
- # smart_link_to is wrapper method for #link_to, #link_to_card, #link_to_view, and
- # #link_to_resource. If the opts argument contains :view, :related, :card, or
- # :resource, it will use the respective method to render a link.
- #
- # This is usually most useful when writing views that generate many different
- # kinds of links.
- def smart_link_to text, opts={}
- if (linktype = %i[view card resource].find { |key| opts[key] })
- send "link_to_#{linktype}", opts.delete(linktype), text, opts
- else
- send :link_to, text, opts
- end
- end
-
- private
-
- def resource_type resource
- case resource
- when /^https?:/ then "external-link"
- when %r{^/} then "internal-link"
- when /^mailto:/ then "email-link"
- when RESOURCE_TYPE_REGEXP then "#{Regexp.last_match(1)}-link"
- end
- end
-
- def clean_resource resource, resource_type
- if resource_type == "internal-link"
- # remove initial slash; #contextualize_path handles relative root
- contextualize_path resource.sub(%r{^/}, "")
- else
- resource
- end
- end
-
- def add_to_path opts, new_hash
- opts[:path] = (opts[:path] || {}).merge new_hash
- end
-end
-
-public
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # in HTML, #link_to renders an anchor tag
- # it treats opts other than "path" as html opts for that tag,
- # and it adds special handling of "remote" and "method" opts
- # (changes them into data attributes)
- def link_to text=nil, opts={}
- opts[:href] ||= path opts.delete(:path)
- text = raw(text || opts[:href])
- interpret_data_opts_to_link_to opts
- wrap_with :a, text, opts
- end
-
- # in HTML, #link_to_card adds special css classes indicated whether a
- # card is "known" (real or virtual) or "wanted" (unknown)
- # TODO: upgrade from (known/wanted)-card to (real/virtual/unknown)-card
- def link_to_card cardish, text=nil, opts={}
- name = Card::Name[cardish]
- slotterify opts if opts[:slotter]
- add_known_or_wanted_class opts, name
- super name, (text || name), opts
- end
-
- # in HTML, #link_to_view defaults to a remote link with rel="nofollow".
- def link_to_view view, text=nil, opts={}
- slotterify opts
- super view, (text || view), opts
- end
-
- # in HTML, #link_to_resource automatically adds a target to external resources
- # so they will open in another tab. It also adds css classes indicating whether
- # the resource is internal or external
- def link_to_resource resource, text=nil, opts={}
- add_resource_opts opts, resource_type(resource)
- super
- end
-
- private
-
- def slotterify opts
- opts.delete(:slotter)
- opts.reverse_merge! remote: true, rel: "nofollow"
- add_class opts, "slotter"
- end
-
- def add_known_or_wanted_class opts, name
- known = opts.delete :known
- known = Card.known?(name) if known.nil?
- add_class opts, (known ? "known-card" : "wanted-card")
- end
-
- def interpret_data_opts_to_link_to opts
- %i[remote method].each do |key|
- next unless (val = opts.delete key)
-
- opts["data-#{key}"] = val
- end
- end
-
- def add_resource_opts opts, resource_type
- opts[:target] ||= "_blank" if resource_type == "external-link"
- add_class opts, resource_type
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/links.rb ~~
diff --git a/set/mod007-format/all/menu.rb b/set/mod007-format/all/menu.rb
deleted file mode 100644
index a3ae7d0..0000000
--- a/set/mod007-format/all/menu.rb
+++ /dev/null
@@ -1,138 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Menu)
-#
-module Menu;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/menu.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :menu, denial: :blank, unknown: true do
- return "" if card.unknown?
-
- wrap_with :div, class: "card-menu #{menu_link_classes}" do
- [render_help_link,
- menu_link,
- (voo.show?(:bridge_link) ? bridge_link(false) : nil)]
- end
- end
-
- def menu_link
- case voo.edit
- when :inline
- edit_inline_link
- when :full
- edit_in_bridge_link
- else # :standard
- edit_link
- end
- end
-
- def edit_view
- case voo.edit
- when :inline
- :edit_inline
- when :full
- :edit
- else # :standard
- edit_link
- end
- end
-
- view :edit_link, unknown: true, denial: :blank do
- edit_link edit_link_view
- end
-
- def edit_link_view
- :edit
- end
-
- view :full_page_link do
- full_page_link
- end
-
- view :bridge_link, unknown: true do
- bridge_link
- end
-
- def bridge_link in_modal=true
- opts = { class: "bridge-link" }
- if in_modal
- # add_class opts, "close"
- opts["data-slotter-mode"] = "modal-replace"
- end
- link_to_view :bridge, material_icon(:more_horiz), opts
- end
-
- # no caching because help_text view doesn't cache, and we can't have a
- # stub in the data-content attribute or it will get html escaped.
- view :help_link, cache: :never, unknown: true do
- help_link render_help_text, help_title
- end
-
- def help_link text=nil, title=nil
- opts = help_popover_opts text, title
- add_class opts, "_card-menu-popover"
- link_to help_icon, opts
- end
-
- def help_popover_opts text=nil, title=nil
- text ||= render_help_text
- opts = { "data-placement": :left, class: "help-link" }
- popover_opts text, title, opts
- end
-
- def help_icon
- material_icon("help")
- end
-
- def help_title
- "#{name_parts_links} (#{render_type}) #{full_page_link unless card.simple?}"
- end
-
- def name_parts_links
- card.name.parts.map do |part|
- link_to_card part
- end.join Card::Name.joint
- end
-
- def full_page_link
- link_to_card full_page_card, full_page_icon, class: classy("full-page-link")
- end
-
- def full_page_card
- card
- end
-
- def edit_in_bridge_link opts={}
- edit_link :bridge, opts
- end
-
- def edit_link view=:edit, opts={}
- link_to_view view, opts.delete(:link_text) || menu_icon,
- edit_link_opts(opts.reverse_merge(modal: :lg))
- end
-
- # @param modal [Symbol] modal size
- def edit_link_opts modal: nil
- opts = { class: classy("edit-link") }
- if modal
- opts[:"data-slotter-mode"] = "modal"
- opts[:"data-modal-class"] = "modal-#{modal}"
- end
- opts
- end
-
- def menu_link_classes
- "nodblclick#{show_view?(:hover_link) ? ' _show-on-hover' : ''}"
- end
-
- def menu_icon
- material_icon "edit"
- end
-
- def full_page_icon
- icon_tag :open_in_new
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/menu.rb ~~
diff --git a/set/mod007-format/all/path.rb b/set/mod007-format/all/path.rb
deleted file mode 100644
index ac2a1b7..0000000
--- a/set/mod007-format/all/path.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Path)
-#
-module Path;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/path.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- # Decko uses the term "path" a bit unusually.
- #
- # In most formats, #path returns a full url. In HTML, it provides everything after
- # the domain/port.
- #
- # If you're feeling saucy, you might point out that typically "paths" don't
- # include queries and fragment identifiers, much less protocols, domains, and ports.
- # 10 pedantry points to you! But "path" is easy to type and the method is smart about
- # format needs, so using it will lead you down the right ... something or other.
-
- # Format#path is for generating standard card routes, eg, assuming the card
- # associated with the current format is named "current", it will generate paths like
- # these:
-
- # path view: :bar -> "current?view=bar"
- # path mark: [mycardid] -> "mycardname"
- # path format: :csv) -> "current.csv"
- # path action: :update -> "update/current"
-
- # #path produces paths that follow one of three main patterns:
-
- # 1. mark[.format][?query] # standard GET request
- # 2. action/mark[?query] # GET variant of standard actions
- # 3. new/mark # shortcut for "new" view of cardtype
-
- # @param opts [Hash, String] a String is treated as a complete path and
- # bypasses all processing
- # @option opts [String, Card::Name, Integer, Symbol, Card] :mark
- # @option opts [Symbol] :action card action (:create, :update, :delete)
- # @option opts [Symbol] :format
- # @option opts [Hash] :card
- # @option opts [TrueClass] :no_mark
-
- def path opts={}
- return opts unless opts.is_a? Hash
-
- path = Card::Path.new(card, opts)&.render
- contextualize_path path
- end
-
- # in base format (and therefore most other formats), even internal paths
- # are rendered as absolute urls.
- def contextualize_path relative_path
- card_url relative_path
- end
-end
-
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- def add_unknown_name_to_opts name, opts
- # noop
- end
-end
-
-module CssFormat; module_parent.send :register_set_format, Card::Format::CssFormat, self; extend Card::Set::AbstractFormat
- def contextualize_path relative_path
- if Card.config.file_storage == :local
- # absolute paths lead to invalid assets path in css for cukes
- card_path relative_path
- else
- # ...but relative paths are problematic when machine output and
- # hard-coded assets (like fonts) are on different servers
- card_url relative_path
- end
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # in HTML, decko paths rendered as relative to the site's root.
- def contextualize_path relative_path
- card_path relative_path
- end
-end
-
-module EmailHtmlFormat; module_parent.send :register_set_format, Card::Format::EmailHtmlFormat, self; extend Card::Set::AbstractFormat
- def contextualize_path relative_path
- card_url relative_path
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/path.rb ~~
diff --git a/set/mod007-format/all/rich_html.rb b/set/mod007-format/all/rich_html.rb
deleted file mode 100644
index 4f4b0ec..0000000
--- a/set/mod007-format/all/rich_html.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (RichHtml)
-#
-module RichHtml;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/rich_html.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- delegate :class_up, :class_down, :with_class_up, :without_upped_class, :classy,
- to: :voo
-
- view :type, unknown: true do
- link_to_card card.type_card, nil, class: "cardtype"
- end
-
- view :type_info do
- return unless card.type_code != :basic
-
- wrap_with :span, class: "type-info float-right" do
- link_to_card card.type_name, nil, class: "navbar-link"
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/rich_html.rb ~~
diff --git a/set/mod007-format/all/rss.rb b/set/mod007-format/all/rss.rb
deleted file mode 100644
index 475b047..0000000
--- a/set/mod007-format/all/rss.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Rss)
-#
-module Rss;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/rss.rb"; end
-module RssFormat; module_parent.send :register_set_format, Card::Format::RssFormat, self; extend Card::Set::AbstractFormat
- attr_accessor :xml
-
- def initialize card, args
- super
- @xml = @parent ? @parent.xml : ::Builder::XmlMarkup.new
- end
-
- def show view, args
- view ||= :feed
- render! view, args
- end
-
- # FIXME: integrate this with common XML features when it is added
- view :feed, cache: :never do
- return "RSS feeds disabled" unless Cardio.config.rss_enabled
-
- begin
- @xml.instruct! :xml, version: "1.0", standalone: "yes"
- @xml.rss version: "2.0",
- "xmlns:content" => "http://purl.org/rss/1.0/modules/content/" do
- @xml.channel do
- @xml.title render_feed_title
- @xml.description render_feed_description
- @xml.link render_url
- render_feed_body
- end
- end
- rescue StandardError => e
- @xml.error "\n\nERROR rendering RSS: #{e.inspect}\n\n #{e.backtrace}"
- end
- end
-
- def raw_feed_items
- [card]
- end
-
- view :feed_body, cache: :never do
- raw_feed_items.each do |item|
- @xml.item do
- subformat(item).render! :feed_item
- end
- end
- end
-
- view :feed_title do
- "#{Card::Rule.global_setting(:title)} : #{card.name.gsub(/^\*/, '')}"
- end
-
- view :feed_item do
- @xml.title card.name
- add_name_context
- @xml.description render_feed_item_description
- @xml.pubDate pub_date
- @xml.link render_url
- @xml.guid render_url
- end
-
- def pub_date
- (card.updated_at || Time.zone.now).to_s(:rfc822)
- # updated_at fails on virtual
- # cards, because not all to_s's take args (just actual dates)
- end
-
- view :feed_item_description do
- render_open_content
- end
-
- view(:feed_description) { "" }
- view(:comment_box) { "" }
- view(:menu) { "" }
-
- view :open, :titled, mod: All::Base::Format
- view :content, :core, mod: All::Base::Format
- view :open_content, :core, mod: All::Base::Format
- view :closed, :link, mod: All::Base::Format
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/rss.rb ~~
diff --git a/set/mod007-format/all/text.rb b/set/mod007-format/all/text.rb
deleted file mode 100644
index 265a3d5..0000000
--- a/set/mod007-format/all/text.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Text)
-#
-module Text;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/all/text.rb"; end
-module TextFormat; module_parent.send :register_set_format, Card::Format::TextFormat, self; extend Card::Set::AbstractFormat
- view :core do
- HTMLEntities.new.decode strip_tags(super()).to_s
- # need this string method to get out of html_safe mode
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/all/text.rb ~~
diff --git a/set/mod007-format/self/home.rb b/set/mod007-format/self/home.rb
deleted file mode 100644
index 9c264df..0000000
--- a/set/mod007-format/self/home.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Home"
-#
-module Home;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/self/home.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :home_url, perms: :none do
- card_url ""
- end
-
- view :home_path, perms: :none do
- card_path ""
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/self/home.rb ~~
diff --git a/set/mod007-format/type/cardtype.rb b/set/mod007-format/type/cardtype.rb
deleted file mode 100644
index 8065f58..0000000
--- a/set/mod007-format/type/cardtype.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Cardtype" cards
-#
-module Cardtype;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/type/cardtype.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :type, unknown: true do
- link_to_card card.type_card, nil, class: "cardtype"
- end
-
- def type_formgroup args={}
- if card.cards_of_type_exist?
- wrap_with :div, t(:format_cards_exist, scope: "core", cardname: safe_name)
- else
- super
- end
- end
-
- view :add_link do
- add_link
- end
-
- view :add_button do
- add_link class: "btn btn-secondary"
- end
-
- def add_link opts={}
- voo.title ||= t(:format_add_card, cardname: safe_name)
- link_to render_title, add_link_opts(opts)
- end
-
- def add_link_opts opts
- modal = opts.delete :modal
- if modal.nil? || modal
- modal_link_opts opts.merge(path: add_path(:new_in_modal))
- else
- opts.merge path: add_path(:new)
- end
- end
-
- view :add_url do
- card_url _render_add_path
- end
-
- def add_path view
- path_args = { mark: card.name }
- process_voo_params(path_args) if voo.params
- if view == :new
- path_args[:action] = :new
- else
- path_args[:action] = :type
- path_args[:view] = view
- end
- path path_args
- end
-
- # don't cache because it depends on update permission for another card
- view :configure_link, cache: :never, perms: ->(fmt) { fmt.can_configure? } do
- configure_link
- end
-
- def can_configure?
- Card.fetch(card, :type, :structure, new: {}).ok? :update
- end
-
- view :configure_button, cache: :never,
- denial: :blank,
- perms: ->(fmt) { fmt.can_configure? } do
- configure_link "btn btn-secondary"
- end
-
- def configure_link css_class=nil
- return "" unless Card.fetch(card, :type, :structure, new: {}).ok? :update
-
- voo.title ||= t(:format_configure_card, cardname: safe_name.pluralize)
- title = _render_title
- link_to_card card, title,
- path: { view: :bridge,
- bridge: { tab: :rules_tab },
- set: Card::Name[safe_name, :type] },
- class: css_classes("configure-type-link ml-3", css_class)
- end
-
- private
-
- def process_voo_params path_args
- context = (@parent&.card || card).name
- Rack::Utils.parse_nested_query(voo.params).each do |key, value|
- value = value.to_name.absolute(context) if value
- key = key.to_name.absolute(context)
- path_args[key] = value
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/type/cardtype.rb ~~
diff --git a/set/mod007-format/type/html.rb b/set/mod007-format/type/html.rb
deleted file mode 100644
index 0b8de61..0000000
--- a/set/mod007-format/type/html.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Html" cards
-#
-module Html;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/type/html.rb"; end
-def clean_html?
- false
-end
-
-def diff_args
- { diff_format: :raw }
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :one_line_content do
- raw_one_line_content
- end
-
- def chunk_list
- :references
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :ace_editor
- end
-
- view :one_line_content, wrap: {} do
- raw_one_line_content
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/type/html.rb ~~
diff --git a/set/mod007-format/type/json.rb b/set/mod007-format/type/json.rb
deleted file mode 100644
index 9e0ca47..0000000
--- a/set/mod007-format/type/json.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Json" cards
-#
-# include_set Abstract::Pointer
-module Json;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/type/json.rb"; end
-
-event :validate_json, :validate, on: :save, changed: :content do
- check_json_syntax if content.present?
-end
-
-def check_json_syntax
- parse_content
-rescue JSON::ParserError => e
- errors.add t(:format_invalid_json), e.message.sub(/^\d+: /, "").to_s
-end
-
-def parse_content
- JSON.parse content
-end
-
-def item_names _args={}
- parse_content.keys.map(&:to_name)
-end
-
-def item_values
- parse_content.values
-end
-
-def item_value name
- parse_content[name]
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- process_content ::CodeRay.scan(_render_raw, :json).div
- end
-
- def input_type
- :ace_editor
- end
-
- def ace_mode
- :json
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/type/json.rb ~~
diff --git a/set/mod007-format/type/number.rb b/set/mod007-format/type/number.rb
deleted file mode 100644
index 0d3f49c..0000000
--- a/set/mod007-format/type/number.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Number" cards
-#
-module Number;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/type/number.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :text_field
- end
-end
-
-event :validate_number, :validate, on: :save do
- unless valid_number?(content)
- errors.add :content,
- t(:format_not_numeric, content: content)
- end
-end
-
-def valid_number? string
- return true if string.empty?
-
- valid = true
- begin
- Kernel.Float(string)
- rescue ArgumentError, TypeError
- valid = false
- end
- valid
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/type/number.rb ~~
diff --git a/set/mod007-format/type/phrase.rb b/set/mod007-format/type/phrase.rb
deleted file mode 100644
index 01b9cd5..0000000
--- a/set/mod007-format/type/phrase.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Phrase" cards
-#
-module Phrase;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/type/phrase.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :text_field
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/type/phrase.rb ~~
diff --git a/set/mod007-format/type/plain_text.rb b/set/mod007-format/type/plain_text.rb
deleted file mode 100644
index 590b1b5..0000000
--- a/set/mod007-format/type/plain_text.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "PlainText" cards
-#
-module PlainText;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/type/plain_text.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :text_area
- end
-
- view :core do
- process_content CGI.escapeHTML(_render_raw)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/type/plain_text.rb ~~
diff --git a/set/mod007-format/type/toggle.rb b/set/mod007-format/type/toggle.rb
deleted file mode 100644
index dd4b83c..0000000
--- a/set/mod007-format/type/toggle.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Toggle" cards
-#
-module Toggle;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/type/toggle.rb"; end
-def checked?
- content == "1"
-end
-
-view :core do
- case card.content.to_i
- when 1 then t(:format_toggle_yes)
- when 0 then t(:format_toggle_no)
- else
- "?"
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :input do
- toggle
- end
-
- view :labeled_editor do
- toggle + toggle_label
- end
-
- def toggle
- check_box :content
- end
-
- def toggle_label
- label :content, card.name.tag
- end
-
- def one_line_content
- short_content
- end
-
- def short_content
- render_core
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/type/toggle.rb ~~
diff --git a/set/mod007-format/type/uri.rb b/set/mod007-format/type/uri.rb
deleted file mode 100644
index a86c1c0..0000000
--- a/set/mod007-format/type/uri.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Uri" cards
-#
-module Uri;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/format/set/type/uri.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :core do
- link_to_resource _render_raw, render_title
- end
-
- view :url_link do
- link_to_resource _render_raw
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :text_field
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/format/set/type/uri.rb ~~
diff --git a/set/mod008-list/abstract/01_pointer.rb b/set/mod008-list/abstract/01_pointer.rb
deleted file mode 100644
index b0aeac8..0000000
--- a/set/mod008-list/abstract/01_pointer.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Pointer)
-#
-module Pointer;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer.rb"; end
-include_set Abstract::Paging
-include_set Abstract::Items
-
-def diff_args
- { diff_format: :pointer }
-end
-
-def count
- item_strings.size
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer.rb ~~
diff --git a/set/mod008-list/abstract/01_pointer/events.rb b/set/mod008-list/abstract/01_pointer/events.rb
deleted file mode 100644
index 58e5dc0..0000000
--- a/set/mod008-list/abstract/01_pointer/events.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Pointer;
-# Set: Abstract (Pointer, Events)
-#
-module Events;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/events.rb"; end
-event :add_and_drop_items, :prepare_to_validate, on: :save do
- adds = Env.params["add_item"]
- drops = Env.params["drop_item"]
- Array.wrap(adds).each { |i| add_item i } if adds
- Array.wrap(drops).each { |i| drop_item i } if drops
-end
-
-event :insert_item_event, :prepare_to_validate, on: :save, when: :item_to_insert do
- index = Env.params["item_index"] || 0
- insert_item index.to_i, item_to_insert
-end
-
-def item_to_insert
- Env.params["insert_item"]
-end
-
-# If a card's type and content are updated in the same action, the new module
-# will override the old module's events and functions. But this event is only
-# on pointers -- other type cards do not have this event,
-# Therefore if something is changed from a pointer and its content is changed
-# in the same action, this event will be run and will treat the content like
-# it' still pointer content. The "when" clause helps with that (but is a hack)
-event :standardize_items, :prepare_to_validate,
- on: :save, changed: :content, when: :still_pointer? do
- items_to_content item_strings
-end
-
-def still_pointer?
- type_id == PointerID
- # Card.new(type_id: type_id).is_a? Abstract::Pointer
-end
-
-def changed_item_names
- dropped_item_names + added_item_names
-end
-
-def dropped_item_names
- return item_names if trash
- return [] unless (old_content = db_content_before_act)
-
- old_items = item_names content: old_content
- old_items - item_names
-end
-
-def added_item_names
- return [] if trash
- return item_names unless (old_content = db_content_before_act)
-
- old_items = item_names content: old_content
- item_names - old_items
-end
-
-# TODO: refactor. many of the above could be written more elegantly with improved
-# handling of :content in item_names. If content is nil here, we would expect an
-# empty set of cards, but in fact we get items based on self.content.
-
-def changed_item_cards
- dropped_item_cards + added_item_cards
-end
-
-def dropped_item_cards
- return [] unless db_content_before_act
-
- all_item_cards item_names: dropped_item_names
-end
-
-def added_item_cards
- return item_cards unless db_content_before_act
-
- all_item_cards item_names: added_item_names
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/events.rb ~~
diff --git a/set/mod008-list/abstract/01_pointer/html_views.rb b/set/mod008-list/abstract/01_pointer/html_views.rb
deleted file mode 100644
index 2f79941..0000000
--- a/set/mod008-list/abstract/01_pointer/html_views.rb
+++ /dev/null
@@ -1,131 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Pointer;
-# Set: Abstract (Pointer, HtmlViews)
-#
-module HtmlViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/html_views.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core, cache: :never do
- standard_pointer_core
- end
-
- view :item_cores, cache: :never do
- card.known_item_cards.map do |item|
- nest item, view: :core
- end.join "\n"
- end
-
- def standard_pointer_core
- with_paging do |paging_args|
- wrap_with :div, standard_pointer_items(paging_args), class: "pointer-list"
- end
- end
-
- def standard_pointer_items paging_args
- pointer_items(paging_args.extract!(:limit, :offset)).join(voo.separator || "\n")
- end
-
- view :one_line_content do
- item_view = implicit_item_view
- item_view = item_view == "name" ? "name" : "link"
- wrap_with :div, class: "pointer-list" do
- # limit to first 10 items to optimize
- pointer_items(view: item_view, limit: 10, offset: 0).join ", "
- end
- end
-
- def wrap_item rendered, item_view
- %(#{rendered}
)
- end
-
- view :input do
- _render_hidden_content_field + super()
- end
-
- def default_input_type
- :list
- end
-
- view :list, cache: :never do
- list_input
- end
-
- # view :nav_item do
- # nav_dropdown
- # end
-
- def list_input args={}
- items = items_for_input args[:item_list]
- extra_class = "pointer-list-ul"
- ul_classes = classy "pointer-list-editor", extra_class
- haml :list_input, items: items, ul_classes: ul_classes,
- options_card: options_card_name
- end
-
- %i[autocomplete checkbox radio select multiselect].each do |editor_view|
- view(editor_view) { send "#{editor_view}_input" }
- end
-
- def autocomplete_input
- haml :autocomplete_input, item: items_for_input.first, options_card: options_card_name
- end
-
- def checkbox_input
- haml :checkbox_input, submit_on_change: @submit_on_change
- end
-
- def radio_input
- haml :radio_input, submit_on_change: @submit_on_change
- end
-
- def select_input
- options = { "-- Select --" => "" }.merge card.options_hash
- select_tag("pointer_select-#{unique_id}",
- options_for_select(options, card.item_name),
- class: "pointer-select form-control")
- end
-
- def multiselect_input
- select_tag "pointer_multiselect-#{unique_id}",
- options_for_select(card.options_hash, card.item_names),
- multiple: true, class: "pointer-multiselect form-control"
- end
-
- def add_item_modal_link
- modal_link "Add Item",
- size: :large,
- class: "btn btn-sm btn-outline-secondary _add-item-link",
- path: { view: :filter_items_modal,
- item: implicit_item_view,
- filter_card: filter_card.name,
- slot_selector: filtered_list_slot_class,
- item_selector: "_filtered-list-item",
- slot: { hide: [:modal_footer] },
- filter: { not_ids: not_ids_value } }
- end
-
- def not_ids_value
- card.item_ids.map(&:to_s).join(",")
- end
-
- def add_item_overlay_link; end
-
- def one_line_content
- if count == 1
- card.first_name
- else
- short_content
- end
- end
-
- private
-
- # currently only used by :list and :autocomplete. could be generalized?
- def items_for_input items=nil
- items ||= card.item_names context: :raw
- items.empty? ? [""] : items
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/html_views.rb ~~
diff --git a/set/mod008-list/abstract/01_pointer/html_views/filter.rb b/set/mod008-list/abstract/01_pointer/html_views/filter.rb
deleted file mode 100644
index f6e5685..0000000
--- a/set/mod008-list/abstract/01_pointer/html_views/filter.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Pointer;; module HtmlViews;
-# Set: Abstract (Pointer, HtmlViews, Filter)
-#
-module Filter;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/html_views/filter.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :filtered_list, unknown: true do
- filtered_list_input
- end
-
- view :filter_items_modal, unknown: true, wrap: :modal do
- render_filter_items
- end
-
- view :filter_items, unknown: true, wrap: :slot, template: :haml
-
- def filtered_list_input
- with_nest_mode :normal do
- class_up "card-slot", filtered_list_slot_class
- with_class_up "card-slot", filtered_list_slot_class do
- wrap do
- haml :filtered_list_input
- end
- end
- end
- end
-
- # NOCACHE because params alter view
- view :add_selected_link, cache: :never, unknown: true do
- link_to "Add Selected",
- path: { filter_card: params[:filter_card] },
- class: "_add-selected slotter _close-modal btn btn-primary disabled",
- data: { "slot-selector": ".#{params[:slot_selector]}",
- "item-selector": ".#{params[:item_selector]}",
- remote: true }
- end
-
- def filtered_list_item item_card
- nest_item item_card do |rendered, item_view|
- wrap_item rendered, item_view
- end
- end
-
- # for override
- # @return [Card] search card on which filtering is based
- def filter_card
- filter_card_from_params || default_filter_card
- end
-
- def default_filter_card
- fcard = card.options_rule_card || Card[:all]
- return fcard if fcard.respond_to? :cql_hash
-
- fcard.fetch :referred_to_by, new: {}
- end
-
- def filter_card_from_params
- return unless params[:filter_card]
-
- Card.fetch params[:filter_card], new: {}
- end
-
- # currently actually used as a class
- # (because we don't have api to override slot's id)
- def filtered_list_slot_class
- @filtered_list_slot_class ||= "filtered-list-#{unique_id}"
- end
-end
-end;end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/html_views/filter.rb ~~
diff --git a/set/mod008-list/abstract/01_pointer/options_api.rb b/set/mod008-list/abstract/01_pointer/options_api.rb
deleted file mode 100644
index 8837178..0000000
--- a/set/mod008-list/abstract/01_pointer/options_api.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Pointer;
-# Set: Abstract (Pointer, OptionsApi)
-#
-# TODO: some of this should be moved to right/options!!
-module OptionsApi;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/options_api.rb"; end
-# or to type/JSON?
-
-def options_hash
- json_options? ? options_card.parse_content : option_hash_from_names
-end
-
-def json_options?
- options_card&.type_id == JsonID
-end
-
-def option_hash_from_names
- option_names.each_with_object({}) do |name, hash|
- hash[name] = name
- end
-end
-
-def option_names
- if (selected_options = item_names)
- (standard_option_names + selected_options).uniq
- else
- standard_option_names
- end
-end
-
-def option_cards
- option_names.map do |name|
- Card.fetch name, new: {}
- end
-end
-
-def options_rule_card
- rule_card :content_options
-end
-
-def standard_option_names
- if json_options?
- options_hash.values.map(&:to_name)
- else
- option_names_from_items
- end
-end
-
-def option_names_from_items
- o_card = options_card
- limit = o_card.try(:default_limit).to_i
- o_card.item_names context: name, limit: limit
-end
-
-def options_card
- options_rule_card || Card[:all]
-end
-
-def options_card_name
- options_rule_card&.name&.url_key || ":all"
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def options_card_name
- card.options_card_name
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def option_label option_name, id
- %(#{option_label_text option_name} )
- end
-
- def option_view
- @option_view ||= card.rule(:content_option_view) || :smart_label
- end
-
- def option_label_text option_name
- return option_name unless (option_card = Card.fetch option_name)
-
- nest option_card, view: option_view
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/options_api.rb ~~
diff --git a/set/mod008-list/abstract/01_pointer/other_views.rb b/set/mod008-list/abstract/01_pointer/other_views.rb
deleted file mode 100644
index 9f4a506..0000000
--- a/set/mod008-list/abstract/01_pointer/other_views.rb
+++ /dev/null
@@ -1,112 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Pointer;
-# Set: Abstract (Pointer, OtherViews)
-#
-# BASE views
-module OtherViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/other_views.rb"; end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def default_limit
- 20
- end
-
- def item_links args={}
- card.item_cards(args).map do |item_card|
- subformat(item_card).render_link
- end
- end
-
- def nest_item_array
- card.item_cards.map do |item|
- nest_item item
- end
- end
-
- view :core do
- pointer_items.join ", "
- end
-
- def pointer_items args={}
- page_args = args.extract! :limit, :offset
- listing card.item_cards(page_args), args
- end
-end
-
-# JavaScript views
-
-module JsFormat; module_parent.send :register_set_format, Card::Format::JsFormat, self; extend Card::Set::AbstractFormat
- view :core do
- nest_item_array.join "\n\n"
- end
-end
-
-# Data views
-
-module DataFormat; module_parent.send :register_set_format, Card::Format::DataFormat, self; extend Card::Set::AbstractFormat
- view :core do
- nest_item_array
- end
-end
-
-# JSON views
-
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- view :content do
- card.item_names
- end
-
- def item_cards
- card.item_cards
- end
-
- def max_depth
- params[:max_depth] || 1
- end
-
- def items_for_export
- card.item_cards
- end
-
- def essentials
- return {} if depth > max_depth
-
- card.item_cards.map do |item|
- nest item, view: :essentials
- end
- end
-
- view :links do
- []
- end
-end
-
-# CSS views
-
-module CssFormat; module_parent.send :register_set_format, Card::Format::CssFormat, self; extend Card::Set::AbstractFormat
- # generalize to all collections?
- def default_item_view
- :content
- end
-
- view :titled do
- %(#{major_comment "STYLE GROUP: \"#{card.name}\"", '='}#{_render_core})
- end
-
- view :core do
- nest_item_array.join "\n\n"
- end
-
- view :content, :core
-end
-
-# RSS views
-
-module RssFormat; module_parent.send :register_set_format, Card::Format::RssFormat, self; extend Card::Set::AbstractFormat
- def raw_feed_items
- @raw_feed_items ||= card.item_cards(limit: limit, offset: offset)
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/abstract/01_pointer/other_views.rb ~~
diff --git a/set/mod008-list/abstract/code_pointer.rb b/set/mod008-list/abstract/code_pointer.rb
deleted file mode 100644
index 65c25ca..0000000
--- a/set/mod008-list/abstract/code_pointer.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (CodePointer)
-#
-module CodePointer;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/abstract/code_pointer.rb"; end
-include_set Abstract::Pointer
-
-abstract_basket :item_codenames
-
-# simplify api
-# Self::MyCodePointerSet.add_item :my_item_codename
-# instead of
-# Self::MyCodePointerSet.add_to_basket :item_codenames, :my_item_codename
-module ClassMethods
- def add_item codename
- valid_codename codename do
- add_to_basket :item_codenames, codename
- end
- end
-
- def unshift_item codename
- valid_codename codename do
- unshift_basket :item_codenames, codename
- end
- end
-
- def valid_codename codename
- if Card::Codename.exist? codename
- yield
- else
- Rails.logger.info "unknown codename '#{codename}' added to code pointer"
- end
- end
-end
-
-def content
- item_codenames.map do |codename|
- Card.fetch_name codename
- end.compact.to_pointer_content
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/abstract/code_pointer.rb ~~
diff --git a/set/mod008-list/abstract/id_pointer.rb b/set/mod008-list/abstract/id_pointer.rb
deleted file mode 100644
index 926b240..0000000
--- a/set/mod008-list/abstract/id_pointer.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (IdPointer)
-#
-# store items as ids, not names
-module IdPointer;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/abstract/id_pointer.rb"; end
-
-def standardize_item cardish
- if (id = Card.id cardish)
- "~#{id}"
- else
- Rails.logger.info "no id for '#{cardish}' added to id pointer"
- nil
- end
-end
-
-def item_ids args={}
- item_strings(args).map do |item|
- item = standardize_item item unless item.match?(/^~/)
- item.to_s.tr("~", "").to_i
- end.compact
-end
-
-def item_names args={}
- item_ids(args).map(&:cardname).compact
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/abstract/id_pointer.rb ~~
diff --git a/set/mod008-list/all/supports_content_options.rb b/set/mod008-list/all/supports_content_options.rb
deleted file mode 100644
index e8308ec..0000000
--- a/set/mod008-list/all/supports_content_options.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (SupportsContentOptions)
-#
-module SupportsContentOptions;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/all/supports_content_options.rb"; end
-def supports_content_options?
- false
-end
-
-def supports_content_option_view?
- false
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/all/supports_content_options.rb ~~
diff --git a/set/mod008-list/right/content_option_view.rb b/set/mod008-list/right/content_option_view.rb
deleted file mode 100644
index 130e0ce..0000000
--- a/set/mod008-list/right/content_option_view.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+ContentOptionView" cards
-#
-module ContentOptionView;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/right/content_option_view.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def quick_edit
- if card.left.prototype_default_card&.try(:show_content_options?) &&
- card.left.prototype.rule_card(:input_type)&.supports_content_option_view?
- super
- else
- ""
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/right/content_option_view.rb ~~
diff --git a/set/mod008-list/right/content_options.rb b/set/mod008-list/right/content_options.rb
deleted file mode 100644
index 96dfbd6..0000000
--- a/set/mod008-list/right/content_options.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+ContentOptions" cards
-#
-module ContentOptions;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/right/content_options.rb"; end
-def default_limit
- cql_limit = fetch_query.limit if respond_to?(:fetch_query)
- cql_limit || 50
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def quick_edit
- card.left.prototype_default_card.try(:show_content_options?) ? super : ""
- end
-
- def quick_editor
- wrap_type_formgroup do
- type_field class: "type-field rule-type-field _submit-on-select"
- end +
- wrap_content_formgroup do
- text_field :content, class: "d0-card-content _submit-after-typing"
- end
- end
-
- def visible_cardtype_groups
- { "Organize" => %w[List Pointer] }
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/right/content_options.rb ~~
diff --git a/set/mod008-list/self/content_option_view.rb b/set/mod008-list/self/content_option_view.rb
deleted file mode 100644
index 3c8ce8c..0000000
--- a/set/mod008-list/self/content_option_view.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "ContentOptionView"
-#
-module ContentOptionView;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/self/content_option_view.rb"; end
-setting_opts group: :editing, position: 6,
- restricted_to_type: %i[list pointer session],
- rule_type_editable: false,
- help_text: "Label view for radio button and checkbox items. "\
- "[[http://decko.org/Pointer|more]]",
- applies: lambda { |prototype|
- prototype.supports_content_options? &&
- prototype.rule_card(:input_type)&.supports_content_option_view?
- }
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/self/content_option_view.rb ~~
diff --git a/set/mod008-list/self/content_options.rb b/set/mod008-list/self/content_options.rb
deleted file mode 100644
index ed0178b..0000000
--- a/set/mod008-list/self/content_options.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "ContentOptions"
-#
-module ContentOptions;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/self/content_options.rb"; end
-setting_opts group: :editing, position: 5,
- restricted_to_type: %i[list pointer session],
- rule_type_editable: true,
- help_text: "Value options for [[List]] and [[Pointer]] and cards. "\
- "Can itself be a List or a [[Search]]. "\
- "[[http://decko.org/Pointer|more]]",
- applies: lambda { |prototype|
- prototype.rule_card(:input_type).supports_content_options?
- }
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/self/content_options.rb ~~
diff --git a/set/mod008-list/self/input_options.rb b/set/mod008-list/self/input_options.rb
deleted file mode 100644
index 0fb3f0d..0000000
--- a/set/mod008-list/self/input_options.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "InputOptions"
-#
-module InputOptions;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/self/input_options.rb"; end
-include_set Abstract::Pointer
-
-basket :options
-add_to_basket :options, "radio"
-add_to_basket :options, "checkbox"
-add_to_basket :options, "select"
-add_to_basket :options, "multiselect"
-add_to_basket :options, "list"
-add_to_basket :options, "filtered list"
-add_to_basket :options, "autocomplete"
-
-def content
- options.to_pointer_content
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/self/input_options.rb ~~
diff --git a/set/mod008-list/type/link_list.rb b/set/mod008-list/type/link_list.rb
deleted file mode 100644
index e7be5d4..0000000
--- a/set/mod008-list/type/link_list.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "LinkList" cards
-#
-module LinkList;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/type/link_list.rb"; end
-include_set Abstract::Pointer
-
-def raw_item_strings content
- reference_chunks(content).map(&:referee_name)
-end
-
-def item_titles default_to_name=true
- reference_chunks.map do |chunk|
- chunk.options[:title] || (default_to_name ? chunk.referee_name : nil)
- end
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def chunk_list
- :references
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :link_list
- end
-
- view :link_list_input, cache: :never do
- link_list_input
- end
-
- def items_for_input items=nil
- items ||= card.item_names context: :raw
- items.empty? ? [["", ""]] : items.zip(card.item_titles(false))
- end
-
- def link_list_input args={}
- items = items_for_input args[:item_list]
- extra_class = "pointer-link-list-ul"
- ul_classes = classy "pointer-list-editor", extra_class
- haml :link_list_input, items: items, ul_classes: ul_classes,
- options_card: options_card_name
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/type/link_list.rb ~~
diff --git a/set/mod008-list/type/list.rb b/set/mod008-list/type/list.rb
deleted file mode 100644
index a244683..0000000
--- a/set/mod008-list/type/list.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "List" cards
-#
-module List;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/type/list.rb"; end
-include_set Abstract::Pointer
-
-def each_reference_out
- item_names.each do |name|
- yield(name, Card::Content::Chunk::Link::CODE)
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :view_list do
- %i[info_bar bar box closed titled labeled].map do |view|
- voo.items[:view] = view
- wrap_with :p, [content_tag(:h3, "#{view} items"), render_content]
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/type/list.rb ~~
diff --git a/set/mod008-list/type/nest_list.rb b/set/mod008-list/type/nest_list.rb
deleted file mode 100644
index 3546e15..0000000
--- a/set/mod008-list/type/nest_list.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "NestList" cards
-#
-module NestList;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/type/nest_list.rb"; end
-include_set Abstract::Items
-
-def raw_item_strings content
- reference_chunks(content).map(&:referee_raw_name)
-end
-
-def item_options
- nest_chunks.map(&:raw_options)
-end
-
-def items_to_content array
- items = array.map { |i| standardize_item i }.reject(&:blank?)
- self.content = items.join("\n")
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def chunk_list
- :references
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :nest_list
- end
-
- view :nest_list_input, cache: :never do
- nest_list_input
- end
-
- view :input do
- _render_hidden_content_field + super()
- end
-
- def items_for_input items=nil
- items ||= card.item_names context: :raw
- items.empty? ? [["", ""]] : items.zip(card.item_options)
- end
-
- def nest_list_input args={}
- items = items_for_input args[:item_list]
- extra_class = "_nest-list-ul"
- ul_classes = classy "pointer-list-editor", extra_class
- haml :nest_list_input, items: items, ul_classes: ul_classes
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/type/nest_list.rb ~~
diff --git a/set/mod008-list/type/pointer.rb b/set/mod008-list/type/pointer.rb
deleted file mode 100644
index a5c8e49..0000000
--- a/set/mod008-list/type/pointer.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Pointer" cards
-#
-module Pointer;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/list/set/type/pointer.rb"; end
-include_set Abstract::Pointer
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :view_list do
- %i[info_bar bar box closed titled labeled].map do |view|
- voo.items[:view] = view
- wrap_with :p, [content_tag(:h3, "#{view} items"), render_content]
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/list/set/type/pointer.rb ~~
diff --git a/set/mod009-permissions/abstract/permission.rb b/set/mod009-permissions/abstract/permission.rb
deleted file mode 100644
index b156363..0000000
--- a/set/mod009-permissions/abstract/permission.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Permission)
-#
-module Permission;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/abstract/permission.rb"; end
-def standardize_items
- super unless content == "_left"
-end
-
-def options_rule_card
- Card[:cards_with_account]
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :pointer_core do
- wrap_with :div, pointer_items, class: "pointer-list"
- end
-
- view :core, cache: :never do
- if card.content == "_left"
- core_inherit_content
- else
- render! :pointer_core
- end
- end
-
- view :one_line_content, cache: :never do
- render_core items: { view: :link }
- end
-
- view :input do
- item_names = inheriting? ? [] : card.item_names
- %(
- #{_render_hidden_content_field}
-
- #{inheritance_checkbox}
-
-
Groups
- #{groups item_names}
-
-
-
-
Individuals
- #{list_input item_list: item_names, extra_css_class: 'perm-indiv-ul'}
-
-
- )
- end
-
- private
-
- def groups item_names
- group_options.map do |option|
- checked = !item_names.delete(option.name).nil?
- icon = icon_tag "open_in_new", "link-muted"
- option_link = link_to_card option.name, icon, target: "decko_role"
- box = check_box_tag "#{option.key}-perm-checkbox",
- option.name, checked, class: "perm-checkbox-button"
- <<-HTML
-
-
- #{box} #{option.name} #{option_link}
-
-
- HTML
- end * "\n"
- end
-
- def group_options
- Auth.as_bot do
- Card.search({ type_id: RoleID, sort: "name" }, "roles by name")
- end
- end
-
- def inheritable?
- @inheritable ||=
- begin
- set_name = card.name.trunk_name
- set_card = Card.fetch(set_name)
- not_set = set_card && set_card.type_id != SetID
- not_set ? false : set_card.inheritable?
- end
- end
-
- def inheriting?
- @inheriting ||= inheritable? && card.content == "_left"
- end
-
- def inheritance_checkbox
- return unless inheritable?
-
- <<-HTML
-
- #{check_box_tag 'inherit', 'inherit', inheriting?}
-
- #{core_inherit_content}
- #{wrap_with(:a, title: "use left's #{card.name.tag} rule") { '?' }}
-
-
- HTML
- end
-
- def core_inherit_content
- text = if in_context_of_self_set?
- core_inherit_for_content_for_self_set
- else
- "Inherit from left card"
- end
- %(#{text} )
- end
-
- def in_context_of_self_set?
- return false unless @set_context
-
- @set_context.to_name.tag_name.key == Card[:self].key
- end
-
- def core_inherit_for_content_for_self_set
- task = card.tag.codename
- ancestor = Card[@set_context.trunk_name.trunk_name]
- links = ancestor.who_can(task).map do |card_id|
- link_to_card card_id, nil, target: args[:target]
- end * ", "
- "Inherit ( #{links} )"
- rescue StandardError
- "Inherit"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/abstract/permission.rb ~~
diff --git a/set/mod009-permissions/all/permissions.rb b/set/mod009-permissions/all/permissions.rb
deleted file mode 100644
index c349439..0000000
--- a/set/mod009-permissions/all/permissions.rb
+++ /dev/null
@@ -1,240 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Permissions)
-#
-module Permissions;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/all/permissions.rb"; end
-module ClassMethods
- def repair_all_permissions
- Card.where("(read_rule_class is null or read_rule_id is null) and trash is false")
- .each do |broken_card|
- broken_card.include_set_modules
- broken_card.repair_permissions!
- end
- end
-end
-
-def repair_permissions!
- rule_id, rule_class = permission_rule_id_and_class :read
- update_columns read_rule_id: rule_id, read_rule_class: rule_class
-end
-
-# ok? and ok! are public facing methods to approve one action at a time
-#
-# fetching: if the optional :trait parameter is supplied, it is passed
-# to fetch and the test is perfomed on the fetched card, therefore:
-#
-# trait: :account would fetch this card plus a tag codenamed :account
-# trait: :roles, new: {} would initialize a new card with default ({})
-# options.
-
-def ok? action
- @ok ||= {}
- aok = @ok[Auth.as_id] ||= {}
- if (cached = aok[action])
- cached
- else
- aok[action] = send "ok_to_#{action}"
- end
-end
-
-def ok! action
- raise Card::Error::PermissionDenied, self unless ok? action
-end
-
-def who_can action
- permission_rule_card(action).item_cards.map(&:id)
-end
-
-def anyone_can? action
- who_can(action).include? AnyoneID
-end
-
-def direct_rule_card action
- direct_rule_id = rule_card_id action
- require_permission_rule! direct_rule_id, action
- Card.quick_fetch direct_rule_id
-end
-
-def permission_rule_id action
- if compound? && rule(action).match?(/^\[?\[?_left\]?\]?$/)
- left_permission_rule_id action
- else
- rule_card_id(action)
- end
-end
-
-def permission_rule_id_and_class action
- [permission_rule_id(action), direct_rule_card(action).rule_class_name]
-end
-
-def left_permission_rule_id action
- lcard = left_or_new(skip_virtual: true, skip_modules: true)
- action = :update if action == :create && lcard.real? && lcard.action != :create
- lcard.permission_rule_id action
-end
-
-def permission_rule_card action
- Card.fetch permission_rule_id(action)
-end
-
-def require_permission_rule! rule_id, action
- return if rule_id
-
- # RULE missing. should not be possible.
- # generalize this to handling of all required rules
- errors.add :permission_denied,
- t(:permission_error_no_action_rule, action: action, name: name)
- raise Card::Error::PermissionDenied, self
-end
-
-def rule_class_name
- trunk.type_id == SetID ? name.trunk_name.tag : nil
-end
-
-def you_cant what
- "You don't have permission to #{what}"
-end
-
-def deny_because why
- @permission_errors << why if @permission_errors
- false
-end
-
-def permitted? action
- return false if Card.config.read_only # :read does not call #permit
- return true if Auth.always_ok?
-
- Auth.as_card.among? who_can(action)
-end
-
-def permit action, verb=nil
- # not called by ok_to_read
- if Card.config.read_only
- deny_because "Currently in read-only mode"
- return false
- end
-
- return true if permitted? action
-
- verb ||= action.to_s
- deny_because you_cant("#{verb} #{name.present? ? name : 'this'}")
-end
-
-def ok_to_create
- return false unless permit :create
- return true if simple?
-
- %i[left right].find { |side| !ok_to_create_side side } ? false : true
-end
-
-def ok_to_create_side side
- # left is supercard; create permissions will get checked there.
- return true if side == :left && superleft
-
- part_card = send side, new: {}
- # if no card, there must be other errors
- return true unless part_card&.new_card? && !part_card.ok?(:create)
-
- deny_because you_cant("create #{part_card.name}")
- false
-end
-
-def ok_to_read
- return true if Auth.always_ok?
-
- self.read_rule_id ||= permission_rule_id :read
- return true if Auth.as_card.read_rules_hash[read_rule_id]
-
- deny_because you_cant "read this"
-end
-
-def ok_to_update
- return false unless permit(:update)
- return true unless type_id_changed? && !permitted?(:create)
-
- deny_because you_cant("change to this type (need create permission)")
-end
-
-def ok_to_delete
- permit :delete
-end
-
-# don't know why we introduced this
-# but we have to preserve read rules to make
-# delete acts visible in recent changes -pk
-# event :clear_read_rule, :store, on: :delete do
-# self.read_rule_id = self.read_rule_class = nil
-# end
-
-event :set_read_rule, :store, on: :save, changed: %i[type_id name] do
- read_rule_id, read_rule_class = permission_rule_id_and_class(:read)
- self.read_rule_id = read_rule_id
- self.read_rule_class = read_rule_class
-end
-
-event :set_field_read_rules, after: :set_read_rule, on: :update, changed: :type_id do
- each_field_as_bot(&:update_read_rule)
-end
-
-def update_field_read_rules
- return unless type_id_changed? || read_rule_id_changed?
-
- each_field_as_bot do |field|
- field.update_read_rule if field.rule(:read) == "_left"
- end
-end
-
-def each_field_as_bot &block
- # find all cards with me as trunk and update their read_rule
- # (because of *type plus right)
- # skip if name is updated because will already be resaved
- Auth.as_bot do
- fields.each(&block)
- end
-end
-
-def without_timestamps
- Card.record_timestamps = false
- yield
-ensure
- Card.record_timestamps = true
-end
-
-event :update_read_rule do
- without_timestamps do
- reset_patterns # why is this needed?
- rcard_id, rclass = permission_rule_id_and_class :read
- # these two are just to make sure vals are correct on current object
- self.read_rule_id = rcard_id
- self.read_rule_class = rclass
- Card.where(id: id).update_all read_rule_id: rcard_id, read_rule_class: rclass
- expire :hard
- update_field_read_rules
- end
-end
-
-def add_to_read_rule_update_queue updates
- @read_rule_update_queue = Array.wrap(@read_rule_update_queue).concat updates
-end
-
-event :check_permissions, :validate do
- track_permission_errors do
- ok? action_for_permission_check
- end
-end
-
-def action_for_permission_check
- commenting? ? :update : action
-end
-
-def track_permission_errors
- @permission_errors = []
- result = yield
- @permission_errors.each { |msg| errors.add :permission_denied, msg }
- @permission_errors = nil
- result
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/all/permissions.rb ~~
diff --git a/set/mod009-permissions/all/update_read_rules.rb b/set/mod009-permissions/all/update_read_rules.rb
deleted file mode 100644
index 6605863..0000000
--- a/set/mod009-permissions/all/update_read_rules.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (UpdateReadRules)
-#
-# FIXME: the following don't really belong here, but they have to come after
-module UpdateReadRules;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/all/update_read_rules.rb"; end
-# the reference stuff. we need to organize a bit!
-
-event :update_rule_cache, :finalize, when: :rule? do
- Card::Rule.clear_rule_cache
-end
-
-event :expire_related, :finalize do
- reset_patterns
- structuree_names.each { |name| Director.expirees << name } if is_structure?
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/all/update_read_rules.rb ~~
diff --git a/set/mod009-permissions/right/create.rb b/set/mod009-permissions/right/create.rb
deleted file mode 100644
index 9f2f325..0000000
--- a/set/mod009-permissions/right/create.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Create" cards
-#
-module Create;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/right/create.rb"; end
-include_set Abstract::Permission
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/right/create.rb ~~
diff --git a/set/mod009-permissions/right/delete.rb b/set/mod009-permissions/right/delete.rb
deleted file mode 100644
index 9b5c854..0000000
--- a/set/mod009-permissions/right/delete.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Delete" cards
-#
-module Delete;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/right/delete.rb"; end
-include_set Abstract::Permission
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/right/delete.rb ~~
diff --git a/set/mod009-permissions/right/read.rb b/set/mod009-permissions/right/read.rb
deleted file mode 100644
index 2e90bbb..0000000
--- a/set/mod009-permissions/right/read.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Read" cards
-#
-module Read;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/right/read.rb"; end
-include Abstract::Permission
-
-format :html do include Abstract::Permission::HtmlFormat end
-
-event :cascade_read_rule, :finalize, after: :update_rule_cache, when: :rule? do
- return unless name_is_changing? || trash_is_changing?
-
- update_read_ruled_cards
-end
-
-def update_read_ruled_cards
- Card::Rule.clear_read_rule_cache
- Card.cache.reset # maybe be more surgical, just Auth.user related
- expire # probably shouldn't be necessary,
- # but was sometimes getting cached version when card should be in the
- # trash. could be related to other bugs?
-
- processed = update_read_rules_of_set_members
- update_cards_with_read_rule_id processed unless new?
-end
-
-def update_read_rules_of_set_members
- return unless rule_pattern_index
-
- each_member do |member, processed|
- processed << member.key
- member.update_read_rule unless member_has_overriding_rule?(member)
- end
-end
-
-def member_has_overriding_rule? member
- pattern_index(Card.fetch_id(member.read_rule_class)) < rule_pattern_index
-end
-
-# cards with this card as a read_rule_id
-# These may include cards that are no longer set members if the card was renamed
-# (edge case)
-def update_cards_with_read_rule_id processed
- processed ||= ::Set.new
- Card::Auth.as_bot do
- Card.search(read_rule_id: id) do |card|
- card.update_read_rule unless processed.include?(card.key)
- end
- end
-end
-
-def each_member &block
- Auth.as_bot do
- all_members.each_with_object(::Set.new, &block)
- end
-end
-
-def all_members
- rule_set.item_cards limit: 0
-end
-
-def rule_pattern_index
- return if trash
-
- @rule_pattern_index ||= pattern_index rule_set&.tag&.id
-end
-
-def pattern_index pattern_id
- pattern_ids.index(pattern_id) || invalid_pattern_id(pattern_id)
-end
-
-def pattern_ids
- @pattern_ids ||= set_patterns.map(&:pattern_id)
-end
-
-def invalid_pattern_id pattern_id
- Rails.logger.info "invalid pattern id for read rule: #{pattern_id}"
-end
-
-event :process_read_rule_update_queue, :finalize do
- left&.update_read_rule
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/right/read.rb ~~
diff --git a/set/mod009-permissions/right/update.rb b/set/mod009-permissions/right/update.rb
deleted file mode 100644
index cbb8adf..0000000
--- a/set/mod009-permissions/right/update.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Update" cards
-#
-module Update;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/right/update.rb"; end
-include_set Abstract::Permission
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/right/update.rb ~~
diff --git a/set/mod009-permissions/self/create.rb b/set/mod009-permissions/self/create.rb
deleted file mode 100644
index 4284558..0000000
--- a/set/mod009-permissions/self/create.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Create"
-#
-module Create;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/self/create.rb"; end
-setting_opts group: :permission, position: 1, rule_type_editable: false,
- short_help_text: "who can create cards",
- help_text: "Who can create new cards"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/self/create.rb ~~
diff --git a/set/mod009-permissions/self/delete.rb b/set/mod009-permissions/self/delete.rb
deleted file mode 100644
index fa78e1d..0000000
--- a/set/mod009-permissions/self/delete.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Delete"
-#
-module Delete;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/self/delete.rb"; end
-setting_opts group: :permission, position: 4, rule_type_editable: false,
- short_help_text: "who can delete cards",
- help_text: "Who can delete cards"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/self/delete.rb ~~
diff --git a/set/mod009-permissions/self/read.rb b/set/mod009-permissions/self/read.rb
deleted file mode 100644
index 37368e6..0000000
--- a/set/mod009-permissions/self/read.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Read"
-#
-module Read;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/self/read.rb"; end
-setting_opts group: :permission, position: 2, rule_type_editable: false,
- short_help_text: "who can view cards",
- help_text: "Who can view cards in the [[set]]."
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/self/read.rb ~~
diff --git a/set/mod009-permissions/self/update.rb b/set/mod009-permissions/self/update.rb
deleted file mode 100644
index bf7a3f2..0000000
--- a/set/mod009-permissions/self/update.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Update"
-#
-module Update;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/permissions/set/self/update.rb"; end
-setting_opts group: :permission, position: 3, rule_type_editable: false,
- short_help_text: "who can update cards",
- help_text: "Who can update cards"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/permissions/set/self/update.rb ~~
diff --git a/set/mod010-account/abstract/account_field.rb b/set/mod010-account/abstract/account_field.rb
deleted file mode 100644
index ed736c9..0000000
--- a/set/mod010-account/abstract/account_field.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (AccountField)
-#
-module AccountField;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/abstract/account_field.rb"; end
-delegate :accounted, to: :account_card
-
-def account_card
- left
-end
-
-# allow account owner to update account field content
-def ok_to_update
- return true if own_account? && !name_changed? && !type_id_changed?
-
- super
-end
-
-# force inherit permission on create
-# (cannot be done with rule, because sets are not addressable)
-def permission_rule_id action
- if action == :create
- left_permission_rule_id action
- else
- super
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/abstract/account_field.rb ~~
diff --git a/set/mod010-account/abstract/accountable.rb b/set/mod010-account/abstract/accountable.rb
deleted file mode 100644
index d80854d..0000000
--- a/set/mod010-account/abstract/accountable.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Accountable)
-#
-module Accountable;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/abstract/accountable.rb"; end
-def account
- fetch :account, new: {}
-end
-
-def default_account_status
- "active"
-end
-
-def current_account?
- id && Auth.current_id == id
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def default_bridge_tab
- card.current_account? ? :account_tab : super
- end
-
- view :account_tab do
- bridge_pill_sections "Account" do
- [["Settings", account_details_items],
- ["Content", account_content_items]]
- end
- end
-
- def show_account_tab?
- card.account.real?
- end
-
- def account_formgroups
- Auth.as_bot do
- subformat(card.account)._render :content_formgroups, structure: true
- end
- end
-
- def account_details_items
- [
- ["Email and Password", :account,
- { path: { slot: { hide: %i[help_link bridge_link] } } }],
- ["Roles", :roles,
- { path: { view: :content_with_edit_button } }],
- ["Notifications", :follow],
- ["API", :account,
- { path: { view: :api_key,
- items: { view: :content },
- slot: { hide: %i[help_link bridge_link] } } }]
- ]
- end
-
- def account_content_items
- [["Created", :created],
- ["Edited", :edited]]
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/abstract/accountable.rb ~~
diff --git a/set/mod010-account/all/account.rb b/set/mod010-account/all/account.rb
deleted file mode 100644
index dbccece..0000000
--- a/set/mod010-account/all/account.rb
+++ /dev/null
@@ -1,115 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Account)
-#
-module Account;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/all/account.rb"; end
-module ClassMethods
- def default_accounted_type_id
- UserID
- end
-end
-
-def account
- fetch :account
-end
-
-def parties
- @parties ||= (all_enabled_roles << id).flatten.reject(&:blank?)
-end
-
-def among? ok_ids
- ok_ids.any? do |ok_id|
- ok_id == AnyoneID ||
- (ok_id == AnyoneWithRoleID && all_enabled_roles.size > 1) ||
- parties.member?(ok_id)
- end
-end
-
-def own_account?
- # card is +*account card of signed_in user.
- name.part_names[0].key == Auth.as_card.key &&
- name.part_names[1].key == Card[:account].key
-end
-
-def read_rules
- @read_rules ||= fetch_read_rules
-end
-
-def read_rules_hash
- @read_rules_hash ||= read_rules.each_with_object({}) { |id, h| h[id] = true }
-end
-
-def fetch_read_rules
- return [] if id == WagnBotID # always_ok, so not needed
-
- ([AnyoneID] + parties).each_with_object([]) do |party_id, rule_ids|
- next unless (cache = Card::Rule.read_rule_cache[party_id])
-
- rule_ids.concat cache
- end
-end
-
-def clear_roles
- @parties = @all_roles = @all_active_roles = @read_rules = nil
-end
-
-def with_clear_roles
- a = @parties
- b = @all_roles
- c = @all_active_roles
- d = @read_rules
- yield
-ensure
- @parties = a
- @all_roles = b
- @all_active_roles = c
- @read_rules = d
-end
-
-def all_enabled_roles
- @all_active_roles ||= (id == AnonymousID ? [] : enabled_role_ids)
-end
-
-def all_roles
- @all_roles ||= (id == AnonymousID ? [] : fetch_roles)
-end
-
-def enabled_role_ids
- with_enabled_roles do |enabled|
- enabled.virtual? ? enabled.item_ids : fetch_roles
- end
-end
-
-def with_enabled_roles
- Auth.as_bot do
- Card::Codename.exists?(:enabled_roles) ? yield(enabled_roles_card) : fetch_roles
- end
-end
-
-def enabled_roles_card
- fetch :enabled_roles, eager_cache: true, new: { type_id: SessionID }
-end
-
-def fetch_roles
- [AnyoneSignedInID] + role_ids_from_roles_trait
-end
-
-def role_ids_from_roles_trait
- Auth.as_bot do
- role_trait = fetch :roles
- role_trait ? role_trait.item_ids : []
- end
-end
-
-event :generate_token do
- Digest::SHA1.hexdigest "--#{Time.zone.now.to_f}--#{rand 10}--"
-end
-
-event :set_stamper, :prepare_to_validate do
- self.updater_id = Auth.current_id
- self.creator_id = updater_id if new_card?
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/all/account.rb ~~
diff --git a/set/mod010-account/right/account.rb b/set/mod010-account/right/account.rb
deleted file mode 100644
index b64edd5..0000000
--- a/set/mod010-account/right/account.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Account" cards
-#
-# -*- encoding : utf-8 -*-
-module Account;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/right/account.rb"; end
-
-card_accessor :email
-card_accessor :password
-card_accessor :salt
-card_accessor :status
-
-require_field :email
-
-def accounted
- left
-end
-
-def accounted_id
- left_id
-end
-
-def ok_to_read
- own_account? || super
-end
-
-# allow account owner to update account field content
-def ok_to_update
- return true if own_account? && !name_changed? && !type_id_changed?
-
- super
-end
-
-def changes_visible? act
- act.actions_affecting(act.card).each do |action|
- return true if action.card.ok? :read
- end
- false
-end
-
-def send_account_email email_template
- ecard = Card[email_template]
- unless ecard&.type_id == EmailTemplateID
- raise Card::Error, "invalid email template: #{email_template}"
- end
-
- ecard.deliver self, to: email
-end
-
-def method_missing method, *args
- return super unless args.empty? && (matches = method.match(/^(?.*)\?$/))
-
- status == matches[:status]
-end
-
-def respond_to_missing? method, _include_private=false
- method.match?(/\?$/) ? true : super
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/right/account.rb ~~
diff --git a/set/mod010-account/right/account/events.rb b/set/mod010-account/right/account/events.rb
deleted file mode 100644
index a79a166..0000000
--- a/set/mod010-account/right/account/events.rb
+++ /dev/null
@@ -1,108 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right; module Account;
-# Set: All "+Account+Events" cards (Events)
-#
-#### ON CREATE
-module Events;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/right/account/events.rb"; end
-
-event :set_default_salt, :prepare_to_validate, on: :create do
- add_subfield(:salt).generate
-end
-
-event :set_default_status, :prepare_to_validate, on: :create do
- add_subfield :status, content: (accounted&.try(:default_account_status) || "active")
-end
-
-# ON UPDATE
-
-# reset password emails contain a link to update the +*account card
-# and trigger this event
-event :reset_password, :prepare_to_validate, on: :update, trigger: :required do
- verifying_token :reset_password_success, :reset_password_failure
-end
-
-event :verify_and_activate, :prepare_to_validate, on: :update, trigger: :required do
- activatable do
- verifying_token :verify_and_activate_success, :verify_and_activate_failure
- add_subcard(accounted)&.try :activate_accounted
- end
-end
-
-event :password_redirect, :finalize, on: :update, when: :password_redirect? do
- success << { id: name, view: "edit" }
-end
-
-# INTEGRATION
-
-%i[password_reset_email verification_email welcome_email].each do |email|
- event "send_#{email}".to_sym, :integrate, trigger: :required do
- send_account_email email
- end
-end
-
-## EVENT HELPERS
-
-def activatable
- abort :failure, "no field manipulation mid-activation" if subcards.present?
- # above is necessary because activation uses super user (Decko Bot),
- # so allowing subcards would be unsafe
- yield
-end
-
-# NOTE: this only works in the context of an action.
-# if run independently, it will not activate an account
-event :activate_account do
- add_subfield :status, content: "active"
- trigger_event! :send_welcome_email
-end
-
-def verifying_token success, failure
- requiring_token do |token|
- result = Auth::Token.decode token
- if result.is_a?(String)
- send failure, result
- else
- send success
- end
- end
-end
-
-def requiring_token
- if !(token = Env.params[:token])
- errors.add :token, "is required"
- else
- yield token
- end
-end
-
-def password_redirect?
- Auth.current_id == accounted_id && password.blank?
-end
-
-def verify_and_activate_success
- Auth.signin accounted_id
- Auth.as_bot # use admin permissions for rest of action
- activate_account
- success << ""
-end
-
-def verify_and_activate_failure error_message
- send_verification_email
- errors.add :content,
- "Sorry, #{error_message}. Please check your email for a new activation link."
-end
-
-def reset_password_success
- Auth.signin accounted_id
- success << { id: name, view: :edit }
- abort :success
-end
-
-def reset_password_failure error_message
- Auth.as_bot { send_password_reset_email }
- errors.add :content, t(:account_sorry_email_reset, error_msg: error_message)
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/right/account/events.rb ~~
diff --git a/set/mod010-account/right/account/views.rb b/set/mod010-account/right/account/views.rb
deleted file mode 100644
index e91d255..0000000
--- a/set/mod010-account/right/account/views.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right; module Account;
-# Set: All "+Account+Views" cards (Views)
-#
-module Views;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/right/account/views.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :verify_url, cache: :never do
- raise Error::PermissionDenied unless card.ok?(:create) || card.action
-
- token_url :verify_and_activate, anonymous: true
- end
-
- view :reset_password_url do
- raise Error::PermissionDenied unless card.password_card.ok? :update
-
- token_url :reset_password
- end
-
- view :token_expiry do
- "(#{token_expiry_sentence}"
- end
-
- view :token_days do
- Card.config.token_expiry / 1.day
- end
-
- # DEPRECATED
- view :verify_days, :token_days
- view :reset_password_days, :token_days
-
- def token_url trigger, extra_payload={}
- card_url path(action: :update,
- card: { trigger: trigger },
- token: new_token(extra_payload))
- end
-
- def token_expiry_sentence
- "Link will expire in #{render_token_days} days"
- end
-
- def new_token extra_payload
- Auth::Token.encode card.accounted_id, extra_payload
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- [account_field_nest(:email, "email"),
- account_field_nest(:password, "password")]
- end
-
- def account_field_nest field, title
- field_nest field, title: title, view: :labeled
- # edit: :inline, hide: [:help_link, :bridge_link]
- end
-
- before :content_formgroups do
- voo.edit_structure = [[:email, "email"], [:password, "password"]]
- end
-
- view :token_expiry do
- "#{token_expiry_sentence}
"
- end
-end
-
-module EmailHtmlFormat; module_parent.send :register_set_format, Card::Format::EmailHtmlFormat, self; extend Card::Set::AbstractFormat
- def mail context, fields
- super context, fields.reverse_merge(to: card.email)
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/right/account/views.rb ~~
diff --git a/set/mod010-account/right/email.rb b/set/mod010-account/right/email.rb
deleted file mode 100644
index 7bdd3f7..0000000
--- a/set/mod010-account/right/email.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Email" cards
-#
-# -*- encoding : utf-8 -*-
-module Email;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/right/email.rb"; end
-
-include_set Abstract::AccountField
-
-event :validate_email, :validate, on: :save do
- return unless content?
-
- self.content = content.strip
- return if content.match?(/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i)
-
- errors.add :content, t(:account_error_invalid_address)
-end
-
-event :validate_unique_email, after: :validate_email, on: :save do
- if content.present?
- Auth.as_bot do
- cql = { right_id: EmailID, eq: content, return: :id }
- cql[:not] = { id: id } if id
- cql_comment = t(:account_search_email_duplicate, content: content)
- if Card.search(cql, cql_comment).first
- errors.add :content, t(:account_error_not_unique)
- end
- end
- end
-end
-
-event :downcase_email, :prepare_to_validate, on: :save do
- return if !content || content == content.downcase
-
- self.content = content.downcase
-end
-
-def email_required?
- !left.system?
-end
-
-def ok_to_read
- if own_email? || Auth.always_ok?
- true
- else
- deny_because t(:account_deny_email_restricted)
- end
-end
-
-def own_email?
- name.part_names[0].key == Auth.as_card.key
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/right/email.rb ~~
diff --git a/set/mod010-account/right/password.rb b/set/mod010-account/right/password.rb
deleted file mode 100644
index f1654c2..0000000
--- a/set/mod010-account/right/password.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Password" cards
-#
-module Password;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/right/password.rb"; end
-include_set Abstract::AccountField
-
-def history?
- false
-end
-
-def ok_to_read
- own_account? || super
-end
-
-event :encrypt_password, :store,
- on: :save, changed: :content,
- when: proc { !Card::Env[:no_password_encryptions] } do
- # no_password_encryptions = hack for import - fix with api for ignoring events
- salt = left&.salt
- self.content = Auth.encrypt content, salt
-
- # errors.add :password, 'need a valid salt'
- # turns out we have a lot of existing account without a salt.
- # not sure when that broke??
-end
-
-event :validate_password, :validate, on: :save do
- return if content.length > 3
-
- errors.add :password, t(:account_password_length)
-end
-
-event :validate_password_present, :prepare_to_validate, on: :update do
- abort :success if content.blank?
-end
-
-view :raw do
- t :account_encrypted
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core, wrap: :em do
- render_raw
- end
-
- view :input do
- card.content = ""
- password_field :content, class: "d0-card-content", autocomplete: autocomplete?
- end
-
- def autocomplete?
- return "on" if @parent && @parent.card.name == "*signin+*account" # HACK
-
- "off"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/right/password.rb ~~
diff --git a/set/mod010-account/right/roles.rb b/set/mod010-account/right/roles.rb
deleted file mode 100644
index 5d5df5e..0000000
--- a/set/mod010-account/right/roles.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Roles" cards
-#
-module Roles;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/right/roles.rb"; end
-event :validate_permission_to_assign_roles, :validate, on: :save do
- return unless (fr = forbidden_roles).present?
-
- errors.add :permission_denied,
- "You don't have permission to assign the role#{'s' if fr.size > 1} "\
- "#{fr.map(&:name).to_sentence}" # LOCALIZE
-end
-
-def forbidden_roles
- # restore old roles for permission check
- with_old_role_permissions do |new_roles|
- new_roles.reject do |card|
- Card.fetch(card, "*members").ok? :update
- end
- end
-end
-
-def with_old_role_permissions
- new_roles = item_cards
- new_content = content
- left.clear_roles
- Auth.update_always_cache Card::Auth.as_id, nil
- self.content = db_content_before_act
- yield new_roles
-ensure
- self.content = new_content
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/right/roles.rb ~~
diff --git a/set/mod010-account/right/salt.rb b/set/mod010-account/right/salt.rb
deleted file mode 100644
index e775ff0..0000000
--- a/set/mod010-account/right/salt.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Salt" cards
-#
-module Salt;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/right/salt.rb"; end
-include_set Abstract::AccountField
-
-def generate
- self.content = Digest::SHA1.hexdigest "--#{Time.zone.now}--"
-end
-
-def history?
- false
-end
-
-view :raw do
- t :account_private_data
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/right/salt.rb ~~
diff --git a/set/mod010-account/right/status.rb b/set/mod010-account/right/status.rb
deleted file mode 100644
index d73f0cb..0000000
--- a/set/mod010-account/right/status.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Status" cards
-#
-module Status;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/right/status.rb"; end
-include_set Abstract::AccountField
-include_set Abstract::Pointer
-
-def input_type
- :radio
-end
-
-def option_names
- %w[unapproved unverified active blocked system]
-end
-
-def ok_to_update
- if own_account? && !Auth.always_ok?
- deny_because you_cant(t(:account_deny_not_change_own_account))
- else
- super
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/right/status.rb ~~
diff --git a/set/mod010-account/self/signin.rb b/set/mod010-account/self/signin.rb
deleted file mode 100644
index 7d3f378..0000000
--- a/set/mod010-account/self/signin.rb
+++ /dev/null
@@ -1,222 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Signin"
-#
-# The Sign In card manages logging in and out of the site.
-#
-module Signin;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/self/signin.rb"; end
-# /:signin (core view) gives the login ui
-# /:signin?view=edit gives the forgot password ui
-
-# /update/:signin is the login action
-# /delete/:signin is the logout action
-
-# authentication event
-event :signin, :validate, on: :update do
- email = subfield :email
- email &&= email.content
- pword = subfield :password
- pword &&= pword.content
-
- authenticate_or_abort email, pword
-end
-
-# abort after successful signin (do not save card)
-event :signin_success, after: :signin do
- abort :success
-end
-
-event :signout, :validate, on: :delete do
- Env.reset_session
- Auth.signin AnonymousID
- abort :success
-end
-
-# triggered by clicking "Reset my Password", this sends out the verification password
-# and aborts (does not sign in)
-event :send_reset_password_token, before: :signin, on: :update, trigger: :required do
- aborting do
- blank_email? ? break : send_reset_password_email_or_fail
- end
-end
-
-def email_from_subfield
- @email_from_subfield ||= subfield(:email)&.content
-end
-
-def ok_to_read
- true
-end
-
-def recaptcha_on?
- false
-end
-
-def authenticate_or_abort email, pword
- abort_unless email, :email_missing
- abort_unless pword, :password_missing
- authenticate_and_signin(email, pword) || failed_signin(email)
-end
-
-def authenticate_and_signin email, pword
- return unless (account = Auth.authenticate email, pword)
-
- Auth.signin account.left_id
-end
-
-def failed_signin email
- errors.add :signin, signin_error_message(account_for(email))
- abort :failure
-end
-
-def abort_unless value, error_key
- abort :failure, t("account_#{error_key}") unless value
-end
-
-def signin_error_message account
- t "account_#{signin_error_key account}"
-end
-
-def error_on field, error_key
- errors.add field, t("account_#{error_key}")
-end
-
-def account_for email
- Auth.find_account_by_email email
-end
-
-def send_reset_password_email_or_fail
- if (account = account_for email_from_subfield)&.active?
- send_reset_password_email account
- else
- reset_password_fail account
- end
-end
-
-def blank_email?
- return false if email_from_subfield.present?
-
- error_on :email, :error_blank
-end
-
-def send_reset_password_email account
- Auth.as_bot { account.send_password_reset_email }
-end
-
-def reset_password_fail account
- if account
- error_on :account, :error_not_active
- else
- error_on :email, :error_not_recognized
- end
-end
-
-private
-
-def signin_error_key account
- case
- when account.nil? then :error_unknown_email
- when !account.active? then :error_not_active
- else :error_wrong_password
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core, cache: :never do
- voo.edit_structure = [signin_field(:email), signin_field(:password)]
- with_nest_mode :edit do
- card_form :update, recaptcha: :off, success: signin_success do
- [
- _render_content_formgroups,
- _render_signin_buttons
- ]
- end
- end
- end
-
- view :open do
- voo.show :help
- voo.hide :menu
- super()
- end
-
- # FIXME: need a generic solution for this
- view :title do
- voo.title ||= t(:account_sign_in_title)
- super()
- end
-
- view :open_content do
- # annoying step designed to avoid table of contents. sigh
- _render_core
- end
-
- view :one_line_content do
- ""
- end
-
- view :reset_password_success do
- # 'Check your email for a link to reset your password'
- frame { t :account_check_email }
- end
-
- view :signin_buttons do
- button_formgroup do
- [signin_button, signup_link, reset_password_link]
- end
- end
-
- # FORGOT PASSWORD
- view :edit do
- reset_password_voo
- Auth.as_bot { super() }
- end
-
- def reset_password_voo
- voo.title ||= t :account_forgot_password
- voo.edit_structure = [signin_field(:email)]
- voo.hide :help
- end
-
- view :edit_buttons do
- button_tag t(:account_reset_my_password),
- situation: "primary", class: "_close-modal-on-success"
- end
-
- def signin_success
- { redirect: true, mark: (Env.interrupted_action || "*previous") }
- end
-
- def signin_button
- button_tag t(:account_sign_in), situation: "primary"
- end
-
- def signup_link
- subformat(Card[:account_links]).render! :sign_up, title: t(:account_or_sign_up)
- end
-
- def reset_password_link
- link = link_to_view :edit, t(:account_reset_password),
- path: { slot: { hide: :bridge_link } }
- # FIXME: inline styling
- raw("#{link}
")
- end
-
- def edit_view_hidden
- hidden_tags card: { trigger: :send_reset_password_token }
- end
-
- def edit_success
- { view: :reset_password_success }
- end
-
- def signin_field name
- nest_name = "".to_name.trait(name)
- [nest_name, { title: name.to_s, view: "titled",
- nest_name: nest_name, skip_perms: true }]
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/self/signin.rb ~~
diff --git a/set/mod010-account/type/role.rb b/set/mod010-account/type/role.rb
deleted file mode 100644
index fa9ea50..0000000
--- a/set/mod010-account/type/role.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Role" cards
-#
-module Role;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/type/role.rb"; end
-def disabled?
- Auth.current&.fetch(:disabled_roles)&.item_ids&.include? id
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :link_with_checkbox, cache: :never do
- role_checkbox
- end
-
- def role_checkbox
- name = card.disabled? ? "add_item" : "drop_item"
- subformat(Auth.current.field(:disabled_roles, new: {})).card_form :update do
- [check_box_tag(name, card.id, !card.disabled?, class: "_edit-item"),
- render_link]
- end
- end
-
- def related_by_content_items
- super.unshift ["members", :members]
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/type/role.rb ~~
diff --git a/set/mod010-account/type/signup.rb b/set/mod010-account/type/signup.rb
deleted file mode 100644
index bf0ad05..0000000
--- a/set/mod010-account/type/signup.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Signup" cards
-#
-module Signup;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/type/signup.rb"; end
-include_set Abstract::Accountable
-
-require_field :account
-
-def default_account_status
- can_approve? ? "unverified" : "unapproved"
-end
-
-def can_approve?
- Card.new(type_id: Card.default_accounted_type_id).ok? :create
-end
-
-def activate_accounted
- self.type_id = Card.default_accounted_type_id
-end
-
-event :auto_approve_with_verification, :validate, on: :create, when: :can_approve? do
- request_verification
-end
-
-event :approve_with_verification, :validate, on: :update, trigger: :required do
- approvable { request_verification }
-end
-
-event :approve_without_verification, :validate, on: :update, trigger: :required do
- # TODO: if validated here, add trigger and activate in storage phase
- approvable do
- activate_accounted
- account_subfield.activate_account
- end
-end
-
-event :act_as_current_for_integrate_stage, :integrate, on: :create do
- # needs justification!
- Auth.current_id = id
-end
-
-def account_subfield
- subfield(:account) || add_subfield(:account)
-end
-
-def request_verification
- acct = account_subfield
- acct.add_subfield :status, content: "unverified"
- acct.trigger_event! :send_verification_email
-end
-
-def approvable
- if can_approve?
- yield
- else
- abort :failure, "illegal approval" # raise permission denied?
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/type/signup.rb ~~
diff --git a/set/mod010-account/type/signup/views.rb b/set/mod010-account/type/signup/views.rb
deleted file mode 100644
index b9bc843..0000000
--- a/set/mod010-account/type/signup/views.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type; module Signup;
-# Set: All "Signup+Views" cards (Views)
-#
-module Views;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/type/signup/views.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def invitation?
- Auth.signed_in? && card.can_approve?
- end
-
- view :new do
- voo.title = invitation? ? t(:account_invite) : t(:account_sign_up)
- super()
- end
-
- view :content_formgroups do
- [account_formgroups, (card.structure ? edit_slot : "")].join
- end
-
- view :new_buttons do
- button_formgroup do
- [standard_create_button, invite_button].compact
- end
- end
-
- def invite_button
- return unless invitation?
-
- button_tag "Send Invitation", situation: "primary"
- end
-
- view :core, template: :haml do
- @lines = [signup_line] + account_lines
- @body = process_content _render_raw
- end
-
- def signup_line
- ["#{safe_name} ",
- ("was" if invited?),
- "signed up on #{format_date card.created_at}"].compact.join " "
- end
-
- def invited?
- !self_signup?
- end
-
- def self_signup?
- card.creator_id == AnonymousID
- end
-
- def account_lines
- if card.account
- verification_lines
- else
- [t(:account_missing_account)]
- end
- end
-
- def verification_lines
- [verification_sent_line, verification_link_line].compact
- end
-
- def verification_sent_line
- account = card.account
- return unless account.email_card.ok?(:read)
-
- "A verification email has been sent to #{account.email}"
- end
-
- def verification_link_line
- links = verification_links
- return if links.empty?
-
- links.join " "
- end
-
- def verification_links
- [approve_with_token_link, approve_without_token_link, deny_link].compact
- end
-
- def approve_with_token_link
- action = card.account.status == "unverified" ? "Resend" : "Send"
- approval_link "#{action} verification email", :with
- end
-
- def approve_without_token_link
- approval_link "Approve without verification", :without
- end
-
- def approval_link text, with_or_without
- return unless card.can_approve?
-
- link_to_card card, text,
- path: { action: :update,
- card: { trigger: "approve_#{with_or_without}_verification" } }
- end
-
- def deny_link
- return unless card.ok? :delete
-
- link_to_card card, "Deny and delete", path: { action: :delete }
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/type/signup/views.rb ~~
diff --git a/set/mod010-account/type/user.rb b/set/mod010-account/type/user.rb
deleted file mode 100644
index 94b5d0b..0000000
--- a/set/mod010-account/type/user.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "User" cards
-#
-module User;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/type/user.rb"; end
-include_set Abstract::Accountable
-
-attr_accessor :email
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :setup, unknown: true, perms: ->(_fmt) { Auth.needs_setup? } do
- with_nest_mode :edit do
- voo.title = "Your deck is ready to go!" # LOCALIZE
- voo.show! :help
- voo.hide! :menu
- voo.help = haml :setup_help
- Auth.as_bot { setup_form }
- end
- end
-
- def setup_form
- frame_and_form :create do
- [
- setup_hidden_fields,
- _render_name_formgroup,
- account_formgroups,
- setup_form_buttons
- ]
- end
- end
-
- def setup_form_buttons
- button_formgroup { setup_button }
- end
-
- def setup_button
- submit_button text: "Set up", disable_with: "Setting up"
- end
-
- def setup_hidden_fields
- hidden_tags(
- setup: true,
- success: { redirect: true, mark: path(mark: "") },
- "card[type_id]" => Card.default_accounted_type_id
- )
- end
-end
-
-def setup?
- Card::Env.params[:setup]
-end
-
-event :setup_as_bot, before: :check_permissions, on: :create, when: :setup? do
- abort :failure unless Auth.needs_setup?
- Auth.as_bot
- # we need bot authority to set the initial administrator roles
- # this is granted and inspected here as a separate event for
- # flexibility and security when configuring initial setups
-end
-
-event :setup_first_user, :prepare_to_store, on: :create, when: :setup? do
- add_subcard "signup alert email+*to", content: name
- add_subfield :roles, content: roles_for_first_user
-end
-
-def roles_for_first_user
- %i[help_desk shark administrator].map(&:cardname)
-end
-
-event :signin_after_setup, :integrate, on: :create, when: :setup? do
- Auth.signin id
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/type/user.rb ~~
diff --git a/set/mod010-account/type_plus_right/user/email.rb b/set/mod010-account/type_plus_right/user/email.rb
deleted file mode 100644
index cf8ceaf..0000000
--- a/set/mod010-account/type_plus_right/user/email.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class TypePlusRight; module User;
-# Set: All "+Email" cards on "User" cards
-#
-# supports legacy references to +*email
-module Email;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/account/set/type_plus_right/user/email.rb"; end
-# (standard representation is now +*account+*email)
-view :raw do
- card.content_email || card.account_email || ""
-end
-
-def content_email
- content if real?
-end
-
-def account_email
- left&.account&.email
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/account/set/type_plus_right/user/email.rb ~~
diff --git a/set/mod011-edit/all/bridge.rb b/set/mod011-edit/all/bridge.rb
deleted file mode 100644
index 4e8c31e..0000000
--- a/set/mod011-edit/all/bridge.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Bridge)
-#
-module Bridge;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge.rb"; end
-BRIDGE_TABS = { "Account" => :account_tab,
- "Guide" => :guide_tab,
- "Engage" => :engage_tab,
- "History" => :history_tab,
- "Related" => :related_tab,
- "Rules" => :rules_tab }.freeze
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- wrapper :bridge do
- class_up "modal-dialog", "no-gaps"
- voo.hide! :modal_footer
- wrap_with_modal size: :full, title: bridge_breadcrumbs do
- haml :bridge
- end
- end
-
- def bridge_tabs
- wrap do
- tabs(visible_bridge_tabs, bridge_tab, load: :lazy) { _render bridge_tab }
- end
- end
-
- def bridge_tab
- @bridge_tab ||= bridge_param :tab
- end
-
- def bridge_param key
- params.dig(:bridge, key)&.to_sym || try("default_bridge_#{key}")
- end
-
- def bridge_breadcrumbs
- <<-HTML.strip_heredoc
-
-
- #{card.name}
- Edit
-
-
- HTML
- end
-
- def bridge_link_opts opts={}
- opts[:"data-slot-selector"] = bridge_slot_selector
- opts[:remote] = true
- add_class opts, "slotter"
- opts.bury :path, :layout, :overlay
- opts[:path][:view] ||= :content
- opts
- end
-
- def bridge_slot_selector
- ".bridge-main > .overlay-container > .card-slot._bottomlay-slot," \
- ".bridge-main > ._overlay-container-placeholder > .card-slot"
- end
-
- def default_bridge_tab
- show_guide_tab? ? :guide_tab : :engage_tab
- end
-
- def breadcrumb_data title, html_class=nil
- html_class ||= title.underscore
- { "data-breadcrumb": title, "data-breadcrumb-class": html_class }
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge.rb ~~
diff --git a/set/mod011-edit/all/bridge/bridge_pills.rb b/set/mod011-edit/all/bridge/bridge_pills.rb
deleted file mode 100644
index 1a3a62f..0000000
--- a/set/mod011-edit/all/bridge/bridge_pills.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bridge;
-# Set: All cards (Bridge, BridgePills)
-#
-module BridgePills;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/bridge_pills.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- BRIDGE_PILL_UL_CLASSES =
- "nav nav-pills _auto-single-select bridge-pills flex-column".freeze
-
- BRIDGE_PILL_LI_CLASSES = "nav-item".freeze
-
- def bridge_pills items
- list_tag class: BRIDGE_PILL_UL_CLASSES, items: { class: BRIDGE_PILL_LI_CLASSES } do
- items
- end
- end
-
- def bridge_pill_items data, breadcrumb
- data.map do |text, field, extra_opts|
- opts = bridge_pill_item_opts breadcrumb, extra_opts, text
- mark = opts.delete(:mark) == :absolute ? field : [card, field]
- link_to_card mark, text, opts
- end
- end
-
- def bridge_pill_item_opts breadcrumb, extra_opts, text
- opts = bridge_link_opts.merge("data-toggle": "pill")
- opts.merge! breadcrumb_data(breadcrumb)
-
- if extra_opts
- classes = extra_opts.delete :class
- add_class opts, classes if classes
- opts.deep_merge! extra_opts
- end
- opts["data-cy"] = "#{text.to_name.key}-pill"
- add_class opts, "nav-link"
- opts
- end
-
- def bridge_pill_sections tab_name
- wrap_with :ul, class: BRIDGE_PILL_UL_CLASSES do
- yield.map { |args| bridge_pill_section(tab_name, *args) }
- end
- end
-
- def bridge_pill_section tab_name, title, items
- wrap_with(:h6, title, class: "ml-1 mt-3") +
- wrap_each_with(:li, class: BRIDGE_PILL_LI_CLASSES) do
- bridge_pill_items(items, tab_name)
- end.html_safe
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/bridge_pills.rb ~~
diff --git a/set/mod011-edit/all/bridge/follow_section.rb b/set/mod011-edit/all/bridge/follow_section.rb
deleted file mode 100644
index 625401d..0000000
--- a/set/mod011-edit/all/bridge/follow_section.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bridge;
-# Set: All cards (Bridge, FollowSection)
-#
-module FollowSection;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/follow_section.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def follow_section
- return unless show_follow?
-
- wrap_with :div, class: "mb-3" do
- [follow_button_group, followers_bridge_link, follow_overview_button]
- end
- end
-
- def follow_button_group
- wrap_with :div, class: "btn-group btn-group-sm follow-btn-group" do
- [follow_button, follow_advanced]
- end
- end
-
- def follow_overview_button
- link_to_card [Auth.current, :follow], "all followed cards",
- bridge_link_opts(class: "btn btn-sm btn-secondary",
- "data-cy": "follow-overview")
- end
-
- def follow_advanced
- opts = bridge_link_opts(class: "btn btn-sm btn-primary",
- path: { view: :overlay_rule },
- "data-cy": "follow-advanced")
- opts[:path].delete :layout
- link_to_card card.follow_rule_card(Auth.current.name, new: {}),
- icon_tag("more_horiz"), opts
- end
-
- def followers_bridge_link
- cnt = card.followers_count
- link_to_card card.name.field(:followers), "#{cnt} follower#{'s' unless cnt == 1}",
- bridge_link_opts(class: "btn btn-sm ml-2 btn-secondary slotter",
- remote: true, "data-cy": "followers")
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/follow_section.rb ~~
diff --git a/set/mod011-edit/all/bridge/related_section.rb b/set/mod011-edit/all/bridge/related_section.rb
deleted file mode 100644
index ad7e6c0..0000000
--- a/set/mod011-edit/all/bridge/related_section.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bridge;
-# Set: All cards (Bridge, RelatedSection)
-#
-module RelatedSection;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/related_section.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- RELATED_ITEMS =
- {
- "by name" => [["children", :children],
- ["mates", :mates]],
- # FIXME: optimize,
- "by content" => [["links out", :links_to],
- ["links in", :linked_to_by],
- ["nests", :nests],
- ["nested by", :nested_by],
- ["references out", :refers_to],
- ["references in", :referred_to_by]]
- # ["by edit", [["creator", :creator],
- # ["editors", :editors],
- # ["last edited", :last_edited]]]
- }.freeze
-
- def related_by_name_items
- pills = []
- if card.name.compound?
- pills += card.name.ancestors.map { |a| [a, a, { mark: :absolute }] }
- end
- pills += RELATED_ITEMS["by name"]
- pills
- end
-
- def related_by_content_items
- RELATED_ITEMS["by content"]
- end
-
- def related_by_type_items
- [["#{card.type} cards", [card.type, :type, :by_name], { mark: :absolute }]]
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/related_section.rb ~~
diff --git a/set/mod011-edit/all/bridge/tab_views.rb b/set/mod011-edit/all/bridge/tab_views.rb
deleted file mode 100644
index 83d1431..0000000
--- a/set/mod011-edit/all/bridge/tab_views.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bridge;
-# Set: All cards (Bridge, TabViews)
-#
-module TabViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/tab_views.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :engage_tab, wrap: { div: { class: "m-3 mt-4 _engage-tab" } }, cache: :never do
- [render_follow_section, discussion_section].compact
- end
-
- view :history_tab, wrap: :slot do
- class_up "d0-card-body", "history-slot"
- voo.hide :act_legend
- acts_bridge_layout card.history_acts
- end
-
- view :related_tab do
- bridge_pill_sections "Related" do
- %w[name content type].map do |section_name|
- ["by #{section_name}", send("related_by_#{section_name}_items")]
- end
- end
- end
-
- view :rules_tab, unknown: true do
- class_up "card-slot", "flex-column"
- wrap do
- nest current_set_card, view: :bridge_rules_tab
- end
- end
-
- view :follow_section, wrap: :slot, cache: :never do
- follow_section
- end
-
- view :guide_tab, unknown: true do
- render_guide
- end
-
- def discussion_section
- return unless show_discussion?
-
- field_nest(:discussion, view: :titled, title: "Discussion", show: :comment_box,
- hide: [:menu])
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/tab_views.rb ~~
diff --git a/set/mod011-edit/all/bridge/tab_visibility.rb b/set/mod011-edit/all/bridge/tab_visibility.rb
deleted file mode 100644
index 1737308..0000000
--- a/set/mod011-edit/all/bridge/tab_visibility.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bridge;
-# Set: All cards (Bridge, TabVisibility)
-#
-module TabVisibility;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/tab_visibility.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def visible_bridge_tabs
- Bridge::BRIDGE_TABS.select do |_title, view|
- send "show_#{view}?"
- end
- end
-
- private
-
- def show_engage_tab?
- return unless card.real?
-
- show_follow? || show_discussion?
- end
-
- def show_account_tab?
- false
- end
-
- def show_history_tab?
- card.real?
- end
-
- def show_related_tab?
- card.real?
- end
-
- def show_rules_tab?
- true
- end
-
- def show_guide_tab?
- guide.present?
- end
-
- def show_discussion?
- return unless (d_card = discussion_card)
-
- d_card.ok? discussion_permission_task(d_card)
- end
-
- def discussion_card?
- card.compound? && card.name.tag_name.key == :discussion.cardname.key
- end
-
- def discussion_card
- return if card.new_card? || discussion_card?
-
- card.fetch :discussion, skip_modules: true, new: {}
- end
-
- private
-
- def discussion_permission_task d_card=nil
- d_card ||= discussion_card
- d_card.new_card? ? :update : :read
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/bridge/tab_visibility.rb ~~
diff --git a/set/mod011-edit/all/edit_content.rb b/set/mod011-edit/all/edit_content.rb
deleted file mode 100644
index ce1745b..0000000
--- a/set/mod011-edit/all/edit_content.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (EditContent)
-#
-module EditContent;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/edit_content.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :edit_form, wrap: :slot do
- voo.show :edit_type_row
- with_nest_mode :edit do
- edit_form
- end
- end
-
- def edit_form
- voo.hide :edit_type_row
- form_opts = edit_form_opts.reverse_merge success: edit_success
- card_form(:update, form_opts) do
- [
- edit_view_hidden,
- _render_edit_type_row(home_view: :edit_type_row),
- # home_view is necessary for cancel to work correctly.
- # it seems a little strange to have to think about home_view here,
- # but the issue is that something currently has to happen prior to the
- # render to get voo.slot_options to have the write home view in
- # the slot wrap. Id think this would probably best be handled as an
- # option to #wrap that triggers a new heir voo
- _render_content_formgroups,
- _render_edit_buttons
- ]
- end
- end
-
- view :edit, perms: :update, unknown: true, cache: :never,
- wrap: { modal: { footer: "",
- size: :edit_modal_size,
- title: :render_title,
- menu: :edit_modal_menu } } do
- add_name_context
- with_nest_mode :edit do
- voo.show :help
- voo.hide :save_button
- wrap true do
- [
- frame_help,
- _render_edit_form
- ]
- end
- end
- end
-
- def edit_modal_size
- :large
- end
-
- def edit_modal_menu
- wrap_with_modal_menu do
- [close_modal_window, render_bridge_link]
- end
- end
-
- def edit_form_opts
- # for override
- { "data-slot-selector": "modal-origin", "data-slot-error-selector": ".card-slot" }
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/edit_content.rb ~~
diff --git a/set/mod011-edit/all/edit_inline.rb b/set/mod011-edit/all/edit_inline.rb
deleted file mode 100644
index f50af49..0000000
--- a/set/mod011-edit/all/edit_inline.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (EditInline)
-#
-module EditInline;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/edit_inline.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :edit_inline, perms: :update, unknown: true, cache: :never, wrap: :slot do
- voo.hide :name_formgroup, :type_formgroup
- with_nest_mode :edit do
- card_form :update, success: edit_success do
- [
- edit_view_hidden,
- _render_content_formgroups,
- _render_edit_inline_buttons
- ]
- end
- end
- end
-
- view :edit_name_row do
- edit_row_fixed_width "Name", card.name, :name_form
- end
-
- view :edit_inline_buttons do
- button_formgroup do
- wrap_with "div", class: "d-flex" do
- [standard_save_button, cancel_in_place_button, delete_button]
- end
- end
- end
-
- # TODO: better styling for this so that is reusable
- # At the moment it is used for the name and type field in the bridge
- # (with fixed 50px width for the title column) and
- # for password and email for accounts (with fixed 75px width for the title column)
- # The view is very similar to labeled but with fixed edit link on the right
- # and a fixed width for the labels so that the content column is aligned
- # There is also the problem that label and content are not vertically aligned
- view :edit_row do
- edit_row_fixed_width render_title, render_core, :edit_inline, 75
- end
-
- def edit_row_fixed_width title, content, edit_view, width=50
- class_up "card-slot", "d-flex"
- wrap do
- ["#{title} ",
- content,
- edit_inline_link(edit_view, align: :right)]
- end
- end
-
- def edit_inline_link view=:edit_inline, align: :left
- align = align == :left ? "ml-2" : "ml-auto"
- link_to_view view, menu_icon, class: "#{align} edit-link", "data-cy": "edit-link"
- end
-
- def cancel_in_place_button args={}
- args.reverse_merge! class: "cancel-button btn-sm", href: path
- cancel_button args
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/edit_inline.rb ~~
diff --git a/set/mod011-edit/all/edit_name.rb b/set/mod011-edit/all/edit_name.rb
deleted file mode 100644
index 70d9d7a..0000000
--- a/set/mod011-edit/all/edit_name.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (EditName)
-#
-module EditName;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/edit_name.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :edit_name, perms: :update do
- frame { name_form }
- end
-
- view :name_form, perms: :update, wrap: :slot, cache: :never do
- name_form :edit_name_row
- end
-
- def name_form success_view=nil
- card_form({ action: :update, id: card.id },
- { "data-main-success": JSON(redirect: true, view: ""),
- "data-update-origin": "true",
- class: "_rename-form",
- success: edit_name_success(success_view) }) do
- [edit_name_hidden_fields,
- _render_name_formgroup,
- edit_name_confirmation,
- edit_name_buttons]
- end
- end
-
- def edit_name_success view=nil
- success = { name: "_self", redirect: "" }
- success[:view] = view if view
- success
- end
-
- def edit_name_hidden_fields
- hidden_tags old_name: card.name, card: { update_referers: false }
- end
-
- def edit_name_buttons
- class_up "button-form-group", "rename-button-form-group"
- button_formgroup do
- [rename_and_update_button, rename_button, standard_cancel_button]
- end
- end
-
- def edit_name_confirmation
- alert "warning", false, false, class: "hidden-alert" do
- haml :edit_name_confirmation, referer_count: card.references_in.count
- end
- end
-
- def rename_and_update_button
- submit_button text: t(:core_rename_and_update),
- disable_with: t(:core_renaming),
- class: "_renamer-updater"
- end
-
- def rename_button
- button_tag t(:core_rename),
- class: "renamer", data: { disable_with: t(:core_renaming) }
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/edit_name.rb ~~
diff --git a/set/mod011-edit/all/edit_type.rb b/set/mod011-edit/all/edit_type.rb
deleted file mode 100644
index 8ee15ed..0000000
--- a/set/mod011-edit/all/edit_type.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (EditType)
-#
-module EditType;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/edit_type.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :edit_type, cache: :never, perms: :update do
- frame do
- _render_edit_type_form
- end
- end
-
- view :edit_type_form, cache: :never, perms: :update, wrap: :slot do
- card_form :update, success: edit_type_success do
- [type_formgroup, render_new_buttons]
- end
- end
-
- def edit_type_success
- { view: :core }
- end
-
- view :edit_type_row do
- return _render_bridge_type_formgroup if voo.visible?(:type_form) { false }
-
- edit_row_fixed_width "Type", link_to_card(card.type), :bridge_type_formgroup
- end
-
- view :bridge_type_formgroup, unknown: true, wrap: :slot do
- type_formgroup href: path(mark: card.id,
- view: :edit_form,
- assign: true,
- slot: { show: :type_form }),
- class: "live-type-field slotter",
- 'data-remote': true,
- 'data-slot-selector': ".card-slot.edit_form-view"
- end
-
- view :type_formgroup do
- type_formgroup
- end
-
- def type_formgroup args={}
- add_class args, "type-field"
- wrap_type_formgroup do
- type_field args
- end
- end
-
- def type_field args={}
- @no_current_type = args.delete :no_current_type # just a test artifact?
- action_view.select_tag "card[type]", type_field_options,
- args.merge("data-select2-id": "#{unique_id}-#{Time.now.to_i}")
- end
-
- private
-
- def raw_type_options
- return @raw_type_options if @raw_type_options
-
- options = Auth.createable_types
- if !@no_current_type && card.real? && !options.include?(card.type_name)
- # current type should be an option on existing cards,
- # regardless of create perms
- options.push(card.type_name).sort!
- end
- @raw_type_options = ::Set.new options
- end
-
- def wrap_type_formgroup
- formgroup "Type", input: "type", class: "type-formgroup", help: false do
- output [yield, hidden_field_tag(:assign, true)]
- end
- end
-
- def type_field_options
- if grouped_types.size == 1
- simple_type_field_options
- else
- multi_type_field_options
- end
- end
-
- def simple_type_field_options
- options_for_select grouped_types.flatten[1], current_type_value
- end
-
- def multi_type_field_options
- grouped_options_for_select grouped_types, current_type_value
- end
-
- def current_type_value
- return if @no_current_type
-
- @current_type_value ||= card.type_name_or_default
- end
-
- def grouped_types
- groups = Hash.new { |h, k| h[k] = [] }
-
- visible_cardtype_groups.each_pair.with_object(groups) do |(name, items), grps|
- if name == "Custom"
- custom_grouped_types grps
- else
- standard_grouped_types grps, name, items
- end
- end
- end
-
- def custom_grouped_types groups
- Auth.createable_types.each do |type|
- groups["Custom"] << type unless ::Card::Set::Self::Cardtype::GROUP_MAP[type]
- end
- end
-
- def standard_grouped_types groups, name, items
- items.each do |i|
- groups[name] << i if raw_type_options.include?(i)
- end
- end
-
- def visible_cardtype_groups
- ::Card::Set::Self::Cardtype::GROUP
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/edit_type.rb ~~
diff --git a/set/mod011-edit/all/editing.rb b/set/mod011-edit/all/editing.rb
deleted file mode 100644
index 4f4309a..0000000
--- a/set/mod011-edit/all/editing.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Editing)
-#
-module Editing;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/editing.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- ###---( TOP_LEVEL (used by menu) NEW / EDIT VIEWS )
- view :bridge, perms: :update, unknown: true, cache: :never, wrap: :bridge do
- with_nest_mode :edit do
- add_name_context
- voo.show :help
- wrap true, breadcrumb_data("Editing", "edit") do
- bridge_parts
- end
- end
- end
-
- view :cardboard, :bridge
-
- def bridge_parts
- voo.show! :edit_type_row
-
- [
- frame_help,
- _render_edit_name_row(home_view: :edit_name_row),
- # home_view is necessary for cancel to work correctly.
- # it seems a little strange to have to think about home_view here,
- # but the issue is that something currently has to happen prior to the
- # render to get voo.slot_options to have the write home view in
- # the slot wrap. I think this would probably best be handled as an
- # option to #wrap that triggers a new heir voo
- _render_edit_form
- ]
- end
-
- def edit_success
- # for override
- end
-
- def edit_view_hidden
- # for override
- end
-
- view :edit_buttons do
- button_formgroup do
- wrap_with "div", class: "d-flex" do
- [standard_submit_button, edit_cancel_button, delete_button]
- end
- end
- end
-
- # TODO: add undo functionality
- view :just_deleted, unknown: true do
- wrap { "#{render_title} deleted" }
- end
-
- view :edit_rules, cache: :never, unknown: true do
- nest current_set_card, view: :bridge_rules_tab
- end
-
- view :edit_structure, cache: :never do
- return unless card.structure
-
- nest card.structure_rule_card, view: :edit
- # FIXME: this stuff:
- # slot: {
- # cancel_slot_selector: ".card-slot.related-view",
- # cancel_path: card.format.path(view: :edit), hide: :edit_toolbar,
- # hidden: { success: { view: :open, "slot[subframe]" => true } }
- # }
- # }
- end
-
- view :edit_nests, cache: :never do
- frame do
- with_nest_mode :edit do
- multi_card_edit
- end
- end
- end
-
- # FIXME: - view can recurse. temporarily turned off
- #
- # view :edit_nest_rules, cache: :never do
- # return ""#
- # view = args[:rule_view] || :field_related_rules
- # frame do
- # # with_nest_mode :edit do
- # nested_fields.map do |name, _options|
- # nest Card.fetch(name.to_name.trait(:self)),
- # view: :titled, title: name, rule_view: view,
- # hide: :set_label, show: :rule_navbar
- # end
- # end
- # end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/editing.rb ~~
diff --git a/set/mod011-edit/all/editor.rb b/set/mod011-edit/all/editor.rb
deleted file mode 100644
index f976726..0000000
--- a/set/mod011-edit/all/editor.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Editor)
-#
-module Editor;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/editor.rb"; end
-Self::InputOptions.add_to_basket :options, "text area"
-Self::InputOptions.add_to_basket :options, "text field"
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- voo.input_type.present? ? voo.input_type : input_type_from_rule
- end
-
- def input_type_from_rule
- card.rule(:input_type)&.gsub(/[\[\]]/, "")&.tr(" ", "_")
- end
-
- def input_method input_type
- "#{input_type}_input"
- end
-
- # core view of card is input
- def input_defined_by_card
- with_card input_type do |input_card|
- nest input_card, view: :core
- end
- end
-
- # move somewhere more accessible?
- def with_card mark
- card = Card[mark]
- yield card if card
- rescue Card::Error::CodenameNotFound
- nil
- end
-
- view :input, unknown: true do
- try(input_method(input_type)) ||
- input_defined_by_card ||
- send(input_method(default_input_type))
- end
-
- def default_input_type
- :rich_text
- end
-
- def rich_text_input
- send "#{Cardio.config.rich_text_editor || :text_area}_editor_input"
- end
-
- def text_area_input
- text_area :content, rows: 5, class: "d0-card-content",
- "data-card-type-code": card.type_code
- end
-
- def text_field_input
- text_field :content, class: classy("d0-card-content")
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/editor.rb ~~
diff --git a/set/mod011-edit/all/form.rb b/set/mod011-edit/all/form.rb
deleted file mode 100644
index fd7a3c9..0000000
--- a/set/mod011-edit/all/form.rb
+++ /dev/null
@@ -1,257 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Form)
-#
-module Form;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/form.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # FIELDSET VIEWS
-
- # sometimes multiple card formgroups, sometimes just one
- view :content_formgroups, cache: :never do
- wrap_with :fieldset, edit_slot, class: classy("card-editor", "editor")
- end
-
- view :name_formgroup do
- formgroup "Name", input: "name", help: false do
- raw name_field
- end
- end
-
- # single card content formgroup, labeled with "Content"
- view :content_formgroup, unknown: true, cache: :never do
- wrap_content_formgroup { content_field }
- end
-
- view :edit_in_form, cache: :never, perms: :update, unknown: true do
- reset_form
- @in_multi_card_editor = true
- edit_slot
- end
-
- view :conflict_tracker, cache: :never, unknown: true do
- return unless card&.real?
-
- card.last_action_id_before_edit = card.last_action_id
- hidden_field :last_action_id_before_edit, class: "current_revision_id"
- end
-
- def wrap_content_formgroup &block
- formgroup("Content", input: :content, help: false,
- class: classy("card-editor"), &block)
- end
-
- def button_formgroup &block
- wrap_with :div, class: "form-group #{classy 'button-form-group'}", &block
- end
-
- def name_field
- # value needed because otherwise gets wrong value if there are updates
- text_field :name, value: card.name, autocomplete: "off"
- end
-
- def content_field
- with_nest_mode :normal do
- # by changing nest mode to normal, we ensure that editors (eg image
- # previews) can render core views.
- output [_render_conflict_tracker, _render_input]
- end
- end
-
- # SAMPLE editor view for override
- # view :input do
- # text_area :content, rows: 5, class: "d0-card-content"
- # end
-
- def edit_slot
- case
- when inline_nests_editor? then _render_core
- when multi_card_editor? then multi_card_edit(true)
- when in_multi_card_editor? then editor_in_multi_card
- else single_card_edit_field
- end
- end
-
- # test: render nests within a normal rendering of the card's content?
- # (as opposed to a standardized form)
- def inline_nests_editor?
- voo.input_type == :inline_nests
- end
-
- # test: are we opening a new multi-card form?
- def multi_card_editor?
- voo.structure || voo.edit_structure || # structure configured in voo
- card.structure || # structure in card rule
- edit_fields? # list of fields in card rule
- end
-
- # override and return true to optimize
- def edit_fields?
- edit_fields.present?
- end
-
- # test: are we already within a multi-card form?
- def in_multi_card_editor?
- @in_multi_card_editor.present?
- end
-
- def single_card_edit_field
- if voo.show?(:type_formgroup) || voo.show?(:name_formgroup)
- _render_content_formgroup # use formgroup for consistency
- else
- editor_wrap(:content) { content_field }
- end
- end
-
- def editor_in_multi_card
- add_junction_class
- formgroup render_title,
- input: "content", help: true, class: classy("card-editor") do
- [content_field, (form.hidden_field(:type_id) if card.new_card?)]
- end
- end
-
- def multi_card_edit fields_only=false
- field_configs = edit_field_configs fields_only
- return structure_link if field_configs.empty?
-
- field_configs.map do |name, options|
- nest name, options || {}
- end.join "\n"
- end
-
- def structure_link
- # LOCALIZE
- structured = link_to_card card.structure_rule_card, "structured"
- "Content "\
- "Uneditable; content is #{structured} without nests
"
- end
-
- # @param [Hash|Array] fields either an array with field names and/or field
- # cards or a hash with the fields as keys and a hash with nest options as
- # values
- def process_edit_fields fields
- fields.map do |field, opts|
- field_nest field, opts
- end.join "\n"
- end
- ###
-
- # If you use subfield cards to render a form for a new card
- # then the subfield cards should be created on the new card not the existing
- # card that build the form
-
- def form
- @form ||= inherit(:form) || new_form
- end
-
- def new_form
- @form_root = true unless parent&.form_root
- instantiate_builder(form_prefix, card, {})
- end
-
- def reset_form
- @form = new_form
- end
-
- def form_prefix
- case
- when explicit_form_prefix then explicit_form_prefix # configured
- when simple_form? then "card" # simple form
- when parent.card.name == card.name then parent.form_prefix # card nests self
- else edit_in_form_prefix
- end
- end
-
- def simple_form?
- form_root? || !form_root || !parent
- end
-
- def edit_in_form_prefix
- "#{parent.form_prefix}[subcards][#{card.name.from form_context.card.name}]"
- end
-
- def explicit_form_prefix
- inherit :explicit_form_prefix
- end
-
- def form_context
- form_root? || !form_root ? self : parent
- end
-
- def form_root?
- @form_root == true
- end
-
- def form_root
- return self if @form_root
-
- parent ? parent.form_root : nil
- end
-
- def card_form action, opts={}
- @form_root = true
- hidden = hidden_form_tags action, opts
- form_for card, card_form_opts(action, opts) do |cform|
- @form = cform
- hidden + output(yield(cform))
- end
- end
-
- def hidden_form_tags _action, opts
- success = opts.delete :success
- success_tags success
- end
-
- # @param action [Symbol] :create or :update
- # @param opts [Hash] html options
- # @option opts [Boolean] :redirect (false) if true form is no "slotter"
- def card_form_opts action, opts={}
- url, action = card_form_url_and_action action
- html_opts = card_form_html_opts action, opts
- form_opts = { url: url, html: html_opts }
- form_opts[:remote] = true unless html_opts.delete(:redirect)
- form_opts
- end
-
- def card_form_html_opts action, opts={}
- add_class opts, "card-form"
- add_class opts, "slotter" unless opts[:redirect] || opts[:no_slotter]
- add_class opts, "autosave" if action == :update
- interpret_main_success_opts opts
- opts
- end
-
- def interpret_main_success_opts opts
- return unless (hash = opts.delete :main_success)
-
- opts["data-main-success"] = JSON hash
- end
-
- def card_form_url_and_action action
- case action
- when Symbol then [path(action: action), action]
- when Hash then [path(action), action[:action]]
- # for when non-action path args are required
- else
- raise Card::Error, "unsupported #card_form_url action: #{action}"
- end
- end
-
- def editor_wrap type=nil, &block
- html_class = "editor"
- html_class << " #{type}-editor" if type
- wrap_with :div, class: html_class, &block
- end
-
- # FIELD VIEWS
-
- def add_junction_class
- return unless card.name.compound?
-
- class_up "card-editor", "RIGHT-#{card.name.tag_name.safe_key}"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/form.rb ~~
diff --git a/set/mod011-edit/all/form_buttons.rb b/set/mod011-edit/all/form_buttons.rb
deleted file mode 100644
index 966dae5..0000000
--- a/set/mod011-edit/all/form_buttons.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (FormButtons)
-#
-module FormButtons;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/form_buttons.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def standard_submit_button
- output [standard_save_button, standard_save_and_close_button]
- end
-
- def standard_save_button opts={}
- return if voo&.hide?(:save_button)
-
- add_class opts, "submit-button btn-sm mr-3 _update-history-pills"
- opts[:text] ||= "Save"
- opts["data-cy"] = "save"
- submit_button opts
- end
-
- # @param opts [Hash]
- # @option close [:modal, :overlay]
- #
- def standard_save_and_close_button opts={}
- close = opts.delete(:close) || :modal
- text = opts[:text] || "Save and Close"
- add_class opts, "submit-button btn-sm mr-3 _close-on-success"
- add_class opts, "_update-origin" unless opts[:no_origin_update]
- opts.reverse_merge! text: text, "data-cy": "submit-#{close}"
-
- submit_button opts
- end
-
- def standard_cancel_button args={}
- args.reverse_merge! class: "cancel-button ml-4", href: path, "data-cy": "cancel"
- cancel_button args
- end
-
- def modal_cancel_button
- modal_close_button "Cancel", situation: "secondary", class: "btn-sm cancel-button"
- end
-
- def edit_cancel_button
- modal_cancel_button
- end
-
- def new_cancel_button
- voo.show?(:cancel_button) && modal_cancel_button
- end
-
- def delete_button opts={}
- return unless card.real?
-
- link_to "Delete", delete_button_opts(opts)
- end
-
- def delete_button_opts opts={}
- add_class opts, "slotter btn btn-outline-danger ml-auto btn-sm"
- opts["data-confirm"] = delete_confirm opts
- opts[:path] = { action: :delete }
- opts[:path][:success] = delete_success(opts)
- opts[:remote] = true
- opts
- end
-
- def delete_confirm opts
- opts.delete(:confirm) || "Are you sure you want to delete #{safe_name}?"
- end
-
- def delete_success opts
- if opts[:success]
- opts.delete :success
- elsif main?
- { redirect: true, mark: "*previous" }
- else
- { view: :just_deleted }
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/form_buttons.rb ~~
diff --git a/set/mod011-edit/all/form_elements.rb b/set/mod011-edit/all/form_elements.rb
deleted file mode 100644
index 8d89293..0000000
--- a/set/mod011-edit/all/form_elements.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (FormElements)
-#
-module FormElements;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/form_elements.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def success_tags opts
- return "" unless opts.present?
-
- hidden_tags success: opts
- end
-
- # convert hash into a collection of hidden tags
- def hidden_tags hash, base=nil
- hash ||= {}
- hash.inject("") do |result, (key, val)|
- new_base = base ? "#{base}[#{key}]" : key
- result + process_hidden_value(val, new_base)
- end
- end
-
- def process_hidden_value val, base
- case val
- when Hash
- hidden_tags val, base
- when Array
- base += "[]"
- val.map do |v|
- hidden_field_tag base, v
- end.join
- else
- hidden_field_tag base, val
- end
- end
-
- FIELD_HELPERS =
- %w[
- hidden_field color_field date_field datetime_field datetime_local_field
- email_field month_field number_field password_field phone_field
- range_field search_field telephone_field text_area text_field time_field
- url_field week_field file_field label check_box radio_button
- ].freeze
-
- FIELD_HELPERS.each do |method_name|
- define_method(method_name) do |*args|
- form.send(method_name, *args)
- end
- end
-
- def submit_button args={}
- text = args.delete(:text) || "Submit"
- args.reverse_merge! situation: "primary", data: {}
- args[:data][:disable_with] ||= args.delete(:disable_with) || "Submitting"
- button_tag text, args
- end
-
- # redirect to *previous if no :href is given
- def cancel_button args={}
- return unless voo.show? :cancel_button
-
- text = args.delete(:text) || "Cancel"
- add_class args, "btn btn-#{args.delete(:situation) || 'secondary'}"
- add_class args, cancel_strategy(args[:redirect], args[:href])
- args[:href] ||= path_to_previous
- args["data-remote"] = true
- link_to text, args
- end
-
- def cancel_strategy redirect, href
- redirect = href.blank? if redirect.nil?
- redirect ? "redirecter" : "slotter"
- end
-
- def path_to_previous
- path mark: "*previous"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/form_elements.rb ~~
diff --git a/set/mod011-edit/all/formgroup.rb b/set/mod011-edit/all/formgroup.rb
deleted file mode 100644
index 93cd0fe..0000000
--- a/set/mod011-edit/all/formgroup.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Formgroup)
-#
-module Formgroup;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/formgroup.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # a formgroup has a label, an input and help text
- def formgroup title, opts={}, &block
- wrap_with :div, formgroup_div_args(opts[:class]) do
- formgroup_body title, opts, &block
- end
- end
-
- def formgroup_body title, opts, &block
- label = formgroup_label opts[:input], title
- editor_body = editor_wrap opts[:input], &block
- help_text = formgroup_help_text opts[:help]
- "#{label}#{help_text} #{editor_body}
"
- end
-
- def formgroup_label input, title
- return if voo&.hide?(:title) || title.blank?
-
- label_type = input || :content
- form.label label_type, title
- end
-
- def formgroup_div_args html_class
- div_args = { class: ["form-group", html_class].compact.join(" ") }
- div_args[:card_id] = card.id if card.real?
- div_args[:card_name] = h card.name if card.name.present?
- div_args
- end
-
- def formgroup_help_text text=nil
- return "" if text == false
-
- class_up "help-text", "help-block"
- voo.help = text if voo && text.to_s != "true"
- _render_help
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/formgroup.rb ~~
diff --git a/set/mod011-edit/all/new.rb b/set/mod011-edit/all/new.rb
deleted file mode 100644
index b228c6b..0000000
--- a/set/mod011-edit/all/new.rb
+++ /dev/null
@@ -1,195 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (New)
-#
-module New;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/new.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- delegate :autoname?, to: :card
-
- view :new, perms: :create, unknown: true, cache: :never do
- new_view_frame_and_form new_form_opts
- end
-
- view :new_content_form, wrap: :slot, unknown: true, cache: :never do
- with_nest_mode :edit do
- create_form
- end
- end
-
- view :new_in_modal, perms: :create, unknown: true, cache: :never,
- wrap: { modal: { footer: "", size: :edit_modal_size,
- title: :new_in_modal_title,
- menu: :new_modal_menu } } do
- _render_new_content_form
- end
-
- def create_form
- form_opts = new_in_modal_form_opts.reverse_merge(success: new_in_modal_success)
- buttons = form_opts.delete(:buttons) || _render_new_buttons
-
- voo.title ||= new_view_title if new_name_prompt?
- voo.show :help
- card_form(:create, form_opts) do
- create_form_with_alert_guide buttons
- end
- end
-
- def new_modal_size
- :large
- end
-
- def new_modal_menu
- wrap_with_modal_menu do
- [close_modal_window, render_bridge_link]
- end
- end
-
- def new_view_frame_and_form form_opts={}
- buttons = form_opts.delete(:buttons) || _render_new_buttons
- form_opts = form_opts.reverse_merge(success: new_success)
-
- with_nest_mode :edit do
- voo.title ||= new_view_title if new_name_prompt?
- voo.show :help
- frame_and_form :create, form_opts do
- create_form_with_alert_guide buttons
- end
- end
- end
-
- def create_form_with_alert_guide buttons
- wrap_with :div, class: "d-flex justify-content-between" do
- [(wrap_with(:div, class: "w-100") do
- [
- new_view_hidden,
- new_view_name,
- new_view_type,
- _render_content_formgroups,
- buttons
- ]
- end),
- (alert_guide if voo.show?(:guide))]
- end
- end
-
- def new_view_hidden; end
-
- def new_in_modal_form_opts
- { "data-slot-selector": "modal-origin", "data-slot-error-selector": ".card-slot",
- buttons: _render_new_in_modal_buttons }
- end
-
- def new_form_opts
- { "data-main-success": JSON(redirect: true) }
- end
-
- def new_view_title
- output(
- "New",
- (card.type_name unless card.type_id == Card.default_type_id)
- )
- end
-
- def new_in_modal_title
- new_name_prompt? ? new_view_title : render_title
- end
-
- def new_success
- { mark: (card.rule(:thanks) || "_self") }
- end
-
- def new_in_modal_success; end
-
- # NAME HANDLING
-
- def new_view_name
- if new_name_prompt?
- new_name_formgroup
- elsif !autoname?
- hidden_field_tag "card[name]", card.name
- end
- end
-
- def new_name_formgroup
- output _render_name_formgroup,
- hidden_field_tag("name_prompt", true)
- end
-
- def new_name_prompt?
- voo.visible? :name_formgroup do
- needs_name? || params[:name_prompt]
- end
- end
-
- def needs_name?
- card.name.blank? && !autoname?
- end
-
- # TYPE HANDLING
-
- def new_view_type
- if new_type_prompt?
- _render_new_type_formgroup
- else
- hidden_field_tag "card[type_id]", card.type_id
- end
- end
-
- def new_type_prompt?
- voo.visible? :new_type_formgroup do
- !new_type_preset? && new_type_prompt_context? && new_type_permitted?
- end
- end
-
- def new_type_preset?
- params[:type] || voo.type
- end
-
- def new_type_prompt_context?
- main? || card.simple? || card.is_template?
- end
-
- def new_type_permitted?
- Card.new(type_id: card.type_id).ok? :create
- end
-
- view :new_type_formgroup do
- wrap_type_formgroup do
- type_field class: "type-field live-type-field",
- href: path(view: :new),
- "data-remote" => true
- end
- end
-
- view :new_buttons do
- button_formgroup do
- [standard_create_button, standard_cancel_button(cancel_button_new_args)]
- end
- end
-
- view :new_in_modal_buttons do
- button_formgroup do
- wrap_with "div", class: "d-flex" do
- [standard_save_and_close_button(text: "Submit"), modal_cancel_button]
- end
- end
- end
-
- # path to redirect to after canceling a new form
- def cancel_button_new_args
- href = case
- when main? then path_to_previous
- when voo&.home_view then path(view: voo.home_view)
- else path(view: :unknown)
- end
- { href: href }
- end
-
- def standard_create_button
- submit_button class: "submit-button create-submit-button"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/new.rb ~~
diff --git a/set/mod011-edit/all/overlay_guide.rb b/set/mod011-edit/all/overlay_guide.rb
deleted file mode 100644
index 909fcd4..0000000
--- a/set/mod011-edit/all/overlay_guide.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (OverlayGuide)
-#
-module OverlayGuide;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/overlay_guide.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :overlay_guide,
- cache: :never, unknown: true, template: :haml,
- wrap: { slot: { class: "_overlay d0-card-overlay card nodblclick" } } do
- # TODO: use a common template for this and the nest editor
- # (the common thing is that they both are an overlay of the bridge sidebar)
- # and maybe make it look more like the overlay on the left with the same close icon
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/overlay_guide.rb ~~
diff --git a/set/mod011-edit/all/template_nest.rb b/set/mod011-edit/all/template_nest.rb
deleted file mode 100644
index 3d4162b..0000000
--- a/set/mod011-edit/all/template_nest.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (TemplateNest)
-#
-module TemplateNest;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/all/template_nest.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :template_nest, cache: :never, unknown: true do
- return "" unless voo.nest_name
-
- if voo.nest_name.to_name.field_only?
- with_nest_mode :normal do
- nest template_link_set_name, view: :template_link
- end
- else
- "{{#{voo.nest_syntax}}}"
- end
- end
-
- def template_link_set_name
- name = voo.nest_name.to_name
- if name.absolute?
- name.trait_name :self
- else
- template_link_set_name_for_relative_name name
- end
- end
-
- def template_link_set_name_for_relative_name name
- name = name.stripped.gsub(/^\+/, "")
-
- if (type = on_type_set)
- [type, name].to_name.trait_name :type_plus_right
- else
- name.to_name.trait_name :right
- end
- end
-
- def on_type_set
- return unless
- (tmpl_set_name = parent.card.name.trunk_name) &&
- (tmpl_set_class_name = tmpl_set_name.tag_name) &&
- (tmpl_set_class_card = Card[tmpl_set_class_name]) &&
- (tmpl_set_class_card.codename == :type)
-
- tmpl_set_name.left_name
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/all/template_nest.rb ~~
diff --git a/set/mod011-edit/right/input_type.rb b/set/mod011-edit/right/input_type.rb
deleted file mode 100644
index c79ca07..0000000
--- a/set/mod011-edit/right/input_type.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+InputType" cards
-#
-module InputType;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/right/input_type.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def quick_editor
- @submit_on_change = true
- super
- end
-
- def quick_form_opts
- super.merge "data-update-foreign-slot":
- ".card-slot.quick_edit-view.RIGHT-Xcontent_option_view"
- end
-
- def default_input_type
- :radio
- end
-
- def raw_help_text
- "edit interface for list cards"
- end
-
- # def option_label_text option_name
- # super.downcase
- # end
-
- def quick_edit
- card.left.prototype_default_card.try(:show_input_type?) ? super : ""
- end
-end
-
-def option_names
- left.prototype_default_card&.try(:input_type_content_options) || super
-end
-
-def supports_content_option_view?
- item_name.in? ["checkbox", "radio", "filtered list"]
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/right/input_type.rb ~~
diff --git a/set/mod011-edit/self/input_type.rb b/set/mod011-edit/self/input_type.rb
deleted file mode 100644
index 8ea8b27..0000000
--- a/set/mod011-edit/self/input_type.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "InputType"
-#
-module InputType;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/self/input_type.rb"; end
-setting_opts group: :editing,
- position: 3,
- rule_type_editable: false,
- short_help_text: "edit interface"
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def raw_help_text
- "Configure [[https://ace.c9.io/|ace]], "\
- "Decko's default code editor, using these available "\
- "[[https://github.com/ajaxorg/ace/wiki/Configuring-Ace|options]]."
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/self/input_type.rb ~~
diff --git a/set/mod011-edit/type/list.rb b/set/mod011-edit/type/list.rb
deleted file mode 100644
index aec948b..0000000
--- a/set/mod011-edit/type/list.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "List" cards
-#
-module List;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/type/list.rb"; end
-def input_type_content_options
- ["multiselect", "checkbox", "autocompleted list", "filtered list"]
-end
-
-def show_content_options?
- true
-end
-
-def show_input_type?
- true
-end
-
-def field_settings
- %i[default help input_type content_options content_option_view]
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/type/list.rb ~~
diff --git a/set/mod011-edit/type/plain_text.rb b/set/mod011-edit/type/plain_text.rb
deleted file mode 100644
index 8374258..0000000
--- a/set/mod011-edit/type/plain_text.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "PlainText" cards
-#
-module PlainText;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/type/plain_text.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type_content_options
- ["text area", "text field", "ace editor"]
- end
-end
-
-def field_settings
- %i[default help input_type]
-end
-
-def show_input_type?
- true
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/type/plain_text.rb ~~
diff --git a/set/mod011-edit/type/pointer.rb b/set/mod011-edit/type/pointer.rb
deleted file mode 100644
index 9a51516..0000000
--- a/set/mod011-edit/type/pointer.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Pointer" cards
-#
-module Pointer;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/edit/set/type/pointer.rb"; end
-def show_content_options?
- true
-end
-
-def show_input_type?
- true
-end
-
-def input_type_content_options
- %w[select radio autocomplete]
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/edit/set/type/pointer.rb ~~
diff --git a/set/mod012-history/all/history.rb b/set/mod012-history/all/history.rb
deleted file mode 100644
index 71bc9d5..0000000
--- a/set/mod012-history/all/history.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (History)
-#
-module History;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history.rb"; end
-event :update_ancestor_timestamps, :integrate do
- ids = history_ancestor_ids
- return unless ids.present?
-
- Card.where(id: ids).update_all(updater_id: Auth.current_id, updated_at: Time.now)
- ids.map { |anc_id| Card.expire anc_id.cardname }
-end
-
-# track history (acts, actions, changes) on this card
-def history?
- true
-end
-
-# all cards whose acts are considered part of this card's history
-def history_card_ids
- nestee_ids << id
-end
-
-# all cards who are considered updated if this card's was updated
-def history_parent_ids
- nester_ids
-end
-
-def history_ancestor_ids recursion_level=0
- return [] if recursion_level > 5
-
- ids = history_parent_ids +
- history_parent_ids.map { |id| Card[id].history_ancestor_ids(recursion_level + 1) }
- ids.flatten
-end
-
-# ~~FIXME~~: optimize (no need to instantiate all actions and changes!)
-# Nothing is instantiated here. ActiveRecord is much smarter than you think.
-# Methods like #empty? and #size make sql queries if their receivers are not already
-# loaded -pk
-def first_change?
- # = update or delete
- @current_action.action_type != :create && action_count == 2 &&
- create_action.card_changes.empty?
-end
-
-def first_create?
- @current_action.action_type == :create && action_count == 1
-end
-
-def action_count
- Card::Action.where(card_id: @current_action.card_id).count
-end
-
-# card has account that is responsible for prior acts
-def has_edits?
- Card::Act.where(actor_id: id).where("card_id IS NOT NULL").present?
-end
-
-def changed_fields
- Card::Change::TRACKED_FIELDS & (changed_attribute_names_to_save | saved_changes.keys)
-end
-
-def nestee_ids
- requiring_id { @nestee_ids ||= nesting_ids(:referee_id, :referer_id) }
-end
-
-def nester_ids
- requiring_id { @nester_ids ||= nesting_ids(:referer_id, :referee_id) }
-end
-
-def diff_args
- { diff_format: :text }
-end
-
-# Delete all changes and old actions and make the last action the create action
-# (that way the changes for that action will be created with the first update)
-def make_last_action_the_initial_action
- delete_all_changes
- old_actions.delete_all
- last_action.update! action_type: :create
-end
-
-def clear_history
- delete_all_changes
- delete_old_actions
-end
-
-def delete_old_actions
- old_actions.delete_all
-end
-
-def delete_all_changes
- Card::Change.where(card_action_id: all_action_ids).delete_all
-end
-
-def save_content_draft content
- super
- acts.create do |act|
- act.ar_actions.build(draft: true, card_id: id, action_type: :update)
- .card_changes.build(field: :db_content, value: content)
- end
-end
-
-private
-
-def nesting_ids return_field, where_field
- Card::Reference.select(return_field).distinct.where(
- ref_type: "I", where_field => id
- ).pluck(return_field).compact
-end
-
-def requiring_id
- id ? yield : (return [])
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history.rb ~~
diff --git a/set/mod012-history/all/history/act_listing.rb b/set/mod012-history/all/history/act_listing.rb
deleted file mode 100644
index 06536ac..0000000
--- a/set/mod012-history/all/history/act_listing.rb
+++ /dev/null
@@ -1,136 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module History;
-# Set: All cards (History, ActListing)
-#
-module ActListing;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history/act_listing.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def act_from_context
- if (act_id = params["act_id"])
- Act.find(act_id) || raise(Card::NotFound, "act not found")
- else
- card.last_action.act
- end
- end
-
- # used (by history and recent)for rendering act lists with legend and paging
- #
- # @param acts [ActiveRecord::Relation] relation that will return acts objects
- # @param context [Symbol] :relative or :absolute
- # @param draft_legend [Symbol] :show or :hide
- def acts_layout acts, context, draft_legend=:hide
- bs_layout container: false, fluid: false do
- html _render_act_legend(draft_legend => :draft_legend)
- row(12) { act_list acts, context }
- row(12) { act_paging acts, context }
- end
- end
-
- def act_list acts, context
- act_accordion acts, context do |act, seq|
- fmt = context == :relative ? self : act.card.format(:html)
- fmt.act_listing act, seq, context
- end
- end
-
- def act_listing act, seq=nil, context=nil
- opts = act_listing_opts_from_params(seq)
- opts[:slot_class] = "revision-#{act.id} history-slot list-group-item"
- context ||= (params[:act_context] || :absolute).to_sym
- act_renderer(context).new(self, act, opts).render
- end
-
- # TODO: consider putting all these under one top-level param, eg:
- # act: { seq: X, diff: [show/hide], action_view: Y }
- def act_listing_opts_from_params seq
- { act_seq: (seq || params["act_seq"]),
- action_view: (params["action_view"] || "summary").to_sym,
- hide_diff: params["hide_diff"].to_s.strip == "true" }
- end
-
- def act_accordion acts, context, &block
- accordion_group acts_for_accordion(acts, context, &block), nil, class: "clear-both"
- end
-
- def acts_for_accordion acts, context
- clean_acts(current_page_acts(acts)).map do |act|
- with_act_seq(context, acts) do |seq|
- yield act, seq
- end
- end
- end
-
- def with_act_seq context, acts
- yield(context == :absolute ? nil : current_act_seq(acts))
- end
-
- def current_act_seq acts
- @act_seq = @act_seq ? (@act_seq -= 1) : act_list_starting_seq(acts)
- end
-
- def clean_acts acts
- # FIXME: if we get rid of bad act data, this will not be necessary
- # The current
- acts.select(&:card)
- end
-
- def current_page_acts acts
- acts.page(acts_page_from_params).per acts_per_page
- end
-
- def act_list_starting_seq acts
- acts.size - (acts_page_from_params - 1) * acts_per_page
- end
-
- def acts_per_page
- @acts_per_page ||= Card.config.acts_per_page || 10
- end
-
- def acts_page_from_params
- @acts_page_from_params ||= params["page"].present? ? params["page"].to_i : 1
- end
-
- def act_paging acts, context
- return unless controller.request # paginate requires a request
-
- wrap_with :div, class: "slotter btn-sm" do
- paginate current_page_acts(acts), act_paging_opts(context)
- end
- end
-
- def act_paging_opts context
- { remote: true, theme: "twitter-bootstrap-4" }.tap do |opts|
- opts[:total_pages] = 10 if limited_paging? context
- end
- end
-
- def limited_paging? context
- context == :absolute && Act.count > 1000
- end
-
- def action_icon action_type, extra_class=nil
- icon = case action_type
- when :create then :add_circle
- when :update then :pencil
- when :delete then :remove_circle
- when :draft then :wrench
- end
- icon_tag icon, extra_class
- end
-
- private
-
- def act_renderer context
- case context
- when :absolute
- Act::ActRenderer::AbsoluteActRenderer
- when :bridge
- Act::ActRenderer::BridgeActRenderer
- else # relative
- Act::ActRenderer::RelativeActRenderer
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history/act_listing.rb ~~
diff --git a/set/mod012-history/all/history/actions.rb b/set/mod012-history/all/history/actions.rb
deleted file mode 100644
index cb53cb9..0000000
--- a/set/mod012-history/all/history/actions.rb
+++ /dev/null
@@ -1,137 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module History;
-# Set: All cards (History, Actions)
-#
-# -*- encoding : utf-8 -*-
-module Actions;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history/actions.rb"; end
-
-def all_action_ids
- Card::Action.where(card_id: id).pluck :id
-end
-
-def action_from_id action_id
- return unless action_id.is_a?(Integer) || action_id =~ /^\d+$/
-
- # if not an integer, action_id is probably a mod (e.g. if you request
- # files/:logo/standard.png)
-
- action_if_on_self Action.fetch(action_id)
-end
-
-def action_if_on_self action
- return unless action.is_a? Action
-
- action if action.card_id == id
-end
-
-def old_actions
- actions.where("id != ?", last_action_id)
-end
-
-def create_action
- @create_action ||= actions.first
-end
-
-def nth_action index
- index = index.to_i
- return unless id && index.positive?
-
- Action.where("draft is not true AND card_id = #{id}")
- .order(:id).limit(1).offset(index - 1).first
-end
-
-def new_content_action_id
- return unless @current_action && current_action_changes_content?
-
- @current_action.id
-end
-
-def current_action_changes_content?
- new_card? || @current_action.new_content? || db_content_is_changing?
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def action_from_context
- if (action_id = voo.action_id || params[:action_id])
- Action.fetch action_id
- else
- card.last_action
- end
- end
-
- def action_content action, view_type
- return "" unless action.present?
-
- wrap do
- [action_content_toggle(action, view_type),
- content_diff(action, view_type)]
- end
- end
-
- def content_diff action, view_type
- diff = action.new_content? && content_changes(action, view_type)
- return "empty " unless diff.present?
-
- diff
- end
-
- def action_content_toggle action, view_type
- return unless show_action_content_toggle?(action, view_type)
-
- toggle_action_content_link action, view_type
- end
-
- def show_action_content_toggle? action, view_type
- view_type == :expanded || action.summary_diff_omits_content?
- end
-
- def toggle_action_content_link action, view_type
- other_view_type = view_type == :expanded ? :summary : :expanded
- css_class = "revision-#{action.card_act_id} float-right"
- link_to_view "action_#{other_view_type}",
- icon_tag(action_arrow_dir(view_type), class: "md-24"),
- class: css_class,
- path: { action_id: action.id, look_in_trash: true }
- end
-
- def action_arrow_dir view_type
- view_type == :expanded ? :triangle_left : :triangle_right
- end
-
- def revert_actions_link link_text, path_args, html_args={}
- return unless card.ok? :update
-
- path_args.reverse_merge! action: :update, look_in_trash: true, assign: true,
- card: { skip: :validate_renaming }
- html_args.reverse_merge! remote: true, method: :post, rel: "nofollow", path: path_args
- add_class html_args, "slotter"
- link_to link_text, html_args
- end
-
- def action_legend
- types = %i[create update delete]
- legend = types.map do |action_type|
- "#{action_icon(action_type)} #{action_type}d"
- end
- legend << _render_draft_legend if voo.show?(:draft_legend)
- "Actions: #{legend.join ' | '} "
- end
-
- def content_legend
- legend = [Card::Content::Diff.render_added_chunk("Additions"),
- Card::Content::Diff.render_deleted_chunk("Subtractions")]
- "Content changes: #{legend.join ' | '} "
- end
-
- def content_changes action, diff_type, hide_diff=false
- if hide_diff
- action.raw_view
- else
- action.content_diff diff_type
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history/actions.rb ~~
diff --git a/set/mod012-history/all/history/acts.rb b/set/mod012-history/all/history/acts.rb
deleted file mode 100644
index c2d7131..0000000
--- a/set/mod012-history/all/history/acts.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module History;
-# Set: All cards (History, Acts)
-#
-# all acts with actions on self and on cards included in self (ie, acts shown in history)
-module Acts;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history/acts.rb"; end
-def history_acts
- @history_acts ||= Act.all_with_actions_on(history_card_ids, true).order id: :desc
-end
-
-def draft_acts
- drafts.created_by(Card::Auth.current_id).map(&:act)
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history/acts.rb ~~
diff --git a/set/mod012-history/all/history/events.rb b/set/mod012-history/all/history/events.rb
deleted file mode 100644
index c63e153..0000000
--- a/set/mod012-history/all/history/events.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module History;
-# Set: All cards (History, Events)
-#
-# must be called on all actions and before :set_name, :process_subcards and
-module Events;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history/events.rb"; end
-# :validate_delete_children
-event :assign_action, :initialize, when: :actionable? do
- act = director.need_act
- @current_action = Card::Action.create(
- card_act_id: act.id,
- action_type: action,
- draft: (Env.params["draft"] == "true")
- )
- if @supercard && @supercard != self
- @current_action.super_action = @supercard.current_action
- end
-end
-
-# can we store an action? (can be overridden, eg in files)
-def actionable?
- history?
-end
-
-event :detect_conflict, :validate, on: :update, when: :edit_conflict? do
- errors.add :conflict, Cardio.t(:history_error_not_latest_revision)
-end
-
-def edit_conflict?
- last_action_id_before_edit &&
- last_action_id_before_edit.to_i != last_action_id &&
- (la = last_action) &&
- la.act.actor_id != Auth.current_id
-end
-
-# stores changes in the changes table and assigns them to the current action
-# removes the action if there are no changes
-event :finalize_action, :finalize, when: :finalize_action? do
- if changed_fields.present?
- @current_action.update! card_id: id
-
- # NOTE: #last_change_on uses the id to sort by date
- # so the changes for the create changes have to be created before the first change
- store_card_changes_for_create_action if first_change?
- store_card_changes unless first_create?
- # FIXME: a `@current_action.card` call here breaks specs in solid_cache_spec.rb
- elsif @current_action.card_changes.reload.empty?
- @current_action.delete
- @current_action = nil
- end
-end
-
-# changes for the create action are stored after the first update
-def store_card_changes_for_create_action
- Card::Action.cache.delete "#{create_action.id}-changes"
- store_each_history_field create_action.id do |field|
- attribute_before_act field
- end
-end
-
-def store_card_changes
- store_each_history_field @current_action.id, changed_fields do |field|
- self[field]
- end
-end
-
-def store_each_history_field action_id, fields=nil
- fields ||= Card::Change::TRACKED_FIELDS
- if false # Card::Change.supports_import?
- # attach.feature fails with this
- values = fields.map.with_index { |field, index| [index, yield(field), action_id] }
- Card::Change.import %i[field value card_action_id], values # , validate: false
- else
- fields.each do |field|
- Card::Change.create field: field,
- value: yield(field),
- card_action_id: action_id
- end
- end
-end
-
-def finalize_action?
- actionable? && current_action
-end
-
-event :rollback_actions, :prepare_to_validate, on: :update, when: :rollback_request? do
- update_args = process_revert_actions
- Env.params["revert_actions"] = nil
- update! update_args
- clear_drafts
- abort :success
-end
-
-event :finalize_act, after: :finalize_action, when: :act_card? do
- Card::Director.act.update! card_id: id
-end
-
-event :remove_empty_act, :integrate_with_delay_final, when: :remove_empty_act? do
- # Card::Director.act.delete
- # Card::Director.act = nil
-end
-
-def remove_empty_act?
- act_card? && Director.act&.ar_actions&.reload&.empty?
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history/events.rb ~~
diff --git a/set/mod012-history/all/history/last.rb b/set/mod012-history/all/history/last.rb
deleted file mode 100644
index 62639ce..0000000
--- a/set/mod012-history/all/history/last.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module History;
-# Set: All cards (History, Last)
-#
-module Last;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history/last.rb"; end
-def acted_at
- last_act.acted_at
-end
-
-def revised_at
- (last_action && (act = last_action.act) && act.acted_at) || Time.zone.now
-end
-
-def last_change_on field, opts={}
- action_id = extract_action_id(opts[:before] || opts[:not_after])
-
- # If there is only one action then there are no entries in the changes table,
- # so we can't do a sql search but the changes are accessible via the action.
- if no_last_change? action_id, opts[:before]
- nil
- elsif create_action_last_change? action_id
- create_action&.change field
- else
- last_change_from_action_id action_id, field, opts
- end
-end
-
-def no_last_change? action_id, before
- before && action_id == create_action.id
-end
-
-def create_action_last_change? action_id
- action_id == create_action&.id || (!action_id && create_action&.sole?)
-end
-
-def last_change_from_action_id action_id, field, opts
- Change.joins(:action).where(
- last_change_sql_conditions(opts),
- card_id: id,
- action_id: action_id,
- field: Card::Change.field_index(field)
- ).order(:id).last
-end
-
-def last_change_sql_conditions opts
- cond = "card_actions.card_id = :card_id AND field = :field"
- cond += " AND (draft is not true)" unless opts[:including_drafts]
- operator = "<" if opts[:before]
- operator = "<=" if opts[:not_after]
- cond += " AND card_action_id #{operator} :action_id" if operator
- cond
-end
-
-def last_action_id
- last_action&.id
-end
-
-def last_action
- actions.where("id IS NOT NULL").last
-end
-
-def last_content_action
- last_change_on(:db_content)&.action
-end
-
-def last_content_action_id
- last_change_on(:db_content)&.card_action_id
-end
-
-def last_actor
- last_act.actor
-end
-
-def last_act
- @last_act ||=
- if (action = last_action)
- last_act_on_self = acts.last
- act_of_last_action = action.act
- return act_of_last_action unless last_act_on_self
- return last_act_on_self unless act_of_last_action
-
- return last_act_on_self if act_of_last_action == last_act_on_self
-
- if last_act_on_self.acted_at > act_of_last_action.acted_at
- last_act_on_self
- else
- act_of_last_action
- end
- end
-end
-
-def previous_action action_id
- return unless action_id
-
- action_index = actions.find_index { |a| a.id == action_id }
- all_actions[action_index - 1] if action_index.to_i.nonzero?
-end
-
-private
-
-def extract_action_id action_arg
- action_arg.is_a?(Card::Action) ? action_arg.id : action_arg
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history/last.rb ~~
diff --git a/set/mod012-history/all/history/revision.rb b/set/mod012-history/all/history/revision.rb
deleted file mode 100644
index 4fccdca..0000000
--- a/set/mod012-history/all/history/revision.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module History;
-# Set: All cards (History, Revision)
-#
-module Revision;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history/revision.rb"; end
-def revision action, before_action=false
- # a "revision" refers to the state of all tracked fields
- # at the time of a given action
- action = Card::Action.fetch(action) if action.is_a? Integer
- return unless action
-
- if before_action
- revision_before_action action
- else
- revision_attributes action
- end
-end
-
-def revision_attributes action
- Card::Change::TRACKED_FIELDS.each_with_object({}) do |field, attr_changes|
- last_change = action.change(field) || last_change_on(field, not_after: action)
- attr_changes[field.to_sym] = (last_change ? last_change.value : self[field])
- end
-end
-
-def revision_before_action action
- if (prev_action = action.previous_action)
- revision prev_action
- else
- { trash: true }
- end
-end
-
-def rollback_request?
- history? && actions_to_revert.any?
-end
-
-def process_revert_actions revert_actions=nil
- revert_actions ||= actions_to_revert
- update_args = { subcards: {} }
- reverting_to_previous = Env.params["revert_to"] == "previous"
- revert_actions.each do |action|
- merge_revert_action! action, update_args, reverting_to_previous
- end
- update_args
-end
-
-def actions_to_revert
- if (act_id = Env.params["revert_act"])
- Act.find(act_id).actions
- else
- explicit_actions_to_revert
- end
-end
-
-def explicit_actions_to_revert
- Array.wrap(Env.params["revert_actions"]).map do |a_id|
- Action.fetch(a_id) || nil
- end.compact
-end
-
-def merge_revert_action! action, update_args, reverting_to_previous
- rev = action.card.revision(action, reverting_to_previous)
- rev.delete :name unless rev[:name] # handles null name field in compound cards
- if action.card_id == id
- update_args.merge! rev
- else
- update_args[:subcards][action.card.name] = rev
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history/revision.rb ~~
diff --git a/set/mod012-history/all/history/selected.rb b/set/mod012-history/all/history/selected.rb
deleted file mode 100644
index cbaecec..0000000
--- a/set/mod012-history/all/history/selected.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module History;
-# Set: All cards (History, Selected)
-#
-# if these aren't in a nested module, the methods just overwrite the base
-# methods, but we need a distinct module so that super will be able to refer to
-module Selected;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history/selected.rb"; end
-# the base methods.
-def content
- @selected_action_id ? selected_content : super
-end
-
-def content= value
- @selected_content = nil
- super
-end
-
-def select_action_by_params params
- action = nth_action(params[:rev]) || action_from_id(params[:rev_id])
- return unless action
-
- select_action action.id
-end
-
-def select_action action_id
- run_callbacks :select_action do
- self.selected_action_id = action_id
- end
-end
-
-def selected_action_id
- @selected_action_id || @current_action&.id || last_action_id
-end
-
-def selected_action_id= action_id
- @selected_content = nil
- @selected_action_id = action_id
-end
-
-def selected_action
- selected_action_id && Action.fetch(selected_action_id)
-end
-
-def selected_content
- @selected_content ||= content_at_time_of_selected_action || db_content
-end
-
-def content_at_time_of_selected_action
- last_change_on(:db_content, not_after: selected_action_id,
- including_drafts: true)&.value
-end
-
-def with_selected_action_id action_id
- current_action_id = @selected_action_id
- select_action_id action_id
- result = yield
- select_action_id current_action_id
- result
-end
-
-def select_action_id action_id
- run_callbacks :select_action do
- self.selected_action_id = action_id
- end
-end
-
-def selected_content_action_id
- @selected_action_id || new_content_action_id || last_content_action_id
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history/selected.rb ~~
diff --git a/set/mod012-history/all/history/views.rb b/set/mod012-history/all/history/views.rb
deleted file mode 100644
index a673d2c..0000000
--- a/set/mod012-history/all/history/views.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module History;
-# Set: All cards (History, Views)
-#
-# History views
-module Views;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history/views.rb"; end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :history, cache: :never do
- frame do
- class_up "d0-card-body", "history-slot"
- acts_layout card.history_acts, :relative, :show
- end
- end
-
- view :act, cache: :never do
- act_listing act_from_context
- end
-
- view :act_legend do
- bs_layout do
- row md: [12, 12], lg: [7, 5] do
- col action_legend
- col content_legend, class: "text-right"
- end
- end
- end
-
- view :draft_legend do
- "#{action_icon(:draft)} unsaved draft"
- end
-
- view :action_summary do
- action_content action_from_context, :summary
- end
-
- view :action_expanded do
- action_content action_from_context, :expanded
- end
-
- view :change do
- voo.show :title_link
- voo.hide :menu
- wrap do
- [_render_title,
- _render_menu,
- _render_last_action]
- end
- end
-
- view :last_action do
- %(
-
- #{render_last_action_verb} #{render_acted_at} ago by
- #{nest card.last_actor, view: :link}
-
- )
- end
-
- view :last_action_verb, cache: :never do
- return unless (act = card.last_act)
- return unless (action = act.action_on card.id)
-
- case action.action_type
- when :create then "added"
- when :delete then "deleted"
- else
- link_to_view :history, "edited", class: "last-edited", rel: "nofollow"
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history/views.rb ~~
diff --git a/set/mod012-history/all/history_bridge.rb b/set/mod012-history/all/history_bridge.rb
deleted file mode 100644
index 8334054..0000000
--- a/set/mod012-history/all/history_bridge.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (HistoryBridge)
-#
-module HistoryBridge;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/history/set/all/history_bridge.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :creator_credit,
- wrap: { div: { class: "text-muted creator-credit" } }, cache: :never do
- return "" unless card.real?
-
- "Created by #{nest card.creator, view: :link} "\
- "#{time_ago_in_words(card.created_at)} ago"
- end
-
- view :updated_by, wrap: { div: { class: "text-muted" } } do
- updaters = Card.search(updater_of: { id: card.id }) if card.id
- return "" unless updaters.present?
-
- links = updater_links updaters, others_target: card.fetch(:editors)
- "Updated by #{links}"
- end
-
- def acts_bridge_layout acts, context=:bridge
- output [
- _render_creator_credit,
- act_link_list(acts, context),
- act_paging(acts, context)
- ]
- end
-
- def act_link_list acts, context
- items = acts_for_accordion(acts, context) do |act, seq|
- act_link_list_item act, seq, context
- end
- bridge_pills items
- end
-
- def act_link_list_item act, seq=nil, _context=nil
- opts = act_listing_opts_from_params(seq)
- opts[:slot_class] = "revision-#{act.id} history-slot nav-item"
- act_renderer(:bridge).new(self, act, opts).bridge_link
- end
-
- def act_list_group acts, context, &block
- list_group acts_for_accordion(acts, context, &block), class: "clear-both"
- end
-
- view :bridge_act, cache: :never do
- opts = act_listing_opts_from_params(nil)
- act = act_from_context
- ar = act_renderer(:bridge).new(self, act, opts)
- class_up "action-list", "my-3"
- wrap_with_overlay title: ar.overlay_title, slot: breadcrumb_data("History") do
- act_listing(act, opts[:act_seq], :bridge)
- end
- end
-
- private
-
- def updater_links updaters, item_view: :link, max_count: 3, others_target: card
- total = updaters.size
- num_to_show = number_of_updaters_to_show total, max_count
-
- links =
- links_to_updaters(updaters, num_to_show, item_view) +
- link_to_other_updaters(total, others_target, num_to_show)
-
- links.to_sentence
- end
-
- def number_of_updaters_to_show total, max_count
- total > max_count ? max_count - 1 : max_count
- end
-
- def links_to_updaters updaters, num_to_show, item_view
- updaters[0..(num_to_show - 1)].map { |c| nest c, view: item_view }
- end
-
- def link_to_other_updaters total, target, num_to_show
- return [] unless total > num_to_show
-
- link_to_card target, "#{total - num_to_show} others"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/history/set/all/history_bridge.rb ~~
diff --git a/set/mod013-carrierwave/abstract/attachment.rb b/set/mod013-carrierwave/abstract/attachment.rb
deleted file mode 100644
index 82e0b56..0000000
--- a/set/mod013-carrierwave/abstract/attachment.rb
+++ /dev/null
@@ -1,144 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Attachment)
-#
-module Attachment;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment.rb"; end
-attr_writer :empty_ok
-
-def self.included host_class
- host_class.extend CarrierWave::CardMount
-end
-
-event :select_file_revision, after: :select_action do
- attachment.retrieve_from_store!(attachment.identifier)
-end
-
-# we need a card id for the path so we have to update db_content when we have
-# an id
-event :correct_identifier, :finalize, on: :create, when: proc { |c| !c.web? } do
- update_column(:db_content, attachment.db_content)
- expire
-end
-
-event :save_original_filename, :prepare_to_store, on: :save, when: :file_ready_to_save? do
- return unless @current_action
-
- @current_action.update! comment: original_filename
-end
-
-event :validate_file_exist, :validate, on: :create do
- return if empty_ok?
-
- if will_be_stored_as == :web
- errors.add "url is missing" if content.blank?
- elsif !attachment.file.present?
- errors.add attachment_name, "is missing"
- end
-end
-
-event :write_identifier, after: :save_original_filename, when: proc { |c| !c.web? } do
- self.content = attachment.db_content
-end
-
-def file_ready_to_save?
- attachment.file.present? &&
- !preliminary_upload? &&
- !save_preliminary_upload? &&
- attachment_is_changing?
-end
-
-# needed for flexmail attachments. hacky.
-def item_names _args={}
- [name]
-end
-
-def original_filename
- return content.split("/").last if web?
-
- attachment.original_filename
-end
-
-def unfilled?
- !attachment.present? && !save_preliminary_upload? && !subcards? && blank_content?
-end
-
-def attachment_changed?
- send "#{attachment_name}_changed?"
-end
-
-def attachment_is_changing?
- send "#{attachment_name}_is_changing?"
-end
-
-def attachment_before_act
- send "#{attachment_name}_before_act"
-end
-
-def create_versions? _new_file
- true
-end
-
-def empty_ok?
- @empty_ok
-end
-
-def assign_set_specific_attributes
- # reset content if we really have something to upload
- self.content = nil if set_specific[attachment_name].present?
- super
-end
-
-def delete_files_for_action action
- with_selected_action_id(action.id) do
- attachment.file.delete
- attachment.versions.each_value do |version|
- version.file.delete
- end
- end
-end
-
-def revision action, before_action=false
- return unless (result = super)
-
- result[:empty_ok] = true
- result
-end
-
-def attachment_format ext
- rescuing_extension_issues do
- return unless ext.present? && original_extension
-
- confirm_original_extension(ext) || detect_extension(ext)
- end
-end
-
-def rescuing_extension_issues
- yield
-rescue StandardError => e
- Rails.logger.info "attachment_format issue: #{e.message}"
- nil
-end
-
-def detect_extension ext
- return unless (mime_types = MIME::Types[attachment.content_type])
-
- recognized_extension?(mime_types, ext) ? ext : mime_types[0].extensions[0]
-end
-
-def recognized_extension? mime_types, ext
- mime_types.find { |mt| mt.extensions.member? ext }
-end
-
-def confirm_original_extension ext
- return unless ["file", original_extension].member? ext
-
- original_extension
-end
-
-def original_extension
- @original_extension ||= attachment&.extension&.sub(/^\./, "")
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment.rb ~~
diff --git a/set/mod013-carrierwave/abstract/attachment/cloud.rb b/set/mod013-carrierwave/abstract/attachment/cloud.rb
deleted file mode 100644
index b5eaf50..0000000
--- a/set/mod013-carrierwave/abstract/attachment/cloud.rb
+++ /dev/null
@@ -1,146 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Attachment;
-# Set: Abstract (Attachment, Cloud)
-#
-module Cloud;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/cloud.rb"; end
-event :change_bucket_if_read_only, :initialize,
- on: :update, when: :change_bucket_if_read_only? do
- @new_storage_type = storage_type_from_config
-end
-
-event :validate_storage_type_update, :validate, on: :update, when: :cloud? do
- # FIXME: make it possible to retrieve the file from cloud storage
- # to store it somewhere else. Currently, it only works to change the
- # storage type if a new file is provided
- # i.e. `update storage_type: :local` fails but
- # `update storage_type: :local, file: [file handle]` is ok
- return unless storage_type_changed? && !attachment_is_changing?
-
- errors.add :storage_type, t(:carrierwave_moving_files_is_not_supported)
-end
-
-def bucket
- @bucket ||= cloud? && (new_card_bucket || bucket_from_content || bucket_from_config)
-end
-
-def new_card_bucket
- return unless new_card?
-
- # If the file is assigned before the bucket option we have to
- # check if there is a bucket options in set_specific.
- # That happens for exmaple when the file appears before the bucket in the
- # options hash:
- # Card.create file: file_handle, bucket: "my_bucket"
- set_specific[:bucket] || set_specific["bucket"] || bucket_from_config
-end
-
-def bucket_config
- @bucket_config ||= load_bucket_config
-end
-
-def load_bucket_config
- return {} unless bucket
-
- bucket_config = Cardio.config.file_buckets&.dig(bucket.to_sym) || {}
- bucket_config.symbolize_keys!
- bucket_config[:credentials]&.symbolize_keys!
- # we don't want :attributes hash symbolized, so we can't use
- # deep_symbolize_keys
- ensure_bucket_config do
- load_bucket_config_from_env bucket_config
- end
-end
-
-def ensure_bucket_config
- yield.tap do |config|
- require_configuration! config
- require_credentials! config
- end
-end
-
-def require_configuration! config
- cant_find_in_bucket! "configuration" unless config.present?
-end
-
-def require_credentials! config
- cant_find_in_bucket! "credentials" unless config[:credentials]
-end
-
-def cant_find_in_bucket! need
- raise Card::Error, "couldn't find #{need} for bucket #{bucket}"
-end
-
-def load_bucket_config_from_env config
- config ||= {}
- each_config_option_from_env do |key|
- replace_with_env_variable config, key
- end
- credential_config config do |cred_hash|
- load_bucket_credentials_from_env cred_hash
- end
-end
-
-def credential_config config
- config[:credentials] ||= {}
- yield config[:credentials]
- config.delete :credentials if config[:credentials].blank?
- config
-end
-
-def each_config_option_from_env
- CarrierWave::FileCardUploader::CONFIG_OPTIONS.each do |key|
- yield key unless key.in? %i[attributes credentials]
- end
-end
-
-def load_bucket_credentials_from_env cred_config
- each_credential_from_env do |option|
- replace_with_env_variable cred_config, option, "credentials"
- end
-end
-
-def each_credential_from_env
- regexp = credential_from_env_regexp
- ENV.each_key do |env_key|
- next unless (m = regexp.match env_key)
-
- yield m[:option].downcase.to_sym
- end
-end
-
-def credential_from_env_regexp
- Regexp.new "^(?:#{bucket.to_s.upcase}_)?CREDENTIALS_(?.+)$"
-end
-
-def replace_with_env_variable config, option, prefix=nil
- env_key = [prefix, option].compact.join("_").upcase
- new_value = ENV["#{bucket.to_s.upcase}_#{env_key}"] || ENV[env_key]
- config[option] = new_value if new_value
-end
-
-def bucket_from_content
- return unless content
-
- content.match(/^\((?[^)]+)\)/) { |m| m[:bucket] }
-end
-
-def bucket_from_config
- cnf = Cardio.config
- cnf.file_default_bucket || cnf.file_buckets&.keys&.first
-end
-
-def change_bucket_if_read_only?
- cloud? && bucket_config[:read_only] && attachment_is_changing?
-end
-
-def bucket= value
- if @action == :update
- @new_bucket = value
- else
- @bucket = value
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/cloud.rb ~~
diff --git a/set/mod013-carrierwave/abstract/attachment/coded.rb b/set/mod013-carrierwave/abstract/attachment/coded.rb
deleted file mode 100644
index 3c83552..0000000
--- a/set/mod013-carrierwave/abstract/attachment/coded.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Attachment;
-# Set: Abstract (Attachment, Coded)
-#
-module Coded;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/coded.rb"; end
-event :lose_coded_status_on_update, :initialize, on: :update, when: :coded? do
- # unless explicit
- return if @new_mod
-
- @new_storage_type ||= storage_type_from_config
-end
-
-event :validate_coded_storage_type, :validate, on: :save, when: :will_become_coded? do
- storage_type_error :mod_argument_needed_to_save unless mod || @new_mod
- storage_type_error :codename_needed_for_storage if codename.blank?
-end
-
-def storage_type_error error_name
- errors.add :storage_type, t("carrierwave_#{error_name}")
-end
-
-def will_become_coded?
- will_be_stored_as == :coded
-end
-
-def mod= value
- if @action == :update && mod != value
- @new_mod = value.to_s
- else
- @mod = value.to_s
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/coded.rb ~~
diff --git a/set/mod013-carrierwave/abstract/attachment/local.rb b/set/mod013-carrierwave/abstract/attachment/local.rb
deleted file mode 100644
index 0e6417d..0000000
--- a/set/mod013-carrierwave/abstract/attachment/local.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Attachment;
-# Set: Abstract (Attachment, Local)
-#
-module Local;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/local.rb"; end
-event :update_public_link_on_create, :integrate, on: :create, when: :local? do
- update_public_link
-end
-
-event :remove_public_link_on_delete, :integrate, on: :delete, when: :local? do
- remove_public_links
-end
-
-event :update_public_link, after: :update_read_rule, when: :local? do
- return if content.blank?
-
- if who_can(:read).include? Card::AnyoneID
- create_public_links
- else
- remove_public_links
- end
-end
-
-private
-
-def create_public_links
- path = attachment.public_path
- return if File.exist? path
-
- FileUtils.mkdir_p File.dirname(path)
- File.symlink attachment.path, path unless File.symlink? path
- create_versions_public_links
-end
-
-def create_versions_public_links
- attachment.versions.each_value do |version|
- next if File.symlink? version.public_path
-
- File.symlink version.path, version.public_path
- end
-end
-
-def remove_public_links
- symlink_dir = File.dirname attachment.public_path
- return unless Dir.exist? symlink_dir
-
- FileUtils.rm_rf symlink_dir
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/local.rb ~~
diff --git a/set/mod013-carrierwave/abstract/attachment/paths.rb b/set/mod013-carrierwave/abstract/attachment/paths.rb
deleted file mode 100644
index 1010387..0000000
--- a/set/mod013-carrierwave/abstract/attachment/paths.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Attachment;
-# Set: Abstract (Attachment, Paths)
-#
-module Paths;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/paths.rb"; end
-MOD_FILE_DIR = "file".freeze
-
-def store_dir
- will_become_coded? ? coded_dir(@new_mod) : upload_dir
-end
-
-def retrieve_dir
- coded? ? coded_dir : upload_dir
-end
-
-# place for files of regular file cards
-def upload_dir
- id ? "#{files_base_dir}/#{id}" : tmp_upload_dir
-end
-
-# place for files of mod file cards
-def coded_dir new_mod=nil
- dir = File.join mod_dir(new_mod), MOD_FILE_DIR, codename.to_s
- FileUtils.mkdir_p(dir) unless File.directory?(dir)
- dir
-end
-
-def mod_dir new_mod=nil
- mod_name = new_mod || mod
- dir = Cardio::Mod.dirs.path(mod_name) || (mod_name.to_sym == :test && "test")
-
- raise Error, "can't find mod \"#{mod_name}\"" unless dir
-
- dir
-end
-
-def files_base_dir
- dir = bucket ? bucket_config[:subdirectory] : Card.paths["files"].existent.first
- dir || files_base_dir_configuration_error
-end
-
-def files_base_dir_configuration_error
- raise StandardError,
- "missing directory for file cache (default is `files` in deck root)"
-end
-
-# used in the indentifier
-def file_dir
- if coded?
- ":#{codename}"
- elsif cloud?
- "(#{bucket})/#{file_id}"
- else
- "~#{file_id}"
- end
-end
-
-def public?
- who_can(:read).include? Card::AnyoneID
-end
-
-def file_id
- id? ? id : upload_cache_card.id
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/paths.rb ~~
diff --git a/set/mod013-carrierwave/abstract/attachment/storage_type.rb b/set/mod013-carrierwave/abstract/attachment/storage_type.rb
deleted file mode 100644
index 245d075..0000000
--- a/set/mod013-carrierwave/abstract/attachment/storage_type.rb
+++ /dev/null
@@ -1,180 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Attachment;
-# Set: Abstract (Attachment, StorageType)
-#
-module StorageType;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/storage_type.rb"; end
-attr_writer :bucket, :storage_type
-
-event :storage_type_change, :store, on: :update, when: :storage_type_changed? do
- # carrierwave stores file if @cache_id is not nil
- attachment.cache_stored_file!
- # attachment.retrieve_from_cache!(attachment.cache_name)
- update_storage_attributes
- # next line might be necessary to move files to cloud
-
- # make sure that we get the new identifier
- # otherwise action_id will return wrong id for new identifier
- db_content_will_change!
- write_identifier
-end
-
-event :validate_storage_type, :validate, on: :save do
- return if known_storage_type? will_be_stored_as
-
- errors.add :storage_type, unknown_storage_type(@new_storage_type)
-end
-
-def will_be_stored_as
- @new_storage_type || storage_type
-end
-
-def read_only?
- web? || (cloud? && bucket_config[:read_only])
-end
-
-def cloud?
- storage_type == :cloud
-end
-
-def web?
- storage_type == :web
-end
-
-def local?
- storage_type == :local
-end
-
-def coded?
- storage_type == :coded
-end
-
-def remote_storage?
- cloud? || web?
-end
-
-def storage_type
- @storage_type ||=
- new_card? ? storage_type_from_config : storage_type_from_content
-end
-
-def deprecated_mod_file?
- content && (lines = content.split("\n")) && lines.size == 4
-end
-
-def mod
- @mod ||= coded? && mod_from_content
-end
-
-def mod_from_content
- if (m = content.match %r{^:[^/]+/([^.]+)})
- m[1] # current mod_file format
- else
- mod_from_deprecated_content
- end
-end
-
-# old format is still used in card_changes
-def mod_from_deprecated_content
- return if content.match?(/^~/)
- return unless (lines = content.split("\n")) && lines.size == 4
-
- lines.last
-end
-
-def storage_type_from_config
- valid_storage_type ENV["FILE_STORAGE"] || Cardio.config.file_storage
-end
-
-def valid_storage_type storage_type
- storage_type.to_sym.tap do |type|
- invalid_storage_type! type unless type.in? valid_storage_type_list
- end
-end
-
-def valid_storage_type_list
- CarrierWave::FileCardUploader::STORAGE_TYPES
-end
-
-def invalid_storage_type! type
- raise Card::Error, t(:carrierwave_error_invalid_storage_type, type: type)
-end
-
-def storage_type_from_content
- case content
- when /^\(/ then :cloud
- when %r{/^https?:/} then :web
- when /^~/ then :local
- when /^:/ then :coded
- else
- if deprecated_mod_file?
- :coded
- else
- storage_type_from_config
- end
- end
-end
-
-def update_storage_attributes
- @mod = @new_mod if @new_mod
- @bucket = @new_bucket if @new_bucket
- @storage_type = @new_storage_type
-end
-
-def storage_type_changed?
- @new_bucket || (@new_storage_type && @new_storage_type != storage_type) || @new_mod
-end
-
-def storage_type= value
- known_storage_type? value
- if @action == :update # && storage_type != value
- # we cant update the storage type directly here
- # if we do then the uploader doesn't find the file we want to update
- @new_storage_type = value
- else
- @storage_type = value
- end
-end
-
-def with_storage_options opts={}
- old_values = stash_and_set_storage_options opts
- validate_temporary_storage_type_change opts[:storage_type]
- @temp_storage_type = true
- yield
-ensure
- @temp_storage_type = false
- old_values.each { |key, val| instance_variable_set "@#{key}", val }
-end
-
-def stash_and_set_storage_options opts
- %i[storage_type mod bucket].each_with_object({}) do |opt_name, old_values|
- next unless opts[opt_name]
-
- old_values[opt_name] = instance_variable_get "@#{opt_name}"
- instance_variable_set "@#{opt_name}", opts[opt_name]
- old_values
- end
-end
-
-def temporary_storage_type_change?
- @temp_storage_type
-end
-
-def validate_temporary_storage_type_change type=nil
- return unless type ||= @new_storage_type
- raise Error, unknown_storage_type(type) unless known_storage_type? type
- if type == :coded && codename.blank?
- raise Error, "codename needed for storage type :coded"
- end
-end
-
-def known_storage_type? type=storage_type
- type.in? CarrierWave::FileCardUploader::STORAGE_TYPES
-end
-
-def unknown_storage_type type
- t :carrierwave_unknown_storage_type, new_storage_type: type
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/storage_type.rb ~~
diff --git a/set/mod013-carrierwave/abstract/attachment/upload_cache.rb b/set/mod013-carrierwave/abstract/attachment/upload_cache.rb
deleted file mode 100644
index d399234..0000000
--- a/set/mod013-carrierwave/abstract/attachment/upload_cache.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Attachment;
-# Set: Abstract (Attachment, UploadCache)
-#
-# action id of the cached upload
-module UploadCache;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/upload_cache.rb"; end
-attr_accessor :action_id_of_cached_upload
-
-def actionable?
- super || preliminary_upload?
-end
-
-event :prepare_attachment, :prepare_to_validate, on: :save, when: :preliminary_upload? do
- save_original_filename # save original filename as comment in action
- write_identifier # set db_content
- # (needs original filename to determine extension)
- store_attachment!
- store_card_changes
- # finalize_action # create Card::Change entry for db_content
-
- card_id = new_card? ? upload_cache_card.id : id
- @current_action.update! draft: true, card_id: card_id
- success << {
- target: (new_card? ? upload_cache_card : self),
- type: type_name,
- view: "preview_editor",
- rev_id: current_action.id
- }
- abort :success
-end
-
-event :assign_attachment_on_create, :initialize,
- after: :assign_action, on: :create, when: :save_preliminary_upload? do
- return unless (action = Card::Action.fetch(@action_id_of_cached_upload))
-
- upload_cache_card.selected_action_id = action.id
- upload_cache_card.select_file_revision
- assign_attachment upload_cache_card.attachment.file, action.comment
-end
-
-event :assign_attachment_on_update, :initialize,
- after: :assign_action, on: :update, when: :save_preliminary_upload? do
- return unless (action = Card::Action.fetch(@action_id_of_cached_upload))
-
- uploaded_file = with_selected_action_id(action.id) { attachment.file }
- assign_attachment uploaded_file, action.comment
-end
-
-def assign_attachment file, original_filename
- send "#{attachment_name}=", file
- write_identifier
- @current_action&.update! comment: original_filename
-end
-
-event :delete_cached_upload_file_on_create, :integrate,
- on: :create, when: :save_preliminary_upload? do
- return unless (action = Card::Action.fetch(@action_id_of_cached_upload))
-
- upload_cache_card.delete_files_for_action action
- action.delete
-end
-
-# at some point uploaded files of canceled file card creation
-# should be deleted. We do this when ever an new file is created.
-event :clear_draft_files, :integrate_with_delay, priority: 100, on: :create do
- Card.delete_tmp_files_of_cached_uploads
-end
-
-event :delete_cached_upload_file_on_update, :integrate,
- on: :update, when: :save_preliminary_upload? do
- return unless (action = Card::Action.fetch(@action_id_of_cached_upload))
-
- delete_files_for_action action
- action.delete
-end
-
-# used for uploads for new cards until the new card is created
-def upload_cache_card
- cache_card_codename = "new_#{attachment_name}"
- @upload_cache_card ||= Card::Codename.card(cache_card_codename) { Card[:new_file] }
-end
-
-def preliminary_upload?
- Card::Env && Card::Env.params[:attachment_upload]
-end
-
-def save_preliminary_upload?
- @action_id_of_cached_upload.present?
-end
-
-# place for files if card doesn't have an id yet
-def tmp_upload_dir _action_id=nil
- "#{files_base_dir}/#{upload_cache_card.id}"
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/upload_cache.rb ~~
diff --git a/set/mod013-carrierwave/abstract/attachment/web.rb b/set/mod013-carrierwave/abstract/attachment/web.rb
deleted file mode 100644
index 0f26537..0000000
--- a/set/mod013-carrierwave/abstract/attachment/web.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Attachment;
-# Set: Abstract (Attachment, Web)
-#
-module Web;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/web.rb"; end
-def no_upload?
- web? || storage_type_from_config == :web
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/abstract/attachment/web.rb ~~
diff --git a/set/mod013-carrierwave/all/file_utils.rb b/set/mod013-carrierwave/all/file_utils.rb
deleted file mode 100644
index cf1a951..0000000
--- a/set/mod013-carrierwave/all/file_utils.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (FileUtils)
-#
-module FileUtils;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/all/file_utils.rb"; end
-module ClassMethods
- def update_all_storage_locations
- Card.search(type_id: ["in", Card::FileID, Card::ImageID])
- .each(&:update_storage_location!)
- end
-
- def delete_tmp_files_of_cached_uploads
- cards_with_disposable_attachments do |card, action|
- card.delete_files_for_action action
- action.delete
- end
- end
-
- def cards_with_disposable_attachments
- draft_actions_with_attachment.each do |action|
- # we don't want to delete uploads in progress
- next unless old_enough?(action.created_at) && (card = action.card)
- # we can't delete attachments we don't have write access to
- next if card.read_only?
-
- yield card, action
- end
- end
-
- def old_enough? time, expiration_time=5.day.to_i
- Time.now - time > expiration_time
- end
-
- def draft_actions_with_attachment
- Card::Action.find_by_sql(
- "SELECT * FROM card_actions "\
- "INNER JOIN cards ON card_actions.card_id = cards.id "\
- "WHERE cards.type_id IN (#{Card::FileID}, #{Card::ImageID}) "\
- "AND card_actions.draft = true"
- )
- end
-
- def count_cards_with_attachment
- Card.search type_id: ["in", Card::FileID, Card::ImageID], return: :count
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/all/file_utils.rb ~~
diff --git a/set/mod013-carrierwave/self/admin.rb b/set/mod013-carrierwave/self/admin.rb
deleted file mode 100644
index 404e871..0000000
--- a/set/mod013-carrierwave/self/admin.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Admin"
-#
-module Admin;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/self/admin.rb"; end
-add_to_basket(
- :tasks,
- name: :update_file_storage_locations,
- execute_policy: -> { Card.update_all_storage_locations },
- stats: {
- title: "cards with attachment",
- count: -> { Card.count_cards_with_attachment }
- # link_text: "update storage locations",
- # task: "update_file_storage_locations"
- }
-)
-
-add_to_basket(
- :tasks,
- name: :delete_upload_tmp_files,
- execute_policy: -> { Card.delete_tmp_files_of_cached_uploads },
- stats: {
- title: "tmp files of canceled uploads",
- count: -> { ::Card.draft_actions_with_attachment },
- link_text: "delete tmp files",
- task: "delete_tmp_files_of_cached_uploads"
- }
-)
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/self/admin.rb ~~
diff --git a/set/mod013-carrierwave/self/favicon.rb b/set/mod013-carrierwave/self/favicon.rb
deleted file mode 100644
index 8da79ce..0000000
--- a/set/mod013-carrierwave/self/favicon.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Favicon"
-#
-module Favicon;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/self/favicon.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :source do
- source = card.type_id == Card::ImageID ? super() : nil
- source.present? ? source : nest(:logo, view: :source, size: voo.size)
- end
-
- view :link_tag, perms: :none do
- return unless (source = render :source, size: :small)
-
- tag :link, rel: "shortcut icon", href: source
- end
-
- def raw_help_text
- "A favicon (or shortcut icon) is a small image used by browsers to help identify "\
- "your website. [[http://www.decko.org/favicon|How to customize your favicon]]"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/self/favicon.rb ~~
diff --git a/set/mod013-carrierwave/self/new_file.rb b/set/mod013-carrierwave/self/new_file.rb
deleted file mode 100644
index 6bbcbd0..0000000
--- a/set/mod013-carrierwave/self/new_file.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "NewFile"
-#
-module NewFile;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/self/new_file.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :source, cache: :never do
- super()
- end
-
- view :core, cache: :never do
- super()
- end
-
- view :input, cache: :never do
- super()
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/self/new_file.rb ~~
diff --git a/set/mod013-carrierwave/self/new_image.rb b/set/mod013-carrierwave/self/new_image.rb
deleted file mode 100644
index 89af255..0000000
--- a/set/mod013-carrierwave/self/new_image.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "NewImage"
-#
-module NewImage;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/self/new_image.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :source, cache: :never do
- super()
- end
-
- view :core, cache: :never do
- super()
- end
-
- view :input, cache: :never do
- super()
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/self/new_image.rb ~~
diff --git a/set/mod013-carrierwave/type/file.rb b/set/mod013-carrierwave/type/file.rb
deleted file mode 100644
index 5f7134e..0000000
--- a/set/mod013-carrierwave/type/file.rb
+++ /dev/null
@@ -1,144 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "File" cards
-#
-module File;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/type/file.rb"; end
-attachment :file, uploader: CarrierWave::FileCardUploader
-
-module SelectedAction
- def select_action_by_params params
- # skip action table lookups for current revision
- rev_id = params[:rev_id]
- super unless rev_id && rev_id == last_content_action_id
- end
-
- def last_content_action_id
- return super if temporary_storage_type_change?
-
- # find action id from content (saves lookups)
- db_content.to_s.split(%r{[/.]})[-2]
- end
-end
-include SelectedAction
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :source do
- file = card.attachment
- file.valid? ? contextualize_path(file.url) : ""
- end
-
- view :core do
- handle_source do |source|
- card_url source
- end
- end
-
- def short_content
- number_to_human_size card.attachment.size
- end
-
- def handle_source
- rescuing_file_source_error do
- source = _render_source
- if source.blank?
- ""
- elsif block_given?
- yield source
- else
- source
- end
- end
- end
-
- def selected_version
- card.attachment
- end
-
- private
-
- def rescuing_file_source_error
- yield
- rescue StandardError => e
- Rails.logger.info "Error with file source: #{e.message}"
- t :carrierwave_file_error
- end
-end
-
-module FileFormat; module_parent.send :register_set_format, Card::Format::FileFormat, self; extend Card::Set::AbstractFormat
- # NOCACHE because returns send_file args. not in love with this...
- view :core, cache: :never do
- # this means we only support known formats. dislike.
- attachment_format = card.attachment_format(params[:format])
- return _render_not_found unless attachment_format
- return card.format(:html).render_core if card.remote_storage?
-
- set_response_headers
- args_for_send_file
- end
-
- def args_for_send_file
- file = selected_version
- [file.path, { type: file.content_type,
- filename: "#{card.name.safe_key}#{file.extension}",
- x_sendfile: true,
- disposition: (params[:format] == "file" ? "attachment" : "inline") }]
- end
-
- def set_response_headers
- return unless params[:explicit_file] && (response = controller&.response)
-
- response.headers["Expires"] = 1.year.from_now.httpdate
- # currently using default "private", because proxy servers could block
- # needed permission checks
- # r.headers["Cache-Control"] = "public"
- end
-end
-
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- view(:content) { render_core }
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- handle_source do |source|
- haml :core, source: source
- end
- end
-
- view :input do
- if card.no_upload?
- text_field :content, class: "d0-card-content"
- else
- haml :file_chooser, action_text: file_chooser_action_text
- end
- end
-
- view :preview_editor, unknown: true, cache: :never do
- haml :preview_editor
- end
-
- def file_chooser_action_text
- action = card.new_card? ? "Add" : "Replace"
- "#{action} #{humanized_attachment_name}..."
- end
-
- def humanized_attachment_name
- card.attachment_name.to_s.humanize
- end
-
- def preview
- ""
- end
-
- def cached_upload_card_name
- Card::Env.params[:attachment_upload].gsub(/\[\w+\]$/, "[action_id_of_cached_upload]")
- end
-
- def preview_editor_delete_text
- t :carrierwave_delete
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/type/file.rb ~~
diff --git a/set/mod013-carrierwave/type/image.rb b/set/mod013-carrierwave/type/image.rb
deleted file mode 100644
index bcf10a2..0000000
--- a/set/mod013-carrierwave/type/image.rb
+++ /dev/null
@@ -1,113 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Image" cards
-#
-module Image;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/type/image.rb"; end
-attachment :image, uploader: CarrierWave::ImageCardUploader
-
-include File::SelectedAction
-
-def create_versions? new_file
- new_file.extension != "svg"
-end
-
-def svg?
- image&.extension == ".svg"
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- include File::Format
-
- view :one_line_content do
- _render_core size: :icon
- end
-
- def short_content
- render_core size: :icon
- end
-
- view :source do
- return card.content if card.web?
-
- image = selected_version
- return "" unless image.valid?
-
- contextualize_path image.url
- end
-
- def selected_version
- size = determine_image_size
- if size && size != :original
- card.image.versions[size]
- else
- card.image
- end
- end
-
- def closed_size
- :icon
- end
-
- def main_size
- :large
- end
-
- def default_size
- :medium
- end
-
- def determine_image_size
- voo.size =
- case
- when nest_mode == :closed then closed_size
- when voo.size.present? then voo.size.to_sym
- when main? then main_size
- else default_size
- end
- voo.size = :original if voo.size == :full
- voo.size
- end
-
- view :inline do
- _render_core
- end
-end
-
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- include File::JsonFormat
-end
-
-module EmailHtmlFormat; module_parent.send :register_set_format, Card::Format::EmailHtmlFormat, self; extend Card::Set::AbstractFormat
- view :inline, cache: :never do
- handle_source do |source|
- return source unless (mail = inherit :active_mail) &&
- ::File.exist?(path = selected_version.path)
-
- url = attach_image mail, path
- image_tag url
- end
- end
-
- def attach_image mail, path
- mail.attachments.inline[path] = ::File.read path
- mail.attachments[path].url
- end
-end
-
-module CssFormat; module_parent.send :register_set_format, Card::Format::CssFormat, self; extend Card::Set::AbstractFormat
- view :core do
- handle_source
- end
-
- view :content do # why is this necessary?
- render_core
- end
-end
-
-module FileFormat; module_parent.send :register_set_format, Card::Format::FileFormat, self; extend Card::Set::AbstractFormat
- include File::FileFormat
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/type/image.rb ~~
diff --git a/set/mod013-carrierwave/type/image/html_views.rb b/set/mod013-carrierwave/type/image/html_views.rb
deleted file mode 100644
index bca5bda..0000000
--- a/set/mod013-carrierwave/type/image/html_views.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type; module Image;
-# Set: All "Image+HtmlViews" cards (HtmlViews)
-#
-module HtmlViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/carrierwave/set/type/image/html_views.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- include File::HtmlFormat
-
- # core HTML image view.
- view :core do
- return card.attachment.read if card.svg?
-
- with_valid_source do |source|
- image_tag source, alt: card.name
- end
- end
-
- def with_valid_source
- handle_source do |source|
- if source.blank? || source == "missing"
- # FIXME: these images should be "broken", not "missing"
- invalid_image source
- else
- yield source
- # consider title..
- end
- end
- end
-
- view :full_width do
- with_valid_source do |source|
- image_tag source, alt: card.name, class: "w-100"
- end
- end
-
- def invalid_image source
- # ("missing" is the view for "unknown" now, so we shouldn't further confuse things)
- ""
- end
-
- def preview
- return if card.new_card? && !card.preliminary_upload?
-
- wrap_with :div, class: "attachment-preview",
- id: "#{card.attachment.filename}-preview" do
- _render_core size: :medium
- end
- end
-
- def show_action_content_toggle? _action, _view_type
- true
- end
-
- view :content_changes do
- content_changes card.last_action, :expanded
- end
-
- def content_changes action, diff_type, hide_diff=false
- voo.size = diff_type == :summary ? :icon : :medium
- [old_image(action, hide_diff), new_image(action)].compact.join
- end
-
- def old_image action, hide_diff
- return if hide_diff || !action
-
- old_image_change action do |old_action_id|
- card.with_selected_action_id old_action_id do
- Card::Content::Diff.render_deleted_chunk _render_core
- end
- end
- end
-
- def old_image_change action
- return unless (change = card.last_change_on(:db_content, before: action))
-
- yield change.card_action_id
- end
-
- def new_image action
- card.with_selected_action_id action.id do
- Card::Content::Diff.render_added_chunk _render_core
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/carrierwave/set/type/image/html_views.rb ~~
diff --git a/set/mod014-virtual/abstract/virtual_cache.rb b/set/mod014-virtual/abstract/virtual_cache.rb
deleted file mode 100644
index ccf1add..0000000
--- a/set/mod014-virtual/abstract/virtual_cache.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (VirtualCache)
-#
-# -*- encoding : utf-8 -*-
-module VirtualCache;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/virtual/set/abstract/virtual_cache.rb"; end
-
-def virtual?
- new?
-end
-
-def history?
- false
-end
-
-def followable?
- false
-end
-
-def db_content
- Card::Virtual.fetch_content(self)
-end
-
-# called to refresh the virtual content
-# the default way is to use the card's template content
-def generate_virtual_content
- template&.db_content
-end
-
-event :save_virtual_content, :prepare_to_store, on: :save, changed: :content do
- Card::Virtual.create_or_update(self, attributes["db_content"])
- abort :success
-end
-
-event :delete_virtual_content, :prepare_to_store, on: :delete do
- Card::Virtual.find_by_card(self)&.delete
- abort :success
-end
-
-def delete
- # delete although it's new
- update trash: true
-end
-
-def delete!
- # delete although it's new
- update! trash: true
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/virtual/set/abstract/virtual_cache.rb ~~
diff --git a/set/mod015-machines/abstract/machine.rb b/set/mod015-machines/abstract/machine.rb
deleted file mode 100644
index 6755ba7..0000000
--- a/set/mod015-machines/abstract/machine.rb
+++ /dev/null
@@ -1,230 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Machine)
-#
-# ## What are Machines?
-# {Machine} and {MachineInput} together implement a kind of observer pattern.
-# {Machine} processes a collection of input cards to generate an output card
-# (a {Set::Type::File} card by default). If one of the input cards is changed
-# the output card will be updated.
-#
-# The classic example: A style card observes a collection of css and sccs card
-# to generate a file card with a css file that contains the assembled
-# compressed css.
-#
-# ## Using Machines
-# Include the Machine module in the card set that is supposed to produce the
-# output card. If the output card should be automatically updated when a input
-# card is changed the input card has to be in a set that includes the
-# MachineInput module.
-#
-# The default machine:
-module Machine;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/machines/set/abstract/machine.rb"; end
-#
-# - uses its item cards as input cards or the card itself if there are no
-# item cards;
-# - can be changed by passing a block to collect_input_cards
-# - takes the raw view of the input cards to generate the output;
-# - can be changed by passing a block to machine_input (in the input card
-# set)
-# - stores the output as a .txt file in the '+machine output' card;
-# - can be changed by passing a filetype and/or a block to
-# store_machine_output
-#
-#
-# ## How does it work?
-# Machine cards have a '+machine input' and a '+machine output' card. The
-# '+machine input' card is a pointer to all input cards. Including the
-# MachineInput module creates an 'on: save' event that runs the machines of
-# all cards that are linked to that card via the +machine input pointer.
-module MachineClassMethods
- attr_accessor :output_config
-
- def collect_input_cards &block
- define_method :engine_input, &block
- end
-
- def prepare_machine_input &block
- define_method :before_engine, &block
- end
-
- def machine_engine &block
- define_method :engine, &block
- end
-
- def store_machine_output args={}, &block
- output_config.merge!(args)
- return unless block_given?
-
- define_method :after_engine, &block
- end
-end
-
-card_accessor :machine_output, type: FileID
-card_accessor :machine_input, type: PointerID
-
-def before_engine; end
-
-def engine_input
- ei = EngineInput.new self
- ei.process
- ei.new_input
-end
-
-# TODO: replace with call of extended_item_cards
-# traverse through all levels of pointers and
-# collect all item cards as input
-class EngineInput
- attr_accessor :new_input
-
- def initialize machine_card
- @machine_card = machine_card
- @items = [machine_card]
- @new_input = []
- @extended = {}
- @loop_limit = 5
- end
-
- def process
- each_valid_item do
- input_item = simple_item? ? @item : pointer_item
- new_input << input_item if input_item
- end
- end
-
- def simple_item?
- @item.item_cards == [@item] || @item.try(:self_machine_input?) # no pointer card
- end
-
- def pointer_item
- @items.insert 0, @item.item_cards.reject(&:unknown?)
- @items.flatten!
- record_item
- @item if @item != @machine_card && @item.known?
- end
-
- def record_item
- @extended[@item] = @extended[@item].to_i + 1
- end
-
- def each_valid_item
- until @items.empty?
- @item = @items.shift
- yield unless invalid_item?
- end
- end
-
- def invalid_item?
- @item.trash || @extended[@item.id].to_i > @loop_limit
- end
-end
-
-def engine input
- input
-end
-
-def after_engine output
- filetype = output_config[:filetype]
- file = Tempfile.new [id.to_s, ".#{filetype}"]
- file.write output
- file.rewind
- Card::Auth.as_bot do
- p = machine_output_card
- p.file = file
- p.save!
- end
- file.close
- file.unlink
-end
-
-view :machine_output_url do
- machine_output_url
-end
-
-class << self
- def included host_class
- host_class.extend(MachineClassMethods)
- host_class.mattr_accessor :output_config
- host_class.output_config = { filetype: "txt" }
-
- define_machine_events host_class
- end
-
- def define_machine_events host_class
- event_suffix = host_class.name.tr ":", "_"
- event_name = "reset_machine_output_#{event_suffix}".to_sym
- host_class.event event_name, after: :expire_related, changed: :content, on: :save do
- reset_machine_output
- end
- end
-end
-
-include_set Abstract::Lock
-
-def run_machine joint="\n"
- before_engine
- output =
- input_item_cards.map do |input_card|
- run_engine input_card
- end.select(&:present?).join(joint)
- after_engine output
-end
-
-def direct_machine_input? input_card
- !input_card.collection? ||
- input_card.respond_to?(:machine_input)
-end
-
-def run_engine input_card
- return unless direct_machine_input? input_card
- if (cached = fetch_cache_card(input_card)) && cached.content?
- return cached.content
- end
-
- engine(input_from_card(input_card)).tap do |output|
- cache_output_part input_card, output
- end
-end
-
-def input_from_card input_card
- if input_card.respond_to? :machine_input
- input_card.machine_input
- else
- input_card.format._render_raw
- end
-end
-
-def make_machine_output_coded mod=:machines
- update_machine_output
- Card::Auth.as_bot do
- ENV["STORE_CODED_FILES"] = "true"
- machine_output_card.update! storage_type: :coded, mod: mod,
- codename: machine_output_codename
- ENV["STORE_CODED_FILES"] = nil
- end
-end
-
-def machine_output_codename
- machine_output_card.name.parts.map do |part|
- Card[part].codename&.to_s || Card[part].name.safe_key
- end.join "_"
-end
-
-def input_item_cards
- machine_input_card.item_cards
-end
-
-def machine_output_url
- ensure_machine_output
- machine_output_card.file.url # (:default, timestamp: false)
- # to get rid of additional number in url
-end
-
-def machine_output_path
- ensure_machine_output
- machine_output_card.file.path
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/machines/set/abstract/machine.rb ~~
diff --git a/set/mod015-machines/abstract/machine/output_cache.rb b/set/mod015-machines/abstract/machine/output_cache.rb
deleted file mode 100644
index a37c62c..0000000
--- a/set/mod015-machines/abstract/machine/output_cache.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Machine;
-# Set: Abstract (Machine, OutputCache)
-#
-module OutputCache;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/machines/set/abstract/machine/output_cache.rb"; end
-def fetch_cache_card input_card, new=nil
- new &&= { type_id: PlainTextID }
- Card.fetch input_card.name, name, :machine_cache, new: new
-end
-
-def cache_output_part input_card, output
- Auth.as_bot do
- # save virtual cards first
- # otherwise the cache card will save it to get the left_id
- # and trigger the cache update again
- input_card.save! if input_card.new_card?
-
- cache_card = fetch_cache_card(input_card, true)
- cache_card.update! content: output
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/machines/set/abstract/machine/output_cache.rb ~~
diff --git a/set/mod015-machines/abstract/machine/output_update.rb b/set/mod015-machines/abstract/machine/output_update.rb
deleted file mode 100644
index 315c4f3..0000000
--- a/set/mod015-machines/abstract/machine/output_update.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Machine;
-# Set: Abstract (Machine, OutputUpdate)
-#
-module OutputUpdate;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/machines/set/abstract/machine/output_update.rb"; end
-def reset_machine_output
- Auth.as_bot do
- moc = machine_output_card
- @updated_at = output_updated_at
- moc.delete! if moc.real?
- update_input_card
- expire_if_source_file_changed @updated_at
- end
-end
-
-def regenerate_machine_output
- return unless ok?(:read)
-
- lock { run_machine }
-end
-
-def update_machine_output
- return unless ok?(:read)
-
- lock do
- update_input_card
- expire_if_source_file_changed output_updated_at
- run_machine
- end
-end
-
-def ensure_machine_output
- output = fetch :machine_output
- return if output&.selected_content_action_id
-
- update_machine_output
-end
-
-def update_input_card
- if Card::Director.running_act?
- input_card = attach_subcard! machine_input_card
- input_card.content = ""
- engine_input.each { |input| input_card << input }
- else
- machine_input_card.items = engine_input
- end
-end
-
-def input_cards_with_changed_source output_updated
- machine_input_card.extended_item_cards.select do |i_card|
- i_card.try(:source_changed?, since: output_updated)
- end
-end
-
-def expire_if_source_file_changed output_updated_at
- return unless output_updated_at
-
- changed = input_cards_with_changed_source(output_updated_at)
- return if changed.empty?
-
- changed.each(&:expire_machine_cache)
- true
-end
-
-# regenerates the machine output if a source file of a input card has been changed
-def update_if_source_file_changed
- return unless expire_if_source_file_changed output_updated_at
-
- regenerate_machine_output
-end
-
-def output_updated_at
- return unless (output_card = machine_output_card)
-
- if output_card.coded?
- File.mtime output_card.file.path
- else
- output_card.updated_at
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/machines/set/abstract/machine/output_update.rb ~~
diff --git a/set/mod015-machines/abstract/machine_input.rb b/set/mod015-machines/abstract/machine_input.rb
deleted file mode 100644
index 3ba0a0a..0000000
--- a/set/mod015-machines/abstract/machine_input.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (MachineInput)
-#
-module MachineInput;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/machines/set/abstract/machine_input.rb"; end
-module MachineInputClassMethods
- attr_accessor :machines_cql
-
- def machine_input_for args
- @machines_cql = args
- end
-
- def machine_input &block
- define_method :machine_input, block
- end
-end
-
-def self.included host_class
- host_class.extend(MachineInputClassMethods)
- host_class.machines_cql = {}
- host_class.machine_input do
- format._render_raw
- end
- event_suffix = host_class.name.tr ":", "_"
- define_update_event event_suffix, host_class
- define_delete_events event_suffix, host_class
-end
-
-def self.define_delete_events event_suffix, host_class
- event_name = "before_machine_input_deleted_#{event_suffix}".to_sym
- host_class.event event_name, :store, on: :delete do
- # exclude self because it's on the way to the trash
- # otherwise it will be created again with the reset_machine_output
- # call in the event below
- @involved_machines =
- MachineInput.search_involved_machines(name, host_class)
- .reject { |card| card == self }
- end
- event_name = "after_machine_input_deleted_#{event_suffix}".to_sym
- host_class.event event_name, :finalize, on: :delete do
- expire_machine_cache
- @involved_machines.each do |item|
- item.reset_machine_output if item.is_a? Machine
- end
- end
-end
-
-def self.define_update_event event_suffix, host_class
- host_class.event(
- "after_machine_input_updated_#{event_suffix}".to_sym, :integrate,
- on: :save
- ) do
- expire_machine_cache
- MachineInput.search_involved_machines(name, host_class)
- .each do |item|
- item.reset_machine_output if item.is_a? Machine
- end
- end
-end
-
-def self.search_involved_machines name, host_class
- cql_statement =
- { right_plus: [
- { codename: "machine_input" },
- { link_to: name }
- ] }.merge(host_class.machines_cql)
- Card.search(cql_statement)
-end
-
-def expire_machine_cache
- Card.search(right_plus: [{ codename: "machine_input" }, { link_to: name }],
- return: :name).each do |machine_name|
- cache_card = Card.fetch(name, machine_name, :machine_cache)
- next unless cache_card&.content?
-
- Auth.as_bot { cache_card.update! trash: true }
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/machines/set/abstract/machine_input.rb ~~
diff --git a/set/mod015-machines/all/reset_machines.rb b/set/mod015-machines/all/reset_machines.rb
deleted file mode 100644
index 6fd6054..0000000
--- a/set/mod015-machines/all/reset_machines.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (ResetMachines)
-#
-module ResetMachines;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/machines/set/all/reset_machines.rb"; end
-module ClassMethods
- def reset_script_machine
- Auth.as_bot do
- card = Card[:all, :script, :machine_output]
- if card
- card.update_columns trash: true
- card.expire
- Card::Virtual.where(right_id: MachineCacheID).delete_all
- end
- end
- end
-
- def reset_all_machines
- Auth.as_bot do
- Card.search(right: { codename: "machine_output" }).each do |card|
- card.update_columns trash: true
- card.expire
- end
- Card::Virtual.where(right_id: MachineCacheID).delete_all
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/machines/set/all/reset_machines.rb ~~
diff --git a/set/mod015-machines/right/machine_cache.rb b/set/mod015-machines/right/machine_cache.rb
deleted file mode 100644
index 58fe764..0000000
--- a/set/mod015-machines/right/machine_cache.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+MachineCache" cards
-#
-module MachineCache;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/machines/set/right/machine_cache.rb"; end
-include_set Abstract::VirtualCache
-
-def clean_html?
- false
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/machines/set/right/machine_cache.rb ~~
diff --git a/set/mod015-machines/right/machine_input.rb b/set/mod015-machines/right/machine_input.rb
deleted file mode 100644
index 2791277..0000000
--- a/set/mod015-machines/right/machine_input.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+MachineInput" cards
-#
-module MachineInput;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/machines/set/right/machine_input.rb"; end
-def followable?
- false
-end
-
-def history?
- false
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/machines/set/right/machine_input.rb ~~
diff --git a/set/mod015-machines/right/machine_output.rb b/set/mod015-machines/right/machine_output.rb
deleted file mode 100644
index a7b971e..0000000
--- a/set/mod015-machines/right/machine_output.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+MachineOutput" cards
-#
-module MachineOutput;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/machines/set/right/machine_output.rb"; end
-def followable?
- false
-end
-
-def ok_to_read
- left.ok_to_read
-end
-
-def history?
- false
-end
-
-event :remove_codename, :prepare_to_validate,
- on: :delete,
- when: proc { |c| c.codename.present? } do
- # load file before deleting codename otherwise it will fail later
- attachment
- self.codename = nil
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :not_found do
- if update_machine_output_live?
- Card::Cache.reset_all # FIXME: wow, this is overkill, no?
- root.error_status = 302
- card.left.update_machine_output
- card_path card.left.machine_output_url
- else
- super()
- end
- end
-
- def update_machine_output_live?
- case
- when !card.left.is_a?(Abstract::Machine) then false # must be a machine
- when card.left.locked? then false # machine must not be running
- when card.new_card? then true # always update if new
- else
- # must want current output (won't re-output old stuff)
- (selected_id = card.selected_action_id) &&
- selected_id == card.last_action_id
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/machines/set/right/machine_output.rb ~~
diff --git a/set/mod016-script/abstract/01_asset_java_script.rb b/set/mod016-script/abstract/01_asset_java_script.rb
deleted file mode 100644
index 1739729..0000000
--- a/set/mod016-script/abstract/01_asset_java_script.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (AssetJavaScript)
-#
-# -*- encoding : utf-8 -*-
-module AssetJavaScript;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/abstract/01_asset_java_script.rb"; end
-
-include_set Abstract::AssetFile
-
-def compress_js?
- @minimize
-end
-
-module JsFormat; module_parent.send :register_set_format, Card::Format::JsFormat, self; extend Card::Set::AbstractFormat
- view :source do
- if @local
- card.machine_output_url
- else
- source
- end
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :javascript_include_tag do
- javascript_include_tag card.machine_output_url
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/abstract/01_asset_java_script.rb ~~
diff --git a/set/mod016-script/abstract/asset_coffee_script.rb b/set/mod016-script/abstract/asset_coffee_script.rb
deleted file mode 100644
index 38dd7f8..0000000
--- a/set/mod016-script/abstract/asset_coffee_script.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (AssetCoffeeScript)
-#
-# -*- encoding : utf-8 -*-
-module AssetCoffeeScript;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/abstract/asset_coffee_script.rb"; end
-
-require "coffee-script"
-
-include_set Abstract::AssetFile
-
-def compress_js?
- @minimize
-end
-
-module JsFormat; module_parent.send :register_set_format, Card::Format::JsFormat, self; extend Card::Set::AbstractFormat
- view :source do
- if @local
- card.machine_output_url
- else
- source
- end
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :javascript_include_tag do
- javascript_include_tag card.machine_output_url
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/abstract/asset_coffee_script.rb ~~
diff --git a/set/mod016-script/abstract/asset_list.rb b/set/mod016-script/abstract/asset_list.rb
deleted file mode 100644
index 4fd2c61..0000000
--- a/set/mod016-script/abstract/asset_list.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (AssetList)
-#
-module AssetList;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/abstract/asset_list.rb"; end
-include_set Abstract::Machine
-include_set Abstract::MachineInput
-include_set Abstract::ReadOnly
-include_set Abstract::Sources
-include_set Abstract::Items
-
-machine_input { standard_machine_input }
-store_machine_output filetype: "js"
-
-def update_if_source_file_changed
- return unless !output_updated_at || source_changed?(since: output_updated_at)
-
- update_items!
-end
-
-event :update_asset_list, :prepare_to_store, on: :save do
- self.db_content = relative_paths.join("\n")
-end
-
-def update_items!
- Card::Auth.as_bot do
- save!
- end
- regenerate_machine_output
-end
-
-def item_name_to_path name
- name
-end
-
-def fetch_item_card name, _args={}
- new_asset_file_card item_name_to_path(name)
-end
-
-def new_asset_file_card path, name = ::File.basename(path)
- if path.ends_with? ".js.coffee"
- type_id = Card::CoffeeScriptID
- set_module = ::Card::Set::Abstract::AssetCoffeeScript
- elsif path.ends_with? ".js"
- type_id = Card::JavaScriptID
- set_module = ::Card::Set::Abstract::AssetJavaScript
- else
- return
- end
- asset_card = Card.new name: name,
- type_id: type_id,
- content: path
-
- asset_card.include_set_module set_module
- asset_card.minimize if @minimize
- asset_card.local if @local
- asset_card
-end
-
-def source_paths
- paths
-end
-
-def self_machine_input?
- true
-end
-
-def local
- @local = true
-end
-
-def minimize?
- @minimize = true
-end
-
-def standard_machine_input
- item_cards.map do |mcard|
- js = mcard.format(:js)._render_core
- js = mcard.compress_js js if minimize?
- "// #{mcard.name}\n#{js}"
- end.join "\n"
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :javascript_include_tag do
- javascript_include_tag card.machine_output_url
- end
-end
-
-def source_changed? since:
- difference = (relative_paths + item_names) - (relative_paths & item_names)
- difference.present? ||
- existing_source_paths.any? { |path| ::File.mtime(path) > since }
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/abstract/asset_list.rb ~~
diff --git a/set/mod016-script/abstract/manifest_group.rb b/set/mod016-script/abstract/manifest_group.rb
deleted file mode 100644
index 3f0f7c2..0000000
--- a/set/mod016-script/abstract/manifest_group.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (ManifestGroup)
-#
-module ManifestGroup;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/abstract/manifest_group.rb"; end
-def group_name
- codename.to_s.sub(/^.+__/, "")
-end
-
-def relative_paths
- paths
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- list_group card.item_names
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/abstract/manifest_group.rb ~~
diff --git a/set/mod016-script/abstract/mod_assets.rb b/set/mod016-script/abstract/mod_assets.rb
deleted file mode 100644
index 47910c3..0000000
--- a/set/mod016-script/abstract/mod_assets.rb
+++ /dev/null
@@ -1,145 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (ModAssets)
-#
-module ModAssets;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/abstract/mod_assets.rb"; end
-include_set Abstract::Pointer
-
-def mod_name
- left&.codename.to_s.sub(/^mod_/, "")
-end
-
-def mod
- @mod ||= Cardio::Mod.dirs.mod(mod_name)
-end
-
-def assets_path
- return unless mod&.assets_path.present?
-
- File.join mod&.assets_path, subpath
-end
-
-def manifest_path
- return unless assets_path
-
- File.join(assets_path, "manifest.yml")
-end
-
-def remove_deprecated_items items
- items.each do |deprecated_item|
- next unless (item_card = Card.fetch(deprecated_item))
- item_card.update codename: nil
- item_card.delete
- end
-end
-
-def expected_item_keys
- return [] unless assets_dir_exists?
-
- if manifest_exists?
- manifest.keys.map { |group_key| "#{name}+#{group_key}".to_name.key }
- else
- ["#{name}+#{local_group_name}".to_name.key]
- end
-end
-
-def local_group_name
- "local"
-end
-
-def update_items
- return unless groups_changed?
-
- delete_unused_items do
- self.content = ""
- return unless assets_dir_exists?
-
- if manifest_exists?
- ensure_manifest_groups_cards
- else
- ensure_item local_group_name, ::Card::LocalFolderGroupID
- end
- save!
- end
-end
-
-def delete_unused_items
- @old_items = ::Set.new item_keys
- yield
- remove_deprecated_items @old_items
-end
-
-def assets_dir_exists?
- path = assets_path
- path && Dir.exist?(path)
-end
-
-def manifest_exists?
- manifest_path && File.exist?(manifest_path)
-end
-
-def manifest_group_items group_name
- manifest.dig(group_name, "items") || []
-end
-
-def manifest_group_minimize? group_name
- manifest.dig(group_name, "minimize")
-end
-
-def manifest
- @manifest ||= YAML.load_file manifest_path
-end
-
-def with_manifest_groups
- manifest.each_pair do |key, config|
- yield key, config
- end
-end
-
-def ensure_manifest_groups_cards
- with_manifest_groups { |group_name, config| new_manifest_group group_name, config }
-end
-
-def new_manifest_group group_name, config
- type_id = config["remote"] ? Card::RemoteManifestGroupID : Card::LocalManifestGroupID
- ensure_item group_name, type_id
-end
-
-def ensure_item field, type_id
- item_name = "#{name}+#{field}"
- @old_items.delete item_name.to_name.key
- add_item item_name
-
- card = Card[item_name]
- codename = "#{mod_name}_group__#{field}"
- args = {
- type_id: type_id,
- codename: codename
- }
-
- return if card && card.type_id == type_id && card.codename == codename
- if !card
- Card.create args.merge(name: item_name)
- else
- card.update args
- end
- card.try(:update_machine_output)
-end
-
-def groups_changed?
- expected_items = expected_item_keys
- actual_items = item_keys
- difference = (expected_items + actual_items) - (expected_items & actual_items)
- difference.present?
-end
-
-def update_if_source_file_changed
- update_items
- item_cards.each do |item_card|
- item_card.try(:update_if_source_file_changed)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/abstract/mod_assets.rb ~~
diff --git a/set/mod016-script/abstract/script.rb b/set/mod016-script/abstract/script.rb
deleted file mode 100644
index 13817e0..0000000
--- a/set/mod016-script/abstract/script.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Script)
-#
-# -*- encoding : utf-8 -*-
-module Script;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/abstract/script.rb"; end
-
-require "uglifier"
-
-def self.included host_class
- host_class.include_set Abstract::Machine
- host_class.include_set Abstract::MachineInput
-
- host_class.machine_input { standard_machine_input }
- host_class.store_machine_output filetype: "js"
-end
-
-def standard_machine_input
- js = format(:js)._render_core
- js = compress_js js if compress_js?
- comment_with_source js
-end
-
-def comment_with_source js
- "//#{name}\n#{js}"
-end
-
-def compress_js input
- Uglifier.compile input
-rescue StandardError => e
- # CoffeeScript is compiled in a view
- # If there is a CoffeeScript syntax error we get the rescued view here
- # and the error that the rescued view is no valid Javascript
- # To get the original error we have to refer to Card::Error.current
- raise Card::Error, compression_error_message(e)
-end
-
-def compression_error_message e
- if Card::Error.current
- Card::Error.current.message
- else
- "JavaScript::SyntaxError (#{name}): #{e.message}"
- end
-end
-
-def compress_js?
- Cardio.config.compress_javascript
-end
-
-def clean_html?
- false
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def chunk_list
- # turn off autodetection of uri's
- :nest_only
- end
-
- # def default_nest_view
- # :raw
- # end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :ace_editor
- end
-
- def ace_mode
- :javascript
- end
-
- def content_changes action, diff_type, hide_diff=false
- wrap_with(:pre) { super }
- end
-
- view :core do
- script = card.format(:js).render_core
- process_content highlight(script)
- end
-
- view :include_tag do
- javascript_include_tag card.format(:js).source
- end
-
- def highlight script
- ::CodeRay.scan(script, :js).div
- end
-end
-
-def diff_args
- { diff_format: :text }
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/abstract/script.rb ~~
diff --git a/set/mod016-script/right/script.rb b/set/mod016-script/right/script.rb
deleted file mode 100644
index 4711d9e..0000000
--- a/set/mod016-script/right/script.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Script" cards
-#
-module Script;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/right/script.rb"; end
-def ok_to_read
- true
-end
-
-view :javascript_include_tag do
- item_cards.map do |script|
- script.format(:html).render :javascript_include_tag
- end
-end
-
-def update_if_source_file_changed
- item_cards.each do |item_card|
- item_card.try(:update_if_source_file_changed)
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def raw_help_text
- "JavaScript (or CoffeeScript) for card's page."
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/right/script.rb ~~
diff --git a/set/mod016-script/self/script.rb b/set/mod016-script/self/script.rb
deleted file mode 100644
index d92bbb2..0000000
--- a/set/mod016-script/self/script.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Script"
-#
-module Script;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/self/script.rb"; end
-setting_opts group: :webpage, position: 5
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/self/script.rb ~~
diff --git a/set/mod016-script/self/script_html5shiv_printshiv.rb b/set/mod016-script/self/script_html5shiv_printshiv.rb
deleted file mode 100644
index 4dd1690..0000000
--- a/set/mod016-script/self/script_html5shiv_printshiv.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "ScriptHtml5shivPrintshiv"
-#
-module ScriptHtml5shivPrintshiv;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/self/script_html5shiv_printshiv.rb"; end
-include_set Abstract::CodeFile
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :script_tag, perms: :none do
- <<-HTML.strip_heredoc
-
- HTML
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/self/script_html5shiv_printshiv.rb ~~
diff --git a/set/mod016-script/self/script_mods.rb b/set/mod016-script/self/script_mods.rb
deleted file mode 100644
index 58820ee..0000000
--- a/set/mod016-script/self/script_mods.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "ScriptMods"
-#
-module ScriptMods;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/self/script_mods.rb"; end
-include_set Abstract::CodePointer
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/self/script_mods.rb ~~
diff --git a/set/mod016-script/type/01_coffee_script.rb b/set/mod016-script/type/01_coffee_script.rb
deleted file mode 100644
index a033da3..0000000
--- a/set/mod016-script/type/01_coffee_script.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "CoffeeScript" cards
-#
-module CoffeeScript;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/type/01_coffee_script.rb"; end
-
- # -*- encoding : utf-8 -*-
-
-require "coffee-script"
-
-include_set Abstract::Script
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def ace_mode
- :coffee
- end
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :core do
- compile_coffee _render_raw
- end
-
- def compile_coffee script
- ::CoffeeScript.compile script
- rescue => e
- line_nr = e.to_s.match(/\[stdin\]:(\d*)/)&.capture(0)&.to_i
- line = script.lines[line_nr - 1] if line_nr
- raise Card::Error, "CoffeeScript::Error (#{card.name}): #{e.message}: #{line}"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/type/01_coffee_script.rb ~~
diff --git a/set/mod016-script/type/02_java_script.rb b/set/mod016-script/type/02_java_script.rb
deleted file mode 100644
index d463d30..0000000
--- a/set/mod016-script/type/02_java_script.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "JavaScript" cards
-#
-# -*- encoding : utf-8 -*-
-module JavaScript;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/type/02_java_script.rb"; end
-
-include_set Abstract::Script
-
-module JsFormat; module_parent.send :register_set_format, Card::Format::JsFormat, self; extend Card::Set::AbstractFormat
- view :core do
- _render_raw
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :include_tag do
- javascript_include_tag card.format(:js).render(:source)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/type/02_java_script.rb ~~
diff --git a/set/mod016-script/type/local_folder_group.rb b/set/mod016-script/type/local_folder_group.rb
deleted file mode 100644
index 857cb8f..0000000
--- a/set/mod016-script/type/local_folder_group.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "LocalFolderGroup" cards
-#
-module LocalFolderGroup;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/type/local_folder_group.rb"; end
-include_set Abstract::AssetList
-
-def paths
- return [] unless (path = left&.assets_path)
-
- relative_paths.map { |child| ::File.join path, child }
-end
-
-def relative_paths
- return [] unless (path = left&.assets_path)
-
- Dir::children path
-end
-
-def item_name_to_path name
- ::File.join base_path, name
-end
-
-def base_path
- left&.assets_path
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/type/local_folder_group.rb ~~
diff --git a/set/mod016-script/type/local_manifest_group.rb b/set/mod016-script/type/local_manifest_group.rb
deleted file mode 100644
index cd6675b..0000000
--- a/set/mod016-script/type/local_manifest_group.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "LocalManifestGroup" cards
-#
-module LocalManifestGroup;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/type/local_manifest_group.rb"; end
-include_set Abstract::AssetList
-include_set Abstract::ManifestGroup
-
-def paths
- return [] unless left
-
- relative_paths.map { |path| ::File.join(base_path, path) } || []
-end
-
-def relative_paths
- return [] unless left
-
- left.manifest_group_items group_name
-end
-
-def item_name_to_path name
- ::File.join base_path, name
-end
-
-def minimize?
- left.manifest_group_minimize? group_name
-end
-
-def base_path
- left&.assets_path
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/type/local_manifest_group.rb ~~
diff --git a/set/mod016-script/type/mod_script_assets.rb b/set/mod016-script/type/mod_script_assets.rb
deleted file mode 100644
index 2ac9da6..0000000
--- a/set/mod016-script/type/mod_script_assets.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "ModScriptAssets" cards
-#
-module ModScriptAssets;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/type/mod_script_assets.rb"; end
-include_set Abstract::ModAssets
-
-def subpath
- "javascript"
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :javascript_include_tag do
- card.item_cards.map do |icard|
- nest icard, view: :javascript_include_tag
- end.join("\n")
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/type/mod_script_assets.rb ~~
diff --git a/set/mod016-script/type/remote_manifest_group.rb b/set/mod016-script/type/remote_manifest_group.rb
deleted file mode 100644
index 218fe60..0000000
--- a/set/mod016-script/type/remote_manifest_group.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "RemoteManifestGroup" cards
-#
-module RemoteManifestGroup;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/script/set/type/remote_manifest_group.rb"; end
-include_set Abstract::ReadOnly
-include_set Abstract::ManifestGroup
-
-def local?
- @local = false
-end
-
-def minimize?
- @minimize = false
-end
-
-def paths
- return [] unless left
-
- left.manifest_group_items group_name
-end
-
-def item_names _content=nil
- paths
-end
-
-def content
- paths.join "\n"
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :javascript_include_tag do
- paths.map do |path|
- javascript_include_tag path
- end.join("\n")
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/script/set/type/remote_manifest_group.rb ~~
diff --git a/set/mod017-ace_editor/all/ace_editor.rb b/set/mod017-ace_editor/all/ace_editor.rb
deleted file mode 100644
index af9842e..0000000
--- a/set/mod017-ace_editor/all/ace_editor.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (AceEditor)
-#
-module AceEditor;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/ace_editor/set/all/ace_editor.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def ace_editor_input
- text_area :content, rows: 5,
- class: "d0-card-content ace-editor-textarea",
- "data-ace-mode" => ace_mode
- end
-
- def ace_mode
- :html
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/ace_editor/set/all/ace_editor.rb ~~
diff --git a/set/mod017-ace_editor/self/ace.rb b/set/mod017-ace_editor/self/ace.rb
deleted file mode 100644
index c04070f..0000000
--- a/set/mod017-ace_editor/self/ace.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Ace"
-#
-module Ace;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/ace_editor/set/self/ace.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def raw_help_text
- "Configure [[https://ace.c9.io/|ace]], "\
- "Decko's default code editor, using these available "\
- "[[https://github.com/ajaxorg/ace/wiki/Configuring-Ace|options]]."
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/ace_editor/set/self/ace.rb ~~
diff --git a/set/mod017-ace_editor/self/script_ace.rb b/set/mod017-ace_editor/self/script_ace.rb
deleted file mode 100644
index 81774a1..0000000
--- a/set/mod017-ace_editor/self/script_ace.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "ScriptAce"
-#
-module ScriptAce;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/ace_editor/set/self/script_ace.rb"; end
-include_set Abstract::CodeFile
-
-Self::InputOptions.add_to_basket :options, "ace editor"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/ace_editor/set/self/script_ace.rb ~~
diff --git a/set/mod017-ace_editor/self/script_ace_config.rb b/set/mod017-ace_editor/self/script_ace_config.rb
deleted file mode 100644
index 0a0515d..0000000
--- a/set/mod017-ace_editor/self/script_ace_config.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "ScriptAceConfig"
-#
-module ScriptAceConfig;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/ace_editor/set/self/script_ace_config.rb"; end
-include_set Abstract::CodeFile
-
-All::Head::HtmlFormat.add_to_basket :mod_js_config, [:ace, "setAceConfig"]
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/ace_editor/set/self/script_ace_config.rb ~~
diff --git a/set/mod018-alias/all/alias.rb b/set/mod018-alias/all/alias.rb
deleted file mode 100644
index 8dbe63c..0000000
--- a/set/mod018-alias/all/alias.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Alias)
-#
-# triggerable event to auto-add an alias upon renaming a card
-module Alias;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/alias/set/all/alias.rb"; end
-event :create_alias_upon_rename, :finalize,
- on: :update, changed: :name, trigger: :required do
- add_subcard name_before_act, type_code: :alias, content: name
-end
-
-# actual aliases override this in narrower sets.
-def alias?
- false
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # adds checkbox to rename form
- def edit_name_buttons
- output [auto_alias_checkbox, super].compact
- end
-
- def auto_alias_checkbox
- haml :auto_alias_checkbox if card.simple?
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/alias/set/all/alias.rb ~~
diff --git a/set/mod018-alias/all_plus/alias.rb b/set/mod018-alias/all_plus/alias.rb
deleted file mode 100644
index e10d6fe..0000000
--- a/set/mod018-alias/all_plus/alias.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class AllPlus
-# Set: All "+" cards (Alias)
-#
-module Alias;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/alias/set/all_plus/alias.rb"; end
-event :validate_not_alias, :validate, on: :save do
- errors.add t(:alias_cards_no_children) if alias? && type_code != :alias
-end
-
-# a compound name is an alias if any part is an alias
-def alias?
- name.parts.any? { |p| Card[p]&.alias? }
-end
-
-# reconstructs the name to which a compound name is aliased
-def target_name
- Card::Name[
- name.parts.map do |p|
- part = Card[p]
- part&.alias? ? part.target_name : p
- end
- ]
-end
-
-def target_card
- Card.fetch target_name, new: {}
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/alias/set/all_plus/alias.rb ~~
diff --git a/set/mod018-alias/type/alias.rb b/set/mod018-alias/type/alias.rb
deleted file mode 100644
index e24702b..0000000
--- a/set/mod018-alias/type/alias.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Alias" cards
-#
-module Alias;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/alias/set/type/alias.rb"; end
-include_set Abstract::Pointer
-include_set Abstract::IdPointer
-
-event :validate_alias_source, :validate, on: :save do
- errors.add :name, t(:alias_must_be_simple) if name.compound?
- errors.add :type, t(:alias_cards_no_children) if child_ids.present?
-end
-
-event :validate_alias_target, :validate, on: :save do
- return if count == 1 && target_name&.simple?
-
- errors.add :content, t(:alias_target_must_be_simple)
-end
-
-def alias?
- true
-end
-
-# @return [Card::Name] name to which card's name is aliased
-def target_name
- first_name
-end
-
-# @return [Card] card to which card is aliased
-def target_card
- first_card
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :autocomplete
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/alias/set/type/alias.rb ~~
diff --git a/set/mod019-api_key/right/account.rb b/set/mod019-api_key/right/account.rb
deleted file mode 100644
index 0346c62..0000000
--- a/set/mod019-api_key/right/account.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Account" cards
-#
-module Account;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/api_key/set/right/account.rb"; end
-card_accessor :api_key
-
-delegate :authenticate_api_key, to: :api_key_card
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :api_key do
- field_nest :api_key
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/api_key/set/right/account.rb ~~
diff --git a/set/mod019-api_key/right/api_key.rb b/set/mod019-api_key/right/api_key.rb
deleted file mode 100644
index 38cbd7d..0000000
--- a/set/mod019-api_key/right/api_key.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+ApiKey" cards
-#
-module ApiKey;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/api_key/set/right/api_key.rb"; end
-include_set Abstract::AccountField
-
-# triggerable event to generate new API Key
-event :generate_api_key, :prepare_to_validate, trigger: :required do
- generate
-end
-
-event :validate_api_key, :validate, on: :save, changed: :content do
- errors.add :content, t(:api_key_invalid) unless content.match?(/^\w{20,}$/)
- errors.add :content, t(:api_key_taken) if api_key_taken?
-end
-
-# checks availability of API key
-def api_key_taken?
- return false unless (acct = Card::Auth.find_account_by_api_key content)
-
- acct.id != left_id
-end
-
-def history?
- false
-end
-
-def ok_to_read
- own_account? || super
-end
-
-def ok_to_create
- own_account? || super
-end
-
-# @return [True/False] checks whether key matches content
-def authenticate_api_key api_key
- return true unless (error = api_key_validation_error api_key)
-
- errors.add error, t(error)
- false
-end
-
-def generate
- self.content = SecureRandom.base64.tr "+/=", "Qrt"
-end
-
-def generate!
- generate.tap { save! }
-end
-
-def simple_token
- Card::Auth::Token.encode accounted.id
-end
-
-private
-
-def api_key_validation_error api_key
- case
- when !real?
- :api_key_not_found
- when content != api_key
- :api_key_incorrect
- end
-end
-
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- view :token do
- { token: card.simple_token }
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core, unknown: true, template: :haml
- view(:content, unknown: true) { super() }
-
- %i[titled titled_content].each do |viewname|
- view(viewname, unknown: true) { super() }
- end
-
- view :token_link do
- link_to t(:api_key_get_jwt_token), path: { format: :json, view: :token }
- end
-
- view :generate_button, perms: :update, unknown: true do
- text = card.content.present? ? t(:api_key_regenerate) : t(:api_key_generate)
- card_form :update do
- [
- hidden_tags(card: { trigger: :generate_api_key }),
- submit_button(text: text, disable_with: t(:api_key_generating))
- ]
- end
- end
-
- def input_type
- :text_field
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/api_key/set/right/api_key.rb ~~
diff --git a/set/mod020-style/abstract/skin_box.rb b/set/mod020-style/abstract/skin_box.rb
deleted file mode 100644
index 2648af8..0000000
--- a/set/mod020-style/abstract/skin_box.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (SkinBox)
-#
-module SkinBox;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/abstract/skin_box.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :box do
- class_up "box-middle", "p-0"
- voo.hide :customize_button, :box_middle
- super()
- end
-
- view :box_bottom, template: :haml
-
- view :customize_button, cache: :never do
- customize_button
- end
-
- def customize_button target: parent&.card, text: "Apply and customize"
- return "" unless card.codename.present?
-
- theme = card.codename.match(/^(?.+)_skin$/).capture(:theme_name)
- link_to_card target, text,
- path: { action: :update, card: { content: "[[#{card.name}]]" },
- customize: true, theme: theme },
- class: "btn btn-sm btn-outline-primary mr-2"
- end
-
- view :box_middle do
- return unless card.field(:image)
-
- field_nest(:image, view: :full_width, size: :large)
- end
-
- def select_button target=parent.card
- link_to_card target, "Apply",
- path: { action: :update, card: { content: "[[#{card.name}]]" } },
- class: "btn btn-sm btn-primary"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/abstract/skin_box.rb ~~
diff --git a/set/mod020-style/right/style.rb b/set/mod020-style/right/style.rb
deleted file mode 100644
index efda1fa..0000000
--- a/set/mod020-style/right/style.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Style" cards
-#
-module Style;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/right/style.rb"; end
-require "sassc"
-include_set Abstract::Machine
-
-store_machine_output filetype: "css"
-
-def ok_to_read
- true
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- # turn off autodetection of uri's
- def chunk_list
- :nest_only
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- HIDDEN_SKINS = %w[bootstrap_default_skin themeless_bootstrap_skin bootstrap_default_skin
- classic_bootstrap_skin].freeze
-
- def default_item_view
- :bar
- end
-
- view :input, template: :haml
-
- def themes
- card.rule_card(:content_options).item_cards
- end
-
- def selectable_themes
- themes.reject do |theme_card|
- theme_card.right&.codename == :stylesheets ||
- theme_card.key.in?(HIDDEN_SKINS)
- end
- end
-end
-
-event :customize_theme, :prepare_to_validate, on: :update, when: :customize_theme? do
- skin_name = free_skin_name
- add_subcard skin_name, type_id: CustomizedBootswatchSkinID
- self.content = "[[#{skin_name}]]"
-end
-
-def free_skin_name
- name = "#{@theme} skin customized"
- if Card.exist?(name)
- name = "#{name} 1"
- name.next! while Card.exist?(name)
- end
- name
-end
-
-def customize_theme?
- Env.params[:customize].present? && (@theme = Env.params[:theme]).present?
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/right/style.rb ~~
diff --git a/set/mod020-style/self/style.rb b/set/mod020-style/self/style.rb
deleted file mode 100644
index e55eb92..0000000
--- a/set/mod020-style/self/style.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Style"
-#
-module Style;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/self/style.rb"; end
-setting_opts group: :webpage,
- position: 4,
- help_text: "Skin (collection of stylesheets) for card's page. "\
- "[[http://decko.org/skins|more]]"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/self/style.rb ~~
diff --git a/set/mod020-style/self/style_bootstrap_compatible.rb b/set/mod020-style/self/style_bootstrap_compatible.rb
deleted file mode 100644
index bcb73d7..0000000
--- a/set/mod020-style/self/style_bootstrap_compatible.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleBootstrapCompatible"
-#
-module StyleBootstrapCompatible;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/self/style_bootstrap_compatible.rb"; end
-include_set Abstract::CodeFile
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/self/style_bootstrap_compatible.rb ~~
diff --git a/set/mod020-style/self/style_cards.rb b/set/mod020-style/self/style_cards.rb
deleted file mode 100644
index 88f2347..0000000
--- a/set/mod020-style/self/style_cards.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleCards"
-#
-module StyleCards;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/self/style_cards.rb"; end
-include_set Abstract::CodeFile
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/self/style_cards.rb ~~
diff --git a/set/mod020-style/self/style_jquery_ui_smoothness.rb b/set/mod020-style/self/style_jquery_ui_smoothness.rb
deleted file mode 100644
index f1a0dc8..0000000
--- a/set/mod020-style/self/style_jquery_ui_smoothness.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleJqueryUiSmoothness"
-#
-module StyleJqueryUiSmoothness;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/self/style_jquery_ui_smoothness.rb"; end
-include_set Abstract::CodeFile
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/self/style_jquery_ui_smoothness.rb ~~
diff --git a/set/mod020-style/self/style_libraries.rb b/set/mod020-style/self/style_libraries.rb
deleted file mode 100644
index f3b78b4..0000000
--- a/set/mod020-style/self/style_libraries.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleLibraries"
-#
-module StyleLibraries;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/self/style_libraries.rb"; end
-include_set Abstract::CodePointer
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/self/style_libraries.rb ~~
diff --git a/set/mod020-style/self/style_mods.rb b/set/mod020-style/self/style_mods.rb
deleted file mode 100644
index 7775fdb..0000000
--- a/set/mod020-style/self/style_mods.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleMods"
-#
-module StyleMods;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/self/style_mods.rb"; end
-include_set Abstract::CodePointer
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/self/style_mods.rb ~~
diff --git a/set/mod020-style/type/css.rb b/set/mod020-style/type/css.rb
deleted file mode 100644
index 2a8a264..0000000
--- a/set/mod020-style/type/css.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Css" cards
-#
-# -*- encoding : utf-8 -*-
-module Css;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/type/css.rb"; end
-
-require "sassc"
-require "benchmark"
-
-include_set Abstract::Machine
-include_set Abstract::MachineInput
-
-store_machine_output filetype: "css"
-
-machine_input do
- compress_css format(:css)._render_core
-end
-
-def compress_css input
- compress_css? ? SassC::Engine.new(input, style: :compressed).render : input
-rescue StandardError => e
- raise Card::Error, css_compression_error(e)
-end
-
-def css_compression_error error
- # scss is compiled in a view
- # If there is a scss syntax error we get the rescued view here
- # and the error that the rescued view is no valid css
- # To get the original error we have to refer to Card::Error.current
- if Card::Error.current
- Card::Error.current.message
- else
- "Sass::SyntaxError (#{name}): #{error.message}"
- end
-end
-
-def clean_html?
- false
-end
-
-def compress_css?
- true
- # !Rails.env.development?
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- # def default_nest_view
- # :raw
- # end
-
- # turn off autodetection of uri's
- def chunk_list
- :references
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :ace_editor
- end
-
- def ace_mode
- :css
- end
-
- def default_nest_view
- :closed
- end
-
- view :core do
- # FIXME: scan must happen before process for inclusion interactions to
- # work, but this will likely cause
- # problems with including other css?
- process_content ::CodeRay.scan(_render_raw, :css).div, size: :icon
- end
-
- def content_changes action, diff_type, hide_diff=false
- wrap_with(:pre) { super }
- end
-end
-
-module CssFormat; module_parent.send :register_set_format, Card::Format::CssFormat, self; extend Card::Set::AbstractFormat
- view :import do
- %{\n@import url("#{_render_url}");\n}
- end
-end
-
-def diff_args
- { diff_format: :text }
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/type/css.rb ~~
diff --git a/set/mod020-style/type/scss.rb b/set/mod020-style/type/scss.rb
deleted file mode 100644
index 055476d..0000000
--- a/set/mod020-style/type/scss.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Scss" cards
-#
-module Scss;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/type/scss.rb"; end
-include_set Type::Css
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :core, cache: :never do
- compile_scss process_content(_render_raw)
- end
-
- def compile_scss scss, style=:expanded
- SassC::Engine.new(scss, style: style).render
- rescue SassC::SyntaxError => e
- raise Card::Error,
- "SassC::SyntaxError (#{card.name}:#{e.sass_backtrace}): #{e.message}"
- # "#{#scss.lines[e.sass_line - 1]}\n" \
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def ace_mode
- :scss
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/type/scss.rb ~~
diff --git a/set/mod020-style/type/skin.rb b/set/mod020-style/type/skin.rb
deleted file mode 100644
index 847b3e4..0000000
--- a/set/mod020-style/type/skin.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Skin" cards
-#
-module Skin;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/style/set/type/skin.rb"; end
-include_set Abstract::MachineInput
-include_set Abstract::SkinBox
-include_set Pointer
-
-def machine_input
- # only the item of a skin card contribute input to the machine
- # not the skin card itself
- ""
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/style/set/type/skin.rb ~~
diff --git a/set/mod021-bar_and_box/abstract/media.rb b/set/mod021-bar_and_box/abstract/media.rb
deleted file mode 100644
index 243c0d1..0000000
--- a/set/mod021-bar_and_box/abstract/media.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (Media)
-#
-module Media;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/abstract/media.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def image_card
- @image_card ||= card.fetch(:image, new: {})
- end
-
- def text_with_image opts={}
- class_up "media-left", "m-2"
- @image_card = Card.cardish(opts[:image]) if opts[:image]
- haml :media_snippet, normalized_text_with_image_opts(opts)
- end
-
- private
-
- def normalized_text_with_image_opts opts
- opts.reverse_merge! title: _render_title, text: "", size: voo.size, media_opts: {}
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/abstract/media.rb ~~
diff --git a/set/mod021-bar_and_box/all/bar.rb b/set/mod021-bar_and_box/all/bar.rb
deleted file mode 100644
index 0b8236e..0000000
--- a/set/mod021-bar_and_box/all/bar.rb
+++ /dev/null
@@ -1,112 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Bar)
-#
-module Bar;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/all/bar.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- setting :bar_cols
- setting :info_bar_cols
-
- view :info_bar do
- render_bar show: :bar_middle
- end
-
- before :bar do
- class_up "bar", card.safe_set_keys
- voo.hide! :bar_collapse_link
- voo.hide :edit_link, :full_page_link, :bridge_link
- end
-
- view :bar, unknown: :unknown_bar do
- voo.hide :bar_middle
- voo.hide :bar_bottom # needed for toggle
- class_up_bar_sides(voo.show?(:bar_middle))
- # NOTE: above cannot be in `before`, because before blocks run before viz processing
- wrap { haml :bar }
- end
-
- bar_cols 9, 3
- info_bar_cols 5, 4, 3
-
- view :unknown_bar, unknown: true do
- voo.hide! :bar_middle, :bar_bottom, :bar_nav
- wrap { haml :bar }
- end
-
- before :expanded_bar do
- class_up "bar", card.safe_set_keys
- voo.hide! :bar_expand_link
- end
-
- view :expanded_bar do
- class_up_bar_sides(false)
- wrap { haml :expanded_bar }
- end
-
- def class_up_bar_sides middle
- class_up_cols %w[bar-left bar-right], bar_cols
- class_up_cols %w[bar-left bar-middle bar-right], info_bar_cols, "md" if middle
- end
-
- def class_up_cols classes, cols, context=nil
- classes.each_with_index do |cls, i|
- class_up cls, ["col", context, cols[i]].compact.join("-")
- end
- end
-
- view :bar_left do
- bar_title
- end
-
- def bar_title
- return render_missing if card.unknown?
-
- if voo.show?(:toggle)
- link_to_view bar_title_toggle_view, render_title
- else
- render_title
- end
- end
-
- def bar_title_toggle_view
- voo.show?(:bar_bottom) ? :bar : :expanded_bar
- end
-
- view :bar_right, unknown: :blank do
- [(render(:short_content) unless voo.show?(:bar_middle)),
- render(:edit_button, optional: :hide)]
- end
-
- view :bar_middle, unknown: :blank do
- render :short_content
- end
-
- view :bar_bottom do
- render(nest_mode == :edit ? :edit : :core)
- end
-
- view :bar_nav, unknown: true, wrap: { div: { class: "bar-nav" } } do
- [render_bar_expand_link,
- render_bar_collapse_link,
- render_full_page_link,
- render_edit_link,
- render_bridge_link]
- end
-
- view :bar_expand_link, unknown: true do
- link_to_view :expanded_bar, icon_tag(:keyboard_arrow_down)
- end
-
- view :bar_collapse_link, unknown: true do
- link_to_view :bar, icon_tag(:keyboard_arrow_up)
- end
-
- view :edit_button do
- view = voo.edit == :inline ? :edit_inline : :edit
- link_to_view view, "Edit", class: "btn btn-sm btn-outline-primary mr-2"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/all/bar.rb ~~
diff --git a/set/mod021-bar_and_box/all/box.rb b/set/mod021-bar_and_box/all/box.rb
deleted file mode 100644
index 2511288..0000000
--- a/set/mod021-bar_and_box/all/box.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Box)
-#
-module Box;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/all/box.rb"; end
-view :box, template: :haml do
- voo.hide :menu
-end
-
-view :box_top do
- render_title_link
-end
-
-view :box_middle do
- _render_content
-end
-
-view :box_bottom do
- [_render_creator_credit,
- _render_updated_by]
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/all/box.rb ~~
diff --git a/set/mod021-bar_and_box/self/style_media.rb b/set/mod021-bar_and_box/self/style_media.rb
deleted file mode 100644
index 710587c..0000000
--- a/set/mod021-bar_and_box/self/style_media.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleMedia"
-#
-module StyleMedia;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/self/style_media.rb"; end
-include_set Abstract::CodeFile
-Self::StyleMods.add_item :style_media
-
-def source_files
- scss_files [:image_box]
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/self/style_media.rb ~~
diff --git a/set/mod021-bar_and_box/type/image.rb b/set/mod021-bar_and_box/type/image.rb
deleted file mode 100644
index 506eb0f..0000000
--- a/set/mod021-bar_and_box/type/image.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Image" cards
-#
-module Image;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/type/image.rb"; end
-IMAGE_BOX_SIZE_MAP = {
- icon: :icon, small: :small, medium: :small, large: :medium, xlarge: :medium
-}.freeze
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :boxed, unknown: true do
- image_box { |size| render_core size: size }
- end
-
- view :boxed_link, unknown: true do
- image_box { |size| link_to_card image_box_link_target, render_core(size: size) }
- end
-
- def image_box
- voo.size ||= :medium
- wrap_with :div, title: image_box_title, class: "image-box #{voo.size}" do
- yield image_box_size
- end
- end
-
- ## METHODS FOR OVERRIDE
-
- def image_box_size
- IMAGE_BOX_SIZE_MAP[voo.size.to_sym] || :medium
- end
-
- def image_box_card_name
- card.name.compound? ? card.name.left : card.name
- end
-
- def image_box_link_target
- image_box_card_name
- end
-
- def image_box_title
- voo.title || image_box_card_name
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bar_and_box/set/type/image.rb ~~
diff --git a/set/mod022-bootstrap/abstract/bootstrap_code_file.rb b/set/mod022-bootstrap/abstract/bootstrap_code_file.rb
deleted file mode 100644
index 6b19b65..0000000
--- a/set/mod022-bootstrap/abstract/bootstrap_code_file.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (BootstrapCodeFile)
-#
-module BootstrapCodeFile;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/abstract/bootstrap_code_file.rb"; end
-def self.included host_class
- host_class.include_set Abstract::CodeFile
- host_class.include OverrideCodeFile
-end
-
-module OverrideCodeFile
- def content
- stylesheets.join "\n"
- end
-
- def stylesheets
- load_stylesheets unless @stylesheets
- @stylesheets
- end
-
- def add_bs_subdir sub_dir
- Dir.glob("#{bootstrap_path}/#{sub_dir}/*.scss").each do |path|
- load_from_path path
- end
- end
-
- def mod_path
- mod_root :bootstrap
- end
-
- def bootstrap_path
- "#{mod_path}/vendor/bootstrap/scss"
- end
-
- def add_stylesheet filename, type: :scss
- load_from_path "#{mod_path}/lib/stylesheets/#{filename}.#{type}"
- end
-
- def add_stylesheet_file path
- load_from_path File.join(mod_path, path)
- end
-
- def add_bs_stylesheet filename, type: :scss, subdir: nil
- path = File.join(*[bootstrap_path, subdir, "_#{filename}.#{type}"].compact)
- load_from_path path
- end
-
- def load_from_path path
- @stylesheets ||= []
- Rails.logger.debug "reading file: #{path}"
- @stylesheets << File.read(path)
- end
-
- def source_changed _since:
- false
- end
-
- def existing_source_paths
- []
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/abstract/bootstrap_code_file.rb ~~
diff --git a/set/mod022-bootstrap/abstract/bootswatch_theme.rb b/set/mod022-bootstrap/abstract/bootswatch_theme.rb
deleted file mode 100644
index c1303de..0000000
--- a/set/mod022-bootstrap/abstract/bootswatch_theme.rb
+++ /dev/null
@@ -1,167 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (BootswatchTheme)
-#
-# Bootswatch themes are free themes for bootstrap available at https://bootswatch.com/.
-# For every bootswatch theme we have one card of card type "bootswatch skin".
-# They all have codenames following the pattern "#{theme_name}_skin".
-#
-# The original bootswatch theme is build from two files, `_variables.scss` and
-# `_bootswatch.scss`. The original bootstrap scss has to be put between those two.
-# `_variables.scss` overrides bootstrap variables, `_bootswatch.scss` overrides
-# bootstrap css (variables are defined with `!default` hence only the first appearance
-# has an effect, for css the last appearance counts)
-#
-# The content of a bootswatch theme card consists of four parts:
-# * pre_variables: hard-coded theme independent stuff
-# and bootstrap functions to make them available in the variables part
-# * variables: the content from `_variables.scss`,
-# * post_variables: the bootstrap css and libraries like select2 and
-# bootstrap-colorpicker that depend on the theme
-# * stylesheets: the content from `_bootswatch.scss` and custom styles
-#
-# For the original bootswatch themes all those parts are hard-coded and the content
-module BootswatchTheme;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/abstract/bootswatch_theme.rb"; end
-# is taken from files.
-# The bootswatch theme content is taken directly from the files in the bootswatch
-# submodule. For the rest we use code file cards.
-# Cards of type "customized bootswatch skin" have the same structure but make the variables
-# and stylesheets part editable.
-#
-# Bootswatch theme cards are machine cards for the following reason.
-# Machine cards usually store all involved input cards of all nested levels in
-# there +*machine_input pointer. All those input cards
-# are processed separately and the result is joined to build the machine output.
-# That's a problem for this card when it's used as input.
-# A lot of the items depend on the variables scss and can't
-# be processed independently. Therefore we return only self as item card and join
-# the content of all the item cards in the content of the bootswatch theme card.
-# But then this card has to forward updates of its items to the machine cards it provides
-# input for.
-# To do that it is a machine itself and stores the generated machine output as its
-# content which will trigger the updates of other machines that use this card.
-
-include_set Abstract::Machine
-include_set Type::Scss
-include_set Abstract::CodeFile
-include_set Abstract::SkinBox
-
-CONTENT_PARTS = %i[pre_variables variables post_variables stylesheets].freeze
-
-PRE_VARIABLES_CARD_NAMES = %i[
- style_jquery_ui_smoothness
- bootstrap_functions
-].freeze
-
-POST_VARIABLES_CARD_NAMES = %i[
- bootstrap_core
- style_cards
- style_bootstrap_cards
- style_libraries
- style_mods
-].freeze
-
-# @return [Array]
-def variables_card_names
- []
-end
-
-# @return [Array]
-def stylesheets_card_names
- []
-end
-
-# reject cards that don't contribute directly to the content like skin or pointer cards
-def engine_input
- extended_input_cards.select { |ca| ca.type_id.in? [Card::ScssID, Card::CssID] }
-end
-
-# Don't create "+*machine output" file card
-# instead save the the output as the card's content is
-def after_engine output
- Card::Auth.as_bot { update! db_content: output }
-end
-
-# needed to make the refresh_script_and_style method work with these cards
-def source_files
- extended_input_cards.map do |i_card|
- i_card.try(:source_files)
- end.flatten.compact
-end
-
-# needed to make the refresh_script_and_style method work with these cards
-def existing_source_paths
- extended_input_cards.map do |i_card|
- i_card.try(:existing_source_paths)
- end.flatten.compact
-end
-
-def extended_input_cards
- input_names.map do |n|
- Card.fetch(n).extended_item_cards
- end.flatten.compact
-end
-
-def content
- CONTENT_PARTS.map do |n|
- send "#{n}_content"
- end.join "\n"
-end
-
-def pre_variables_content
- load_content(*PRE_VARIABLES_CARD_NAMES)
-end
-
-def variables_content
- load_content variables_card_names
-end
-
-def post_variables_content
- load_content(*POST_VARIABLES_CARD_NAMES)
-end
-
-def stylesheets_content
- load_content stylesheets_card_names
-end
-
-def input_names _args={}
- (PRE_VARIABLES_CARD_NAMES + variables_card_names +
- POST_VARIABLES_CARD_NAMES + stylesheets_card_names).compact.map do |n|
- Card.fetch_name(n)
- end.compact
-end
-
-def item_names _args={}
- []
-end
-
-def item_cards _args={}
- [self]
-end
-
-def load_content *names
- cards = names.flatten.map { |n| Card.fetch(n)&.extended_item_cards }
- cards.flatten.compact.map(&:content).join "\n"
-end
-
-def scss_from_theme_file file
- return "" unless (path = ::File.join(source_dir, "_#{file}.scss")) &&
- ::File.exist?(path)
-
- ::File.read path
-end
-
-def theme_name
- /^(.+)_skin$/.match(codename)&.capture(0) ||
- /^(.+)[ _][sS]kin/.match(name)&.capture(0)&.downcase
-end
-
-def source_dir
- @source_dir ||= File.expand_path(
- "#{mod_root :bootstrap}/vendor/bootswatch/dist/#{theme_name}", __FILE__
- )
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/abstract/bootswatch_theme.rb ~~
diff --git a/set/mod022-bootstrap/abstract/bootswatch_theme/html_views.rb b/set/mod022-bootstrap/abstract/bootswatch_theme/html_views.rb
deleted file mode 100644
index 2ff1b1e..0000000
--- a/set/mod022-bootstrap/abstract/bootswatch_theme/html_views.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module BootswatchTheme;
-# Set: Abstract (BootswatchTheme, HtmlViews)
-#
-module HtmlViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/abstract/bootswatch_theme/html_views.rb"; end
-include_set Abstract::Media
-# include_set Abstract::BsBadge
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- before :box do
- voo.show! :customize_button, :box_middle
- end
-
- view :one_line_content do
- ""
- end
-
- view :bar_left do
- class_up "card-title", "my-0 ml-2"
- class_up "media-left", "m-0"
- text_with_image size: :medium, title: "", text: _render_title,
- media_opts: { class: "align-items-center" }
- # field_nest(:image, view: :core) + wrap_with(:h4, render(:title))
- end
-
- view :bar_right do
- customize_button text: "Customize"
- end
-
- view :bar_bottom do
- wrap_with :code do
- render_core
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/abstract/bootswatch_theme/html_views.rb ~~
diff --git a/set/mod022-bootstrap/abstract/bs_badge.rb b/set/mod022-bootstrap/abstract/bs_badge.rb
deleted file mode 100644
index 75a8649..0000000
--- a/set/mod022-bootstrap/abstract/bs_badge.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (BsBadge)
-#
-module BsBadge;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/abstract/bs_badge.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def labeled_badge count, label, opts={}
- haml :labeled_badge, badge_haml_opts(count, label, opts)
- end
-
- def tab_badge count, label, opts={}
- haml :tab_badge, badge_haml_opts(count, label, opts)
- end
-
- def badge_haml_opts count, label, opts
- process_badge_opts count, opts
- { count: count, label: label, klass: opts[:klass], color: opts[:color],
- title: opts[:title] }
- end
-
- def process_badge_opts count, opts
- if count.try(:zero?) && !opts[:zero_ok]
- opts[:klass] = [opts[:klass], "disabled-o"].compact.join " "
- end
- opts[:color] ||= "secondary"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/abstract/bs_badge.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/accordion.rb b/set/mod022-bootstrap/all/bootstrap/accordion.rb
deleted file mode 100644
index adee05f..0000000
--- a/set/mod022-bootstrap/all/bootstrap/accordion.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Accordion)
-#
-module Accordion;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/accordion.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def accordion_group list, collapse_id=nil, args={}
- collapse_id ||= card.name.safe_key
- accordions = ""
- index = 1
- case list
- when Array then accordions = list.join
- when String then accordions = list
- else
- list.each_pair do |title, content|
- accordions << accordion(title, content, "#{collapse_id}-#{index}")
- index += 1
- end
- end
- add_class args, "act-accordion-group w-100"
- wrap_with :div, class: args[:class], id: "accordion-#{collapse_id}",
- role: "tablist", "aria-multiselectable" => "true" do
- accordions
- end
- end
-
- def accordion title, content, collapse_id=card.name.safe_key
- accordion_content =
- case content
- when Hash then accordion_group content, collapse_id
- when Array then content.present? && list_group(content)
- when String then content
- end
- <<-HTML.html_safe
-
- #{accordion_panel(title, accordion_content, collapse_id)}
-
- HTML
- end
-
- def accordion_panel title, body, collapse_id, _panel_heading_link=false
- if body
- <<-HTML
-
-
- HTML
- else
- <<-HTML
-
-
-
- HTML
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/accordion.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/dropdown.rb b/set/mod022-bootstrap/all/bootstrap/dropdown.rb
deleted file mode 100644
index 2fb9f73..0000000
--- a/set/mod022-bootstrap/all/bootstrap/dropdown.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Dropdown)
-#
-module Dropdown;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/dropdown.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def dropdown_button name, items_or_opts={}, opts={}
- items = block_given? ? yield : items_or_opts
- opts = items_or_opts if block_given?
- haml :dropdown_button, name: name, items: items, opts: opts
- end
-
- def split_button main_button, active_item
- wrap_with :div, class: "btn-group" do
- [
- main_button,
- split_button_toggle,
- dropdown_list(yield, "dropdown-menu-right", active_item)
- ]
- end
- end
-
- private
-
- # @param items
- # [String] plain html
- # [Array] list of item names
- # If an item is an array then the first element is used as header for a section.
- # The second item has to be an array with the item names for that section.
- # [Hash] key is used to identify active item, value is the item name.
- # @param active specifies which item to highlight as active. If items are given as array
- # it has to be the index of the active item. If items are given as hash it has to be
- # the key of that item.
- def dropdown_list items, extra_css_class=nil, active=nil
- wrap_with :ul, class: "dropdown-menu #{extra_css_class}", role: "menu" do
- list =
- case items
- when Array
- dropdown_array_list items, active
- when Hash
- dropdown_hash_list items, active
- else
- [items]
- end
- list.flatten.compact.join "\n"
- end
- end
-
- def dropdown_header text
- content_tag(:h6, text, class: "dropdown-header")
- end
-
- def dropdown_hash_list items, active=nil
- items.map { |key, item| dropdown_list_item item, key, active }
- end
-
- def dropdown_array_list items, active=nil
- items.map.with_index { |item, i| dropdown_list_item item, i, active }
- end
-
- def dropdown_list_item item, active_test, active
- return unless item
-
- if item.is_a? Array
- formatted_dropdown_list_item item
- else
- simple_dropdown_list_item item, (active_test == active)
- end
- end
-
- def formatted_dropdown_list_item item
- [dropdown_header(item.first), dropdown_array_list(item.second)]
- end
-
- def simple_dropdown_list_item item, active
- "#{item} "
- end
-
- def split_button_toggle
- wrap_with :a,
- href: "#",
- class: "nav-link pl-0 dropdown-toggle dropdown-toggle-split",
- "data-toggle" => "dropdown",
- "aria-haspopup" => "true",
- "aria-expanded" => "false" do
- 'Toggle Dropdown '
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/dropdown.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/form.rb b/set/mod022-bootstrap/all/bootstrap/form.rb
deleted file mode 100644
index fed1978..0000000
--- a/set/mod022-bootstrap/all/bootstrap/form.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Form)
-#
-module Form;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/form.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def button_tag content_or_options=nil, options={}, &block
- bootstrapify_button(block_given? ? content_or_options : options)
- super(content_or_options, options, &block)
- end
-
- def bootstrapify_button options
- situation = options.delete(:situation) || "primary"
- options[:class] = [options[:class], "btn", "btn-#{situation}"].compact * " "
- end
-
- def type_field args={}
- args[:class] ||= ""
- args[:class] += " form-control"
- super(args)
- end
-
- def bootstrap_options options
- options[:class] ||= ""
- options[:class] += " form-control"
- options
- end
-
- FIELD_HELPERS = %w[hidden_field color_field date_field datetime_field
- datetime_local_field email_field month_field number_field
- password_field phone_field range_field search_field
- telephone_field text_area text_field time_field
- url_field week_field file_field].freeze
-
- FIELD_HELPERS.each do |method_name|
- define_method(method_name) do |name, options={}|
- form.send(method_name, name, bootstrap_options(options))
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/form.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/helper.rb b/set/mod022-bootstrap/all/bootstrap/helper.rb
deleted file mode 100644
index a556444..0000000
--- a/set/mod022-bootstrap/all/bootstrap/helper.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Helper)
-#
-module Helper;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/helper.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def button_link link_text, opts={}
- btn_type = opts.delete(:btn_type) || "primary"
- opts[:class] = [opts[:class], "btn btn-#{btn_type}"].compact.join " "
- smart_link_to link_text, opts
- end
-
- def separator
- ' '
- end
-
- def list_group content_or_options=nil, options={}
- options = content_or_options if block_given?
- content = block_given? ? yield : content_or_options
- content = Array(content).map(&:to_s)
- add_list_group_classes options
- list_tag content, options
- end
-
- def add_list_group_classes options
- add_class options, "list-group"
- options[:items] ||= {}
- add_class options[:items], "list-group-item"
- end
-
- def list_tag content_or_options=nil, options={}, &block
- content, options = list_tag_content_and_options content_or_options, options, &block
- default_item_options = options.delete(:items) || {}
- wrap_with (options[:ordered] ? :ol : :ul), options do
- list_items content, default_item_options
- end
- end
-
- def list_items content, default_item_options
- content.map do |item|
- i_content, i_opts = item
- i_opts ||= default_item_options
- wrap_with :li, i_content, i_opts
- end
- end
-
- def list_tag_content_and_options content_or_options, options
- options = content_or_options if block_given?
- content = block_given? ? yield : content_or_options
- [Array(content), options]
- end
-
- def badge_tag content, options={}
- add_class options, "badge"
- wrap_with :span, content, options
- end
-
- def popover_link text, title=nil, link_text=fa_icon("question-circle"), opts={}
- link_to link_text, popover_opts(text, title, opts)
- end
-
- def popover_opts text, title, opts
- add_class opts, "pl-1 text-muted-link"
- opts.merge! path: "#", "data-toggle": "popover",
- "data-trigger": :focus, "data-content": text
- opts["data-title"] = title if title
- opts
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/helper.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/icon.rb b/set/mod022-bootstrap/all/bootstrap/icon.rb
deleted file mode 100644
index e5faa94..0000000
--- a/set/mod022-bootstrap/all/bootstrap/icon.rb
+++ /dev/null
@@ -1,125 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Icon)
-#
-module Icon;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/icon.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # same for all:
- # :search,
- ICON_MAP = {
- material: {
- plus: :add,
- pencil: :edit,
- trash: :delete,
- wrench: :build,
- new_window: :open_in_new,
- history: :history,
- triangle_left: :expand_less,
- triangle_right: :expand_more,
- flag: :flag,
- option_horizontal: :more_horiz,
- option_vertical: :more_vert,
- pushpin: :pin_drop,
- baby_formula: :device_hub,
- log_out: :call_made,
- log_in: :call_received,
- explore: :explore,
- remove: :close,
- expand: :expand_more,
- collapse_down: :expand_less,
- globe: :public,
- commenting: :comment
- },
- font_awesome: {
- option_horizontal: :ellipsis_h,
- pushpin: "thumb-tack",
- globe: :globe,
- zoom_out: "search-minus",
- close: :remove,
- check_circle: "check-circle",
- reorder: "align-justify",
- commenting: :comments
- },
- glyphicon: {
- option_horizontal: "option-horizontal",
- option_vertical: "option-vertical",
- triangle_left: "triangle-left",
- triangle_right: "triangle-right",
- baby_formula: "baby-formula",
- log_out: "log-out",
- log_in: "log-in",
- collapse_down: "collapse-down",
- globe: :globe,
- zoom_out: "zoom-out",
- close: :remove,
- new_window: "new-window",
- history: :time,
- check_circle: "ok-sign",
- reorder: "align-justify"
- }
-
- }.freeze
-
- def icon_class library, icon
- ICON_MAP[library][icon] || icon
- end
-
- def material_icon icon, opts={}
- universal_icon_tag icon, :material, opts
- end
-
- def glyphicon icon, opts={}
- universal_icon_tag icon, :glyphicon, opts
- end
-
- def fa_icon icon, opts={}
- universal_icon_tag icon, :font_awesome, opts
- end
-
- def icon_tag icon, opts={}
- with_icon_tag_opts(opts) do |tag_opts|
- library = tag_opts.delete(:library) || default_icon_library
- universal_icon_tag icon, library, tag_opts
- end
- end
-
- def universal_icon_tag icon, icon_library=default_icon_library, opts={}
- return "" unless icon.present?
-
- with_icon_tag_opts(opts) do |tag_opts|
- send "#{icon_library}_icon_tag", icon, tag_opts
- end
- end
-
- def default_icon_library
- :material
- end
-
- def glyphicon_icon_tag icon, opts={}
- prepend_class opts, "glyphicon glyphicon-#{icon_class(:glyphicon, icon)}"
- wrap_with :span, "", opts.merge("aria-hidden": true)
- end
-
- def font_awesome_icon_tag icon, opts={}
-
- prepend_class opts,
- "fa#{'b' if opts.delete :brand} fa-#{icon_class(:font_awesome, icon)}"
- wrap_with :i, "", opts
- end
-
- def material_icon_tag icon, opts={}
- add_class opts, "material-icons"
- wrap_with :i, icon_class(:material, icon), opts
- end
-
- private
-
- def with_icon_tag_opts opts={}
- opts = { class: opts } unless opts.is_a? Hash
- yield opts
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/icon.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/navbar.rb b/set/mod022-bootstrap/all/bootstrap/navbar.rb
deleted file mode 100644
index 50b77dd..0000000
--- a/set/mod022-bootstrap/all/bootstrap/navbar.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Navbar)
-#
-module Navbar;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/navbar.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # Options
- # @param opts [Hash]
- # @option opts [String, Hash] brand
- # @option opts [String] class
- # @option opts [Boolean] no_collapse
- # @option opts [:left, :right] toggle_align
- def navbar id, opts={}, &block
- nav_opts = opts[:navbar_opts] || {}
- nav_opts[:class] ||= opts[:class]
- add_class nav_opts,
- "navbar navbar-dark bg-#{opts.delete(:navbar_type) || 'primary'}"
- navbar_content id, opts, nav_opts, &block
- end
-
- private
-
- def navbar_content id, opts, nav_opts
- content = yield
- if opts[:no_collapse]
- navbar_nocollapse content, nav_opts
- else
- navbar_responsive id, content, opts, nav_opts
- end
- end
-
- def navbar_nocollapse content, nav_opts
- # content = wrap_with(:div, content)
- wrap_with :nav, content, nav_opts
- end
-
- def navbar_responsive id, content, opts, nav_opts
- opts[:toggle_align] ||= :right
- wrap_with :nav, nav_opts do
- haml :navbar_responsive, id: id, content: content, opts: opts
- end
- end
-
- def breadcrumb items
- wrap_with :ol, class: "breadcrumb" do
- items.map do |item|
- wrap_with :li, item, class: "breadcrumb-item"
- end.join
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/navbar.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/table.rb b/set/mod022-bootstrap/all/bootstrap/table.rb
deleted file mode 100644
index f9ac938..0000000
--- a/set/mod022-bootstrap/all/bootstrap/table.rb
+++ /dev/null
@@ -1,110 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Table)
-#
-module Table;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/table.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- class TableHelper
- def initialize format, content, opts={}
- @format = format
- @div_table = opts.delete :div_table
- @header = initialize_header opts[:header], content
- @rows = content
- @opts = opts
- @format.add_class opts, :table
- end
-
- def render
- tag :table, class: @opts[:class] do
- [header, body]
- end
- end
-
- def header
- return unless @header
-
- tag :thead do
- tag :tr do
- @header.map do |item|
- tag(:th) { item }
- end.join "\n"
- end
- end
- end
-
- def body
- tag :tbody do
- @rows.map do |row_content|
- row row_content
- end.join "\n"
- end
- end
-
- def row row
- row_data, row_class =
- case row
- when Hash then
- [row.delete(:content), row]
- else
- [row, {}]
- end
- row_content =
- if row_data.is_a?(Array)
- row_data.map { |item| cell item }.join "\n"
- else
- row_data
- end
- tag :tr, row_content, row_class
- end
-
- def cell cell
- if cell.is_a? Hash
- content = cell.delete(:content).to_s
- tag :td, cell do
- content
- end
- else
- tag :td do
- String(cell)
- end
- end
- end
-
- def tag elem, *args, &block
- if @div_table
- add_div_table_class elem, *args
- elem = :div
- end
- @format.wrap_with elem, *args, &block
- end
-
- private
-
- def add_div_table_class elem, content_or_opts={}, opts={}
- klass_opts = content_or_opts.is_a?(Hash) ? content_or_opts : opts
- @format.add_class klass_opts, elem
- end
-
- def initialize_header header, content
- case header
- when Array then header
- when nil then nil
- else content.shift
- end
- end
- end
-
- # @param [Array] content the content for the table. Accepts
- # strings or arrays for each row.
- # @param [Hash] opts
- # @option opts [String, Array] :header use first row of content as header or
- # value of this option if it is a string
- # @return [HTML] bootstrap table
- def table content, opts={}
- TableHelper.new(self, content, opts).render
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/table.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/tabs.rb b/set/mod022-bootstrap/all/bootstrap/tabs.rb
deleted file mode 100644
index 3ad0ffe..0000000
--- a/set/mod022-bootstrap/all/bootstrap/tabs.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Tabs)
-#
-module Tabs;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/tabs.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # @param tab_hash [Hash] keys are the tab names
- # Each value can be either a String or a Hash.
- # If a Hash can contain the following keys:
- # :title - the label to appear in the clickable tab nav.
- # if title is not specified, the key is used
- # :content - body of tab pane
- # :button_attr - attributes for button link in tab nav.
- #
- # If using lazy loading (see :load below), the following options also apply
- # :path - explicit path to use for tab pane
- # :view - card view from which to auto-construct path (if missing, uses key)
- #
- # If the value is a String, it is treated as the tab content for static tabs and
- # the view for lazy tabs
- #
- # @param active_name [String] label of the tab that should be active at the
- #
- # @param [Hash] args options
- # @option args [String] :tab_type ('tabs') use pills or tabs
- # @option args [Hash] :panel_attr html args used for the panel div
- # @option args [Hash] :pane_attr html args used for the pane div
- # @option args [Hash] :load. `:lazy` for lazy-loading tabs
- #
- # @param [Block] block content of the active tab (for lazy-loading)
- # beginning (default is the first)
- #
- # @return [HTML] bootstrap tabs element with all content preloaded
- def tabs tab_hash, active_name=nil, args={}, &block
- klass = args[:load] == :lazy ? Card::LazyTab : Card::Tab
- args.reverse_merge!(
- panel_attr: {},
- pane_attr: {},
- tab_type: "tabs",
- block: block,
- tab_objects: Card::Tab.tab_objects(self, tab_hash, active_name, klass)
- )
- haml :tab_panel, args
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/tabs.rb ~~
diff --git a/set/mod022-bootstrap/all/bootstrap/wrapper.rb b/set/mod022-bootstrap/all/bootstrap/wrapper.rb
deleted file mode 100644
index 80dcd15..0000000
--- a/set/mod022-bootstrap/all/bootstrap/wrapper.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Bootstrap;
-# Set: All cards (Bootstrap, Wrapper)
-#
-module Wrapper;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/wrapper.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def frame
- class_up "d0-card-header", "card-header"
- class_up "d0-card-body", "card-body card-text"
- super
- end
-
- def standard_frame slot=true
- if panel_state
- class_up "d0-card-frame", "card bg-#{panel_state} text-white"
- else
- class_up "d0-card-frame", "card"
- end
- super
- end
-
- def panel_state; end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/bootstrap/wrapper.rb ~~
diff --git a/set/mod022-bootstrap/all/rich_bootstrap.rb b/set/mod022-bootstrap/all/rich_bootstrap.rb
deleted file mode 100644
index ccb454f..0000000
--- a/set/mod022-bootstrap/all/rich_bootstrap.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (RichBootstrap)
-#
-module RichBootstrap;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/rich_bootstrap.rb"; end
-def read_bootstrap_variables
- path = ::File.expand_path(
- "#{mod_root :bootstrap}/vendor/bootstrap/scss/_variables.scss", __FILE__
- )
- ::File.exist?(path) ? ::File.read(path) : ""
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :closed do
- class_up "d0-card-body", "closed-content"
- super()
- end
-
- include Bootstrapper
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/all/rich_bootstrap.rb ~~
diff --git a/set/mod022-bootstrap/self/bootstrap_core.rb b/set/mod022-bootstrap/self/bootstrap_core.rb
deleted file mode 100644
index a3af1c0..0000000
--- a/set/mod022-bootstrap/self/bootstrap_core.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "BootstrapCore"
-#
-module BootstrapCore;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/bootstrap_core.rb"; end
-include_set Abstract::BootstrapCodeFile
-
-def load_stylesheets
- add_bs_stylesheet "variables"
- add_bs_subdir "mixins"
- %w[
- print reboot type images code grid tables forms buttons transitions dropdown
- button-group input-group custom-forms nav navbar card breadcrumb pagination badge
- jumbotron alert progress media list-group close modal tooltip popover carousel
- ].each do |name|
- add_bs_stylesheet name
- end
- add_bs_subdir "utilities"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/bootstrap_core.rb ~~
diff --git a/set/mod022-bootstrap/self/bootstrap_functions.rb b/set/mod022-bootstrap/self/bootstrap_functions.rb
deleted file mode 100644
index fc1f5cf..0000000
--- a/set/mod022-bootstrap/self/bootstrap_functions.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "BootstrapFunctions"
-#
-module BootstrapFunctions;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/bootstrap_functions.rb"; end
-include_set Abstract::BootstrapCodeFile
-
-def load_stylesheets
- add_bs_stylesheet "functions"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/bootstrap_functions.rb ~~
diff --git a/set/mod022-bootstrap/self/font_awesome.rb b/set/mod022-bootstrap/self/font_awesome.rb
deleted file mode 100644
index 89e9dc3..0000000
--- a/set/mod022-bootstrap/self/font_awesome.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "FontAwesome"
-#
-module FontAwesome;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/font_awesome.rb"; end
-include_set Abstract::CodeFile
-Self::StyleLibraries.add_item :font_awesome
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/font_awesome.rb ~~
diff --git a/set/mod022-bootstrap/self/material_icons.rb b/set/mod022-bootstrap/self/material_icons.rb
deleted file mode 100644
index 25c19e7..0000000
--- a/set/mod022-bootstrap/self/material_icons.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "MaterialIcons"
-#
-module MaterialIcons;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/material_icons.rb"; end
-include_set Abstract::CodeFile
-Self::StyleLibraries.add_item :material_icons
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/material_icons.rb ~~
diff --git a/set/mod022-bootstrap/self/script_load_select2.rb b/set/mod022-bootstrap/self/script_load_select2.rb
deleted file mode 100644
index 1c7c363..0000000
--- a/set/mod022-bootstrap/self/script_load_select2.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "ScriptLoadSelect2"
-#
-module ScriptLoadSelect2;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/script_load_select2.rb"; end
-include_set Abstract::CodeFile
-Self::ScriptMods.add_item :script_load_select2
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/script_load_select2.rb ~~
diff --git a/set/mod022-bootstrap/self/smartmenu_css.rb b/set/mod022-bootstrap/self/smartmenu_css.rb
deleted file mode 100644
index 9e2f00c..0000000
--- a/set/mod022-bootstrap/self/smartmenu_css.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "SmartmenuCss"
-#
-module SmartmenuCss;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/smartmenu_css.rb"; end
-include_set Abstract::CodeFile
-
-def source_files
- "startmenu.css"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/smartmenu_css.rb ~~
diff --git a/set/mod022-bootstrap/self/smartmenu_js.rb b/set/mod022-bootstrap/self/smartmenu_js.rb
deleted file mode 100644
index a9c309a..0000000
--- a/set/mod022-bootstrap/self/smartmenu_js.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "SmartmenuJs"
-#
-module SmartmenuJs;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/smartmenu_js.rb"; end
-include_set Abstract::CodeFile
-
-def source_files
- "startmenu.js"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/smartmenu_js.rb ~~
diff --git a/set/mod022-bootstrap/self/style_bootstrap_cards.rb b/set/mod022-bootstrap/self/style_bootstrap_cards.rb
deleted file mode 100644
index 2f6f0cf..0000000
--- a/set/mod022-bootstrap/self/style_bootstrap_cards.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleBootstrapCards"
-#
-module StyleBootstrapCards;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/style_bootstrap_cards.rb"; end
-include_set Abstract::CodeFile
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/style_bootstrap_cards.rb ~~
diff --git a/set/mod022-bootstrap/self/style_bootstrap_colorpicker.rb b/set/mod022-bootstrap/self/style_bootstrap_colorpicker.rb
deleted file mode 100644
index 0713387..0000000
--- a/set/mod022-bootstrap/self/style_bootstrap_colorpicker.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleBootstrapColorpicker"
-#
-module StyleBootstrapColorpicker;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/style_bootstrap_colorpicker.rb"; end
-include_set Abstract::BootstrapCodeFile
-Self::StyleLibraries.add_item :style_bootstrap_colorpicker
-
-def load_stylesheets
- add_stylesheet_file "vendor/bootstrap-colorpicker/src/sass/_colorpicker.scss"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/style_bootstrap_colorpicker.rb ~~
diff --git a/set/mod022-bootstrap/self/style_select2.rb b/set/mod022-bootstrap/self/style_select2.rb
deleted file mode 100644
index 4b93c99..0000000
--- a/set/mod022-bootstrap/self/style_select2.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleSelect2"
-#
-module StyleSelect2;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/style_select2.rb"; end
-include_set Abstract::CodeFile
-Self::StyleLibraries.add_item :style_select2
-
-def source_files
- ["vendor/select2/dist/css/select2.css", "lib/stylesheets/style_select2_bootstrap.scss"]
-end
-
-def source_dir
- ""
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/style_select2.rb ~~
diff --git a/set/mod022-bootstrap/self/style_select2_bootstrap.rb b/set/mod022-bootstrap/self/style_select2_bootstrap.rb
deleted file mode 100644
index 083dabf..0000000
--- a/set/mod022-bootstrap/self/style_select2_bootstrap.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleSelect2Bootstrap"
-#
-module StyleSelect2Bootstrap;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/style_select2_bootstrap.rb"; end
-include_set Abstract::CodeFile
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/self/style_select2_bootstrap.rb ~~
diff --git a/set/mod022-bootstrap/type/bootswatch_skin.rb b/set/mod022-bootstrap/type/bootswatch_skin.rb
deleted file mode 100644
index 53841cf..0000000
--- a/set/mod022-bootstrap/type/bootswatch_skin.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "BootswatchSkin" cards
-#
-module BootswatchSkin;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/type/bootswatch_skin.rb"; end
-include_set Abstract::BootswatchTheme
-
-# override to customize the theme or to make it customizable
-# @return [Card, String, Array] strings must be valid (s)css; cards
-# must be of type (S)CSS
-def variables_content
- scss_from_theme_file :variables
-end
-
-# override to customize the theme or to make it customizable
-# @return [Card, String, Array] strings must be valid (s)css; cards
-# must be of type (S)CSS
-def stylesheets_content
- scss_from_theme_file :bootswatch
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/type/bootswatch_skin.rb ~~
diff --git a/set/mod022-bootstrap/type/customized_bootswatch_skin.rb b/set/mod022-bootstrap/type/customized_bootswatch_skin.rb
deleted file mode 100644
index bf542d2..0000000
--- a/set/mod022-bootstrap/type/customized_bootswatch_skin.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "CustomizedBootswatchSkin" cards
-#
-module CustomizedBootswatchSkin;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/type/customized_bootswatch_skin.rb"; end
-include_set Abstract::BootswatchTheme
-
-card_accessor :colors
-card_accessor :variables
-card_accessor :stylesheets
-
-def top_level_item_cards
- cards = PRE_VARIABLES_CARD_NAMES.map { |n| Card[n] }
- cards += [colors_card, variables_card]
- cards += POST_VARIABLES_CARD_NAMES.map { |n| Card[n] }
- cards << stylesheets_card
- cards
-end
-
-def editable_item_cards
- [colors_card, variables_card, stylesheets_card]
-end
-
-def variables_card_names
- %i[colors variables].map { |s| Card.fetch_name name, s }
-end
-
-def stylesheets_card_names
- [Card.fetch_name(name, :stylesheets)]
-end
-
-def theme_card_name
- "#{theme_name} skin"
-end
-
-def theme_name
- Env.params[:theme].present? && Env.params[:theme]
-end
-
-def theme_codename
- theme_name && "#{theme_name}_skin".to_sym
-end
-
-event :validate_theme_template, :validate, on: :create do
- return unless (tname = theme_name) && (etype = theme_error_type)
-
- errors.add :abort, t("bootstrap_#{etype}", theme_name: tname)
-end
-
-def theme_error_type
- if Card.fetch_type_id(theme_card_name) != Card::BootswatchSkinID
- :not_valid_theme
- elsif !Dir.exist? source_dir
- # puts method(:source_dir).source_location
- :cannot_source_theme
- end
-end
-
-event :initialize_because_of_type_change, :prepare_to_store,
- on: :update, changed: :type do
- self.content = content
- initialize_theme old_skin_items
-end
-
-def old_skin_items
- skin = Card.new(type: :pointer, content: db_content_before_act)
- skin.drop_item "bootstrap default skin"
- skin.item_names
-end
-
-event :copy_theme, :prepare_to_store, on: :create do
- initialize_theme
-end
-
-def initialize_theme style_item_names=nil
- add_subfield :colors, type_id: Card::ScssID
- add_variables_subfield
- add_stylesheets_subfield style_item_names
-end
-
-def add_stylesheets_subfield style_items=nil
- opts = { type_id: Card::SkinID }
- if theme_name
- theme_style = add_bootswatch_subfield
- opts[:content] = "[[#{theme_style.name}]]"
- end
- if style_items
- opts[:content] = [opts[:content], style_items].flatten.compact.to_pointer_content
- end
-
- add_subfield :stylesheets, opts
-end
-
-def add_variables_subfield
- theme_content = content_from_theme(:variables)
- default_content = read_bootstrap_variables
- add_subfield :variables,
- type_id: Card::ScssID,
- content: "#{theme_content}\n\n\n#{default_content}"
-end
-
-def add_bootswatch_subfield
- add_subfield :bootswatch, type_id: Card::ScssID,
- content: content_from_theme(:bootswatch)
-end
-
-def theme_card
- @theme_card ||= theme_codename ? Card[theme_codename] : nil
-end
-
-def content_from_theme subfield
- theme_card&.scss_from_theme_file subfield
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def edit_fields
- [[:colors, { title: "" }],
- [:variables, { title: "Variables" }],
- [:stylesheets, { title: "Styles" }]]
- end
-
- view :one_line_content do
- ""
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/type/customized_bootswatch_skin.rb ~~
diff --git a/set/mod022-bootstrap/type/customized_bootswatch_skin/html_views.rb b/set/mod022-bootstrap/type/customized_bootswatch_skin/html_views.rb
deleted file mode 100644
index 80abb2a..0000000
--- a/set/mod022-bootstrap/type/customized_bootswatch_skin/html_views.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type; module CustomizedBootswatchSkin;
-# Set: All "CustomizedBootswatchSkin+HtmlViews" cards (HtmlViews)
-#
-module HtmlViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/type/customized_bootswatch_skin/html_views.rb"; end
-include_set Abstract::Media
-include_set Abstract::BsBadge
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :menu do
- ""
- end
-
- def short_content
- ""
- end
-
- view :core, template: :haml
-
- info_bar_cols 6, 3, 3
-
- before :bar do
- super()
- voo.show :edit_button, :bar_middle
- class_up "bar-middle", "p-3 align-items-center p-0"
- end
-
- view :bar_right do
- render(:short_content)
- end
-
- before :bar_nav do
- voo.hide :edit_link
- end
-
- view :bar_bottom do
- render_core
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/type/customized_bootswatch_skin/html_views.rb ~~
diff --git a/set/mod022-bootstrap/type_plus_right/customized_bootswatch_skin/colors.rb b/set/mod022-bootstrap/type_plus_right/customized_bootswatch_skin/colors.rb
deleted file mode 100644
index 9471cde..0000000
--- a/set/mod022-bootstrap/type_plus_right/customized_bootswatch_skin/colors.rb
+++ /dev/null
@@ -1,123 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class TypePlusRight; module CustomizedBootswatchSkin;
-# Set: All "+Colors" cards on "CustomizedBootswatchSkin" cards
-#
-module Colors;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/bootstrap/set/type_plus_right/customized_bootswatch_skin/colors.rb"; end
-VARIABLE_NAMES = {
- colors: %i[blue indigo purple pink red orange yellow green teal cyan
- white gray-100 gray-200 gray-300 gray-400 gray-500 gray-600 gray-700 gray-800
- gray-900 black],
- theme_colors: %i[primary secondary success info warning danger light dark
- body-bg body-color]
-}.freeze
-
-# temporarily removed: link-color card-bg card-cap-bg
-# bootstrap default for link-color uses the theme-color function which
-# has to be defined between the theme-colors and that variable
-# (see bootstrap's _variables.scss)
-# TODO: deal with that
-
-# @param name [String] a scss variable name (it can start with a $)
-def variable_value name
- value_from_scss(name, content) ||
- value_from_variables_card(name) ||
- default_value_from_bootstrap(name)
-end
-
-def value_from_scss name, source
- name = name.to_s
- name = name[1..-1] if name.start_with?("$")
- source.match(definition_regex(name))&.capture(:value)
-end
-
-def value_from_variables_card name
- return unless (var_card = left.variables_card) && var_card.content.present?
-
- value_from_scss name, var_card.content
-end
-
-def definition_regex name
- /^(?\s*\$#{name}:\s*)(?.+?)(? !default;)$/
-end
-
-def default_value_from_bootstrap name
- value_from_scss name, bootstrap_variables_scss
-end
-
-def bootstrap_variables_scss
- @bootstrap_variables_scss ||= read_bootstrap_variables
-end
-
-def colors
- @colors ||= variable_group_with_values :colors
-end
-
-def theme_colors
- @theme_colors ||= variable_group_with_values :theme_colors
-end
-
-def variable_group_with_values group
- VARIABLE_NAMES[group].each_with_object({}) do |name, h|
- h[name] = variable_value name
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :input, template: :haml do
- @colors = card.colors
- @theme_colors = card.theme_colors
- end
-
- def theme_color_picker name, value
- # value = value[1..-1] if value.start_with? "$"
- options = VARIABLE_NAMES[:colors].map { |var| "$#{var}" }
- options << value unless options.include? value
- select_tag "theme_colors[#{name}]", options_for_select(options, value),
- class: "tags form-control"
- end
-
- before :bar_right do
- voo.show :edit_button
- end
-
- view :core, template: :haml do
- @colors = card.theme_colors.reject { |k, _v| k.in? %i[body-bg body-color] }
- end
-
- view :bar_middle do
- <<-HTML
-
- HTML
- end
-end
-
-event :translate_variables_to_scss, :prepare_to_validate, on: :update do
- replace_values :colors
- replace_values :theme_colors
-end
-
-def replace_values group, prefix=""
- values = variable_values_from_params group
- values.each_pair do |name, val|
- if content.match definition_regex(name)
- content.gsub! definition_regex(name), "\\k#{prefix}#{val}\\k"
- else
- self.content += "$#{name}: #{prefix}#{val} !default;\n"
- end
- end
-end
-
-def variable_values_from_params group
- Env.params[group]&.slice(*VARIABLE_NAMES[group]) || {}
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/bootstrap/set/type_plus_right/customized_bootswatch_skin/colors.rb ~~
diff --git a/set/mod023-comment/all/comment.rb b/set/mod023-comment/all/comment.rb
deleted file mode 100644
index 81d17a1..0000000
--- a/set/mod023-comment/all/comment.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Comment)
-#
-module Comment;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/comment/set/all/comment.rb"; end
-def commenting?
- comment && action != :delete
-end
-
-event :add_comment, :prepare_to_store, on: :save, when: :comment do
- Env.session[:comment_author] = comment_author if Env.session
- return unless comment.present?
-
- self.content =
- [content, format.comment_with_signature].compact.join "\n \n"
- self.comment = nil
-end
-
-attr_writer :comment_author
-
-def comment_author
- @comment_author ||=
- Env.session[:comment_author] || Env.params[:comment_author] || "Anonymous"
-end
-
-def clean_comment
- comment.split(/\n/).map do |line|
- "#{line.strip.empty? ? ' ' : line}
"
- end * "\n"
-end
-
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def comment_with_signature
- "#{card.clean_comment}\n#{comment_signature}"
- end
-
- def comment_signature
- wrap_with :div, class: "w-comment-author" do
- "#{comment_author}.....#{Time.zone.now}"
- end
- end
-
- def comment_author
- if Auth.signed_in?
- "[[#{Auth.current.name}]]"
- else
- "#{card.comment_author} (Not signed in)"
- end
- end
-
- view :comment_box, denial: :blank, unknown: true, perms: :update do
- wrap_with :div, class: "comment-box nodblclick" do
- action = card.new_card? ? :create : :update
- card_form action do
- [hidden_comment_fields, comment_box, comment_buttons]
- end
- end
- end
-
- def hidden_comment_fields
- return unless card.new_card?
-
- hidden_field_tag "card[name]", card.name
- # FIXME: wish we had more generalized solution for names.
- # without this, nonexistent cards will often take left's linkname.
- # (needs test)
- end
-
- def comment_box
- text_area :comment, rows: 3
- end
-
- def comment_buttons
- wrap_with :div, class: "comment-buttons" do
- [comment_author_label, comment_submit_button]
- end
- end
-
- def comment_author_label
- return if Auth.signed_in?
-
- %(My Name is: #{text_field :comment_author})
- end
-
- def comment_submit_button
- submit_button text: "Comment", type: :submit, disable_with: "Commenting"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/comment/set/all/comment.rb ~~
diff --git a/set/mod023-comment/right/comment.rb b/set/mod023-comment/right/comment.rb
deleted file mode 100644
index 403c3f9..0000000
--- a/set/mod023-comment/right/comment.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Comment" cards
-#
-module Comment;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/comment/set/right/comment.rb"; end
-include_set Abstract::Permission
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/comment/set/right/comment.rb ~~
diff --git a/set/mod023-comment/right/discussion.rb b/set/mod023-comment/right/discussion.rb
deleted file mode 100644
index 1f32a5c..0000000
--- a/set/mod023-comment/right/discussion.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Discussion" cards
-#
-module Discussion;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/comment/set/right/discussion.rb"; end
-view :titled, unknown: true do
- voo.show :comment_box
- super()
-end
-
-view :open, unknown: true do
- voo.show :comment_box
- super()
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/comment/set/right/discussion.rb ~~
diff --git a/set/mod024-date/all/calendar.rb b/set/mod024-date/all/calendar.rb
deleted file mode 100644
index 8269e39..0000000
--- a/set/mod024-date/all/calendar.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Calendar)
-#
-module Calendar;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/date/set/all/calendar.rb"; end
-Self::InputOptions.add_to_basket :options, "calendar"
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def calendar_input
- text_field :content, class: "date-editor datetimepicker-input",
- "data-toggle": "datetimepicker",
- "data-target": "##{form_prefix}_content.date-editor"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/date/set/all/calendar.rb ~~
diff --git a/set/mod024-date/right/when_created.rb b/set/mod024-date/right/when_created.rb
deleted file mode 100644
index a230e02..0000000
--- a/set/mod024-date/right/when_created.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+WhenCreated" cards
-#
-module WhenCreated;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/date/set/right/when_created.rb"; end
-def content
- return "" unless left&.real?
-
- I18n.localize left.created_at, format: :card_dayofwk_min_tz
-end
-
-# view :core, :raw
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/date/set/right/when_created.rb ~~
diff --git a/set/mod024-date/right/when_last_edited.rb b/set/mod024-date/right/when_last_edited.rb
deleted file mode 100644
index 0449d5c..0000000
--- a/set/mod024-date/right/when_last_edited.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+WhenLastEdited" cards
-#
-module WhenLastEdited;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/date/set/right/when_last_edited.rb"; end
-def content
- return "" unless left&.real?
-
- I18n.localize left.updated_at, format: :card_dayofwk_min_tz
-end
-
-# view :core, :raw
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/date/set/right/when_last_edited.rb ~~
diff --git a/set/mod024-date/self/datepicker.rb b/set/mod024-date/self/datepicker.rb
deleted file mode 100644
index d6af1a9..0000000
--- a/set/mod024-date/self/datepicker.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Datepicker"
-#
-module Datepicker;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/date/set/self/datepicker.rb"; end
-def raw_help_text
- <<-TEXT
- Configure the date select tool using these available
- [[https://tempusdominus.github.io/bootstrap-4/Options/|options]]
- TEXT
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/date/set/self/datepicker.rb ~~
diff --git a/set/mod024-date/self/now.rb b/set/mod024-date/self/now.rb
deleted file mode 100644
index ef93f2c..0000000
--- a/set/mod024-date/self/now.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Now"
-#
-module Now;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/date/set/self/now.rb"; end
-def content
- I18n.localize(Time.now, format: :card_dayofwk_min_tz)
-end
-
-# view :core, :raw
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/date/set/self/now.rb ~~
diff --git a/set/mod024-date/self/script_datepicker_config.rb b/set/mod024-date/self/script_datepicker_config.rb
deleted file mode 100644
index 48878d9..0000000
--- a/set/mod024-date/self/script_datepicker_config.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "ScriptDatepickerConfig"
-#
-module ScriptDatepickerConfig;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/date/set/self/script_datepicker_config.rb"; end
-include_set Abstract::CodeFile
-
-All::Head::HtmlFormat.add_to_basket :mod_js_config, [:datepicker, "setDatepickerConfig"]
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/date/set/self/script_datepicker_config.rb ~~
diff --git a/set/mod024-date/self/style_datepicker.rb b/set/mod024-date/self/style_datepicker.rb
deleted file mode 100644
index 55fb2c4..0000000
--- a/set/mod024-date/self/style_datepicker.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "StyleDatepicker"
-#
-module StyleDatepicker;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/date/set/self/style_datepicker.rb"; end
-include_set Abstract::CodeFile
-Self::StyleLibraries.add_item :style_datepicker
-
-def source_files
- %w[lib/stylesheets/tempusdominus.scss
- vendor/tempusdominus/src/sass/_tempusdominus-bootstrap-4.scss]
-end
-
-def source_dir
- ""
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/date/set/self/style_datepicker.rb ~~
diff --git a/set/mod024-date/type/date.rb b/set/mod024-date/type/date.rb
deleted file mode 100644
index 05a9c92..0000000
--- a/set/mod024-date/type/date.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Date" cards
-#
-module Date;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/date/set/type/date.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def input_type
- :calendar
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/date/set/type/date.rb ~~
diff --git a/set/mod026-follow/abstract/follow_option.rb b/set/mod026-follow/abstract/follow_option.rb
deleted file mode 100644
index 7219ce6..0000000
--- a/set/mod026-follow/abstract/follow_option.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (FollowOption)
-#
-module FollowOption;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/abstract/follow_option.rb"; end
-def restrictive_option?
- Card::FollowOption.restrictive_options.include? codename
-end
-
-def description set_card
- set_card.follow_label
-end
-
-# follow option methods on the Card class
-# FIXME: there's not a great reason to have these on the Card class
-module ClassMethods
- # args:
- # position: (starting at 1, default: add to end)
- def restrictive_follow_opts args
- add_option args, :restrictive
- end
-
- # args:
- # position: (starting at 1, default: add to end)
- def follow_opts args
- add_option args, :main
- end
-
- def follow_test opts={}, &block
- Card::FollowOption.test[get_codename(opts)] = block
- end
-
- def follower_candidate_ids opts={}, &block
- Card::FollowOption.follower_candidate_ids[get_codename(opts)] = block
- end
-
- private
-
- def insert_option pos, item, type
- list = Card::FollowOption.codenames(type)
- list[pos] ? list.insert(pos, item) : (list[pos] = item)
- # If pos > codenames.size in a previous insert then we have a bunch
- # of preceding nils in the array.
- # Hence, we have to overwrite a nil value if we encounter one and
- # can't use insert.
- end
-
- def add_option opts, type, &_block
- codename = get_codename opts
- if opts[:position]
- insert_option opts[:position] - 1, codename, type
- else
- Card::FollowOption.codenames(type) << codename
- end
- Card::FollowOption.codenames(:all) << codename
- end
-
- def get_codename opts
- opts[:codename] || name.match(/::(\w+)$/)[1].underscore.to_sym
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/abstract/follow_option.rb ~~
diff --git a/set/mod026-follow/all/follow.rb b/set/mod026-follow/all/follow.rb
deleted file mode 100644
index 91cf78b..0000000
--- a/set/mod026-follow/all/follow.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Follow)
-#
-# for override
-module Follow;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow.rb"; end
-def followable?
- true
-end
-
-def follow_label
- name
-end
-
-def list_direct_followers?
- false
-end
-
-def follow_option?
- codename && FollowOption.codenames.include?(codename)
-end
-
-# the set card to be followed if you want to follow changes of card
-def follow_set_card
- Card.fetch name, :self
-end
-
-def follow_rule_name user=nil
- follow_set_card&.follow_rule_name user
-end
-
-def follow_rule_card user=nil, args={}
- Card.fetch follow_rule_name(user), args
-end
-
-def follow_rule? user=nil
- Card.exists? follow_rule_name(user)
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow.rb ~~
diff --git a/set/mod026-follow/all/follow/follow_link.rb b/set/mod026-follow/all/follow/follow_link.rb
deleted file mode 100644
index af6e94d..0000000
--- a/set/mod026-follow/all/follow/follow_link.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Follow)
-#
-#! no set module
-module Follow;
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/follow_link.rb"; end
-class FollowLink
- attr_reader :format, :rule_content, :link_text, :action, :css_class, :hover_text
-
- delegate :link_to, to: :format
-
- def initialize format
- @format = format
- @card = format.card
- end
-
- def modal_link icon=false
- opts = link_opts.merge(
- "data-path": link_opts[:path],
- "data-toggle": "modal",
- "data-target": "#modal-#{card.name.safe_key}",
- class: css_classes("follow-link", link_opts[:class])
- )
- link_to render_link_text(icon), opts
- end
-
- def button
- opts = link_opts(:follow_section).merge(
- remote: true,
- class: @format.css_classes("follow-link", link_opts[:class],
- "slotter btn btn-sm btn-primary")
- )
- opts["data-update-foreign-slot"] =
- ".d0-card-body > .card-slot.RIGHT-Xfollower.content-view"
- opts["data-hover-text"] = hover_text if hover_text
- link_to render_link_text, opts
- end
-
- def link_opts success_view=:follow_status
- { title: title,
- path: path(success_view),
- class: css_class }
- end
-
- def render_link_text icon=false
- verb = %(#{link_text} )
- icon = icon ? icon_tag(:flag) : ""
- [icon, verb].compact.join.html_safe
- end
-
- private
-
- def mark
- @card.follow_set_card.follow_rule_name Auth.current.name
- end
-
- def path view=:follow_status
- @format.path mark: mark,
- action: :update,
- success: { mark: @card.name, view: view },
- card: { content: "[[#{rule_content}]]" }
- end
-
- def title
- "#{action} emails about changes to #{@card.follow_label}"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/follow_link.rb ~~
diff --git a/set/mod026-follow/all/follow/follow_link_views.rb b/set/mod026-follow/all/follow/follow_link_views.rb
deleted file mode 100644
index 58bf7a4..0000000
--- a/set/mod026-follow/all/follow/follow_link_views.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Follow;
-# Set: All cards (Follow, FollowLinkViews)
-#
-module FollowLinkViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/follow_link_views.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- def follow_link_class
- card.followed? ? StopFollowLink : StartFollowLink
- end
-
- def show_follow?
- Auth.signed_in? && !card.new_card? && card.followable?
- end
-end
-
-module JsonFormat; module_parent.send :register_set_format, Card::Format::JsonFormat, self; extend Card::Set::AbstractFormat
- view :follow_status do
- follow_link_class.link_opts
- end
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def follow_button
- follow_link_class.new(self).button
- end
-
- def follow_modal_link
- follow_link_class.new(self).modal_link
- end
-
- view :follow_button, cache: :never do
- follow_button
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/follow_link_views.rb ~~
diff --git a/set/mod026-follow/all/follow/followed_by.rb b/set/mod026-follow/all/follow/followed_by.rb
deleted file mode 100644
index 7a517b5..0000000
--- a/set/mod026-follow/all/follow/followed_by.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Follow;
-# Set: All cards (Follow, FollowedBy)
-#
-# used by +:followers overwritten in type/set.rb and type/cardtype.rb
-module FollowedBy;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/followed_by.rb"; end
-def followed?
- followed_by? Auth.current_id
-end
-
-# for sets and cardtypes it doesn't check whether the users is following the
-# card itself instead it checks whether he is following the complete set
-def followed_by? user_id
- follow_rule_applies?(user_id) || left&.followed_by_as_field?(self, user_id)
-end
-
-def followed_by_as_field? field, user_id
- followed_field?(field) && followed_by?(user_id)
-end
-
-# returns true if according to the follow_field_rule followers of self also
-# follow changes of field_card
-def followed_field? field_card
- return unless (follow_field_rule = rule_card(:follow_fields))
-
- follow_field_rule.item_names(context: self).find do |item|
- case item.to_name.key
- when field_card.key then true
- when :nests.cardname.key then nested_card?(field_card)
- end
- end
-end
-
-def nested_card? card
- nestee_ids.include? card.id
-end
-
-## the following methods all handle _explicit_ (direct) follow rules (not fields)
-
-def follow_rule_applies? follower_id
- !follow_rule_option(follower_id).nil?
-end
-
-def follow_rule_option follower_id
- all_follow_rule_options(follower_id).find do |option|
- follow_rule_option_applies? follower_id, option
- end
-end
-
-def all_follow_rule_options follower_id
- follow_rule = preference :follow, follower_id
- return [] unless follow_rule.present?
-
- follow_rule.split("\n")
-end
-
-def follow_rule_option_applies? follower_id, option
- option_code = option.to_name.code
- candidate_ids = follower_candidate_ids_for_option option_code
- follow_rule_option_applies_to_candidates? follower_id, option_code, candidate_ids
-end
-
-def follow_rule_option_applies_to_candidates? follower_id, option_code, candidate_ids
- if (test = FollowOption.test[option_code])
- test.call follower_id, candidate_ids
- else
- candidate_ids.include? follower_id
- end
-end
-
-def follower_candidate_ids_for_option option_code
- return [] unless (block = FollowOption.follower_candidate_ids[option_code])
-
- block.call self
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/followed_by.rb ~~
diff --git a/set/mod026-follow/all/follow/follower_ids.rb b/set/mod026-follow/all/follow/follower_ids.rb
deleted file mode 100644
index f665687..0000000
--- a/set/mod026-follow/all/follow/follower_ids.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Follow;
-# Set: All cards (Follow, FollowerIds)
-#
-module FollowerIds;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/follower_ids.rb"; end
-FOLLOWER_IDS_CACHE_KEY = "FOLLOWER_IDS".freeze
-
-card_accessor :followers
-
-event :cache_expired_for_type_change, :store, on: :update, changed: %i[type_id name] do
- act_card&.schedule_preference_expiration
- # FIXME: expire (also?) after save
- Card.follow_caches_expired
-end
-
-def schedule_preference_expiration
- @expire_preferences_scheduled = true
-end
-
-def expire_preferences?
- @expire_preferences_scheduled
-end
-
-event :expire_preferences_cache, :finalize, when: :expire_preferences? do
- Card::Rule.clear_preference_cache
-end
-
-# follow cache methods on Card class
-module ClassMethods
- def follow_caches_expired
- Card.clear_follower_ids_cache
- Card::Rule.clear_preference_cache
- end
-
- def follower_ids_cache
- Card.cache.read(FOLLOWER_IDS_CACHE_KEY) || {}
- end
-
- def write_follower_ids_cache hash
- Card.cache.write FOLLOWER_IDS_CACHE_KEY, hash
- end
-
- def clear_follower_ids_cache
- Card.cache.write FOLLOWER_IDS_CACHE_KEY, nil
- end
-end
-
-def write_follower_ids_cache user_ids
- hash = Card.follower_ids_cache
- hash[id] = user_ids
- Card.write_follower_ids_cache hash
-end
-
-def read_follower_ids_cache
- Card.follower_ids_cache[id]
-end
-
-def follower_names
- followers.map(&:name)
-end
-
-def followers
- follower_ids.map do |id|
- Card.fetch(id)
- end
-end
-
-def follower_ids
- @follower_ids = read_follower_ids_cache || begin
- result = direct_follower_ids + indirect_follower_ids
- write_follower_ids_cache result
- result
- end
-end
-
-def followers_count
- follower_ids.size
-end
-
-def indirect_follower_ids
- result = ::Set.new
- left_card = left
- while left_card
- result += left_card.direct_follower_ids if left_card.followed_field? self
- left_card = left_card.left
- end
- result
-end
-
-# all users (cards) that "directly" follow this card
-# "direct" means there is a follow rule that applies explicitly to this card.
-# one can also "indirectly" follow cards by following parent cards or other
-# cards that nest this one.
-def direct_followers
- direct_follower_ids.map do |id|
- Card.fetch(id)
- end
-end
-
-def direct_follower_ids &block
- ids = ::Set.new
- set_names.each do |set_name|
- direct_follower_ids_for_set setcard_from_name(set_name), ids, &block
- end
- ids
-end
-
-def setcard_from_name set_name
- Card.fetch set_name, new: { type_id: SetID }
-end
-
-def direct_follower_ids_for_set set_card, ids
- set_card.all_user_ids_with_rule_for(:follow).each do |user_id|
- next if ids.include?(user_id) || !(option = follow_rule_option user_id)
-
- yield user_id, set_card, option if block_given?
- ids << user_id
- end
-end
-
-def each_direct_follower_id_with_reason
- direct_follower_ids do |user_id, set_card, follow_option|
- reason = follow_option.gsub(/[\[\]]/, "")
- yield user_id, set_card: set_card, option: reason
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/follower_ids.rb ~~
diff --git a/set/mod026-follow/all/follow/start_follow_link.rb b/set/mod026-follow/all/follow/start_follow_link.rb
deleted file mode 100644
index 0a36bc5..0000000
--- a/set/mod026-follow/all/follow/start_follow_link.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Follow)
-#
-#! no set module
-module Follow;
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/start_follow_link.rb"; end
-
-class StartFollowLink < FollowLink
- def initialize format
- @rule_content = "*always"
- @link_text = "follow"
- @action = "send"
- @css_class = ""
- super
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/start_follow_link.rb ~~
diff --git a/set/mod026-follow/all/follow/stop_follow_link.rb b/set/mod026-follow/all/follow/stop_follow_link.rb
deleted file mode 100644
index 0ffd82d..0000000
--- a/set/mod026-follow/all/follow/stop_follow_link.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Follow)
-#
-#! no set module
-module Follow;
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/stop_follow_link.rb"; end
-
-class StopFollowLink < FollowLink
- def initialize format
- @rule_content = "*never"
- @link_text = "following"
- @hover_text = "unfollow"
- @action = "stop sending"
- @css_class = "btn-item-delete"
- super
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/follow/stop_follow_link.rb ~~
diff --git a/set/mod026-follow/all/notify.rb b/set/mod026-follow/all/notify.rb
deleted file mode 100644
index 2de4c25..0000000
--- a/set/mod026-follow/all/notify.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Notify)
-#
-module Notify;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/notify.rb"; end
-attr_accessor :follower_stash
-
-mattr_accessor :force_notifications
-
-event :silence_notifications, :initialize, when: :silence_notifications? do
- @silent_change = true
-end
-
-def silence_notifications?
- !(Card::Env[:controller] || force_notifications)
-end
-
-event :notify_followers_after_save,
- :integrate_with_delay, on: :save, when: :notable_change? do
- notify_followers
-end
-
-# in the delete case we have to calculate the follower_stash beforehand
-# but we can't pass the follower_stash through the ActiveJob queue.
-# We have to deal with the notifications in the integrate phase instead of the
-# integrate_with_delay phase
-event :stash_followers, :store, on: :delete, when: :notable_change? do
- act_card.follower_stash ||= FollowerStash.new
- act_card.follower_stash.check_card self
-end
-
-event :notify_followers_after_delete, :integrate, on: :delete, when: :notable_change? do
- notify_followers
-end
-
-def notify_followers
- return unless (act = Card::Director.act)
-
- act.reload
- notify_followers_of act
-end
-
-def notable_change?
- !silent_change? && current_act_card? &&
- (Card::Auth.current_id != WagnBotID) && followable?
-end
-
-def silent_change?
- silent_change
-end
-
-private
-
-def notify_followers_of act
- act_followers(act).each_follower_with_reason do |follower, reason|
- next if !follower.account || (follower == act.actor)
-
- notify_follower follower, act, reason
- end
-end
-
-def notify_follower follower, act, reason
- follower.account.send_change_notice act, reason[:set_card].name, reason[:option]
-end
-
-def act_followers act
- @follower_stash ||= FollowerStash.new
- act.actions(false).each do |a|
- next if !a.card || a.card.silent_change?
-
- @follower_stash.check_card a.card
- end
- @follower_stash
-end
-
-def silent_change
- @silent_change || @supercard&.silent_change
-end
-
-def current_act_card?
- return false unless act_card
-
- act_card.id.nil? || act_card.id == id
- # FIXME: currently card_id is nil for deleted acts (at least
- # in the store phase when it's tested). The nil test was needed
- # to make this work.
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/notify.rb ~~
diff --git a/set/mod026-follow/all/notify/base_views.rb b/set/mod026-follow/all/notify/base_views.rb
deleted file mode 100644
index b55b728..0000000
--- a/set/mod026-follow/all/notify/base_views.rb
+++ /dev/null
@@ -1,137 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Notify;
-# Set: All cards (Notify, BaseViews)
-#
-module BaseViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/notify/base_views.rb"; end
-module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
- view :list_of_changes, denial: :blank, cache: :never do
- action = notification_action voo.action_id
- relevant_fields(action).map do |type|
- edit_info_for(type, action)
- end.compact.join
- end
-
- view :subedits, perms: :none, cache: :never do
- return unless notification_act
-
- wrap_subedits do
- notification_act.actions_affecting(card).map do |action|
- next if action.card_id == card.id
-
- action.card.format(format: @format).render_subedit_notice action_id: action.id
- end
- end
- end
-
- view :subedit_notice, cache: :never do
- action = notification_action voo.action_id
- wrap_subedit_item do
- %(#{name_before_action action} #{action.action_type}d\n) +
- render_list_of_changes(action_id: action.id)
- end
- end
-
- view :followed, perms: :none, compact: true do
- if (set_card = followed_set_card) && (option_card = follow_option_card)
- option_card.description set_card
- else
- "*followed set of cards*"
- end
- end
-
- view :follower, perms: :none, compact: true do
- active_notice(:follower) || "follower"
- end
-
- view :last_action_verb, cache: :never do
- "#{notification_act&.main_action&.action_type || 'edite'}d"
- end
-
- view :unfollow_url, perms: :none, compact: true, cache: :never do
- return "" unless (rule_name = live_follow_rule_name)
-
- card_url path(mark: "#{active_notice(:follower)}+#{:follow.cardname}",
- action: :update,
- card: { subcards: { rule_name => Card[:never].name } })
- end
-
- def relevant_fields action
- case action.action_type
- when :create then %i[cardtype content]
- when :update then %i[name cardtype content]
- when :delete then %i[content]
- end
- end
-
- def name_before_action action
- (action.value(:name) && action.previous_value(:name)) || card.name
- end
-
- def followed_set_card
- (set_name = active_notice(:followed_set)) && Card.fetch(set_name)
- end
-
- def follow_option_card
- return unless (option_name = active_notice(:follow_option))
-
- Card.fetch option_name
- end
-
- def active_notice key
- @active_notice ||= inherit :active_notice
- return unless @active_notice
-
- @active_notice[key]
- end
-
- def live_follow_rule_name
- return unless (set_card = followed_set_card) && (follower = active_notice(:follower))
-
- set_card.follow_rule_name follower
- end
-
- def edit_info_for field, action
- return nil unless (value = action.value field)
-
- value = action.previous_value if action.action_type == :delete
- wrap_list_item " #{notification_action_label action} #{field}: #{value}"
- end
-
- def notification_action_label action
- case action.action_type
- when :update then "new"
- when :delete then "deleted"
- end
- end
-
- def wrap_subedits
- subedits = yield.compact.join
- return "" if subedits.blank?
-
- "\nThis update included the following changes:\n#{wrap_list subedits}"
- end
-
- def wrap_list list
- "\n#{list}\n"
- end
-
- def wrap_list_item item
- "#{item}\n"
- end
-
- def wrap_subedit_item
- "\n#{yield}\n"
- end
-
- def notification_act act=nil
- @notification_act ||= act || card.acts.last
- end
-
- def notification_action action_id
- action_id ? Action.fetch(action_id) : card.last_action
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/notify/base_views.rb ~~
diff --git a/set/mod026-follow/all/notify/html_views.rb b/set/mod026-follow/all/notify/html_views.rb
deleted file mode 100644
index d8b5ccf..0000000
--- a/set/mod026-follow/all/notify/html_views.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All; module Notify;
-# Set: All cards (Notify, HtmlViews)
-#
-module HtmlViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/all/notify/html_views.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # view :last_action, perms: :none, cache: :never do
- # _render_last_action_verb
- # end
-
- def wrap_list list
- "\n"
- end
-
- def wrap_list_item item
- "#{item} \n"
- end
-
- def wrap_subedit_item
- "#{yield} \n"
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/all/notify/html_views.rb ~~
diff --git a/set/mod026-follow/right/account.rb b/set/mod026-follow/right/account.rb
deleted file mode 100644
index 17aaa38..0000000
--- a/set/mod026-follow/right/account.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Account" cards
-#
-module Account;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/right/account.rb"; end
-def send_change_notice act, followed_set, follow_option
- return unless email.present? && changes_visible?(act)
-
- notify_of_act act do
- { follower: left.name, followed_set: followed_set, follow_option: follow_option }
- end
-end
-
-def notify_of_act act
- Auth.as(left.id) do
- Card[:follower_notification_email].deliver(
- act.card, { to: email }, { auth: left, active_notice: yield }
- )
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/right/account.rb ~~
diff --git a/set/mod026-follow/right/follow.rb b/set/mod026-follow/right/follow.rb
deleted file mode 100644
index 52402f1..0000000
--- a/set/mod026-follow/right/follow.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Follow" cards
-#
-# The Right::Follow set configures follow preferences (`[Set]+[User]+:follow`)
-# While the user follow dashboard ([User]+:follow`) is also in this Set, its
-module Follow;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/right/follow.rb"; end
-# customizations are handled in TypePlusRight::User::Follow
-
-event :cache_expired_for_new_preference, :integrate, when: :preference? do
- Card.follow_caches_expired
-end
-
-def option_cards
- Card::FollowOption.cards.compact
-end
-
-def options_rule_card
- Card.new(
- name: "follow_options_card",
- type_code: :pointer,
- content: option_cards.map { |oc| "[[#{oc.name}]]" }.join("\n")
- )
-end
-
-def add_follow_item? condition
- new_card? || !include_item?(condition)
-end
-
-def ok_to_update
- permit :update
-end
-
-def ok_to_create
- permit :create
-end
-
-def ok_to_delete
- permit :delete
-end
-
-def permit action, verb=nil
- if %i[create delete update].include?(action) && allowed_to_change_follow_status?
- true
- else
- super action, verb
- end
-end
-
-def allowed_to_change_follow_status?
- Auth.signed_in? &&
- ((user = rule_user) && Auth.current_id == user.id) || Auth.always_ok?
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # shows a follow item link for each of the current follow options
- view :follow_status, cache: :never do
- wrap { haml :follow_status }
- end
-
- # interface to view/alter a specific rule option
- view :follow_item, cache: :never do
- follow_item Env.params[:condition]
- end
-
- def follow_item condition, button=true
- condition ||= "*always"
- wrap do
- card_form action: :update, success: { view: :follow_item } do
- [
- follow_item_hidden_tags(condition),
- (follow_item_button(condition) if button),
- follow_item_link(condition)
- ].compact
- end
- end
- end
-
- def rule_form_args
- super.merge "data-update-foreign-slot": ".card-slot.follow_section-view"
- end
-
- private
-
- def follow_item_hidden_tags condition
- condkey = card.add_follow_item?(condition) ? :add_item : :drop_item
- hidden_tags condition: condition, condkey => condition
- end
-
- def follow_item_button condition
- action = card.add_follow_item?(condition) ? :add : :delete
- button_tag type: :submit, "aria-label": "Left Align",
- class: "btn-sm btn-item #{follow_item_button_class action}" do
- follow_item_icon action
- end
- end
-
- def follow_item_button_class action
- action == :add ? "btn-item-add" : "btn-item-delete btn-primary"
- end
-
- def follow_item_icon action
- icon_tag(action == :add ? :add : :check)
- end
-
- def follow_item_link condition
- link_to_card follow_item_link_target, follow_item_link_text(condition)
- end
-
- def follow_item_link_target
- set = card.rule_set
- setname = set.name
- set.tag.codename == :self ? setname.left : setname.field("by name")
- end
-
- def follow_item_link_text condition
- if (option_card = Card.fetch condition)
- option_card.description card.rule_set
- else
- card.rule_set.follow_label
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/right/follow.rb ~~
diff --git a/set/mod026-follow/right/follow_fields.rb b/set/mod026-follow/right/follow_fields.rb
deleted file mode 100644
index 5d4a106..0000000
--- a/set/mod026-follow/right/follow_fields.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+FollowFields" cards
-#
-module FollowFields;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/right/follow_fields.rb"; end
-event :follow_fields_changed, :integrate do
- Card.follow_caches_expired
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/right/follow_fields.rb ~~
diff --git a/set/mod026-follow/right/followers.rb b/set/mod026-follow/right/followers.rb
deleted file mode 100644
index ba28843..0000000
--- a/set/mod026-follow/right/followers.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Followers" cards
-#
-# -*- encoding : utf-8 -*-
-
-module Followers;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/right/followers.rb"; end
-# X+*followers provides a list of all users following X.
-
-include_set Abstract::Pointer
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core, cache: :never do
- super()
- end
-end
-
-def content
- left ? item_names.to_pointer_content : ""
-end
-
-def item_names _args={}
- left ? left.follow_set_card.prototype.follower_names : []
-end
-
-def virtual?
- new?
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/right/followers.rb ~~
diff --git a/set/mod026-follow/right/following.rb b/set/mod026-follow/right/following.rb
deleted file mode 100644
index 65b2051..0000000
--- a/set/mod026-follow/right/following.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Following" cards
-#
-module Following;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/right/following.rb"; end
-def virtual?
- new?
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :core do
- if card.left && Auth.signed_in?
- render_rule_editor
- else
- nest Card.fetch(card.name.left, :followers), view: :titled, items: { view: :link }
- end
- end
-
- view :status do
- if (rcard = current_follow_rule_card)
- rcard.item_cards.map do |item|
- %(
- #{rcard.rule_set.follow_label} : #{item.title}
-
)
- end.join
- else
- "No following preference"
- end
- end
-
- view :one_line_content do
- ""
- end
-
- view :rule_editor, cache: :never do
- rule_context = Card.fetch preference_name, new: { type_id: PointerID }
- wrap_with :div, class: "edit-rule" do
- follow_context = current_follow_rule_card || rule_context
- subformat(follow_context).rule_form :open, rule_context, :modal
- end
- end
-
- def preference_name
- set_name = card.left.follow_set_card.name
- Card::Name[set_name, Auth.current.name, :follow]
- end
-
- def edit_rule_success
- { view: "status", id: card.name.url_key }
- end
-
- def current_follow_rule_card
- card.left.preference :follow
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/right/following.rb ~~
diff --git a/set/mod026-follow/self/always.rb b/set/mod026-follow/self/always.rb
deleted file mode 100644
index d0049ac..0000000
--- a/set/mod026-follow/self/always.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Always"
-#
-module Always;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/self/always.rb"; end
-include_set Abstract::FollowOption
-
-follow_opts position: 2
-
-follow_test { |_follower_id, _accounted_ids| true }
-
-def title
- "Following"
-end
-
-def label
- "follow"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/self/always.rb ~~
diff --git a/set/mod026-follow/self/created.rb b/set/mod026-follow/self/created.rb
deleted file mode 100644
index cd3feb5..0000000
--- a/set/mod026-follow/self/created.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Created"
-#
-module Created;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/self/created.rb"; end
-include_set Abstract::FollowOption
-
-restrictive_follow_opts position: 1
-
-follower_candidate_ids do |card|
- [card.creator_id]
-end
-
-def title
- "Following content you created"
-end
-
-def label
- "follow if I created"
-end
-
-def description set_card
- "#{set_card.follow_label} I created"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/self/created.rb ~~
diff --git a/set/mod026-follow/self/edited.rb b/set/mod026-follow/self/edited.rb
deleted file mode 100644
index 38cffba..0000000
--- a/set/mod026-follow/self/edited.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Edited"
-#
-module Edited;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/self/edited.rb"; end
-include_set Abstract::FollowOption
-
-restrictive_follow_opts position: 2
-
-follower_candidate_ids do |card|
- # FIXME? - could optimize by not using cards table...
- card.id ? Card.search(editor_of: card.id, return: :id) : []
-end
-
-def title
- "Following content you edited"
-end
-
-def label
- "follow if I edited"
-end
-
-def description set_card
- "#{set_card.follow_label} I edited"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/self/edited.rb ~~
diff --git a/set/mod026-follow/self/follow.rb b/set/mod026-follow/self/follow.rb
deleted file mode 100644
index 97a6d09..0000000
--- a/set/mod026-follow/self/follow.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Follow"
-#
-module Follow;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/self/follow.rb"; end
-setting_opts group: :other, position: 7, rule_type_editable: false, preference: true
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/self/follow.rb ~~
diff --git a/set/mod026-follow/self/follow_defaults.rb b/set/mod026-follow/self/follow_defaults.rb
deleted file mode 100644
index af05f3a..0000000
--- a/set/mod026-follow/self/follow_defaults.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "FollowDefaults"
-#
-# DEPRECATED
-#
-# The card "*follow defaults"
-#
-# Despite its name, this card does not influence defaults for *follow rules.
-# What it does is provide a mechanism (with interface) for updating all users so that
-# they follow the items that are its content.
-#
-module FollowDefaults;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/self/follow_defaults.rb"; end
-# PLAN:
-# - actual defaults should be handled as much as possible with something like
-# the *defaults rule
-# - on the *admin page, we can have a link so sharks can update all the pristine cards
-# to use whatever the actual defaults representation is (see previous point)
-# - if you truly want to override existing follow rules, that may be monkey territory?
-# - we will delete "*follow defaults" after the above are completed
-
-event :update_follow_rules, :finalize, on: :save, when: :update_all_users do
- Auth.as_bot do
- Card.search(type: "user").each do |user|
- follow_defaults.each do |set_card, option|
- follow_rule = Card.fetch(set_card.follow_rule_name(user.name), new: {})
- next unless follow_rule
-
- follow_rule.drop_item "*never"
- follow_rule.drop_item "*always"
- follow_rule.add_item option
- follow_rule.save!
- end
- end
- end
- Card.follow_caches_expired
-end
-
-def follow_defaults
- item_names.map do |item|
- if (set_card = Card.fetch item.to_name.left)&.type_code == :set
- [set_card, follow_option(item)]
- end
- end.compact
-end
-
-def follow_option item
- option_card =
- Card.fetch(item.to_name.right) || Card[item.to_name.right.to_sym]
- option_card.follow_option? ? option_card.name : "*always"
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :edit, perms: :update, unknown: true do
- frame_and_form :update, hidden: { card: { update_all_users: false } } do
- [
- _render_content_formgroups,
- _render_confirm_update_all,
- _render_edit_buttons
- ]
- end
- end
-
- view :edit_buttons do
- button_formgroup do
- [submit_and_update_button, simple_submit_button, cancel_to_edit_button]
- end
- end
-
- def submit_and_update_button
- submit_button text: "Submit and update all users",
- disable_with: "Updating", class: "follow-updater"
- end
-
- def simple_submit_button
- button_tag "Submit", class: "follow"
- end
-
- def cancel_to_edit_button
- cancel_button href: path(view: :edit, id: card.id)
- end
-
- view :confirm_update_all do
- wrap do
- alert "info" do
- %(
- Are you sure you want to change the default follow rules?
- You may choose to update all existing users.
- This may take a while.
- )
- end
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/self/follow_defaults.rb ~~
diff --git a/set/mod026-follow/self/follow_fields.rb b/set/mod026-follow/self/follow_fields.rb
deleted file mode 100644
index 70b9c37..0000000
--- a/set/mod026-follow/self/follow_fields.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "FollowFields"
-#
-module FollowFields;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/self/follow_fields.rb"; end
-setting_opts group: :other, position: 5, rule_type_editable: false
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/self/follow_fields.rb ~~
diff --git a/set/mod026-follow/self/never.rb b/set/mod026-follow/self/never.rb
deleted file mode 100644
index 62727ce..0000000
--- a/set/mod026-follow/self/never.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Never"
-#
-module Never;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/self/never.rb"; end
-include_set Abstract::FollowOption
-
-follow_opts position: 3
-
-follow_test { |_follower_id, _accounted_ids| false }
-
-def title
- "Ignoring"
-end
-
-def label
- "ignore"
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/self/never.rb ~~
diff --git a/set/mod026-follow/type/cardtype.rb b/set/mod026-follow/type/cardtype.rb
deleted file mode 100644
index 77fb932..0000000
--- a/set/mod026-follow/type/cardtype.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Cardtype" cards
-#
-module Cardtype;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/type/cardtype.rb"; end
-def follow_label
- follow_set_card.follow_label
-end
-
-def followed_by? user_id=nil
- follow_set_card.all_members_followed_by? user_id
-end
-
-def follow_set_card
- Card.fetch name, :type
-end
-
-def list_direct_followers?
- true
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def related_by_type_items
- super.unshift ["#{card.name} cards", [card, :type, :by_name], { mark: :absolute }]
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/type/cardtype.rb ~~
diff --git a/set/mod026-follow/type/notification_template.rb b/set/mod026-follow/type/notification_template.rb
deleted file mode 100644
index 3792beb..0000000
--- a/set/mod026-follow/type/notification_template.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "NotificationTemplate" cards
-#
-module NotificationTemplate;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/type/notification_template.rb"; end
-card_reader :contextual_class
-card_reader :disappear
-card_reader :message
-
-def deliver context
- success.flash alert_message(context)
-end
-
-def alert_message context
- mcard = message.present? ? message_card : self
- format(:html).alert_message context, mcard
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def alert_message context, message_card
- mformat = subformat message_card
- alert card.alert_class, true, card.disappear? do
- mformat.contextual_content context, view: alert_view(mformat)
- end
- end
-
- def alert_view format
- format.respond_to?(:notify) ? format.notify : :core
- end
-end
-
-def disappear?
- disappear.present? ? disappear_card.checked? : true
-end
-
-def alert_class
- contextual_class.present? ? contextual_class_card.item_name : :success
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/type/notification_template.rb ~~
diff --git a/set/mod026-follow/type/set.rb b/set/mod026-follow/type/set.rb
deleted file mode 100644
index 6326247..0000000
--- a/set/mod026-follow/type/set.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Set" cards
-#
-module Set;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/type/set.rb"; end
-event :cache_expired_for_new_set, :store, on: :create do
- Card.follow_caches_expired
-end
-
-def list_direct_followers?
- true
-end
-
-def follow_label
- if (klass = subclass_for_set)
- klass.short_label name.left_name
- else
- ""
- end
-end
-
-def follow_rule_name user=nil
- Card::Name[[name, user, :follow].compact]
-end
-
-def followed_by? user_id=nil
- all_members_followed_by? user_id
-end
-
-def follow_set_card
- self
-end
-
-def all_members_followed?
- all_members_followed_by? Auth.current_id
-end
-
-def all_members_followed_by? user_id=nil
- return false unless prototype.followed_by?(user_id)
-
- directly_followed_by?(user_id) || broader_set_followed_by?(user_id)
-end
-
-def broader_set_followed_by? user_id
- broader_sets.find do |set_name|
- Card.fetch(set_name)&.directly_followed_by? user_id
- end
-end
-
-def directly_followed?
- directly_followed_by? Auth.current_id
-end
-
-def directly_followed_by? user_id=nil
- return true if user_id && follow_rule?(user_id)
-
- follow_rule?
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/type/set.rb ~~
diff --git a/set/mod026-follow/type/user.rb b/set/mod026-follow/type/user.rb
deleted file mode 100644
index 358fa2d..0000000
--- a/set/mod026-follow/type/user.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "User" cards
-#
-module User;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/type/user.rb"; end
-def follow follow_name, option="*always"
- return unless (follow_rule = Card.fetch(follow_name)&.follow_rule_card(name, new: {}))
-
- follow_rule.drop_item "*never"
- follow_rule.add_item option
- follow_rule.save!
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/type/user.rb ~~
diff --git a/set/mod026-follow/type_plus_right/user/follow.rb b/set/mod026-follow/type_plus_right/user/follow.rb
deleted file mode 100644
index 3cd8da9..0000000
--- a/set/mod026-follow/type_plus_right/user/follow.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class TypePlusRight; module User;
-# Set: All "+Follow" cards on "User" cards
-#
-module Follow;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/type_plus_right/user/follow.rb"; end
-FOLLOW_TABS = { "Follow" => { view: "follow_tab" },
- "Ignore" => { view: "ignore_tab" } }.freeze
-
-# a virtual pointer to the sets that a user is following.
-# (data is stored in preferences: `[Set]+[User]+:follow`)
-
-include_set Abstract::Pointer
-def virtual?
- new?
-end
-
-# overrides pointer default
-def item_names _args={}
- if (user = left)
- Card::Rule.preference_names user.name, "follow"
- else
- []
- end
-end
-
-def suggestions
- Card[:follow_suggestions]&.item_names || []
-end
-
-def current_user?
- Auth.signed_in? && Auth.current_id == left.id
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :one_line_content do
- ""
- end
-
- view :edit do
- render :open
- end
-
- # renders follow tab and ignore tab
- view :core do
- tabs FOLLOW_TABS, "Follow", load: :lazy do
- render_follow_tab
- end
- end
-
- view :follow_tab, cache: :never do
- haml :follow_editor, items_method: :following_rules_and_options
- end
-
- view :ignore_tab, cache: :never do
- haml :follow_editor, items_method: :ignoring_rules_and_options
- end
-
- def show_button?
- card.current_user? || Auth.always_ok?
- end
-
- def pointer_items args
- voo.items[:view] ||= :link
- super(args)
- end
-
- # TODO: research and generalize
- # this does not look specific to following!
- view :errors, perms: :none do
- return unless card.errors.any?
-
- if card.errors.find { |attrib, _msg| attrib == :permission_denied }
- Env.save_interrupted_action(request.env["REQUEST_URI"])
- voo.title = "Problems with #{card.name}"
- class_up "d0-card-frame", "card card-warning card-inverse"
- frame do
- "Please #{link_to_card :signin, 'sign in'}" # " #{to_task}"
- end
- else
- super()
- end
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/type_plus_right/user/follow.rb ~~
diff --git a/set/mod026-follow/type_plus_right/user/follow/follow_editor_helper.rb b/set/mod026-follow/type_plus_right/user/follow/follow_editor_helper.rb
deleted file mode 100644
index f47209f..0000000
--- a/set/mod026-follow/type_plus_right/user/follow/follow_editor_helper.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class TypePlusRight; module User;; module Follow;
-# Set: All "+FollowEditorHelper" cards on "User+Follow" cards (FollowEditorHelper)
-#
-# all the following methods are used to construct the Follow and Ignore tabs
-
-module FollowEditorHelper;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/follow/set/type_plus_right/user/follow/follow_editor_helper.rb"; end
-# TODO: these object representations are complex enough for their own class
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # constructs hash of rules/options for "Follow" tab
- def following_rules_and_options &block
- rule_opt_array = following_rule_options_hash.map do |key, val|
- [(Card.fetch key, new: {}), val]
- end
- rules_and_options_by_set_pattern Hash[rule_opt_array], &block
- end
-
- # constructs hash of rules/options for "Ignore" tab
- def ignoring_rules_and_options &block
- rule_opts_hash = ignore_rules.each_with_object({}) do |rule, hash|
- hash[rule] = [:never.cardname]
- end
- rules_and_options_by_set_pattern rule_opts_hash, &block
- end
-
- private
-
- # all rules with ignore
- def ignore_rules
- never = :never.cardname.key
- card.item_cards.select do |follow_rule|
- follow_rule.item_names.select { |n| n.key == never }.any?
- end
- end
-
- # @param rule_opts_hash [Hash] { rule1_card => rule1_follow_options }
- # for each rule/option variant, yields with rule_card and option params
- def rules_and_options_by_set_pattern rule_opts_hash
- pattern_hash = a_set_pattern_hash rule_opts_hash
- empty = true
- Card.set_patterns.reverse.map do |pattern|
- pattern_hash[pattern].each do |rule_card, options|
- options.each do |option|
- yield rule_card, option
- empty = false
- end
- end
- end
- yield nil if empty
- end
-
- def a_set_pattern_hash rule_opts_hash
- pattern_hash = Hash.new { |h, k| h[k] = [] }
- rule_opts_hash.each do |rule_card, options|
- pattern_hash[rule_card.rule_set.subclass_for_set] << [rule_card, options]
- end
- pattern_hash
- end
-
- # @return Hash # { rule1 => rule1_follow_options }
- def following_rule_options_hash
- merge_option_hashes current_following_rule_options_hash,
- suggested_following_rule_options_hash
- end
-
- # adds suggested follow options to existing rules where applicable
- def merge_option_hashes current, suggested
- current.each do |key, current_opt|
- if (suggested_opt = suggested.delete(key))
- current[key] = (current_opt + suggested_opt).uniq
- end
- end
- current.merge suggested
- end
-
- # @return Hash # { existing_rule1 => rule1_follow_options } (excluding never)
- # (*never is excluded because this list is for the Follow tab, and *never is
- # handled under the Ignore tab)
- def current_following_rule_options_hash
- never = :never.cardname
- card.item_cards.each_with_object({}) do |follow_rule, hash|
- hash[follow_rule.key] = follow_rule.item_names.reject { |item| item == never }
- end
- end
-
- # @return Hash # { suggested_rule1 => rule1_follow_options }
- def suggested_following_rule_options_hash
- return {} unless card.current_user?
-
- card.suggestions.each_with_object({}) do |sug, hash|
- set_card, opt = a_set_and_option_suggestion(sug) || a_set_only_suggestion(sug)
- hash[set_card.follow_rule_name(card.trunk).key] = [opt]
- end
- end
-
- # @param sug [String] follow suggestion
- # @return [Array] set_card and option
- # suggestion value contains both set and follow option
- def a_set_and_option_suggestion sug
- return unless (set_card = valid_set_card(sug.to_name.left))
-
- [set_card, suggested_follow_option(sug.to_name.right)]
- end
-
- def suggested_follow_option name
- # FIXME: option should be unambiguously name or codename
- # (if codename use colon or Symbol)
- option_card = Card.fetch(name) || Card[name.to_sym]
- option_card&.follow_option? ? option_card.name : :always.cardname
- end
-
- # @param sug [String] follow suggestion
- # @return [Array] set_card and option
- # suggestion value contains only set (implies *always)
- def a_set_only_suggestion sug
- return unless (set_card = valid_set_card(sug))
-
- yield set_card, :always.cardname
- end
-
- def valid_set_card name
- card = Card.fetch(name)
- card&.type_code == :set ? card : false
- end
-end
-end;end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/type_plus_right/user/follow/follow_editor_helper.rb ~~
diff --git a/set/mod027-google_analytics/all/google_analytics.rb b/set/mod027-google_analytics/all/google_analytics.rb
deleted file mode 100644
index 3399989..0000000
--- a/set/mod027-google_analytics/all/google_analytics.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (GoogleAnalytics)
-#
-module GoogleAnalytics;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/google_analytics/set/all/google_analytics.rb"; end
-require "staccato"
-
-mattr_accessor :server_side_tracking_formats
-
-self.server_side_tracking_formats = %i[csv json]
-
-event :track_page, before: :show_page, when: :track_page? do
- tracker.pageview path: Env.controller.request&.path, host: Env.host, title: name
-end
-
-def track_page?
- google_analytics_key &&
- Env.controller&.response_format&.in?(server_side_tracking_formats)
-end
-
-def tracker
- return unless google_analytics_key
-
- ::Staccato.tracker google_analytics_key # , nil, ssl: true
-end
-
-def google_analytics_key
- @google_analytics_key ||=
- Card::Rule.global_setting(:google_analytics_key) ||
- Card.config.google_analytics_key
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- delegate :tracker, :google_analytics_key, to: :card
-
- def views_in_head
- super << :google_analytics_snippet
- end
-
- view :google_analytics_snippet, unknown: true, perms: :none do
- haml :google_analytics_snippet if google_analytics_key
- end
-
- def google_analytics_snippet_vars
- { anonymizeIp: true }
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/google_analytics/set/all/google_analytics.rb ~~
diff --git a/set/mod028-help/all/guide.rb b/set/mod028-help/all/guide.rb
deleted file mode 100644
index e9797bc..0000000
--- a/set/mod028-help/all/guide.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Guide)
-#
-module Guide;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/help/set/all/guide.rb"; end
-def guide_card
- guide_card = rule_card(:guide)
- return unless guide_card
-
- guide_card = guide_card.first_card if guide_card.type_id == Card::PointerID
- guide_card if guide_card.ok?(:read)
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :guide, unknown: true, cache: :never, wrap: :slot do
- guide
- end
-
- def guide
- guide_text = rule_based_guide
- return "" unless guide_text.present?
-
- if (rule_card = card.help_rule_card)
- edit_link = with_nest_mode(:normal) { nest(rule_card, view: :edit_link) }
- guide_text = "#{edit_link} #{guide_text}"
- end
- wrap_with :div, guide_text, class: classy("guide-text")
- end
-
- def alert_guide
- guide_text = guide
- return "" unless guide_text.present?
-
- alert(:secondary, true, false, class: "guide") { guide_text }
- end
-
- def raw_guide_text
- false
- end
-
- def rule_based_guide
- if raw_guide_text
- with_nest_mode :normal do
- process_content raw_guide_text, chunk_list: :references
- # render guide text with current card's format
- # so current card's context is used in guide card nests
- end
- elsif card.guide_card
- with_nest_mode :normal do
- nest card.guide_card, view: :core
- end
- else
- ""
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/help/set/all/guide.rb ~~
diff --git a/set/mod028-help/all/help.rb b/set/mod028-help/all/help.rb
deleted file mode 100644
index 9df6139..0000000
--- a/set/mod028-help/all/help.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Help)
-#
-module Help;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/help/set/all/help.rb"; end
-def help_rule_card
- help_card = rule_card(:help)
- help_card if help_card&.ok?(:read)
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :help, unknown: true, cache: :never, wrap: :slot do
- help = help_text
- return "" unless help.present?
-
- wrap_with :div, wrap_help_text(help), class: classy("help-text")
- end
-
- view :help_text, unknown: true, cache: :never do
- wrap_help_text help_text
- end
-
- def wrap_help_text text
- help = text
- if (rule_card = card.help_rule_card)
- edit_link = with_nest_mode(:normal) { nest(rule_card, view: :edit_link) }
- help = "#{edit_link} #{text}"
- end
- help
- end
-
- view :lead do
- class_up "card-slot", "lead"
- _view_content
- end
-
- def help_text
- voo.help || rule_based_help
- end
-
- def raw_help_text
- card.try(:raw_help_text) || card.help_rule_card&.content
- end
-
- def rule_based_help
- return "" unless (help_text = raw_help_text)
-
- with_nest_mode :normal do
- process_content help_text, chunk_list: :references
- # render help card with current card's format
- # so current card's context is used in help card nests
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/help/set/all/help.rb ~~
diff --git a/set/mod028-help/right/guide.rb b/set/mod028-help/right/guide.rb
deleted file mode 100644
index 175d0a8..0000000
--- a/set/mod028-help/right/guide.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Guide" cards
-#
-# include_set Abstract::TemplatedNests
-module Guide;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/help/set/right/guide.rb"; end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def raw_help_text
- # LOCALIZE
- "Appears in the full editor view to guide users."
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/help/set/right/guide.rb ~~
diff --git a/set/mod028-help/right/help.rb b/set/mod028-help/right/help.rb
deleted file mode 100644
index f64c069..0000000
--- a/set/mod028-help/right/help.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Right
-# Set: All "+Help" cards
-#
-module Help;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/help/set/right/help.rb"; end
-include_set Abstract::TemplatedNests
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :popover do
- popover_link _render_core
- end
-
- def quick_editor
- # TODO: refactor when voo.input_type is ready. (and use class_up)
- formgroup "Content", input: :content, help: false do
- text_field :content, value: card.content,
- class: "d0-card-content _submit-after-typing"
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/help/set/right/help.rb ~~
diff --git a/set/mod028-help/self/guide.rb b/set/mod028-help/self/guide.rb
deleted file mode 100644
index 88e0cbe..0000000
--- a/set/mod028-help/self/guide.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Guide"
-#
-module Guide;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/help/set/self/guide.rb"; end
-setting_opts group: :editing, position: 3, rule_type_editable: true,
- short_help_text: "appears in the full editor view to guide users"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/help/set/self/guide.rb ~~
diff --git a/set/mod028-help/self/help.rb b/set/mod028-help/self/help.rb
deleted file mode 100644
index 2fe0d9e..0000000
--- a/set/mod028-help/self/help.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Help"
-#
-module Help;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/help/set/self/help.rb"; end
-setting_opts group: :editing, position: 1, rule_type_editable: true,
- short_help_text: "help text people will see when editing",
- help_text: "[[http://decko.org/custom_help_text|Help text]] "\
- "people will see when editing."
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/help/set/self/help.rb ~~
diff --git a/set/mod029-integrate/all/observer.rb b/set/mod029-integrate/all/observer.rb
deleted file mode 100644
index 28260bd..0000000
--- a/set/mod029-integrate/all/observer.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Observer)
-#
-module Observer;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/integrate/set/all/observer.rb"; end
-%i[create update delete].each do |action|
- event "observer_#{action}".to_sym, :integrate, on: action do
- execute_card_events on: action
- end
-end
-
-event :cache_delete_card_events, :store, on: :delete do
- @card_event_cache = event_cards :on_delete
-end
-
-def execute_card_events args
- setting = "on_#{args[:on]}".to_sym
- event_cards(setting).each do |event_card|
- event_card.deliver self
- end
-end
-
-def event_cards setting
- @card_event_cache ||
- ((event_rule = rule_card(setting)) && event_rule.extended_item_cards) ||
- []
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/integrate/set/all/observer.rb ~~
diff --git a/set/mod029-integrate/self/on_create.rb b/set/mod029-integrate/self/on_create.rb
deleted file mode 100644
index ce6881f..0000000
--- a/set/mod029-integrate/self/on_create.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "OnCreate"
-#
-module OnCreate;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/integrate/set/self/on_create.rb"; end
-setting_opts group: :event, position: 1, rule_type_editable: false,
- help_text: "Configure events to be executed when card is created"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/integrate/set/self/on_create.rb ~~
diff --git a/set/mod029-integrate/self/on_delete.rb b/set/mod029-integrate/self/on_delete.rb
deleted file mode 100644
index f40303a..0000000
--- a/set/mod029-integrate/self/on_delete.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "OnDelete"
-#
-module OnDelete;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/integrate/set/self/on_delete.rb"; end
-setting_opts group: :event, position: 3, rule_type_editable: false,
- help_text: "Configure events to be executed when card is deleted"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/integrate/set/self/on_delete.rb ~~
diff --git a/set/mod029-integrate/self/on_update.rb b/set/mod029-integrate/self/on_update.rb
deleted file mode 100644
index 73628b3..0000000
--- a/set/mod029-integrate/self/on_update.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "OnUpdate"
-#
-module OnUpdate;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/integrate/set/self/on_update.rb"; end
-setting_opts group: :event, position: 2, rule_type_editable: false,
- help_text: "Configure events to be executed when card is updated"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/integrate/set/self/on_update.rb ~~
diff --git a/set/mod029-integrate/self/thanks.rb b/set/mod029-integrate/self/thanks.rb
deleted file mode 100644
index 9c3242e..0000000
--- a/set/mod029-integrate/self/thanks.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Self
-# Set: The card "Thanks"
-#
-module Thanks;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/integrate/set/self/thanks.rb"; end
-setting_opts group: :other, position: 3, rule_type_editable: false,
- short_help_text: "destination after card is created",
- help_text: "Destination after card is created. "\
- "[[http://decko.org/Custom_thank_you_messages_for_forms|more]]"
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/integrate/set/self/thanks.rb ~~
diff --git a/set/mod030-session/all/location_history.rb b/set/mod030-session/all/location_history.rb
deleted file mode 100644
index b6bc356..0000000
--- a/set/mod030-session/all/location_history.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (LocationHistory)
-#
-module LocationHistory;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/session/set/all/location_history.rb"; end
-event :discard_deleted_locations, :finalize, on: :delete do
- Env.discard_locations_for self
- configure_successful_deletion if success.target == self
-end
-
-event :save_current_location, before: :show_page, on: :read do
- Env.save_location self
-end
-
-# TO DISCUSS: should this default behavior be directly in the controller?
-# Or at least in decko?
-def configure_successful_deletion
- if Env.ajax?
- success.card = self
- success.view = :unknown unless success.view
- else
- success.target = :previous
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/session/set/all/location_history.rb ~~
diff --git a/set/mod030-session/type/session.rb b/set/mod030-session/type/session.rb
deleted file mode 100644
index 016729b..0000000
--- a/set/mod030-session/type/session.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Type
-# Set: All "Session" cards
-#
-module Session;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/session/set/type/session.rb"; end
-include_set Pointer
-
-def virtual?
- session_content.present?
-end
-
-def history?
- false
-end
-
-def followable?
- false
-end
-
-def recaptcha_on?
- false
-end
-
-def session_key
- "_card_#{key}"
-end
-
-def session_content
- Env.session[session_key]
-end
-
-def session_content= val
- Env.session[session_key] = val
-end
-
-def content
- db_content || session_content
-end
-
-event :store_in_session, :prepare_to_store, on: :save do
- self.session_content = db_content
- abort :success
-end
-
-event :delete_in_session, :prepare_to_store, on: :delete do
- self.session_content = nil
- abort :success
-end
-
-def ok_to_create
- true
-end
-
-def ok_to_update
- true
-end
-
-def add_to_trash args
- yield args.merge trash: true
-end
-
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- before :core do
- voo.items[:view] = :name
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/session/set/type/session.rb ~~
diff --git a/set/mod031-layout/abstract/account_dropdown.rb b/set/mod031-layout/abstract/account_dropdown.rb
deleted file mode 100644
index abf1b86..0000000
--- a/set/mod031-layout/abstract/account_dropdown.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract
-# Set: Abstract (AccountDropdown)
-#
-module AccountDropdown;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/layout/set/abstract/account_dropdown.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- def link_to_mycard
- link_to_card Auth.current.name, nil,
- id: "my-card-link", class: "nav-link #{classy('my-card')}"
- end
-
- def account_dropdown &render_role_item
- split_button link_to_mycard, nil do
- [
- link_to_card([Auth.current, :account_settings], "Account"),
- (["Roles", role_items(&render_role_item)] if special_roles?)
- ]
- end
- end
-
- def special_roles?
- Auth.current_roles.size > 1
- end
-
- def role_items &block
- Auth.current_roles.map(&block)
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/layout/set/abstract/account_dropdown.rb ~~
diff --git a/set/mod031-layout/abstract/pointer/html_views.rb b/set/mod031-layout/abstract/pointer/html_views.rb
deleted file mode 100644
index 480d6c5..0000000
--- a/set/mod031-layout/abstract/pointer/html_views.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class Abstract; module Pointer;
-# Set: Abstract (Pointer, HtmlViews)
-#
-module HtmlViews;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/layout/set/abstract/pointer/html_views.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :nav_item do
- nav_dropdown
- end
-end
-end;end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/layout/set/abstract/pointer/html_views.rb ~~
diff --git a/set/mod031-layout/all/alert.rb b/set/mod031-layout/all/alert.rb
deleted file mode 100644
index a7e2886..0000000
--- a/set/mod031-layout/all/alert.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Alert)
-#
-module Alert;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/layout/set/all/alert.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # alert_types: 'success', 'info', 'warning', 'danger'
- def alert alert_type, dismissable=false, disappear=false, args={}
- add_class args, alert_classes(alert_type, dismissable, disappear)
- wrap_with :div, args.merge(role: "alert") do
- [(alert_close_button if dismissable), output(yield)]
- end
- end
-
- def alert_classes alert_type, dismissable, disappear
- classes = ["alert", "alert-#{alert_type}"]
- classes << "alert-dismissible " if dismissable
- classes << "_disappear" if disappear
- classy classes
- end
-
- def alert_close_button
- wrap_with :button, type: "button", "data-dismiss": "alert",
- class: "close", "aria-label": "Close" do
- wrap_with :span, "×", "aria-hidden" => true
- end
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/layout/set/all/alert.rb ~~
diff --git a/set/mod031-layout/all/layouts.rb b/set/mod031-layout/all/layouts.rb
deleted file mode 100644
index 73790df..0000000
--- a/set/mod031-layout/all/layouts.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Layouts)
-#
-module Layouts;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/layout/set/all/layouts.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- attr_reader :interior
-
- def layout_nest
- wrap_main { interior }
- end
-
- layout :pre do # {{_main|raw}}
- wrap_with :pre do
- layout_nest
- end
- end
-
- layout :simple do
- layout_nest
- end
-
- layout :no_side do # {{_main|open}}
- <<-HTML.strip_heredoc
- #{nest :header, view: :core}
- #{layout_nest}
- {nest :footer, view: :core}
- HTML
- end
-
- layout :default do
- <<-HTML.strip_heredoc
- #{nest :header, view: :core}
- #{layout_nest}
- #{nest :sidebar, view: :core}
- {nest :footer, view: :core}
- HTML
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/layout/set/all/layouts.rb ~~
diff --git a/set/mod031-layout/all/modal.rb b/set/mod031-layout/all/modal.rb
deleted file mode 100644
index 8805d04..0000000
--- a/set/mod031-layout/all/modal.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Modal)
-#
-module Modal;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/layout/set/all/modal.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- MODAL_SIZE = { small: "sm", medium: nil, large: "lg", full: "full" }.freeze
- MODAL_CLOSE_OPTS = { "data-dismiss": "modal",
- "data-cy": "close-modal" }.freeze
-
- wrapper :modal do |opts={}|
- haml :modal_dialog, body: interior,
- classes: modal_dialog_classes(opts),
- title: normalize_modal_option(:title, opts),
- menu: normalize_modal_option(:menu, opts),
- footer: normalize_modal_option(:footer, opts)
- end
-
- def normalize_modal_option key, opts
- val = opts[key]
- return render("modal_#{key}") unless val
-
- cast_model_option val
- end
-
- def cast_model_option val
- case val
- when Symbol
- cast_model_option_symbol val
- when Proc
- val.call(self)
- else
- val
- end
- end
-
- def cast_model_option_symbol val
- respond_to?(val) ? send(val) : val
- end
-
- view :modal, wrap: :modal do
- ""
- end
-
- def show_in_modal_link link_text, body
- link_to_view :modal, link_text, "data-modal-body": body, "data-slotter-mode": "modal"
- end
-
- def modal_close_button link_text="Close", opts={}
- classes = opts.delete(:class)
- button_opts = opts.merge(MODAL_CLOSE_OPTS)
- add_class button_opts, classes if classes
- button_tag link_text, button_opts
- end
-
- def modal_submit_button opts={}
- add_class opts, "submit-button _close-modal"
- submit_button opts
- end
-
- view :modal_menu, unknown: true, wrap: :modal_menu do
- [close_modal_window, pop_out_modal_window]
- end
-
- wrapper :modal_menu, :div, class: "modal-menu ml-auto"
-
- view :modal_title, unknown: true do
- ""
- end
-
- view :modal_footer, unknown: true do
- button_tag "Close",
- class: "btn-xs _close-modal float-right",
- "data-dismiss" => "modal"
- end
-
- view :modal_link do
- modal_link _render_title, size: voo.size
- end
-
- def modal_link text=nil, opts={}
- opts = modal_link_opts(opts)
- opts[:path][:layout] ||= :modal
- link_to text, opts
- end
-
- def modal_link_opts opts
- add_class opts, "slotter"
- opts.reverse_merge! path: {},
- "data-slotter-mode": "modal",
- "data-modal-class": modal_dialog_classes(opts),
- remote: true
- opts
- end
-
- def modal_dialog_classes opts
- classes = [classy("modal-dialog")]
- return classes unless opts.present?
-
- add_modal_size_class classes, opts[:size]
- classes << "modal-dialog-centered" if opts[:vertically_centered]
- classes.join " "
- end
-
- def add_modal_size_class classes, size
- size = normalize_modal_size_class size
- return if size == :medium || size.blank?
-
- classes << "modal-#{MODAL_SIZE[size]}"
- end
-
- def normalize_modal_size_class size
- size.in?(MODAL_SIZE.keys) ? size : cast_model_option(size)
- end
-
- def close_modal_window
- link_to icon_tag(:close), path: "",
- class: "_close-modal close",
- "data-dismiss": "modal"
- end
-
- def pop_out_modal_window
- link_to icon_tag(:new_window), path: {}, class: "pop-out-modal close"
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/layout/set/all/modal.rb ~~
diff --git a/set/mod031-layout/all/navbar_links.rb b/set/mod031-layout/all/navbar_links.rb
deleted file mode 100644
index 0c47c0d..0000000
--- a/set/mod031-layout/all/navbar_links.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (NavbarLinks)
-#
-module NavbarLinks;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/layout/set/all/navbar_links.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- view :navbar_links, perms: :none do
- wrap_with :ul, class: "navbar-nav" do
- navbar_items
- end
- end
-
- # Iterates over all nests and links and renders them as bootstrap navbar items.
- # Items that are pointer cards become dropdowns
- def navbar_items view: :nav_item, link_class: "nav-link"
- process_content nil, chunk_list: :references do |chunk|
- case chunk
- when Card::Content::Chunk::Link
- navbar_link_chunk chunk, view, link_class
- when Card::Content::Chunk::Nest
- navbar_nest_chunk chunk, view
- else
- chunk.process_chunk
- end
- end
- end
-
- # overridden in Abstact::Pointer to render dropdown
- view :nav_item do
- wrap_with_nav_item link_view(class: "nav-link")
- end
-
- def wrap_with_nav_item content
- wrap_with(:li, content, class: "nav-item")
- end
-
- view :nav_link_in_dropdown do
- link_to_card card, render_title, class: "dropdown-item"
- end
-
- def nav_dropdown
- wrap_with(:li, class: "nav-item dropdown") do
- [
- dropdown_toggle_link,
- dropdown_menu
- ]
- end
- end
-
- def dropdown_toggle_link
- link_to(render_title, href: "#", class: "nav-link dropdown-toggle",
- "data-toggle": "dropdown")
- end
-
- def dropdown_menu
- wrap_with :div, dropdown_menu_items, class: "dropdown-menu"
- end
-
- def dropdown_menu_items
- navbar_items view: :nav_link_in_dropdown, link_class: "dropdown-item"
- end
-
- private
-
- def navbar_link_chunk chunk, view, link_class
- link = chunk.render_link view: view, explicit_link_opts: { class: link_class }
- chunk.explicit_link? && view == :nav_item ? wrap_with_nav_item(link) : link
- end
-
- def navbar_nest_chunk chunk, view
- content_nest chunk.options.merge view: view
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/layout/set/all/navbar_links.rb ~~
diff --git a/set/mod031-layout/all/overlay.rb b/set/mod031-layout/all/overlay.rb
deleted file mode 100644
index 76e923e..0000000
--- a/set/mod031-layout/all/overlay.rb
+++ /dev/null
@@ -1,110 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (Overlay)
-#
-module Overlay;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/layout/set/all/overlay.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- OVERLAY_CLOSE_OPTS = { class: "_close-overlay btn-sm",
- "data-dismiss": "overlay",
- type: "button" }.freeze
-
- wrapper :overlay do |opts|
- class_up "card-slot", "_overlay d0-card-overlay bg-body"
- @content_body = true
- voo.hide! :menu
- overlay_frame true, overlay_header(opts[:title]), opts[:slot] do
- interior
- end
- end
-
- view :overlay_header, unknown: true do
- overlay_header
- end
-
- view :overlay_title do
- _render_title
- end
-
- view :overlay_menu do
- wrap_with :div, class: "btn-group btn-group-sm align-self-start ml-auto" do
- [render_overlay_help_link, slotify_overlay_link, close_overlay_link]
- end
- end
-
- view :overlay_help_link, cache: :never, unknown: true do
- opts = help_popover_opts
- add_open_guide_opts opts
- overlay_menu_link "question-circle", opts
- end
-
- def add_open_guide_opts opts
- return unless card.guide_card
-
- slot_selector = ".bridge-sidebar > ._overlay-container-placeholder > .card-slot"
- opts.merge! remote: true,
- href: path(mark: card, view: :overlay_guide),
- "data-slot-selector": slot_selector,
- "data-slotter-mode": "overlay"
- add_class opts, "slotter"
- end
-
- def slotify_overlay_link
- overlay_menu_link "external-link-square", card: card
- end
-
- def close_overlay_link
- overlay_menu_link :close, path: "#", "data-dismiss": "overlay"
- end
-
- def overlay_close_button link_text="Close", opts={}
- classes = opts.delete(:class)
- button_opts = opts.merge(OVERLAY_CLOSE_OPTS)
- add_class button_opts, classes if classes
- button_tag link_text, button_opts
- end
-
- def overlay_delete_button
- delete_button OVERLAY_CLOSE_OPTS.merge(success: {})
- end
-
- def overlay_save_and_close_button
- submit_button text: "Save and Close", class: "_close-on-success",
- "data-cy": "submit-overlay"
- end
-
- def overlay_menu_link icon, args={}
- add_class args, "border-light text-dark p-1 ml-1"
- button_link fa_icon(icon, class: "fa-lg"), args.merge(btn_type: "outline-secondary")
- end
-
- def overlay_header title=nil
- title ||= _render_overlay_title
- class_up "d0-card-header", "bg-body"
- class_up "d0-card-header-title", "d-flex"
- header_wrap [title, _render_overlay_menu]
- end
-
- def overlay_frame slot=true, header=render_overlay_header, slot_opts=nil, &block
- slot_opts ||= {}
- overlay_framer slot, header, slot_opts do
- wrap_body(&block)
- end
- end
-
- def haml_overlay_frame slot=true, header=render_overlay_header, &block
- overlay_framer slot, header, {} do
- haml_wrap_body(&block)
- end
- end
-
- private
-
- def overlay_framer slot, header, slot_opts, &block
- class_up "card-slot", "_overlay"
- with_frame slot, header, slot_opts, &block
- end
-end
-end;end;end;end;
-# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/layout/set/all/overlay.rb ~~
diff --git a/set/mod031-layout/all/process_layout.rb b/set/mod031-layout/all/process_layout.rb
deleted file mode 100644
index 36a1220..0000000
--- a/set/mod031-layout/all/process_layout.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- encoding : utf-8 -*-
-class Card; module Set; class All
-# Set: All cards (ProcessLayout)
-#
-module ProcessLayout;
-extend Card::Set
-def self.source_location; "/Users/ezl5238/dev/decko/gem/mod/layout/set/all/process_layout.rb"; end
-module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
- # TODO: use CodeFile cards for these
- # builtin layouts allow for rescue / testing
- # HTML_LAYOUTS = Mod::Loader.load_layouts(:html).merge "none" => "{{_main}}"
- # HAML_LAYOUTS = Mod::Loader.load_layouts(:haml)
-
- def show_with_page_layout view, args
- main!
- args = main_render_args view, args
- if explicit_modal_wrapper?(view) && page_layout.to_sym != :modal
- render_outside_of_layout view, args
- else
- render_with_layout view, page_layout, args
- end
- end
-
- def page_layout
- params[:layout] || layout_name_from_rule || :default
- end
-
- def render_with_layout view, layout, args={}
- view_opts = Layout.main_nest_opts(layout, self)
- view ||= view_opts.delete(:view) || default_nest_view
- view_opts[:home_view] = view
- view_opts[:layout] = layout
- render! view, view_opts.reverse_merge(args)
- end
-
- def show_layout?
- !Env.ajax? || params[:layout]
- end
-
- def explicit_modal_wrapper? view
- return unless (wrap_view = view_setting :wrap, view)
-
- (wrapper_names(wrap_view) & %i[modal bridge]).any?
- end
-
- private
-
- def main_render_args view, args
- args[:view] = view if view
- args[:main] = true
- args[:main_view] = true
- args
- end
-
- def layout_name_from_rule
- card.rule_card(:layout)&.try :item_name
- end
-
- def render_outside_of_layout view, args
- body = render_with_layout nil, page_layout, {}
- body_with_modal body, render!(view, args)
- end
-
- def body_with_modal body, modal
- if body.include? "
- body.sub "