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
-
#toggle_logic ⇒ Object
-
#view: closed ⇒ Object
-
#view: content ⇒ Object
-
#view: content_panel ⇒ Object
-
#view: content_with_edit_button ⇒ Object
-
#view: content_with_title ⇒ Object
-
#view: labeled ⇒ Object
unlike unknown: true, unknown: (same view) can be overridden.
-
#view: one_line_content ⇒ Object
-
#view: open ⇒ 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
161 162 163 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 161 def count @count ||= card.count end |
#current_set_card ⇒ Object
120 121 122 123 124 125 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 120 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
89 90 91 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 89 def labeled label, content haml :labeled, label: label, content: content end |
#labeled_field(field, item_view = :name, opts = {}) ⇒ Object
93 94 95 96 97 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 93 def labeled_field field, item_view=:name, opts={} opts[:title] ||= Card.fetch_name field field_nest field, opts.merge(view: :labeled, items: (opts[:items] || {}).merge(view: item_view)) end |
#prepare_content_slot ⇒ Object
11 12 13 14 |
# 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" voo.hide :menu end |
#short_content ⇒ Object
LOCALIZE
128 129 130 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 128 def short_content short_content_items || short_content_fields || short_content_from_core end |
#short_content_fields ⇒ Object
138 139 140 141 142 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 138 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
148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 148 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
132 133 134 135 136 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 132 def short_content_items return unless card.respond_to? :count "#{count} #{'item'.pluralize count}" end |
#toggle_logic ⇒ Object
116 117 118 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 116 def toggle_logic show_view?(:title_link, :hide) ? voo.show(:icon_toggle) : voo.show(:title_toggle) end |
#view: closed ⇒ Object
106 107 108 109 110 111 112 113 114 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 106 view :closed do with_nest_mode :compact do toggle_logic class_up "d0-card-body", "closed-content" @content_body = false @toggle_mode = :close frame end end |
#view: content ⇒ Object
18 19 20 21 22 23 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 18 view :content do voo.hide :edit_button wrap do [, render_core, (edit: :inline)] end end |
#view: content_panel ⇒ Object
62 63 64 65 66 67 68 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 62 view :content_panel do wrap do wrap_with :div, class: "card-body" do [, render_core] end end end |
#view: content_with_edit_button ⇒ Object
29 30 31 32 33 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 29 view :content_with_edit_button, unknown: true do wrap do [, render_core, (edit: :inline)] end end |
#view: content_with_title ⇒ Object
51 52 53 54 55 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 51 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
82 83 84 85 86 87 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 82 view :labeled, unknown: :labeled do @content_body = true wrap(true, class: "row") do labeled(render_title, wrap_body { "#{}#{render_labeled_content}" }) end end |
#view: one_line_content ⇒ Object
44 45 46 47 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 44 view :one_line_content, unknown: :mini_unknown, wrap: { div: { class: "text-muted" } } do one_line_content end |
#view: open ⇒ Object
99 100 101 102 103 104 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 99 view :open do toggle_logic @toggle_mode = :open @content_body = true frame { _render_open_content } end |
#view: raw_one_line_content ⇒ Object
39 40 41 42 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 39 view :raw_one_line_content, unknown: :mini_unknown, wrap: { div: { class: "text-muted" } } do raw_one_line_content end |
#view: short_content ⇒ Object
35 36 37 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 35 view :short_content, wrap: { div: { class: "text-muted" } } do short_content end |
#view: titled ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 70 view :titled 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
144 145 146 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/views.rb', line 144 def with_short_content_fields yield nested_field_names.size if voo.structure || card.structure end |