card 1.103.4 → 1.104.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/environments/development.rb +4 -2
  4. data/config/environments/test.rb +1 -1
  5. data/config/initializers/01_core_extensions/array.rb +4 -1
  6. data/config/initializers/01_core_extensions/object.rb +1 -1
  7. data/config/initializers/02_patches/active_record.rb +16 -17
  8. data/config/locales/de.yml +8 -564
  9. data/config/locales/es.yml +2 -3
  10. data/db/migrate/20110511221913_require_earlier_migrations.rb +1 -1
  11. data/db/migrate/20120105203350_require_1_8_migrations.rb +1 -1
  12. data/db/migrate/20121111025347_require_1_10_migrations.rb +1 -1
  13. data/db/migrate/20211128040849_virtuals_updated_at.rb +11 -0
  14. data/db/migrate_core_cards/20190502130029_add_shark_and_help_desk_role.rb +0 -1
  15. data/db/schema.rb +19 -16
  16. data/db/seed/new/card_actions.yml +1323 -2091
  17. data/db/seed/new/card_acts.yml +2 -2
  18. data/db/seed/new/card_references.yml +629 -741
  19. data/db/seed/new/cards.yml +2593 -5557
  20. data/db/seed/new/schema_migrations.yml +2 -0
  21. data/db/seed/new/schema_migrations_core_cards.yml +8 -0
  22. data/db/seed/test/fixtures/card_actions.yml +2555 -3395
  23. data/db/seed/test/fixtures/card_acts.yml +606 -666
  24. data/db/seed/test/fixtures/card_changes.yml +101 -101
  25. data/db/seed/test/fixtures/card_references.yml +1609 -1686
  26. data/db/seed/test/fixtures/cards.yml +4363 -7541
  27. data/db/seed/test/fixtures/schema_migrations.yml +2 -0
  28. data/db/seed/test/fixtures/schema_migrations_core_cards.yml +8 -0
  29. data/db/test_seed.rb +1 -4
  30. data/db/version.txt +1 -1
  31. data/db/version_core_cards.txt +1 -1
  32. data/lib/card/auth/current.rb +1 -1
  33. data/lib/card/auth/permissions.rb +37 -35
  34. data/lib/card/content/all.rb +3 -3
  35. data/lib/card/content/chunk.rb +1 -0
  36. data/lib/card/director/act_direction.rb +1 -3
  37. data/lib/card/director/card_methods.rb +0 -1
  38. data/lib/card/director/phases.rb +1 -0
  39. data/lib/card/director.rb +1 -0
  40. data/lib/card/fetch/all.rb +3 -3
  41. data/lib/card/fetch/card_class.rb +5 -11
  42. data/lib/card/fetch/results.rb +2 -2
  43. data/lib/card/model/save_helper.rb +2 -2
  44. data/lib/card/name/all/descendants.rb +9 -7
  45. data/lib/card/name/all/parts.rb +1 -1
  46. data/lib/card/name/all.rb +4 -3
  47. data/lib/card/name/card_class.rb +1 -0
  48. data/lib/card/name/fields_and_traits.rb +6 -30
  49. data/lib/card/name/name_variants.rb +5 -1
  50. data/lib/card/name.rb +0 -8
  51. data/lib/card/query/abstract_query/tie.rb +2 -3
  52. data/lib/card/query/card_query/normalization.rb +1 -1
  53. data/lib/card/query/sql_statement/order.rb +5 -6
  54. data/lib/card/query/value.rb +10 -7
  55. data/lib/card/reference/all.rb +9 -7
  56. data/lib/card/reference.rb +36 -41
  57. data/lib/card/rule/all.rb +3 -3
  58. data/lib/card/set/advanced_api.rb +5 -0
  59. data/lib/card/set/event/delayed_event.rb +8 -1
  60. data/lib/card/set/event.rb +1 -0
  61. data/lib/card/set/helpers.rb +30 -17
  62. data/lib/card/set/pattern/all.rb +13 -4
  63. data/lib/card/set/pattern/base.rb +12 -18
  64. data/lib/card/set/pattern/class_methods.rb +13 -13
  65. data/lib/card/set/pattern.rb +30 -19
  66. data/lib/card/set/trait.rb +16 -1
  67. data/lib/card/set/type.rb +3 -0
  68. data/lib/card/subcards/add.rb +1 -3
  69. data/lib/card/subcards/all.rb +30 -56
  70. data/lib/card/view/options.rb +7 -5
  71. data/lib/cardio/cli.rb +1 -0
  72. data/lib/cardio/commands/custom.rb +60 -0
  73. data/lib/cardio/commands/rake_command/parser.rb +49 -48
  74. data/lib/cardio/commands/rake_command.rb +17 -15
  75. data/lib/cardio/commands/rspec_command.rb +2 -0
  76. data/lib/cardio/commands.rb +69 -69
  77. data/lib/cardio/generators.rb +56 -3
  78. data/lib/cardio/migration/deck.rb +0 -0
  79. data/lib/cardio/migration/deck_structure.rb +2 -0
  80. data/lib/cardio/migration/import/import_data/card_content.rb +1 -1
  81. data/lib/cardio/migration/import.rb +2 -2
  82. data/lib/cardio/migration.rb +26 -2
  83. data/lib/cardio/mod/class_methods.rb +112 -0
  84. data/lib/cardio/mod/dirs.rb +15 -11
  85. data/lib/cardio/mod/eat/edibles.rb +92 -0
  86. data/lib/cardio/mod/eat.rb +81 -0
  87. data/lib/cardio/mod/load_strategy/tmp_files.rb +1 -1
  88. data/lib/cardio/mod/modfile_api.rb +5 -0
  89. data/lib/cardio/mod/poop.rb +135 -0
  90. data/lib/cardio/mod.rb +20 -80
  91. data/lib/cardio/railtie.rb +15 -3
  92. data/lib/cardio/schema.rb +11 -10
  93. data/lib/cardio/version.rb +35 -0
  94. data/lib/cardio.rb +4 -0
  95. data/lib/generators/deck/templates/Gemfile.erb +0 -4
  96. data/lib/generators/deck/templates/rspec.erb +1 -1
  97. data/lib/generators/deck/templates/spec/javascripts/support/decko_jasmine.yml.erb +0 -1
  98. data/lib/generators/mod/USAGE +1 -0
  99. data/lib/tasks/card/migrate.rake +41 -1
  100. data/lib/tasks/card/mod.rake +15 -8
  101. data/lib/tasks/card.rake +47 -87
  102. data/mod/admin/locales/de.yml +4 -0
  103. data/mod/admin/set/self/admin.rb +10 -8
  104. data/mod/core/data/production.yml +7 -0
  105. data/mod/core/data/test.yml +30 -0
  106. data/mod/core/locales/de.yml +28 -0
  107. data/mod/core/set/all/assign_attributes.rb +1 -33
  108. data/mod/core/set/all/content.rb +3 -1
  109. data/mod/core/set/all/initialize.rb +1 -4
  110. data/mod/core/set/all/name_events.rb +3 -18
  111. data/mod/core/set/all/reference_events.rb +29 -28
  112. data/mod/core/set/all/subcards.rb +6 -2
  113. data/mod/core/set/all/trash.rb +2 -3
  114. data/mod/core/set/all/type.rb +67 -18
  115. data/mod/core/set/self/version.rb +1 -1
  116. data/mod/core/spec/set/self/trash_spec.rb +1 -1
  117. data/mod/standard/{file → data/files}/favicon/image-icon.png +0 -0
  118. data/mod/standard/{file → data/files}/favicon/image-large.png +0 -0
  119. data/mod/standard/{file → data/files}/favicon/image-medium.png +0 -0
  120. data/mod/standard/{file → data/files}/favicon/image-original.png +0 -0
  121. data/mod/standard/{file → data/files}/favicon/image-small.png +0 -0
  122. data/mod/standard/{file → data/files}/logo/image-original.svg +0 -0
  123. metadata +37 -28
  124. data/db/migrate_core_cards/20150605115802_add_performance_log_card.rb +0 -7
  125. data/lib/card/set/code_nest.rb +0 -15
  126. data/lib/card/version.rb +0 -11
  127. data/lib/cardio/commands/USAGE +0 -28
  128. data/lib/cardio/generators/class_methods.rb +0 -35
  129. data/lib/tasks/card/asset.rake +0 -22
  130. data/mod/core/spec/set/all/clean_me_spec.rb +0 -258
  131. data/mod/core/spec/set/all/export_spec.rb +0 -71
  132. data/tmpsets/set_pattern/100-all.rb +0 -22
  133. data/tmpsets/set_pattern/101-all_plus.rb +0 -24
  134. data/tmpsets/set_pattern/102-type.rb +0 -40
  135. data/tmpsets/set_pattern/103-star.rb +0 -26
  136. data/tmpsets/set_pattern/104-rstar.rb +0 -28
  137. data/tmpsets/set_pattern/105-rule.rb +0 -28
  138. data/tmpsets/set_pattern/106-right.rb +0 -35
  139. data/tmpsets/set_pattern/107-type_plus_right.rb +0 -43
  140. data/tmpsets/set_pattern/108-self.rb +0 -34
data/lib/cardio/schema.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  module Cardio
2
2
  module Schema
3
3
  class << self
4
- def assume_migrated_upto_version type
5
- mode type do |paths|
6
- ActiveRecord::Schema.assume_migrated_upto_version version(type), paths
4
+ def assume_migrated_upto_version type, version=nil
5
+ mode type do |_paths|
6
+ version ||= version type
7
+ ActiveRecord::Schema.assume_migrated_upto_version version
7
8
  end
8
9
  end
9
10
 
@@ -53,6 +54,13 @@ module Cardio
53
54
  list.flatten
54
55
  end
55
56
 
57
+ def migration_context type
58
+ with_suffix type do
59
+ yield ActiveRecord::MigrationContext.new(migration_paths(type),
60
+ ActiveRecord::SchemaMigration)
61
+ end
62
+ end
63
+
56
64
  private
57
65
 
58
66
  def deck_migration? type
@@ -82,13 +90,6 @@ module Cardio
82
90
  ActiveRecord::SchemaMigration.table_name = old_table_name
83
91
  ActiveRecord::SchemaMigration.reset_column_information
84
92
  end
85
-
86
- def migration_context type
87
- with_suffix type do
88
- yield ActiveRecord::MigrationContext.new(migration_paths(type),
89
- ActiveRecord::SchemaMigration)
90
- end
91
- end
92
93
  end
93
94
  end
94
95
  end
@@ -0,0 +1,35 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module Cardio
4
+ module Version
5
+ class << self
6
+ CARD_MINOR = { 0 => 90, 1 => 1000 }.freeze # can remove and hardcode after 1.0
7
+
8
+ def release
9
+ @version ||= File.read(File.expand_path("../../../card/VERSION", __dir__)).strip
10
+ end
11
+
12
+ def card_release
13
+ @card_release ||= [1, minor, point].compact.map(&:to_s).join "."
14
+ end
15
+
16
+ private
17
+
18
+ def bits
19
+ release.split(".").map(&:to_i)
20
+ end
21
+
22
+ def major
23
+ bits[0]
24
+ end
25
+
26
+ def minor
27
+ CARD_MINOR[major] + bits[1]
28
+ end
29
+
30
+ def point
31
+ bits[2]
32
+ end
33
+ end
34
+ end
35
+ end
data/lib/cardio.rb CHANGED
@@ -41,5 +41,9 @@ module Cardio
41
41
  def database
42
42
  @database ||= config.database_configuration.dig Rails.env, "database"
43
43
  end
44
+
45
+ def mods
46
+ Mod.dirs.mods
47
+ end
44
48
  end
45
49
  end
@@ -50,7 +50,3 @@ gem "card-mod-defaults"<%= repo_path_constraint :mod %>
50
50
  # This mod is strongly recommended for platypuses – coders working on the decko core
51
51
  gem "card-mod-platypus"<%= repo_path_constraint :mod %>
52
52
  <% end %>
53
-
54
- # The following allows simple (non-gem) mods to specify gems via a Gemfile.
55
- # You may need to alter this code if you move such mods to an unconventional location.
56
- Dir.glob("mod/**/Gemfile").each { |gemfile| instance_eval File.read(gemfile) }
@@ -1,6 +1,6 @@
1
1
  --color
2
2
  --profile
3
3
  --backtrace
4
- --format documentation
4
+ // --format documentation
5
5
  --default-path '<%= File.expand_path spec_path %>'
6
6
  --require '<%= File.expand_path spec_helper_path %>'
@@ -37,7 +37,6 @@ src_files:
37
37
  - jquery.iframe-transport.js
38
38
  - jquery_ujs.js
39
39
  - script_ace.js
40
- - script_prosemirror.js
41
40
  #- "**/*.{js.coffee,js,coffee}"
42
41
 
43
42
  # list of file expressions to include as css files
@@ -31,3 +31,4 @@ Example:
31
31
  right/
32
32
  self/
33
33
  README.md
34
+
@@ -19,10 +19,12 @@ end
19
19
  # in mods in the deck
20
20
  def reset_column_information mod=false
21
21
  Rails.application.eager_load!
22
- load_mod_lib if mod
22
+ load_mod_lib if mod && !ENV["NO_CARD_LOAD"]
23
23
  Cardio::Record.descendants.each(&:reset_column_information)
24
24
  end
25
25
 
26
+ # FIXME: too general
27
+ # intent is to find Record classes; this gets a lot more.
26
28
  def load_mod_lib
27
29
  Dir.glob(Cardio.root.join("mod/*/lib/*.rb")).sort.each { |x| require x }
28
30
  end
@@ -33,6 +35,44 @@ def without_dumping
33
35
  end
34
36
 
35
37
  namespace :card do
38
+ desc "migrate structure and cards"
39
+ task migrate: :environment do
40
+ ENV["NO_RAILS_CACHE"] = "true"
41
+ ENV["SCHEMA"] ||= "#{Cardio.gem_root}/db/schema.rb"
42
+
43
+ stamp = ENV["STAMP_MIGRATIONS"]
44
+
45
+ puts "migrating structure"
46
+ Rake::Task["card:migrate:structure"].invoke
47
+ Rake::Task["card:migrate:stamp"].invoke :structure if stamp
48
+
49
+ puts "migrating deck structure"
50
+ Rake::Task["card:migrate:deck_structure"].execute
51
+ if stamp
52
+ Rake::Task["card:migrate:stamp"].reenable
53
+ Rake::Task["card:migrate:stamp"].invoke :core_cards
54
+ end
55
+
56
+ puts "migrating core cards"
57
+ Card::Cache.reset_all
58
+ # not invoke because we don't want to reload environment
59
+ Rake::Task["card:migrate:core_cards"].execute
60
+ if stamp
61
+ Rake::Task["card:migrate:stamp"].reenable
62
+ Rake::Task["card:migrate:stamp"].invoke :core_cards
63
+ end
64
+
65
+ puts "migrating deck cards"
66
+ # not invoke because we don't want to reload environment
67
+ Rake::Task["card:migrate:deck_cards"].execute
68
+ if stamp
69
+ Rake::Task["card:migrate:stamp"].reenable
70
+ Rake::Task["card:migrate:stamp"].invoke :deck_cards
71
+ end
72
+
73
+ Card::Cache.reset_all
74
+ end
75
+
36
76
  namespace :migrate do
37
77
  desc "migrate cards"
38
78
  task cards: %i[core_cards deck_cards]
@@ -1,25 +1,32 @@
1
1
  namespace :card do
2
2
  namespace :mod do
3
+ task list: :environment do
4
+ Cardio.mods.each { |m| puts "#{m.name}: #{m.path}".green }
5
+ end
6
+
3
7
  desc "symlink from deck public/{modname} to mod's public directory"
4
8
  task symlink: :environment do
5
9
  FileUtils.rm_rf public_mod_dir
6
10
  FileUtils.mkdir_p public_mod_dir
7
- Cardio::Mod.dirs.each_public_path do |mod, target|
11
+ Cardio::Mod.dirs.each_subpath "public" do |mod, target|
8
12
  link = public_mod_dir mod
9
13
  FileUtils.rm_rf link
10
14
  FileUtils.ln_sf target, link
11
15
  end
12
16
  end
13
17
 
18
+ task missing: :environment do
19
+ Cardio::Mod.missing.each { |m| puts m.modname.yellow }
20
+ end
21
+
22
+ task uninstall: :environment do
23
+ Cardio::Mod.ensure_uninstalled
24
+ end
25
+
14
26
  desc "install all mods"
15
27
  task install: :environment do
16
- Card::Machine.reset_script
17
- Card::Cache.reset_all
18
- puts "installing card mods".green
19
- Cardio::Mod.dirs.mods.each do |mod|
20
- mod.ensure_mod_installed
21
- Card::Cache.reset_all
22
- end
28
+ Cardio.config.compress_assets = true
29
+ Cardio::Mod.ensure_installed
23
30
  end
24
31
 
25
32
  def public_mod_dir subdir=nil
data/lib/tasks/card.rake CHANGED
@@ -1,105 +1,65 @@
1
- namespace :card do
2
- def importer
3
- @importer ||= Cardio::Migration::Import.new Cardio::Migration.data_path
4
- end
5
-
6
- desc "merge import card data that was updated since the last push into " \
7
- "the the database"
8
- task merge: :environment do
9
- importer.merge
10
- end
11
-
12
- desc "merge all import card data into the the database"
13
- task merge_all: :environment do
14
- importer.merge all: true
15
- end
16
-
17
- desc "add card to import data"
18
- task pull: :environment do
19
- pull_card
20
- end
1
+ require "optparse"
21
2
 
22
- desc "add card and all nested cards to import data"
23
- task deep_pull: :environment do
24
- pull_card deep: true
3
+ namespace :card do
4
+ desc "ingest card data from mod yaml"
5
+ task eat: :environment do
6
+ parse_options :eat do
7
+ add_opt :m, :mod, "only merge cards in given mod"
8
+ add_opt :e, :env, "environment of yaml source (default is current env)"
9
+ add_opt :u, :user, "user to credit unless specified (otherwise uses Decko Bot)"
10
+ flag_opt :v, :verbose, "progress info and error backtraces"
11
+ end
12
+ Cardio::Mod::Eat.new(**options).up
13
+ exit 0
25
14
  end
26
15
 
27
- desc "add nested cards to import data (not the card itself)"
28
- task deep_pull_items: :environment do
29
- pull_card items_only: true
30
- end
16
+ desc "export card data to mod yaml"
17
+ task poop: :environment do
18
+ parse_options :poop do
19
+ add_opt :n, :name, "export card with name/mark (handles : and ~ prefixes)"
20
+ flag_opt :i, :items, "also export card items (with -n)"
21
+ flag_opt :o, :only_items, "also export card items (with -n)", items: :only
22
+ add_opt :c, :cql, "export cards found by CQL (in JSON format)"
23
+ add_opt :m, :mod, "output yaml to data/environment.yml file in mod"
24
+ add_opt :e, :env, "environment to dump to (default is current env)"
25
+ add_opt :t, :field_tags, "comma-separated list of field tag marks"
26
+ end
27
+ result = Cardio::Mod::Poop.new(**options).out
28
+ exit 0 if result == :success
31
29
 
32
- # be rake card:pull_export from=live
33
- desc "add items of the export card to import data"
34
- task pull_export: :environment do
35
- importer.pull "export", items_only: true, remote: ENV["from"]
30
+ puts "ERROR in card:poop\n #{result}".red
31
+ exit 1
36
32
  end
37
33
 
38
- desc "add a new card to import data"
39
- task add: :environment do
40
- _task, name, type, codename = ARGV
41
- importer.add_card name: name, type: type || "Basic", codename: codename
42
- exit
34
+ desc "reset cache"
35
+ task reset_cache: :environment do
36
+ Card::Cache.reset_all
43
37
  end
44
38
 
45
- desc "register remote for importing card data"
46
- task add_remote: :environment do
47
- _task, name, url = ARGV
48
- raise "no name given" unless name.present?
49
- raise "no url given" unless url.present?
50
-
51
- importer.add_remote name, url
52
- exit
39
+ def options
40
+ @options ||= {}
53
41
  end
54
42
 
55
- def pull_card opts={}
56
- _task, card = ARGV
57
- raise "no card given" unless card.present?
58
-
59
- importer.pull card, opts.merge(remote: ENV["from"])
60
- exit # without exit the card argument is treated as second rake task
43
+ def flag_opt letter, key, desc, hash=nil
44
+ hash ||= { key => true }
45
+ op.on("-#{letter}", "--#{key.to_s.tr '_', '-'}", desc) { options.merge! hash }
61
46
  end
62
47
 
63
- desc "migrate structure and cards"
64
- task migrate: :environment do
65
- ENV["NO_RAILS_CACHE"] = "true"
66
- ENV["SCHEMA"] ||= "#{Cardio.gem_root}/db/schema.rb"
67
-
68
- stamp = ENV["STAMP_MIGRATIONS"]
69
-
70
- puts "migrating structure"
71
- Rake::Task["card:migrate:structure"].invoke
72
- Rake::Task["card:migrate:stamp"].invoke :structure if stamp
73
-
74
- puts "migrating deck structure"
75
- Rake::Task["card:migrate:deck_structure"].execute
76
- if stamp
77
- Rake::Task["card:migrate:stamp"].reenable
78
- Rake::Task["card:migrate:stamp"].invoke :core_cards
79
- end
80
-
81
- puts "migrating core cards"
82
- Card::Cache.reset_all
83
- # not invoke because we don't want to reload environment
84
- Rake::Task["card:migrate:core_cards"].execute
85
- if stamp
86
- Rake::Task["card:migrate:stamp"].reenable
87
- Rake::Task["card:migrate:stamp"].invoke :core_cards
88
- end
89
-
90
- puts "migrating deck cards"
91
- # not invoke because we don't want to reload environment
92
- Rake::Task["card:migrate:deck_cards"].execute
93
- if stamp
94
- Rake::Task["card:migrate:stamp"].reenable
95
- Rake::Task["card:migrate:stamp"].invoke :deck_cards
48
+ def add_opt letter, key, desc
49
+ op.on "-#{letter}", "--#{key.to_s.tr '_', '-'} #{key.to_s.upcase}", desc do |val|
50
+ options[key] = val
96
51
  end
52
+ end
97
53
 
98
- Card::Cache.reset_all
54
+ def op
55
+ @op ||= OptionParser.new
99
56
  end
100
57
 
101
- desc "reset cache"
102
- task reset_cache: :environment do
103
- Card::Cache.reset_all
58
+ def parse_options task
59
+ op.banner = "Usage: rake card:#{task} -- [options]"
60
+ yield if block_given?
61
+ args = op.order!(ARGV) {}
62
+ # args << "-h" if args.empty?
63
+ op.parse! args
104
64
  end
105
65
  end
@@ -0,0 +1,4 @@
1
+ de:
2
+ admin_warn: ADMINISTRATOR WARNUNG
3
+ admin_email_off:
4
+ E-Mail-Versand ist ausgeschaltet. Ändere die Einstellungen in %{path}, damit Benachrichtigungen verschickt werden, wenn sich neue Nutzer registrieren.
@@ -17,8 +17,8 @@ event :admin_tasks, :initialize, on: :update do
17
17
  when :repair_references then Card::Reference.repair_all
18
18
  when :repair_permissions then Card.repair_all_permissions
19
19
  when :clear_solid_cache then Card.clear_solid_cache
20
- when :clear_machine_cache then Card::Machine.reset_all
21
- when :clear_script_cache then Card::Machine.reset_script
20
+ when :regenerate_assets then Card::Assets.refresh_assets force: true
21
+ # when :regenerate_scripts then Card::Assets.refresh_scripts
22
22
  when :clear_history
23
23
  not_allowed "clear history" unless irreversibles_tasks_allowed?
24
24
  Card::Action.delete_old
@@ -71,10 +71,12 @@ format :html do
71
71
  count: solid_cache_count, unit: " cards",
72
72
  link_text: "clear solid cache",
73
73
  task: "clear_solid_cache" },
74
- { title: "machine cache",
75
- count: machine_cache_count, unit: " cards",
76
- link_text: "clear machine cache",
77
- task: "clear_machine_cache" }
74
+ { title: "style assets",
75
+ link_text: "regenerate styles and scripts",
76
+ task: "regenerate_assets" } # ,
77
+ # { title: "script assets",
78
+ # link_text: "regenerate scripts",
79
+ # task: "regenerate_scripts" }
78
80
  ]
79
81
  # return stats unless Card.config.view_cache#
80
82
  # stats << { title: "view cache",
@@ -117,8 +119,8 @@ format :html do
117
119
  Card.search right: { codename: "solid_cache" }, return: "count"
118
120
  end
119
121
 
120
- def machine_cache_count
121
- Card::Virtual.where(right_id: MachineCacheID).count
122
+ def asset_input_cache_count
123
+ Card.where(right_id: AssetInputCacheID).count
122
124
  end
123
125
 
124
126
  def delete_sessions_link months
@@ -0,0 +1,7 @@
1
+ ---
2
+ - :name: Mod
3
+ :type: :cardtype
4
+ :codename: :mod
5
+ - :name: Cardtype
6
+ :type: :cardtype
7
+ :codename: :cardtype
@@ -0,0 +1,30 @@
1
+ - :name: Author
2
+ :type: :cardtype
3
+ - :name: Fruit
4
+ :type: :cardtype
5
+ - :name: self aware
6
+ :type: :cardtype
7
+ - :name: Cardtype A
8
+ :type: :cardtype
9
+ :codename: :cardtype_a
10
+ - :name: Cardtype B
11
+ :type: :cardtype
12
+ :codename: :cardtype_b
13
+ - :name: Cardtype C
14
+ :type: :cardtype
15
+ :codename: :cardtype_c
16
+ - :name: Cardtype D
17
+ :type: :cardtype
18
+ :codename: :cardtype_d
19
+ - :name: Cardtype E
20
+ :type: :cardtype
21
+ :codename: :cardtype_e
22
+ - :name: Cardtype F
23
+ :type: :cardtype
24
+ :codename: :cardtype_f
25
+ - :name: UserForm
26
+ :type: :cardtype
27
+ - :name: Book
28
+ :type: :cardtype
29
+ - :name: Sample Cardtype
30
+ :type: :cardtype
@@ -0,0 +1,28 @@
1
+ de:
2
+ core_cannot_change_content: Inhalt kann nicht geändert werden, während der Name geändert wird
3
+ core_cannot_change_type: Typ kann nicht geändert werden, während der Name geändert wird
4
+ core_cards_exist: Sorry, diese Karten muss ein Kartentyp bleiben, solange es noch %{cardname}-Karten gibt.
5
+ core_error_banned_characters: "die folgenden Zeichen sind nicht erlaubt: %{banned}"
6
+ core_error_blank_key: darf nicht frei bleiben
7
+ core_error_blank_name: darf nicht frei bleiben
8
+ core_error_cant_alter: Typ kann nicht geändert werden; es gibt noch %{name} Karten
9
+ core_error_cant_change_errors: "von %{name} kann nicht geändert werden; Fehler beim Erstellen von neuen %{type_id}: %{error_messages}"
10
+ core_error_code_in_use: Codename %{codename} ist bereits vergeben
11
+ core_error_hard_templated: kann nicht geändert werden, weil %{name} ist eine Vorlage für %{type_name}
12
+ core_error_indestructible: "%{name} ist eine unzerstörbare Regel"
13
+ core_error_invalid_character_in_cardtype: "folgende Zeichen sind nicht erlaubt: %{banned}"
14
+ core_error_name_exists: muss eindeutig sein; '%{name}' gibt es bereits.
15
+ core_error_name_tag: "%{name} wird als Tag benutzt"
16
+ core_error_no_such_type: diesen Typ gibt es nicht
17
+ core_error_system_card: "%{name} ist eine Systemkarte. (%{codename})"
18
+ core_error_too_long: ist zu lang (%{length} Zeichen; erlaubt sind maximal 255)
19
+ core_error_user_edits: "Wurde bearbeitet mit %{name}s Account.\nLöschen würde den Verlauf durcheinander bringen."
20
+ core_error_wrong_key: falscher Schlüssel '%{key}' für Name %{name}
21
+ core_exception_almost_deleted: Löschen der aktuellen Datei knapp abgewendet
22
+ core_is_incomplete: ist unvollständig
23
+ core_only_admins_codename: nur Administratoren können Codenamen festlegen
24
+ core_renaming: "Wird umbenannt"
25
+ core_rename: "Umbenennen"
26
+ core_rename_confirm: "Sind Sie sicher, dass Sie die Karte umbenennen wollen?"
27
+ skip_update_referer_content:
28
+ Verweise auf diesen Namen nicht aktualisieren
@@ -38,6 +38,7 @@ def prepare_assignment_params args
38
38
  end
39
39
 
40
40
  def prepare_assignment_args args
41
+ @set_specific = {}
41
42
  return {} unless args
42
43
 
43
44
  args = args.symbolize_keys
@@ -66,44 +67,11 @@ def refresh_set_modules
66
67
  end
67
68
 
68
69
  def stash_set_specific_attributes args
69
- @set_specific = {}
70
70
  Card.set_specific_attributes.each do |key|
71
71
  set_specific[key] = args.delete(key) if args.key?(key)
72
72
  end
73
73
  end
74
74
 
75
- def normalize_type_attributes args
76
- new_type_id = extract_type_id! args unless args.delete(:type_lookup) == :skip
77
- args[:type_id] = new_type_id if new_type_id
78
- end
79
-
80
- def extract_type_id! args={}
81
- case
82
- when (type_id = args.delete(:type_id)&.to_i)
83
- type_id.zero? ? nil : type_id
84
- when (type_code = args.delete(:type_code)&.to_sym)
85
- type_id_from_codename type_code
86
- when (type_name = args.delete :type)
87
- type_id_from_cardname type_name
88
- end
89
- end
90
-
91
- def type_id_from_codename type_code
92
- type_id_or_error(type_code) { Card::Codename.id type_code }
93
- end
94
-
95
- def type_id_from_cardname type_name
96
- type_id_or_error(type_name) { type_name.card_id }
97
- end
98
-
99
- def type_id_or_error val
100
- type_id = yield
101
- return type_id if type_id
102
-
103
- errors.add :type, "#{val} is not a known type."
104
- nil
105
- end
106
-
107
75
  # 'set' refers to the noun not the verb
108
76
  def set_specific
109
77
  @set_specific ||= {}
@@ -1,5 +1,5 @@
1
1
  event :set_content, :store, on: :save do
2
- self.db_content = prepare_db_content
2
+ self.content = prepare_db_content
3
3
  @selected_action_id = @selected_content = nil
4
4
  clear_drafts
5
5
  end
@@ -37,6 +37,8 @@ end
37
37
 
38
38
  def prepare_db_content
39
39
  cont = standard_db_content || "" # necessary?
40
+
41
+ # TODO: move this html-specific code somewhere more appropriate
40
42
  clean_html? ? Card::Content.clean!(cont) : cont
41
43
  end
42
44
 
@@ -39,7 +39,6 @@ def initialize args={}
39
39
  super args # ActiveRecord #initialize
40
40
  end
41
41
  end
42
- self
43
42
  end
44
43
 
45
44
  def handle_set_modules args
@@ -49,11 +48,9 @@ def handle_set_modules args
49
48
  end
50
49
 
51
50
  def handle_type args
52
- type_lookup = args[:type_lookup]
53
51
  @supercard = args.delete :supercard
54
-
55
52
  yield
56
- type_id_from_template if type_lookup == :force || (!type_id && type_lookup != :skip)
53
+ ensure_type_id args[:type_lookup]
57
54
  end
58
55
 
59
56
  def initial_name name
@@ -76,10 +76,6 @@ event :update_lexicon, :finalize, changed: :name, on: :save do
76
76
  Card::Lexicon.send lexicon_action, self
77
77
  end
78
78
 
79
- event :cascade_name_changes, :finalize, on: :update, changed: :name do
80
- each_descendant { |d| d.rename_as_descendant !skip_update_referers? }
81
- end
82
-
83
79
  protected
84
80
 
85
81
  def rename_as_trash_obstacle
@@ -88,15 +84,6 @@ def rename_as_trash_obstacle
88
84
  save!
89
85
  end
90
86
 
91
- def rename_as_descendant referers=true
92
- self.action = :update
93
- referers ? update_referer_content : update_referer_references_out
94
- refresh_references_in
95
- refresh_references_out
96
- expire
97
- Card::Lexicon.update self
98
- end
99
-
100
87
  private
101
88
 
102
89
  def name_incomplete?
@@ -114,9 +101,7 @@ def detect_illegal_compound_names
114
101
  end
115
102
 
116
103
  def changing_existing_tag_to_compound?
117
- return false unless changing_name_to_compound?
118
-
119
- name_in_use_as_tag?
104
+ changing_name_to_compound? && name_in_use_as_tag?
120
105
  end
121
106
 
122
107
  def name_in_use_as_tag?
@@ -150,7 +135,7 @@ end
150
135
  def prepare_new_side side, side_id, sidename
151
136
  return unless side_id == -1 || !Card[side_id]&.real?
152
137
 
153
- sidecard = Director.card(sidename) || add_subcard(sidename)
138
+ sidecard = Director.card(sidename) || subcard(sidename)
154
139
  send "#{side}_id=", sidecard
155
140
  end
156
141
 
@@ -158,6 +143,6 @@ def prepare_obstructed_side side, side_id, sidename
158
143
  return unless side_id && side_id == id
159
144
 
160
145
  clear_name sidename
161
- send "#{side}_id=", add_subcard(sidename)
146
+ send "#{side}_id=", subcard(sidename)
162
147
  true
163
148
  end