-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update to rails 6.1 --------- Co-authored-by: Tyranja <tyranja@cassiopeia.uberspace.de>
- Loading branch information
Showing
30 changed files
with
355 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
class Medialink < ApplicationRecord | ||
include AutoHtml | ||
|
||
belongs_to :profile | ||
|
||
validates :title, :url, presence: true | ||
|
||
auto_html_for :url do | ||
html_escape | ||
image | ||
youtube width: 400, height: 250 | ||
vimeo width: 400, height: 250 | ||
simple_format | ||
link target: '_blank', rel: 'nofollow' | ||
def youtube_thumbnail_url | ||
youtube_id = find_youtube_id | ||
return unless youtube_id | ||
|
||
"https://img.youtube.com/vi/" + youtube_id + "/mqdefault.jpg" | ||
end | ||
|
||
def find_youtube_id | ||
id = url.match(/((?<=v=)|(?<=youtu.be\/)).+/) | ||
id ? id[0].split(/(\?|&)/).first : nil | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<%= content_tag_for(:li, medialink, nil, {'title' => t(:tooltip, scope: 'medialinks')}) do %> | ||
<b style="text-decoration: underline"> | ||
<%= link_to medialink.title, url_with_protocol(medialink.url) %> | ||
</b><br> | ||
<% if medialink.url =~ /youtube|youtu.be/i and medialink.youtube_thumbnail_url%> | ||
<img src=<%= medialink.youtube_thumbnail_url %> alt="Video Thumbnail"> | ||
<% end %> | ||
<p> | ||
<%= simple_format(medialink.description, class: '') %> | ||
</p> | ||
<span class="color-grey"> | ||
<%= t(:select_language, scope: 'medialinks') + t("#{medialink.language}", scope: 'iso_639_1').capitalize if medialink.language.present? %> | ||
</span> | ||
<hr> | ||
|
||
<%= link_to "<i class='fa fa-pencil'></i>".html_safe + t(:edit_link, scope: 'medialinks'), | ||
edit_profile_medialink_path(@profile, medialink) %> | ||
<%= link_to "<i class='fa fa-minus-circle'></i>".html_safe + t(:delete_link, scope: 'medialinks'), | ||
profile_medialink_path(@profile, medialink), | ||
method: :delete, | ||
data: { confirm: "Are you sure?"}, | ||
title: t(:delete, scope: "medialinks") %> | ||
<% end %> |
Oops, something went wrong.