Skip to content

Commit

Permalink
Customize the theme as per the direction (ltr and rtl), added transla…
Browse files Browse the repository at this point in the history
…tion, made kkux app for dynamic news at home page. (Fixes openedx#1)
  • Loading branch information
amitvadhel7 committed Apr 10, 2018
1 parent 588bd38 commit 5b650db
Show file tree
Hide file tree
Showing 73 changed files with 3,791 additions and 2,077 deletions.
5 changes: 4 additions & 1 deletion cms/static/js/views/settings/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
this.$el.find('#' + this.fieldToSelectorMap.description).val(this.model.get('description'));

this.$el.find('#' + this.fieldToSelectorMap['short_description']).val(this.model.get('short_description'));
this.$el.find('#' + this.fieldToSelectorMap['short_description_in_arabic']).val(this.model.get('short_description_in_arabic'));

this.$el.find('.current-course-introduction-video iframe').attr('src', this.model.videosourceSample());
this.$el.find('#' + this.fieldToSelectorMap['intro_video']).val(this.model.get('intro_video') || '');
Expand Down Expand Up @@ -182,7 +183,8 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
'course_settings_learning_fields': 'course-settings-learning-fields',
'add_course_learning_info': 'add-course-learning-info',
'add_course_instructor_info': 'add-course-instructor-info',
'course_learning_info': 'course-learning-info'
'course_learning_info': 'course-learning-info',
'short_description_in_arabic': 'course-short-description-ar'
},

addLearningFields: function() {
Expand Down Expand Up @@ -312,6 +314,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
// Added by Mahendra Chaudhari
case 'course_category':
case 'course-short-description':
case 'course-short-description-ar':
this.setField(event);
break;
default: // Everything else is handled by datepickers and CodeMirror.
Expand Down
4 changes: 4 additions & 0 deletions common/djangoapps/course_modes/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Django admin page for course modes
"""
import logging

from django.conf import settings
from django import forms
from django.utils.translation import ugettext_lazy as _
Expand Down Expand Up @@ -30,6 +32,8 @@

COURSE_MODE_SLUG_CHOICES = [(mode_slug, mode_slug) for mode_slug in settings.COURSE_ENROLLMENT_MODES]

log = logging.getLogger(__name__)


class CourseModeForm(forms.ModelForm):
"""
Expand Down
Binary file modified conf/locale/ar/LC_MESSAGES/django.mo
Binary file not shown.
95 changes: 95 additions & 0 deletions conf/locale/ar/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -25890,3 +25890,98 @@ msgid ""
"A new revision was created: Merge between Revision #%(r1)d and Revision "
"#%(r2)d"
msgstr "أُنشأت مراجعة جديدة: الدمج بين المراجعة #%(r1)d والمراجعة #%(r2)d "




#: /themes/kkux/lms/templates/header.html
msgid "Why KKUx?"
msgstr "عن المنصة"

msgid "Skills"
msgstr "المهارات"


#: /themes/kkux/lms/templates/index.html
msgid "Future Skills"
msgstr "مهارات المستقبل"

msgid "Welcome to KKUx"
msgstr" مرحبًا بكم في KKUx"

msgid "Featured Skills"
msgstr "أبرز المهارات"

msgid "Upcoming Skills"
msgstr "المهارات القادمة"

msgid "KKUX News"
msgstr "أبرز الأخبار"

msgid "Achievements at"
msgstr "مكاسب في "

msgid "Our Partners"
msgstr "شركاؤنا"

msgid "Earn Lifelong Skills"
msgstr "إكسب مهارة للحياة"

msgid "Earn Certificate from KKU"
msgstr "إكسب شهادة من KKU"

msgid "You Will earn a New Skill In Your Life"
msgstr "في حال إتمام المهارة سوف تضيف قيمة حقيقية لحياتك"

msgid "You will receive a certificate from King Khalid University to post to your professional network"
msgstr "في حال إتمام المهارة بنجاح سوف ستحصل على شهادة من جامعة الملك خالد تضاف الى سيرتك المهنية"

msgid "Creativity, innovation and entrepreneurship are essential skills for the future generation. Through KKUx, we seek to diversify the experiences of our learners and provide them with a set of basic skills required for the future jobs."
msgstr "تعد مهارات الإبداع والابتكار والريادة من أساسيات جيل المستقبل، ونحن نسعى من خلال هذه المنصة الى تنويع خبرات ابناءنا وتزويدهم بمجموعة من المهارات الأساسية التي تتطلبها وظائف المستقبل ."

msgid "Prof. Falleh R. M. Al-Solamy , Rector of King Khalid University"
msgstr "أ.د. فالح رجاء الله السلمي - مدير جامعة الملك خالد"

msgid "KKUx Provides Distinguished and High Quality Content about the Most Important Skills For Future Jobs."
msgstr "تهدف المنصة إلى المساهمة في تقديم أهم المهارات لوظائف المستقبل عن طريق تقديم محتوى نوعي و عالي الجودة"


#: /themes/kkux/lms/templates/footer.html

msgid "Mission"
msgstr "الرؤية"

msgid "Vision"
msgstr "الرسالة"

msgid "ELD Website"
msgstr "عمادة التعلم الإلكتروني"

msgid "Terms"
msgstr "السياسات"

msgid "Publishing Rules"
msgstr "قواعد النشر"

msgid "Data Use Policy"
msgstr "بيان الخصوصية"

msgid "ELD Open Learning"
msgstr "التعلم المفتوح"

msgid "Open CourseWare"
msgstr "المقررات المفتوحة "

msgid "Olomna"
msgstr "علومنا "

msgid "Tamkeen"
msgstr "تمكين للتدريب"

msgid "Contact us"
msgstr "تواصل معنا"

msgid "KKUx All Right Reserved"
msgstr "جميع الحقوق محفوظة لـ KKUx"


5 changes: 3 additions & 2 deletions lms/djangoapps/certificates/views/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _update_course_context(request, context, course, platform_name):
"""
Updates context dictionary with course info.
"""
context['course_display_name_in_arabic'] = course.display_name_in_arabic
context['course_display_name_in_arabic'] = course.display_name_in_arabic if course.display_name_in_arabic else ""
context['full_course_image_url'] = request.build_absolute_uri(course_image_url(course))
course_title_from_cert = context['certificate_data'].get('course_title', '')
accomplishment_copy_course_name = course_title_from_cert if course_title_from_cert else course.display_name
Expand Down Expand Up @@ -341,7 +341,8 @@ def _get_user_certificate(request, user, course_key, course, preview_mode=None):
user_certificate = GeneratedCertificate(
mode=preview_mode,
verify_uuid=unicode(uuid4().hex),
modified_date=datetime.now().date()
modified_date=datetime.now().date(),
user=user
)
else:
# certificate is being viewed by learner or public
Expand Down
Empty file added lms/djangoapps/kkux/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions lms/djangoapps/kkux/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.contrib import admin
from .models import News, Language


class LanguageAdmin(admin.ModelAdmin):
list_display = ['name', 'code']
search_fields = ['name', 'code']

admin.site.register(Language, LanguageAdmin)


class NewsAdmin(admin.ModelAdmin):
list_display = ['title', 'language', 'position']
list_filter = ['language']
search_fields = ['title']

admin.site.register(News, NewsAdmin)
47 changes: 47 additions & 0 deletions lms/djangoapps/kkux/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import django.utils.timezone
import model_utils.fields


class Migration(migrations.Migration):

dependencies = [
]

operations = [
migrations.CreateModel(
name='Language',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)),
('name', models.CharField(default=b'English', max_length=50)),
('code', models.CharField(default=b'en', unique=True, max_length=10)),
],
options={
'verbose_name': 'Language',
'verbose_name_plural': 'Languages',
},
),
migrations.CreateModel(
name='News',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)),
('title', models.CharField(help_text=b'News title upto 30 characters', max_length=255)),
('link', models.URLField(help_text=b'Link for the news')),
('short_description', models.TextField(help_text=b'Add description upto 100 characters', null=True, blank=True)),
('position', models.IntegerField(default=1, help_text=b'Position/order of the news')),
('language', models.ForeignKey(to='kkux.Language')),
],
options={
'ordering': ['position'],
'verbose_name': 'News',
'verbose_name_plural': 'News',
},
),
]
Empty file.
42 changes: 42 additions & 0 deletions lms/djangoapps/kkux/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from django.db import models

from model_utils.models import TimeStampedModel


class Language(TimeStampedModel):
name = models.CharField(max_length=50, default='English')
code = models.CharField(max_length=10, unique=True, default='en')

class Meta:
app_label = "kkux"
verbose_name = 'Language'
verbose_name_plural = 'Languages'

def __unicode__(self):
return self.name

def __repr__(self):
return self.__unicode__()


class News(TimeStampedModel):
"""
Store KKUx news details and news will be displayed on homepage.
"""
language = models.ForeignKey(Language, on_delete=models.CASCADE)
title = models.CharField(max_length=255, help_text="News title upto 30 characters")
link = models.URLField(help_text="Link for the news")
short_description = models.TextField(null=True, blank=True, help_text="Add description upto 100 characters")
position = models.IntegerField(default=1, help_text="Position/order of the news")

class Meta(object):
app_label = "kkux"
ordering = ['position']
verbose_name = 'News'
verbose_name_plural = 'News'

def __unicode__(self):
return self.title

def __repr__(self):
return self.__unicode__()
10 changes: 5 additions & 5 deletions lms/djangoapps/shoppingcart/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,11 @@ def billing_details(request):
full_name = full_name.split(' ')
first_name = cart.user.first_name if cart.user.first_name else full_name[0]
last_name = cart.user.last_name
mailing_address = cart.user.profile.mailing_address
city = cart.user.profile.city
country_code = cart.user.profile.country_code
phone_number = cart.user.profile.phone_number
postal_code = cart.user.profile.postalcode
mailing_address = cart.user.profile.mailing_address if cart.user.profile.mailing_address else ''
city = cart.user.profile.city if cart.user.profile.city else ''
country_code = cart.user.profile.country_code if cart.user.profile.country_code else ''
phone_number = cart.user.profile.phone_number if cart.user.profile.phone_number else ''
postal_code = cart.user.profile.postalcode if cart.user.profile.postalcode else ''
else:
first_name = cart.user.first_name
last_name = cart.user.last_name
Expand Down
1 change: 1 addition & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2241,6 +2241,7 @@

# For assign course category
'category',
'kkux',
)

######################### CSRF #########################################
Expand Down
4 changes: 2 additions & 2 deletions lms/templates/discovery/course_card.underscore
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
{ start_date: start }, true
) %>
<% if(price > 0) {%>
<span style="float:right"><%- price %> SAR</span>
<span><%- price %> SAR</span>
<% } else {%>
<span style="float:right">Free</span>
<span>Free</span>
<% } %>
</div>
</section>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('course_overviews', '0014_courseoverview_course_category'),
]

operations = [
migrations.AddField(
model_name='courseoverview',
name='short_description_in_arabic',
field=models.TextField(null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('course_overviews', '0015_courseoverview_short_description_in_arabic'),
]

operations = [
migrations.AddField(
model_name='courseoverview',
name='display_name_in_arabic',
field=models.TextField(null=True),
),
]
5 changes: 5 additions & 0 deletions openedx/core/djangoapps/content/course_overviews/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class Meta(object):

language = TextField(null=True)

display_name_in_arabic = TextField(null=True)
short_description_in_arabic = TextField(null=True)

# Added by Mahendra Chaudhari
course_category = TextField(null=True)

Expand Down Expand Up @@ -197,6 +200,8 @@ def _create_or_update(cls, course):

course_overview.language = course.language
course_overview.course_category = course.course_category
course_overview.display_name_in_arabic = course.display_name_in_arabic
course_overview.short_description_in_arabic = CourseDetails.fetch_about_attribute(course.id, 'short_description_in_arabic')

return course_overview

Expand Down
2 changes: 2 additions & 0 deletions openedx/core/djangoapps/lang_pref/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def released_languages():
released_language_codes.append(default_language_code)
released_language_codes.sort()

if 'en' not in released_language_codes:
released_language_codes.append('en')
# Intersect the list of valid language tuples with the list
# of released language codes
return [
Expand Down
1 change: 1 addition & 0 deletions openedx/core/djangoapps/models/course_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'entrance_exam_id',
'entrance_exam_minimum_score_pct',
'course_category',
'short_description_in_arabic',
]


Expand Down
Loading

0 comments on commit 5b650db

Please sign in to comment.