Module: Card::Set::All::Html::Head::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb

Instance Method Summary collapse

Instance Method Details

#debug_or_machine_path(setting, debug_lambda, machine_path_lambda) ⇒ Object



65
66
67
68
69
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 65

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.asset_output_url)
end

#debug_path(setting, asset_card) {|asset_card| ... } ⇒ Object

Yields:

  • (asset_card)


71
72
73
74
75
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 71

def debug_path setting, asset_card
  return unless params[:debug] == setting.to_s

  yield asset_card
end

#head_stylesheet_pathObject



94
95
96
97
98
99
100
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 94

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

#param_or_rule_card(setting) ⇒ Object



57
58
59
60
61
62
63
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 57

def param_or_rule_card setting
  if params[setting]
    Card[params[setting]]
  else
    root.card.rule_card setting
  end
end

#remote_style_tagsObject



86
87
88
89
90
91
92
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 86

def remote_style_tags
  return unless (asset_card = Card[:style_mods])

  asset_card.item_cards.map do |mod_style_card|
    nest mod_style_card, view: :remote_include_tags
  end.select(&:present?)
end

#rss_link?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 82

def rss_link?
  Card.config.rss_enabled && respond_to?(:rss_link_tag)
end

#view: favicon_tagObject



33
34
35
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 33

view :favicon_tag, unknown: true, perms: :none do
  nest :favicon, view: :link_tag
end

#view: headObject



23
24
25
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 23

view :head, unknown: true, perms: :none do
  basket[:head_views].map { |viewname| render viewname }.flatten.compact.join "\n"
end

#view: head_remote_stylesheetsObject



53
54
55
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 53

view :head_remote_stylesheets, unknown: true, cache: :never, perms: :none do
  remote_style_tags
end

#view: head_stylesheetObject

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…)



47
48
49
50
51
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 47

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: meta_tagsObject



27
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 27

view :meta_tags, unknown: true, perms: :none, template: :haml

#view: page_title_tagObject



29
30
31
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 29

view :page_title_tag, unknown: true, perms: :none do
  (:title) { render :page_title }
end

TODO: move to rss mod



78
79
80
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 78

view :rss_links, unknown: true, perms: :none do
  render :rss_link_tag if rss_link?
end

#view: universal_edit_buttonObject



37
38
39
40
41
42
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/head.rb', line 37

view :universal_edit_button, unknown: :blank, 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