Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-google-drive
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
xblock-google-drive
Commits
de1503ae
Commit
de1503ae
authored
Dec 10, 2014
by
marjev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Included PublishEventMixin
parent
7c6ab0ce
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
25 deletions
+7
-25
google_drive/google_calendar.py
+2
-11
google_drive/google_docs.py
+2
-11
google_drive/public/js/google_calendar.js
+1
-1
google_drive/public/js/google_docs.js
+1
-1
google_drive/utils.py
+1
-1
No files found.
google_drive/google_calendar.py
View file @
de1503ae
...
@@ -11,10 +11,11 @@ from xblock.fields import Scope, String, Integer
...
@@ -11,10 +11,11 @@ from xblock.fields import Scope, String, Integer
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
from
.utils
import
loader
,
AttrDict
from
.utils
import
loader
,
AttrDict
from
xblockutils.publish_event
import
PublishEventMixin
# Classes ###########################################################
# Classes ###########################################################
class
GoogleCalendarBlock
(
XBlock
):
class
GoogleCalendarBlock
(
XBlock
,
PublishEventMixin
):
"""
"""
XBlock providing a google calendar view for a specific calendar
XBlock providing a google calendar view for a specific calendar
"""
"""
...
@@ -92,16 +93,6 @@ class GoogleCalendarBlock(XBlock):
...
@@ -92,16 +93,6 @@ class GoogleCalendarBlock(XBlock):
'result'
:
'success'
,
'result'
:
'success'
,
}
}
@XBlock.json_handler
def
publish_event
(
self
,
calendar_data
,
suffix
=
''
):
event_name
=
calendar_data
.
pop
(
'event_name'
)
self
.
runtime
.
publish
(
self
,
event_name
,
calendar_data
)
return
{
'result'
:
'success'
,
}
@staticmethod
@staticmethod
def
workbench_scenarios
():
def
workbench_scenarios
():
"""
"""
...
...
google_drive/google_docs.py
View file @
de1503ae
...
@@ -12,10 +12,11 @@ from xblock.fields import Scope, String
...
@@ -12,10 +12,11 @@ from xblock.fields import Scope, String
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
from
.utils
import
loader
,
AttrDict
from
.utils
import
loader
,
AttrDict
from
xblockutils.publish_event
import
PublishEventMixin
# Classes ###########################################################
# Classes ###########################################################
class
GoogleDocumentBlock
(
XBlock
):
class
GoogleDocumentBlock
(
XBlock
,
PublishEventMixin
):
"""
"""
XBlock providing a google document embed link
XBlock providing a google document embed link
"""
"""
...
@@ -86,16 +87,6 @@ class GoogleDocumentBlock(XBlock):
...
@@ -86,16 +87,6 @@ class GoogleDocumentBlock(XBlock):
}
}
@XBlock.json_handler
@XBlock.json_handler
def
publish_event
(
self
,
data
,
suffix
=
''
):
event_name
=
data
.
pop
(
'event_name'
)
self
.
runtime
.
publish
(
self
,
event_name
,
data
)
return
{
'result'
:
'success'
,
}
@XBlock.json_handler
def
check_url
(
self
,
data
,
suffix
=
''
):
def
check_url
(
self
,
data
,
suffix
=
''
):
try
:
try
:
...
...
google_drive/public/js/google_calendar.js
View file @
de1503ae
...
@@ -6,7 +6,7 @@ function GoogleCalendarBlock(runtime, element) {
...
@@ -6,7 +6,7 @@ function GoogleCalendarBlock(runtime, element) {
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
),
url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
),
data
:
JSON
.
stringify
({
url
:
iframe_url
,
displayedin
:
'iframe'
,
event_
nam
e
:
'edx.googlecomponent.calendar.displayed'
})
data
:
JSON
.
stringify
({
url
:
iframe_url
,
displayedin
:
'iframe'
,
event_
typ
e
:
'edx.googlecomponent.calendar.displayed'
})
});
});
});
});
}
}
google_drive/public/js/google_docs.js
View file @
de1503ae
...
@@ -20,7 +20,7 @@ function GoogleDocumentBlock(runtime, element) {
...
@@ -20,7 +20,7 @@ function GoogleDocumentBlock(runtime, element) {
data
:
JSON
.
stringify
({
data
:
JSON
.
stringify
({
url
:
document_url
,
url
:
document_url
,
displayedin
:
presented_within
,
displayedin
:
presented_within
,
event_
nam
e
:
'edx.googlecomponent.document.displayed'
,
event_
typ
e
:
'edx.googlecomponent.document.displayed'
,
})
})
});
});
}
}
...
...
google_drive/utils.py
View file @
de1503ae
...
@@ -9,7 +9,7 @@ import pkg_resources
...
@@ -9,7 +9,7 @@ import pkg_resources
from
django.template
import
Context
,
Template
from
django.template
import
Context
,
Template
from
xblockutils.resources
import
ResourceLoader
from
xblockutils.resources
import
ResourceLoader
from
xblockutils.publish_event
import
PublishEventMixin
# Globals ###########################################################
# Globals ###########################################################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment