* Adds a new metadata helper and methods to PostPresenter to have metas on post pages. * Adds tests to post controller to check correctness of metas * Add methods to PersonPresenter to have metas on profile pages * Correct meta data helper test * Update PersonPresenter, add test to PeopleController * Creates TagPresenter. Display tag metas on tag index page * Updata meta data helper spec * Not displaying bio as the description meta on profile page for now. Privacy concerns to be cleared. * Set meta info as hashes in presenters * Move original hardcoded metas info to config/defaults.yml * metas_tags include by default the general metas, update views * Update code style, clean views * Renames TagPresenter StreamTagPresenter, updates TagController spec * Add a default_metas entry to diaspora.yml.example * Align metas hash in presenters, refactor meta data helper * Use bio as description meta if user has a public profile * Rename StreamTagPresenter to TagStreamPresenter
19 lines
572 B
Ruby
19 lines
572 B
Ruby
module OpenGraphHelper
|
|
def og_html(cache)
|
|
"<a href=\"#{cache.url}\" target=\"_blank\">" +
|
|
" <div>" +
|
|
" <img src=\"#{cache.image}\" />" +
|
|
" <strong>#{cache.title}</strong>" +
|
|
" <p>#{truncate(cache.description, length: 250, separator: ' ')}</p>" +
|
|
" </div>" +
|
|
"</a>"
|
|
end
|
|
|
|
def link_to_oembed_image(cache, prefix = 'thumbnail_')
|
|
link_to(oembed_image_tag(cache, prefix), cache.url, :target => '_blank')
|
|
end
|
|
|
|
def oembed_image_tag(cache, prefix)
|
|
image_tag(cache.data["#{prefix}url"], cache.options_hash(prefix))
|
|
end
|
|
end
|