Coder Social home page Coder Social logo

django-mediamosa-tinymce's Introduction

Mediamosa plugin for django-tinymce

This django application will add a mediamosa plugin to your tinymce editor.

Installing

Install django-mediamosa-tinymce using pip.

Configure django-mediamosa first. In settings.py of your project:

MEDIAMOSA_URL = 'http://api-mediamosa.example.com'
MEDIAMOSA_USERNAME = 'mediamosa-user'
MEDIAMOSA_PASSWORD = 'mediamosa-password'

Add mediamosa_tinymce to INSTALLED_APPS in settings.py for your project:

INSTALLED_APPS = (
    ...
    'mediamosa_tinymce',
    ...
)

Update your TinyMce configuration so it will load the new plugin and shows a mediamosa button:

TINYMCE_DEFAULT_CONFIG = {
    ...
    'plugins': "table,spellchecker,paste,searchreplace,mediamosa",
    ...
    'theme_advanced_buttons3_add': 'mediamosa'
 }

Add the mediamosa_tinymce.urls to urls.py for your project:

urlpatterns = patterns('',
    ...
    url(r'^mediamosa/tinymce', include('mediamosa_tinymce.urls')),
    ...
)

Run the django collectstatic command to copy the mediamosa plugin for tinymce to your statics directory.

python ./manage.py collectstatic

Usage

Enabling Mediamosa plugin

In order for the tinymce mediamosa to call the correct url's, you need to set the ModelAdmin's change_form template file:

class MyModelAdmin(admin.ModelAdmin):
    ...
    change_form_template = 'admin/mediamosa_tinymce_change_form.html'
    ...

This will load the correct url's to query in the plugin's javascript.

Playing an inserted mediafile

When you now output the model attribute containing the mediamosa entry you just inserted, you can initialize it by adding the following code to your template.

<script type="text/javascript">
    var mediamosaPlayerURI = "{% url mediafile-play %}";
</script>
<script type="text/javascript" src="{{ STATIC_URL }}js/mediamosa-player.js"></script>

This will initialize the URI the ajax call should connect to and launch the code that will replace the still with the actual video.

django-mediamosa-tinymce's People

Contributors

bastiaanraa avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.