Commit ec303769 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review

Merge changes Ib060fef5,I7b66ae08,If7e324b1,I6d0945ee

* changes:
  Bug 1838915: Allow externalmedia / iframe sources to use FontAwsome icons if available
  Bug 1838915: Allow social media to use FontAwsome icons if available
  Bug 1838915: Fixing problem with some custom fontawesome placements
  Bug 1838915: Fixing problem with comment ratings and fontawesome 5
parents 0ee345bc 2bb22fa5
......@@ -19,9 +19,20 @@ define('SECTION_PAGE', 'iframesites');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('upgrade.php');
define('TITLE', get_string('allowediframesites', 'admin'));
safe_require('blocktype', 'externalvideo');
$iframesources = get_records_menu('iframe_source', '', '', 'name,prefix');
$iframedomains = get_records_menu('iframe_source_icon');
$fa_domains = PluginBlocktypeExternalvideo::get_fa_brand_icons();
$data = array();
foreach ($iframedomains as $name => $domain) {
$data[$name]['name'] = $domain;
$data[$name]['icon'] = favicon_display_url($domain);
$lname = strtolower($name);
if (isset($fa_domains[$lname])) {
$data[$name]['faicon'] = $fa_domains[$lname]['faicon'];
$data[$name]['style'] = $fa_domains[$lname]['style'];
}
}
$newform = pieform(array(
'name' => 'newurl',
......@@ -85,7 +96,7 @@ foreach ($iframesources as $url => $name) {
'id' => $i,
'url' => $url,
'name' => $name,
'icon' => favicon_display_url($iframedomains[$name]),
'icon' => $data[$name],
'editform' => pieform(array(
'name' => 'editurl_' . $i,
'successcallback' => 'editurl_submit',
......
......@@ -122,6 +122,7 @@ $string['star'] = 'Star';
$string['heart'] = 'Heart';
$string['thumbsup'] = 'Thumbs up';
$string['ok'] = 'Tick';
$string['smile'] = 'Smile';
$string['ratingexample'] = 'Generated example';
$string['removerating'] = 'Clear ratings';
$string['ratingoption'] = "Set rating %s out of %s";
......@@ -1123,6 +1123,7 @@ class ArtefactTypeComment extends ArtefactType {
'heart' => get_string('heart', 'artefact.comment'),
'thumbs-up' => get_string('thumbsup', 'artefact.comment'),
'check-circle' => get_string('ok', 'artefact.comment'),
'smile' => get_string('smile', 'artefact.comment'),
),
),
'ratinglength' => array(
......
......@@ -1215,19 +1215,19 @@ class ArtefactTypeSocialprofile extends ArtefactTypeProfileField {
switch ($record->note) {
case 'facebook':
$record->icon = favicon_display_url('facebook.com');
$record->faicon = '<span class="icon icon-brand icon-lg icon-facebook-square" style="color: #4267B2"></span>';
break;
case 'tumblr':
$record->icon = favicon_display_url('tumblr.com');
$record->faicon = '<span class="icon icon-brand icon-lg icon-tumblr-square" style="color: #001935"></span>';
break;
case 'twitter':
$record->icon = favicon_display_url('twitter.com');
$record->faicon = '<span class="icon icon-brand icon-lg icon-twitter" style="color: #00ACED"></span>';
break;
case 'instagram':
$record->icon = favicon_display_url('instagram.com');
$record->faicon = '<span class="icon icon-brand icon-lg icon-instagram" style="background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); background-clip: text; color: transparent; line-height: 1"></span>';
break;
case 'pinterest':
$record->icon = favicon_display_url('www.pinterest.com');
$record->faicon = '<span class="icon icon-brand icon-lg icon-pinterest" style="color: #E80021"></span>';
break;
case 'icq':
$record->icon = favicon_display_url('www.icq.com');
......@@ -1236,11 +1236,10 @@ class ArtefactTypeSocialprofile extends ArtefactTypeProfileField {
$record->icon = favicon_display_url('www.aim.com');
break;
case 'yahoo':
$record->icon = favicon_display_url('messenger.yahoo.com');
$record->faicon = '<span class="icon icon-brand icon-lg icon-yahoo" style="color: #4B06A3"></span>';
break;
case 'skype':
// Since www.skype.com favicon is not working...
$record->icon = favicon_display_url('support.skype.com');
$record->faicon = '<span class="icon icon-brand icon-lg icon-skype" style="color: #3498D8"></span>';
break;
case 'jabber':
// Since www.jabber.org favicon is not working...
......@@ -1248,7 +1247,7 @@ class ArtefactTypeSocialprofile extends ArtefactTypeProfileField {
break;
default:
// We'll fall back to the "no favicon" default icon
$record->icon = favicon_display_url('example.com');
$record->faicon = '<span class="icon icon-lg icon-globe-americas" style="color: #BFBFF2"></span>';
// If they've supplied a URL, use its favicon
if (filter_var($record->title, FILTER_VALIDATE_URL)) {
......
......@@ -364,6 +364,17 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
return false;
}
public static function get_fa_brand_icons() {
return array(
'slideshare' => array('faicon' => 'slideshare', 'style' => 'color: #0077B5'),
'vimeo' => array('faicon' => 'vimeo-square', 'style' => 'color: #1AB7EA'),
'youtube' => array('faicon' => 'youtube', 'style' => 'color: #FF0000'),
'youtube [privacy mode]' => array('faicon' => 'youtube-square', 'style' => 'color: #FF0000'),
'google' => array('faicon' => 'google', 'style' => 'color: #4285f4'),
'googlevideo' => array('faicon' => 'google', 'style' => 'color: #4285f4'),
);
}
/**
* Returns a block of HTML that the external video block can use to show the
* sites for which we will process URLs.
......@@ -372,6 +383,7 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
$source_instances = self::load_media_sources();
$wwwroot = get_config('wwwroot');
$fa_domains = self::get_fa_brand_icons();
$data = array();
foreach ($source_instances as $name => $source) {
$sourcestr = get_string($name, 'blocktype.externalvideo');
......@@ -380,8 +392,12 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
'url' => $source->get_base_url(),
'icon' => $wwwroot . 'blocktype/externalvideo/media_sources/' . $name . '/favicon.png',
);
$lname = strtolower($name);
if (isset($fa_domains[$lname])) {
$data[$sourcestr]['faicon'] = $fa_domains[$lname]['faicon'];
$data[$sourcestr]['style'] = $fa_domains[$lname]['style'];
}
}
ksort($data);
$smarty = smarty_core();
......@@ -398,7 +414,7 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
if (empty($iframedomains)) {
return '';
}
$fa_domains = self::get_fa_brand_icons();
$data = array();
foreach ($iframedomains as $name => $host) {
$data[$name] = array(
......@@ -406,6 +422,11 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
'url' => 'http://' . $host,
'icon' => favicon_display_url($host),
);
$lname = strtolower($name);
if (isset($fa_domains[$lname])) {
$data[$name]['faicon'] = $fa_domains[$lname]['faicon'];
$data[$name]['style'] = $fa_domains[$lname]['style'];
}
}
$smarty = smarty_core();
......@@ -433,6 +454,7 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
}
}
else {
$fa_domains = self::get_fa_brand_icons();
foreach ($service_instances as $name => $service) {
$servicestr = get_string($name, 'blocktype.externalvideo');
$data[$servicestr] = array(
......@@ -440,6 +462,11 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
'url' => $service->get_base_url(),
'icon' => $wwwroot . 'blocktype/externalvideo/embed_services/' . $name . '/favicon.png',
);
$lname = strtolower($name);
if (isset($fa_domains[$lname])) {
$data[$sourcestr]['faicon'] = $fa_domains[$lname]['faicon'];
$data[$sourcestr]['style'] = $fa_domains[$lname]['style'];
}
}
}
......
......@@ -80,13 +80,8 @@
$(this).css('color',settings.coloroff);
if (settings.emptyglyph) {
if ($(this).hasClass(settings.glyph)) {
// need to add the '-o' before the end for thumbs
if (settings.glyph == 'icon-thumbs-up') {
$(this).removeClass(settings.glyph).addClass('icon-thumbs-o-up');
}
else {
$(this).removeClass(settings.glyph).addClass(settings.glyph + '-o');
}
// need to set any font type difference for the 'not selected' ratings
$(this).addClass('icon-regular');
}
}
}
......
......@@ -32,7 +32,9 @@
<span class="star-comment-rating">
{for i $item->ratingdata->min_rating $item->ratingdata->max_rating}
<div class="star-rating star star-rating-applied star-rating-readonly {$star}-rating{if $i <= $item->ratingdata->value}-on{else}-off{/if}"><a {if $colour}style="color: {$colour}"{/if}>&nbsp;</a></div>
<div class="star-rating star-rating-readonly">
<a class="icon icon-{$star} {if $i <= $item->ratingdata->value}icon-solid{else}icon-regular{/if}" {if $colour}style="color: {$colour}"{/if}>&nbsp;</a>
</div>
{/for}
</span>
{/if}
......
......@@ -4,14 +4,20 @@
<div class="card-body flush">
{foreach from=$profiles item=p}
{if $p->link}<a href="{$p->link}" title="{$p->link}" class="btn btn-secondary btn-sm socialbtn">
{if $showicon}<img src="{$p->icon}" alt="{$p->link}" class="valign-top">{/if}
{if $showicon}
{if $p->faicon}
{$p->faicon|safe}
{else}
<img src="{$p->icon}" alt="{$p->link}" class="valign-top">
{/if}
{/if}
{if $showicon && $showtext}&nbsp;{/if}
{if $showtext}{$p->description}{/if}
</a>{/if}
{/foreach}
{if $email}
<a href="mailto:{$email}" title="{$email}" class="btn btn-secondary btn-sm socialbtn">
{if $showicon}<span class="icon icon-envelope" role="presentation" aria-hidden="true"></span>{/if}
{if $showicon}<span class="icon icon-regular icon-envelope" role="presentation" aria-hidden="true"></span>{/if}
{if $showicon && $showtext}&nbsp;{/if}
{if $showtext}{str tag='email'}{/if}
</a>
......
......@@ -21,7 +21,11 @@
{foreach from=$rows item=row}
<tr class="social-info">
<td class="text-center">
{if $row->faicon}
{$row->faicon|safe}
{else}
<img src="{$row->icon}" alt="{$row->description}">
{/if}
</td>
<td>
<span>{$row->description}</span>
......
<ul class="text-inline unstyled">
{foreach from=$data item=item}
<li class="text-inline"><a href="{$item.url}"><img src="{$item.icon}" alt="{$item.name}" title="{$item.name}"></a></li>
<li class="text-inline"><a href="{$item.url}">
{if $item.faicon}
<span class="icon icon-lg icon-{$item.faicon} icon-brand" style="{$item.style}"></span>
{else}
<img src="{$item.icon}" alt="{$item.name}" title="{$item.name}">
{/if}</a></li>
{/foreach}
</ul>
\ No newline at end of file
......@@ -408,18 +408,18 @@
.table thead {
a::after {
font-family: 'FontAwesome';
font-family: "Font Awesome 5 Free Solid", "Font Awesome 5 Free" !important;
position: relative;
top: -3px;
margin-left: 3px;
color: $gray-300;
}
.asc > a::after {
content: '\f0dd';
content: fa-content($fa-var-caret-down);
}
.desc > a::after,
.sorted > a::after {
content: '\f0de';
content: fa-content($fa-var-caret-up);
top: 2px;
}
}
......
......@@ -187,11 +187,11 @@ ul.cd-timeline-navigation-second {
outline: 0;
text-decoration: none;
&::after {
content: '\f138';
font-family: FontAwesome;
content: fa-content($fa-var-chevron-circle-right);
font-family: "Font Awesome 5 Free Solid", "Font Awesome 5 Free" !important;
color: $theme-primary-color;
font-size: 30px;
top: -7px;
font-size: 28px;
top: -5px;
position: relative;
}
......
......@@ -65,8 +65,8 @@
z-index: 1;
background: rgba(#fff, 0.8);
&:before {
content: "\25BE";
font-family: "FontAwesome";
content: fa-content($fa-var-caret-down);
font-family: "Font Awesome 5 Free Solid", "Font Awesome 5 Free" !important;
margin-top: 9px;
position: absolute;
right: 0%;
......
......@@ -25,8 +25,8 @@
display:none;
}
&:before {
content: "\25BE";
font-family: "FontAwesome";
content: fa-content($fa-var-caret-down);
font-family: "Font Awesome 5 Free Solid", "Font Awesome 5 Free" !important;
margin-top: 9px;
position: absolute;
right: 0%;
......
......@@ -254,9 +254,9 @@ textarea.resizable {
padding-right: 20px;
}
.hasDatepickerwrapper:after {
font-family: "FontAwesome";
font-size: 16px;
content: "\f073";
content: fa-content($fa-var-calendar-alt);
font-family: "Font Awesome 5 Free Regular", "Font Awesome 5 Free" !important;
font-size: 18px;
color: scale-color($theme-text-color, $lightness: 25%);
position:relative;
right: 25px;
......@@ -264,9 +264,9 @@ textarea.resizable {
cursor: text;
}
.hasDatepickerwrapperacl:after {
font-family: "FontAwesome";
font-size: 16px;
content: "\f073";
content: fa-content($fa-var-calendar-alt);
font-family: "Font Awesome 5 Free Regular", "Font Awesome 5 Free" !important;
font-size: 18px;
color: scale-color($theme-text-color, $lightness: 25%);
right: 10px;
position: absolute;
......
......@@ -22,11 +22,11 @@
border-radius: 0;
&:before {
content: fa-content($fa-var-arrows-alt);
font-family: "Font Awesome 5 Free Solid", "Font Awesome 5 Free" !important;
box-sizing: border-box;
color: $gray-300;
opacity: 0.7;
content: "";
font-family: FontAwesome;
line-height: 1;
text-rendering: auto;
display: block;
......
......@@ -12,9 +12,9 @@
color: $input-color;
&.select2-selection--multiple {
&:after {
content: "\f002";
font-family: "Font Awesome 5 Free Solid", "Font Awesome 5 Free" !important;
content: fa-content($fa-var-search);
color: scale-color($theme-text-color, $lightness: 62.5%);
font-family: FontAwesome;
font-size: 1em;
display:inline-block;
position:absolute;
......@@ -73,9 +73,9 @@
.select2-search {
position: relative;
&:after {
content: "\f002";
font-family: "Font Awesome 5 Free Solid", "Font Awesome 5 Free" !important;
content: fa-content($fa-var-search);
color: scale-color($theme-text-color, $lightness: 62.5%);
font-family: FontAwesome;
font-size: 1em;
display:inline-block;
position:absolute;
......
......@@ -98,7 +98,6 @@
}
.star-rating-readonly {
width: 15px;
a {
font-size: 15px;
&:hover {
......@@ -108,9 +107,8 @@
}
.star-comment-rating {
float:right;
margin: -10px 40% 0 0;
padding: 10px 0 0 10px;
display: block;
padding: 6px 0 6px 0;
}
.ratingicon:hover {
color: theme-color("success") !important;
......
......@@ -15,8 +15,12 @@
<tbody>
{foreach from=$editurls item=item name=urls}
<tr class="{cycle values='r0,r1' advance=false}">
<th><img src="{$item.icon}" alt="{$item.name}" title="{$item.name}">&nbsp;{$item.name}</th>
<th>{if $item.icon.faicon}
<span class="icon icon-lg icon-brand icon-{$item.icon.faicon}" style="{$item.icon.style}" alt="{$item.name}" title="{$item.name}"></span>
{else}
<img src="{$item.icon.icon}" alt="{$item.name}" title="{$item.name}">
{/if}
{$item.name}</th>
<td>{$item.url}</td>
<td class="buttonscell">
<div class="btn-group">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment