Skip to content

Commit

Permalink
feat: add react app
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Salman authored and Ali Salman committed Dec 1, 2023
1 parent bd7ef76 commit ed6ae31
Show file tree
Hide file tree
Showing 14 changed files with 173 additions and 2 deletions.
1 change: 1 addition & 0 deletions openedx/features/google_cdn_uploads/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = "openedx.features.google_cdn_uploads.apps:GoogleCDNUploadsConfig"
17 changes: 17 additions & 0 deletions openedx/features/google_cdn_uploads/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Admin registration for Messenger.
"""
from django.contrib import admin

from openedx.features.google_cdn_uploads.models import GoogleCDNUpload


class GoogleCDNUploadAdmin(admin.ModelAdmin):
"""
Admin config clearesult credit providers.
"""
list_display = ("file_name", "course_id",)
search_fields = ("file_name", "course_id",)


admin.site.register(GoogleCDNUpload, GoogleCDNUploadAdmin)
24 changes: 24 additions & 0 deletions openedx/features/google_cdn_uploads/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Meta Translations App Config
"""
from django.apps import AppConfig
from edx_django_utils.plugins import PluginURLs, PluginSettings
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType

class GoogleCDNUploadsConfig(AppConfig):
name = 'openedx.features.google_cdn_uploads'
plugin_app = {
PluginURLs.CONFIG: {
ProjectType.CMS: {
PluginURLs.NAMESPACE: 'google_cdn_uploads',
PluginURLs.REGEX: '^google_cdn_uploads/',
PluginURLs.RELATIVE_PATH: 'urls',
},
},
PluginSettings.CONFIG: {
ProjectType.CMS: {
SettingsType.COMMON: {PluginSettings.RELATIVE_PATH: 'settings.common'},
},
}
}

Empty file.
17 changes: 17 additions & 0 deletions openedx/features/google_cdn_uploads/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Meta Translations Models
"""
from django.db import models
from opaque_keys.edx.django.models import CourseKeyField


class GoogleCDNUpload(models.Model):
"""
Store course id and file name
"""
course_id = CourseKeyField(max_length=255, db_index=True)
file_name = models.CharField(max_length=255)

class Meta:
app_label = 'google_cdn_uploads'
verbose_name = "Google CDN Uploads"
Empty file.
17 changes: 17 additions & 0 deletions openedx/features/google_cdn_uploads/settings/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Common settings for Messenger
"""


def plugin_settings(settings):
"""
Common settings for uploading mp4
"""
settings.MAKO_TEMPLATE_DIRS_BASE.append(
settings.OPENEDX_ROOT / 'features' / 'google_cdn_uploads' / 'templates',
)

settings.STATICFILES_DIRS.append (
settings.OPENEDX_ROOT / 'features' / 'google_cdn_uploads' / 'static',
)
print('CDN App - Setting Updated')
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import UploadContext from "./UploadContext";

export default class GoogleCDNUpload {
constructor() {
ReactDOM.render(<UploadContext context={context} />, document.getElementById("root"));
}
}

export { GoogleCDNUpload }
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

function UploadContext({ context }) {
return (
<div className="translations">
<p>kjasnxkajsnkxajns</p>
</div>
)
}

export default UploadContext;
25 changes: 25 additions & 0 deletions openedx/features/google_cdn_uploads/templates/uploads.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<%inherit file="base.html" />
<%namespace name='static' file='static_content.html'/>
<%!
from django.urls import reverse
from django.utils.translation import ugettext as _
from openedx.core.djangolib.js_utils import js_escaped_string, dump_js_escaped_json
%>

<%def name="online_help_token()"><% return "home" %></%def>
<%block name="title">${_("{studio_name} Home").format(studio_name=settings.STUDIO_SHORT_NAME)}</%block>
<%block name="bodyclass">is-signedin index view-dashboard</%block>



<%block name="content">
<div id="root" class="container">
hello
</div>

<%static:webpack entry="GoogleCDNUpload">
var context = {}

new GoogleCDNUpload(context);
</%static:webpack>
</%block>
21 changes: 21 additions & 0 deletions openedx/features/google_cdn_uploads/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
Urls for Meta Translations
"""
from django.conf.urls import include, url

from openedx.features.google_cdn_uploads.views import render_google_cdn_uploads_home

app_name = 'google_cdn_uploads'

urlpatterns = [
# url(
# r'^course_blocks_mapping/$',
# course_blocks_mapping,
# name='course_blocks_mapping'
# ),
url(
r'^$',
render_google_cdn_uploads_home,
name='google_cdn_uploads_home'
),
]
23 changes: 23 additions & 0 deletions openedx/features/google_cdn_uploads/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Views for uploading mp4
"""
import json
from logging import getLogger
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_http_methods
from django.http import JsonResponse
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.keys import CourseKey
from django.conf import settings
from common.djangoapps.edxmako.shortcuts import render_to_response

from lms.djangoapps.courseware.courses import get_course_by_id
log = getLogger(__name__)


@login_required
def render_google_cdn_uploads_home(request):
return render_to_response('uploads.html', {
'uses_bootstrap': True,
'login_user_username': request.user.username,
})
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

setup(
name="Open edX",
version='0.13',
version='0.14',
install_requires=["setuptools"],
requires=[],
# NOTE: These are not the names we should be installing. This tree should
Expand Down Expand Up @@ -173,6 +173,7 @@
"user_authn = openedx.core.djangoapps.user_authn.apps:UserAuthnConfig",
"instructor = lms.djangoapps.instructor.apps:InstructorConfig",
"course_apps = openedx.core.djangoapps.course_apps.apps:CourseAppsConfig",
"google_cdn_uploads = openedx.features.google_cdn_uploads.apps:GoogleCDNUploadsConfig"
],
'openedx.learning_context': [
'lib = openedx.core.djangoapps.content_libraries.library_context:LibraryContextImpl',
Expand Down
5 changes: 4 additions & 1 deletion webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ module.exports = Merge.smart({
ReactRenderer: './common/static/js/src/ReactRenderer.jsx',
XModuleShim: './xmodule/js/src/xmodule.js',
VerticalStudentView: './xmodule/assets/vertical/public/js/vertical_student_view.js',
commons: 'babel-polyfill'
commons: 'babel-polyfill',

// SDAIA
GoogleCDNUpload: './openedx/features/google_cdn_uploads/static/google_cdn_uploads/js/GoogleCDNUpload.js',
},

output: {
Expand Down

0 comments on commit ed6ae31

Please sign in to comment.