Module: Card::Set::All::Html::Views::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb
Instance Method Summary collapse
-
#count ⇒ Object
-
#current_set_card ⇒ Object
-
#labeled(label, content) ⇒ Object
-
#labeled_field(field, item_view = :name, opts = {}) ⇒ Object
-
#prepare_content_slot ⇒ Object
-
#short_content ⇒ Object
LOCALIZE.
-
#short_content_fields ⇒ Object
-
#short_content_from_core ⇒ Object
-
#short_content_items ⇒ Object
-
#view: content ⇒ Object
-
#view: content_panel ⇒ Object
-
#view: content_with_title ⇒ Object
-
#view: labeled ⇒ Object
unlike unknown: true, unknown: (same view) can be overridden.
-
#view: one_line_content ⇒ Object
-
#view: raw_one_line_content ⇒ Object
-
#view: short_content ⇒ Object
-
#view: titled ⇒ Object
-
#with_short_content_fields {|nested_field_names.size| ... } ⇒ Object
Instance Method Details
#count ⇒ Object
132 133 134 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 132 def count @count ||= card.count end |
#current_set_card ⇒ Object
91 92 93 94 95 96 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 91 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 |
#labeled(label, content) ⇒ Object
81 82 83 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 81 def labeled label, content haml :labeled, label: label, content: content end |
#labeled_field(field, item_view = :name, opts = {}) ⇒ Object
85 86 87 88 89 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 85 def labeled_field field, item_view=:name, opts={} opts[:title] ||= field.cardname field_nest field, opts.merge(view: :labeled, items: (opts[:items] || {}).merge(view: item_view)) end |
#prepare_content_slot ⇒ Object
11 12 13 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 11 def prepare_content_slot class_up "card-slot", "d0-card-content" end |
#short_content ⇒ Object
LOCALIZE
99 100 101 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 99 def short_content short_content_items || short_content_fields || short_content_from_core end |
#short_content_fields ⇒ Object
109 110 111 112 113 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 109 def short_content_fields with_short_content_fields do |num_fields| "#{num_fields} #{'field'.pluralize num_fields}" if num_fields.positive? end end |
#short_content_from_core ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 119 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 |
#short_content_items ⇒ Object
103 104 105 106 107 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 103 def short_content_items return unless card.respond_to? :count "#{count} #{'item'.pluralize count}" end |
#view: content ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 17 view :content, cache: :yes do wrap do [ (optional: :hide), render_core, (optional: :hide, edit: :inline) ] end end |
#view: content_panel ⇒ Object
54 55 56 57 58 59 60 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 54 view :content_panel do wrap do wrap_with :div, class: "card-body" do [, render_core] end end end |
#view: content_with_title ⇒ Object
43 44 45 46 47 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 43 view :content_with_title do wrap true, title: card.format(:text).render_core do [, render_core] end end |
#view: labeled ⇒ Object
unlike unknown: true, unknown: (same view) can be overridden
74 75 76 77 78 79 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 74 view :labeled, unknown: :labeled, cache: :yes do @content_body = true wrap(true, class: "row") do [labeled(render_title, wrap_body { render_labeled_content }), ] end end |
#view: one_line_content ⇒ Object
36 37 38 39 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 36 view :one_line_content, unknown: :mini_unknown, wrap: { div: { class: "text-muted" } } do one_line_content end |
#view: raw_one_line_content ⇒ Object
31 32 33 34 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 31 view :raw_one_line_content, unknown: :mini_unknown, wrap: { div: { class: "text-muted" } } do raw_one_line_content end |
#view: short_content ⇒ Object
27 28 29 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 27 view :short_content, wrap: { div: { class: "text-muted" } } do short_content end |
#view: titled ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 62 view :titled, cache: :yes do @content_body = true wrap do [ naming { render_header }, render_flash, wrap_body { render_titled_content } ] end end |
#with_short_content_fields {|nested_field_names.size| ... } ⇒ Object
115 116 117 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 115 def with_short_content_fields yield nested_field_names.size if voo.structure || card.structure end |