diff options
Diffstat (limited to 'lib/ccc_conventions.rb')
| -rw-r--r-- | lib/ccc_conventions.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/ccc_conventions.rb b/lib/ccc_conventions.rb new file mode 100644 index 0000000..352dd3c --- /dev/null +++ b/lib/ccc_conventions.rb | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | module CccConventions | ||
| 2 | ERFA_PARENT_NAME = "club/erfas" | ||
| 3 | CHAOSTREFF_PARENT_NAME = "club/chaostreffs" | ||
| 4 | SITEMAP_COLLAPSED_PATHS = %w[updates club/erfas club/chaostreffs disclosure].freeze | ||
| 5 | |||
| 6 | NODE_KINDS = { | ||
| 7 | "top_level" => { | ||
| 8 | parent: -> { Node.root }, | ||
| 9 | parent_match: ->(path) { path == [] }, | ||
| 10 | path_prefix: "", | ||
| 11 | label: "Top Level" | ||
| 12 | }, | ||
| 13 | "generic" => { | ||
| 14 | parent_match: ->(path) { true }, | ||
| 15 | label: "Generic", | ||
| 16 | hint: "Can be created anywhere - choose the parent below." | ||
| 17 | }, | ||
| 18 | "update" => { | ||
| 19 | parent: -> { Update.find_or_create_parent }, | ||
| 20 | parent_match: ->(path) { path[0] == "updates" && (path.length == 1 || path[1] =~ /\A\d{4}\z/) }, | ||
| 21 | tags: ["update"], | ||
| 22 | path_prefix: -> { "updates/#{Time.now.year}" }, | ||
| 23 | label: "Update", | ||
| 24 | hint: -> { "Automatically created in /updates/#{Time.now.year}/, gets tag \"update\", and inherits the update template." } | ||
| 25 | }, | ||
| 26 | "press_release" => { | ||
| 27 | parent: -> { Update.find_or_create_parent }, | ||
| 28 | parent_match: ->(path) { path[0] == "updates" && (path.length == 1 || path[1] =~ /\A\d{4}\z/) }, | ||
| 29 | tags: ["update", "pressemitteilung"], | ||
| 30 | path_prefix: -> { "updates/#{Time.now.year}" }, | ||
| 31 | label: "Pressemitteilung", | ||
| 32 | hint: -> { "Automatically created in /updates/#{Time.now.year}/, gets tags \"update, pressemitteilung\", and inherits the update template." } | ||
| 33 | }, | ||
| 34 | "erfa" => { | ||
| 35 | parent: -> { Node.find_by_unique_name!(ERFA_PARENT_NAME) }, | ||
| 36 | parent_match: ->(path) { path == ["club", "erfas"] }, | ||
| 37 | tags: ["erfa-detail"], | ||
| 38 | template: "chapter_detail", | ||
| 39 | path_prefix: ERFA_PARENT_NAME, | ||
| 40 | label: "Erfa", | ||
| 41 | hint: "Automatically created under the Erfa-Kreise overview page, gets tag \"erfa-detail\", and uses the chapter detail template." | ||
| 42 | }, | ||
| 43 | "chaostreff" => { | ||
| 44 | parent: -> { Node.find_by_unique_name!(CHAOSTREFF_PARENT_NAME) }, | ||
| 45 | parent_match: ->(path) { path == ["club", "chaostreffs"] }, | ||
| 46 | tags: ["chaostreff-detail"], | ||
| 47 | template: "chapter_detail", | ||
| 48 | path_prefix: CHAOSTREFF_PARENT_NAME, | ||
| 49 | label: "Chaostreff", | ||
| 50 | hint: "Automatically created under the Chaostreffs overview page, gets tag \"chaostreff-detail\", and uses the chapter detail template." | ||
| 51 | } | ||
| 52 | }.freeze | ||
| 53 | end | ||
