From b015d16810499989fdea9a7d696a7072fe7e552e Mon Sep 17 00:00:00 2001 From: Leigh B Stoller Date: Thu, 27 Feb 2014 14:03:03 -0700 Subject: [PATCH] Add a double click handler so render the instructions when editing/creating a profile. --- www/aptui/js/manage_profile.js | 15 +++++++++++++-- www/aptui/manage_profile.php | 25 ++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/www/aptui/js/manage_profile.js b/www/aptui/js/manage_profile.js index dfde7e9c4..8e9a71009 100644 --- a/www/aptui/js/manage_profile.js +++ b/www/aptui/js/manage_profile.js @@ -2,7 +2,7 @@ window.APT_OPTIONS.config(); require(['jquery', 'js/quickvm_sup', // jQuery modules - 'bootstrap','filestyle'], + 'bootstrap','filestyle','marked'], function ($, sup) { 'use strict'; @@ -118,6 +118,17 @@ function ($, sup) ChangeHandlerAux("description"); }); + /* + * A double click handler that will render the instructions + * in a modal. + */ + $('#profile_instructions').dblclick(function() { + var text = $(this).val(); + var marked = require("marked"); + $('#renderer_modal_div').html(marked(text)); + sup.ShowModal("#renderer_modal"); + }); + /* * If editing, need to suck the description and instructions * out of the rspec and put them into the text boxes. But @@ -136,7 +147,7 @@ function ($, sup) else { /* * Not editing, so disable the text boxes until we get - * an rspec. + * an rspec via the file chooser. */ $('#profile_instructions').prop("disabled", true); $('#profile_description').prop("disabled", true); diff --git a/www/aptui/manage_profile.php b/www/aptui/manage_profile.php index c9ff180ec..920957fa0 100644 --- a/www/aptui/manage_profile.php +++ b/www/aptui/manage_profile.php @@ -273,7 +273,8 @@ function SPITFORM($formfields, $errors) class='form-control' placeholder='' type='textarea'>", - "Briefly describe how to use this profile after it starts"); + "Briefly describe how to use this profile after it starts. ". + "Double click to see it rendered."); $formatter("profile_listed", "Listed?", "
@@ -369,6 +370,28 @@ function SPITFORM($formfields, $errors)
\n"; + echo " + \n"; + echo "\n"; -- GitLab