From 3744d9b71de7fda543c5cad519184445371cbd6d Mon Sep 17 00:00:00 2001 From: robertop23 Date: Fri, 11 Oct 2013 22:31:22 -0430 Subject: [PATCH] Select option added in editor config button to enable/disable autoclosetag in html mode --- applications/admin/controllers/default.py | 4 +-- applications/admin/settings.cfg | 4 +++ applications/admin/views/default/edit.html | 35 ++++++++++--------- applications/admin/views/default/edit_js.html | 2 +- .../admin/views/default/editor_settings.html | 3 ++ 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index 6d90608d..f0419e6c 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -563,7 +563,7 @@ def edit(): # Load json only if it is ajax edited... app = get_app(request.vars.app) app_path = apath(app, r=request) - editor_defaults={'theme':'web2py', 'editor': 'default'} + editor_defaults={'theme':'web2py', 'editor': 'default', 'closetag': 'true'} config = Config(os.path.join(request.folder, 'settings.cfg'), section='editor', default_values=editor_defaults) preferences = config.read() @@ -589,7 +589,7 @@ def edit(): response.headers["web2py-component-flash"] = T('Preferences saved correctly') else: response.headers["web2py-component-flash"] = T('Preferences saved on session only') - response.headers["web2py-component-command"] = "update_theme('%s');update_editor('%s');jQuery('a[href=#editor_settings] button.close').click();" % (config.read()['theme'], config.read()['editor']) + response.headers["web2py-component-command"] = "update_editor('%s', '%s', '%s');jQuery('a[href=#editor_settings] button.close').click();" % (config.read()['theme'], config.read()['editor'], config.read()['closetag']) return else: details = {'filename':'settings', 'id':'editor_settings', 'force': False} diff --git a/applications/admin/settings.cfg b/applications/admin/settings.cfg index eb36ad9c..a278e05f 100644 --- a/applications/admin/settings.cfg +++ b/applications/admin/settings.cfg @@ -1,6 +1,10 @@ [DEFAULT] theme = web2py +closetag = true +editor = default [editor] theme = web2py +editor = default +closetag = true diff --git a/applications/admin/views/default/edit.html b/applications/admin/views/default/edit.html index da9c97bb..92500751 100644 --- a/applications/admin/views/default/edit.html +++ b/applications/admin/views/default/edit.html @@ -18,7 +18,6 @@ - {{if editor_settings['editor'] != 'default':}}{{pass}} @@ -45,6 +44,12 @@