/xblock-inline-dropdown

Inline Dropdown XBlock for the edX Platform

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

Inline Dropdown XBlock

This XBlock provides a way to place dropdown questions inline with other text, for example, in a paragraph.

Completed Question

Installation

To install the Inline Dropdown XBlock within your edX python environment, simply run this command:

$ sudo -Hu edxapp bash
$ git clone https://github.com/eazaika/xblock-inline-dropdown.git
$ cd && . edxapp_env  && . ./venvs/edxapp/bin/activate && cd xblock-inline-dropdown/
$ pip install -r requirements.txt

Then add:

edx-platform/[l|c]ms/envs/common.py

OPTIONAL_APPS = (
...
    ('inline_dropdown', None),

[l|c]ms.env.json

    "ADD_INSTALLED_APPS": [
        "inline_dropdown",
    ]

Then recompile your static files and restart production app.

Enabling in Studio

Go to Settings -> Advanced Settings and set Advanced Module List to ["inline-dropdown"].

Advanced Module List

Usage

Once the Inline Dropdown XBlock is enabled in Studio, you should see a new Component button labeled Advanced:

Component Buttons

Click the Advanced button and you should see the Inline Dropdown XBlock listed:

Advanced Component List

After you've selected the Inline Dropdown XBlock, a default question will be inserted into your unit:

Default Question

Customization

The question can be customized by clicking the Edit button on the component:

Studio View Studio View

The Inline Dropdown XBlock uses a simple XML-based structure as shown below:

<inline_dropdown schema_version='1'>
    <body>
        <p>A fruit is the fertilized ovary of a tree or plant and contains seeds. Given this, a <input_ref input="i1"/> is consider a fruit, while a <input_ref input="i2"/> is considered a vegetable.</p>
    </body>
    <optionresponse>
       	<optioninput id="i1">
       		<option correct="True">tomato<optionhint>Since the tomato is the fertilized ovary of a tomato plant and contains seeds, it is a fruit.</optionhint></option>
       		<option correct="False">potato<optionhint>A potato is an edible part of a plant in tuber form and is a vegetable, not a fruit.</optionhint></option>
       	</optioninput>
    </optionresponse>
    <optionresponse>
       	<optioninput id="i2">
       		<option correct="False">cucumber<optionhint>Many people mistakenly think a cucumber is a vegetable. However, because a cucumber is the fertilized ovary of a cucumber plant and contains seeds, it is a fruit.</optionhint></option>
       		<option correct="True">onion<optionhint>The onion is the bulb of the onion plant and contains no seeds and is therefore a vegetable.</optionhint></option>
       	</optioninput>
    </optionresponse>
    <demandhint>
        <hint>A fruit is the fertilized ovary from a flower.</hint>
        <hint>A fruit contains seeds of the plant.</hint>
    </demandhint>
</inline_dropdown>