-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adds word cloud xblock extracting from edx-platform repo
- Loading branch information
Showing
14 changed files
with
1,323 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ | |
|
||
from .poll import PollXBlock | ||
|
||
from .word_cloud import WordCloudXBlock | ||
|
||
__version__ = "0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[main] | ||
host = https://www.transifex.com | ||
|
||
[o:open-edx:p:p:xblocks:r:word_cloud] | ||
file_filter = word_cloud/translations/<lang>/LC_MESSAGES/text.po | ||
source_file = word_cloud/translations/en/LC_MESSAGES/text.po | ||
source_lang = en | ||
type = PO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .word_cloud import WordCloudXBlock |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Configuration for i18n workflow. | ||
|
||
locales: | ||
- en # English - Source Language | ||
# - am # Amharic | ||
- ar # Arabic | ||
# - az # Azerbaijani | ||
# - bg_BG # Bulgarian (Bulgaria) | ||
# - bn_BD # Bengali (Bangladesh) | ||
# - bn_IN # Bengali (India) | ||
# - bs # Bosnian | ||
# - ca # Catalan | ||
# - ca@valencia # Catalan (Valencia) | ||
# - cs # Czech | ||
# - cy # Welsh | ||
# - da # Danish | ||
# - de_DE # German (Germany) | ||
# - el # Greek | ||
# - en_GB # English (United Kingdom) | ||
# # Don't pull these until we figure out why pages randomly display in these locales, | ||
# # when the user's browser is in English and the user is not logged in. | ||
# #- en@lolcat # LOLCAT English | ||
# #- en@pirate # Pirate English | ||
- es_419 # Spanish (Latin America) | ||
# - es_AR # Spanish (Argentina) | ||
# - es_EC # Spanish (Ecuador) | ||
# - es_ES # Spanish (Spain) | ||
# - es_MX # Spanish (Mexico) | ||
# - es_PE # Spanish (Peru) | ||
# - et_EE # Estonian (Estonia) | ||
# - eu_ES # Basque (Spain) | ||
# - fa # Persian | ||
# - fa_IR # Persian (Iran) | ||
# - fi_FI # Finnish (Finland) | ||
# - fil # Filipino | ||
- fr # French | ||
# - gl # Galician | ||
# - gu # Gujarati | ||
- he # Hebrew | ||
- hi # Hindi | ||
# - hr # Croatian | ||
# - hu # Hungarian | ||
# - hy_AM # Armenian (Armenia) | ||
# - id # Indonesian | ||
# - it_IT # Italian (Italy) | ||
# - ja_JP # Japanese (Japan) | ||
# - kk_KZ # Kazakh (Kazakhstan) | ||
# - km_KH # Khmer (Cambodia) | ||
# - kn # Kannada | ||
- ko_KR # Korean (Korea) | ||
# - lt_LT # Lithuanian (Lithuania) | ||
# - ml # Malayalam | ||
# - mn # Mongolian | ||
# - mr # Marathi | ||
# - ms # Malay | ||
# - nb # Norwegian Bokmål | ||
# - ne # Nepali | ||
# - nl_NL # Dutch (Netherlands) | ||
# - or # Oriya | ||
# - pl # Polish | ||
- pt_BR # Portuguese (Brazil) | ||
# - pt_PT # Portuguese (Portugal) | ||
# - ro # Romanian | ||
- ru # Russian | ||
# - si # Sinhala | ||
# - sk # Slovak | ||
# - sl # Slovenian | ||
# - sq # Albanian | ||
# - sr # Serbian | ||
# - sv # Swedish | ||
# - sw # Swahili | ||
# - ta # Tamil | ||
# - te # Telugu | ||
# - th # Thai | ||
# - tr_TR # Turkish (Turkey) | ||
# - uk # Ukranian | ||
# - ur # Urdu | ||
# - uz # Uzbek | ||
# - vi # Vietnamese | ||
- zh_CN # Chinese (China) | ||
# - zh_HK # Chinese (Hong Kong) | ||
# - zh_TW # Chinese (Taiwan) | ||
|
||
|
||
# The locales used for fake-accented English, for testing. | ||
dummy_locales: | ||
- eo | ||
- rtl # Fake testing language for Arabic | ||
|
||
# Directories we don't search for strings. | ||
ignore_dirs: | ||
- '*/css' | ||
- 'public/js/translations' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
This static directory is for files that should be included in your kit as plain | ||
static files. | ||
|
||
You can ask the runtime for a URL that will retrieve these files with: | ||
|
||
url = self.runtime.local_resource_url(self, "static/js/lib.js") | ||
|
||
The default implementation is very strict though, and will not serve files from | ||
the static directory. It will serve files from a directory named "public". | ||
Create a directory alongside this one named "public", and put files there. | ||
Then you can get a url with code like this: | ||
|
||
url = self.runtime.local_resource_url(self, "public/js/lib.js") | ||
|
||
The sample code includes a function you can use to read the content of files | ||
in the static directory, like this: | ||
|
||
frag.add_javascript(self.resource_string("static/js/my_block.js")) | ||
|
29 changes: 29 additions & 0 deletions
29
xblocks_contrib/word_cloud/static/css/word_cloud_xblock.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* CSS for WordCloudXBlock */ | ||
|
||
@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,400,400i,600,700"); | ||
|
||
.input-cloud { | ||
margin: 5px; | ||
} | ||
|
||
.result_cloud_section { | ||
display: none; | ||
width: 0; | ||
height: 0; | ||
} | ||
|
||
.result_cloud_section.active { | ||
display: block; | ||
width: 100%; | ||
height: auto; | ||
margin-top: 1em; | ||
} | ||
|
||
.result_cloud_section.active h3 { | ||
font-size: 100%; | ||
} | ||
|
||
.your_words { | ||
font-size: 0.85em; | ||
display: block; | ||
} |
49 changes: 49 additions & 0 deletions
49
xblocks_contrib/word_cloud/static/html/word_cloud_xblock.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{% load i18n %} | ||
|
||
<div | ||
id="word_cloud_{{ element_id }}" | ||
class="word_cloud_block"> | ||
{% if display_name %} | ||
<h3 class="hd hd-3" id="word_cloud_{{ element_id }}_heading">{{ display_name }}</h3> | ||
{% endif %} | ||
|
||
{% if instructions is not None %} | ||
<div class="input_cloud_section" role="group" aria-labelledby="word_cloud_{{ element_id }}_instructions"> | ||
{% elif display_name %} | ||
<div class="input_cloud_section" role="group" aria-labelledby="word_cloud_{{ element_id }}_heading"> | ||
{% else %} | ||
<div class="input_cloud_section" role="group"> | ||
{% endif %} | ||
|
||
{% if instructions is not None %} | ||
<div class="input_cloud_instructions" id="word_cloud_{{ element_id }}_instructions"> | ||
{{ instructions }} | ||
</div> | ||
{% endif %} | ||
|
||
{% for row in range_num_inputs %} | ||
<label> | ||
<span class="sr"> | ||
{% blocktrans with num=row|add:1 %} | ||
{{ num }} of {{ num_inputs }} | ||
{% endblocktrans %} | ||
</span> | ||
<input class="input-cloud" type="text" size="40" | ||
{% if submitted %}style="display: none;"{% endif %} | ||
/> | ||
</label> | ||
{% endfor %} | ||
|
||
<div class="action"> | ||
<button class="save" type="button">{% trans 'Save' %}</button> | ||
</div> | ||
</div> | ||
|
||
<div id="result_cloud_section_{{ element_id }}" class="result_cloud_section"> | ||
<div class="word_cloud"></div> | ||
<p class="total_num_words"></p> | ||
<p>{% trans 'Your words were:' %}</p> | ||
<ul class="your_words"></ul> | ||
</div> | ||
|
||
</div> |
Oops, something went wrong.