Navigation Menu

Skip to content

Commit

Permalink
Redefine settings for css/jss files
Browse files Browse the repository at this point in the history
  • Loading branch information
lqez committed Apr 10, 2016
1 parent c975956 commit 03e3ac4
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGES
@@ -1,3 +1,4 @@
0.8.5 - Bump summernote version
0.8.4 - Support distinct js/css settings for each widget
0.8.3 - Hotfix for width setting
0.8.2 - Bump summernote version with minor fixes
Expand Down
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -147,17 +147,30 @@ In settings.py,

# for SummernoteWidget.
'css_for_iframe': (
'//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css',
static_url('django_summernote/summernote.css'),
static_url('django_summernote/django_summernote.css'),
),
'js_for_iframe': (
'//code.jquery.com/jquery-1.9.1.min.js',
'//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js',
static_url('django_summernote/jquery.ui.widget.js'),
static_url('django_summernote/jquery.iframe-transport.js'),
static_url('django_summernote/jquery.fileupload.js'),
static_url('django_summernote/summernote.min.js'),
),

# for SummernoteInplaceWidget.
# !!! Be sure to put {{ form.media }} in template before initiate summernote.
'css_for_inplace': (
static_url('django_summernote/summernote.css'),
static_url('django_summernote/django_summernote_inplace.css'),
),
'js_for_inplace': (
static_url('django_summernote/jquery.ui.widget.js'),
static_url('django_summernote/jquery.iframe-transport.js'),
static_url('django_summernote/jquery.fileupload.js'),
static_url('django_summernote/summernote.min.js'),
),
}

Expand Down
2 changes: 1 addition & 1 deletion django_summernote/__init__.py
@@ -1,4 +1,4 @@
version_info = (0, 8, 4)
version_info = (0, 8, 5)

__version__ = version = '.'.join(map(str, version_info))
__project__ = PROJECT = 'django-summernote'
Expand Down
36 changes: 20 additions & 16 deletions django_summernote/settings.py
Expand Up @@ -62,6 +62,7 @@ def static_url(url):
'lang': None,
'lang_matches': {
'ar': 'ar-AR',
'bg': 'bg-BG',
'ca': 'ca-ES',
'cs': 'cs-CZ',
'da': 'da-DK',
Expand All @@ -70,6 +71,7 @@ def static_url(url):
'fa': 'fa-IR',
'fi': 'fi-FI',
'fr': 'fr-FR',
'gl': 'gl-ES',
'he': 'he-IL',
'hr': 'hr-HR',
'hu': 'hu-HU',
Expand Down Expand Up @@ -101,32 +103,34 @@ def static_url(url):
'attachment_require_authentication': False,
'attachment_model': 'django_summernote.Attachment',

'internal_css': (
'default_css': (
'//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css',
static_url('django_summernote/summernote.css'),
static_url('django_summernote/django_summernote.css'),
),
'internal_js': (
'default_js': (
'//code.jquery.com/jquery-1.9.1.min.js',
'//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js',
static_url('django_summernote/jquery.ui.widget.js'),
static_url('django_summernote/jquery.iframe-transport.js'),
static_url('django_summernote/jquery.fileupload.js'),
static_url('django_summernote/summernote.min.js'),
),
'external_css': (
'//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css',
),
'external_js': (
'//code.jquery.com/jquery-1.9.1.min.js',
'//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js',
),
'css_for_iframe': (
static_url('django_summernote/django_summernote.css'),
),
'js_for_iframe': (
),
'css_for_inplace': (
'css': (),
'js': (),

'default_css_for_inplace': (
static_url('django_summernote/summernote.css'),
static_url('django_summernote/django_summernote_inplace.css'),
),
'js_for_inplace': (
'default_js_for_inplace': (
static_url('django_summernote/jquery.ui.widget.js'),
static_url('django_summernote/jquery.iframe-transport.js'),
static_url('django_summernote/jquery.fileupload.js'),
static_url('django_summernote/summernote.min.js'),
),
'css_for_inplace': (),
'js_for_inplace': (),
# Disable upload
'disable_upload': False,
}
Expand Down
10 changes: 4 additions & 6 deletions django_summernote/views.py
Expand Up @@ -15,14 +15,12 @@ def editor(request, id):
'id_src': id,
'id': id.replace('-', '_'),
'css': (
summernote_config['external_css'] +
summernote_config['internal_css'] +
summernote_config['css_for_iframe']
summernote_config['default_css'] +
summernote_config['css']
),
'js': (
summernote_config['external_js'] +
summernote_config['internal_js'] +
summernote_config['js_for_iframe']
summernote_config['default_js'] +
summernote_config['js']
),
'disable_upload': summernote_config['disable_upload'],
}
Expand Down
6 changes: 2 additions & 4 deletions django_summernote/widgets.py
Expand Up @@ -109,15 +109,13 @@ class SummernoteInplaceWidget(SummernoteWidgetBase):
class Media:
css = {
'all': (
summernote_config['external_css'] +
summernote_config['internal_css'] +
summernote_config['default_css_for_inplace'] +
summernote_config['css_for_inplace']
)
}

js = (
summernote_config['external_js'] +
summernote_config['internal_js'] +
summernote_config['default_js_for_inplace'] +
summernote_config['js_for_inplace']
)

Expand Down

0 comments on commit 03e3ac4

Please sign in to comment.