Class: Card::Format::HtmlFormat

Inherits:
Card::Format show all
Defined in:
mod/format/lib/card/format/html_format.rb

Overview

Main Format class for formatting card views in HTML

Direct Known Subclasses

EmailHtmlFormat, RssFormat

Constant Summary

Constants included from MethodDelegation

MethodDelegation::RENDER_METHOD_RE

Instance Attribute Summary collapse

Attributes inherited from Card::Format

#card, #error_status, #form, #main_opts, #modal_opts, #parent, #rendered

Instance Method Summary collapse

Methods inherited from Card::Format

#controller, #include_set_format_modules, #initialize, #page, #request_url, #require_card_to_initialize!, #symbol, view_caching?

Methods included from Registration

#class_from_name, #format_ancestry, #format_class, #format_class_name, #new, #register, #symbol

Methods included from MethodDelegation

#action_view, #api_render

Methods included from Error

#anyone_can?, #error_cardname, #loud_error, #loud_error?, #monitor_depth, #ok?, #quiet_error, #rendering_error, #rescue_view, #view_for_denial, #view_for_unknown

Methods included from Content

#add_class, #content_nest, #css_classes, #format_date, #id_counter, #output, #prepend_class, #process_content, #safe_process_content, #unique_id

Methods included from ContextNames

#add_name_context, #context_names, #context_names_from_params, #context_names_to_params, #initial_context_names, #naming, #relevant_context_names, #title_in_context

Methods included from Wrapper

#raise_wrap_error, #render_with_card_layout, #render_with_wrapper, #send_wrapper_method, #with_wrapper, #wrap_with_wrapper

Methods included from Render

#add_debug_info, #before_view, #current_view, #expand_stubs, #final_render, #prepare_stub_nest, #pretty_path, #render!, #show_debug_info?, #show_view?, #stub_nest, #stub_render, #supports_view?, #view_cache_setting, #view_method, #view_setting, #voo, #with_voo, #wrap_and_render

Methods included from Nesting

#default_nest_view, #field_nest, #implicit_nest_view, #nest, #nest_path

Methods included from Nesting::Mode

#configured_view_in_compact_mode, #hide_view_in_edit_mode?, #modal_nest_view, #nest_mode, #view_in_compact_mode, #view_in_edit_mode, #with_altered_nest_mode, #with_nest_mode

Methods included from Nesting::Subformat

#depth, #field_subformat, #inherit, #main, #root, #root?, #subformat

Methods included from Nesting::Main

#already_mained?, #main!, #main_nest, #main_nest?, #main_nest_options, #main_nest_render, #wrap_main

Methods included from Env::Location

#card_path, #card_url, #cardname_from_url, #relative_url_root

Constructor Details

This class inherits a constructor from Card::Format

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Card::Format::MethodDelegation

Instance Attribute Details

#options_need_saveObject

Returns the value of attribute options_need_save.



9
10
11
# File 'mod/format/lib/card/format/html_format.rb', line 9

def options_need_save
  @options_need_save
end

#skip_autosaveObject

Returns the value of attribute skip_autosave.



9
10
11
# File 'mod/format/lib/card/format/html_format.rb', line 9

def skip_autosave
  @skip_autosave
end

#start_timeObject

Returns the value of attribute start_time.



9
10
11
# File 'mod/format/lib/card/format/html_format.rb', line 9

def start_time
  @start_time
end

Instance Method Details

#escape_literal(literal) ⇒ Object



20
21
22
# File 'mod/format/lib/card/format/html_format.rb', line 20

def escape_literal literal
  "<span>#{literal}</span>"
end

#final_render_call(method) ⇒ Object



28
29
30
31
# File 'mod/format/lib/card/format/html_format.rb', line 28

def final_render_call method
  rendered = super
  rendered.is_a?(Array) ? output(rendered) : rendered
end

#focal?Boolean

is the current card the requested card?

Returns:

  • (Boolean)


16
17
18
# File 'mod/format/lib/card/format/html_format.rb', line 16

def focal?
  @focal ||= show_layout? ? main? : depth.zero?
end

#main?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'mod/format/lib/card/format/html_format.rb', line 11

def main?
  !@main.nil?
end

#mime_typeObject



24
25
26
# File 'mod/format/lib/card/format/html_format.rb', line 24

def mime_type
  "text/html"
end


33
34
35
# File 'mod/format/lib/card/format/html_format.rb', line 33

def stylesheet_link_tag path
  tag "link", href: path, media: "all", rel: "stylesheet", type: "text/css"
end