Commit 7860ad08 by Awais Committed by Awais Qureshi

Adding social links.

ECOM-7736
parent 7ff7f3cd
......@@ -7,7 +7,8 @@ from django.test import TestCase
from course_discovery.apps.core.tests.helpers import make_image_file
from course_discovery.apps.course_metadata.choices import CourseRunPacing
from course_discovery.apps.course_metadata.tests.factories import OrganizationFactory, PersonFactory, PositionFactory
from course_discovery.apps.course_metadata.tests.factories import (OrganizationFactory, PersonFactory,
PersonSocialNetworkFactory, PositionFactory)
from course_discovery.apps.publisher.choices import CourseRunStateChoices, PublisherUserRole
from course_discovery.apps.publisher.models import Seat
from course_discovery.apps.publisher.tests import factories
......@@ -185,12 +186,17 @@ class CourseRunWrapperTests(TestCase):
self.course_run.staff = [staff, staff_2]
self.course_run.save()
facebook = PersonSocialNetworkFactory(person=staff_2, type='facebook')
twitter = PersonSocialNetworkFactory(person=staff_2, type='twitter')
expected = [
{
'uuid': str(staff.uuid),
'full_name': staff.full_name,
'image_url': staff.get_profile_image_url,
'profile_url': staff.profile_url,
'social_networks': {},
'bio': staff.bio
},
{
'uuid': str(staff_2.uuid),
......@@ -199,6 +205,8 @@ class CourseRunWrapperTests(TestCase):
'position': position.title,
'organization': position.organization_name,
'profile_url': staff.profile_url,
'social_networks': {'facebook': facebook.value, 'twitter': twitter.value},
'bio': staff_2.bio
}
]
......
......@@ -197,6 +197,11 @@ class CourseRunWrapper(BaseWrapper):
'full_name': staff.full_name,
'image_url': staff.get_profile_image_url,
'profile_url': staff.profile_url,
'bio': staff.bio,
'social_networks': {
staff.type: staff.value
for staff in staff.person_networks.all()
}
}
if hasattr(staff, 'position'):
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-20 11:50+0500\n"
"POT-Creation-Date: 2017-04-20 12:22+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -1030,6 +1030,7 @@ msgid "Organization"
msgstr ""
#: templates/publisher/_add_instructor_popup.html
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "Bio"
msgstr ""
......@@ -2315,6 +2316,18 @@ msgid "Profile URL "
msgstr ""
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "FaceBook URL "
msgstr ""
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "Twitter URL "
msgstr ""
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "Blog URL "
msgstr ""
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "Close"
msgstr ""
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-20 11:50+0500\n"
"POT-Creation-Date: 2017-04-20 12:22+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-20 11:50+0500\n"
"POT-Creation-Date: 2017-04-20 12:22+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -1189,6 +1189,7 @@ msgid "Organization"
msgstr "Örgänïzätïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/publisher/_add_instructor_popup.html
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "Bio"
msgstr "Bïö Ⱡ'σяєм#"
......@@ -2742,6 +2743,18 @@ msgid "Profile URL "
msgstr "Pröfïlé ÛRL Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "FaceBook URL "
msgstr "FäçéBöök ÛRL Ⱡ'σяєм ιρѕυм ∂σłσя ѕι#"
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "Twitter URL "
msgstr "Twïttér ÛRL Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "Blog URL "
msgstr "Blög ÛRL Ⱡ'σяєм ιρѕυм ∂σł#"
#: templates/publisher/course_run_detail/_instructor_profile.html
msgid "Close"
msgstr "Çlösé Ⱡ'σяєм ιρѕ#"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-20 11:50+0500\n"
"POT-Creation-Date: 2017-04-20 12:22+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -37,15 +37,14 @@ $(document).ready(function(){
$('#instructorProfileModal div.organization').html(data['organization']);
$('#instructorProfileModal img.image_url').attr('src', data['image_url']);
$('#instructorProfileModal a.btn-download').attr('href', data['image_url']);
$('#instructorProfileModal div.position').html(data['position']);
$('#instructorProfileModal div.bio').html(data['bio']);
if (data['profile_url']) {
$('#instructorProfileModal a.profile_url').attr("href", data['profile_url']);
$('#instructorProfileModal div.profile_url_copy').html(data['profile_url']).hide();
}
else
$('#instructorProfileModal a.profile_url').attr("href", '#');
assignData('.profile_url', data['profile_url']);
assignData('.facebook_url', data['social_networks']['facebook']);
assignData('.twitter_url', data['social_networks']['twitter']);
assignData('.blog_url', data['social_networks']['blog']);
$('#instructorProfileModal div.position').html(data['position']);
});
});
......@@ -72,9 +71,18 @@ function clearModalError($modal) {
function resetModalData() {
$('#instructorProfileModal div.full_name').html('');
$('#instructorProfileModal div.organization').html('');
$('#instructorProfileModal img.image_url').attr('src','');
$('#instructorProfileModal a.btn-download').attr('href', '');
$('#instructorProfileModal a.profile_url').attr("href", '');
$('#instructorProfileModal div.profile_url_copy').html('');
$('#instructorProfileModal img.image_url').attr('src','#');
$('#instructorProfileModal div.position').html('');
$('#instructorProfileModal a.btn-download').attr('href', '#');
$('#instructorProfileModal div.bio').html('');
assignData('.facebook_url', '#');
assignData('.twitter_url', '#');
assignData('.profile_url', '#');
assignData('.blog_url', '#');
}
function assignData(element, data){
$(element).attr("href", data);
$(element + '_copy').html(data);
}
......@@ -657,3 +657,28 @@
width: 120px;
height: 120px;
}
.social-links {
text-align: center;
margin-top: 20px;
.heading {
&.icon {
display: inline-block;
width: 30%;
> a {
font-weight: bold;
font-size: 1.1em;
vertical-align: middle;
color: #065683;
}
.btn {
@include padding(5px, 5px, 5px, 5px);
@include margin-left(6px);
}
}
}
}
{% load i18n %}
{% load compress %}
{% load i18n %}
{% load staticfiles %}
<div id="instructorProfileModal" class="modal">
......@@ -39,7 +38,34 @@
<a class="profile_url" target="_blank">{% trans "Profile URL "%}</a>
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy profile_url_copy"></div>
<div class="copy profile_url_copy hidden"></div>
</div>
<div class="info-item">
<div class="heading">{% trans "Bio" %}:
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy bio"></div>
</div>
<div class="social-links">
<div class="heading icon">
<a class="facebook_url" target="_blank">{% trans "FaceBook URL "%}</a>
{% include "publisher/course_run_detail/_clipboard.html" %}
<div class="copy facebook_url_copy hidden"></div>
</div>
<div class="heading icon">
<a class="twitter_url" target="_blank">{% trans "Twitter URL "%}</a>
{% include "publisher/course_run_detail/_clipboard.html" %}
<div class="copy twitter_url_copy hidden"></div>
</div>
<div class="heading icon">
<a class="blog_url" target="_blank">{% trans "Blog URL "%}</a>
{% include "publisher/course_run_detail/_clipboard.html" %}
<div class="copy blog_url_copy hidden"></div>
</div>
</div>
<div class="actions">
......@@ -47,3 +73,13 @@
</div>
</div>
</div>
{% block extra_js %}
<script src="{% static 'bower_components/clipboard/dist/clipboard.min.js' %}"></script>
<script>
new Clipboard(".btn-copy", {
text: function(trigger) {
return $(trigger).next('.copy').text().trim();
}
});
</script>
{% endblock %}
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