internal links in procedure
This commit is contained in:
@@ -21,9 +21,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="titles_read" class="step_box round hide">
|
||||
<p class="read_title"><span id="titles_read_title"></span></p>
|
||||
<p class="read_title"><span id="title_read" class="read"></span></p>
|
||||
<p class="read_details">Créé par <span id="titles_read_user"></span> (<span id="titles_read_company"></span>) le <span id="titles_read_led"></span></p>
|
||||
<p class="read_description"><span id="titles_read_description"></span></p>
|
||||
<p class="read_description"><span id="description_read" class="read"></span></p>
|
||||
</div>
|
||||
<div id="procedure_steps"></div>
|
||||
<div class="proc_menu" id="bottom_menu">
|
||||
@@ -45,7 +45,10 @@
|
||||
<td colspan="2" class="step_nb_box">Étape <span id="step_nb"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="step_margin"><textarea id="step_text" name="step_text" class="round"></textarea></td>
|
||||
<td class="step_margin">
|
||||
<textarea id="step_text" name="step_text" class="round"></textarea>
|
||||
<div id="step_text_read" class="read textarea round"></div>
|
||||
</td>
|
||||
<td class="image_box_container">
|
||||
<div id="step_images"></div>
|
||||
<div id="step_images_thumbs"></div>
|
||||
@@ -148,18 +151,14 @@ function resizeDescription()
|
||||
|
||||
function setDisplay(sNewMode)
|
||||
{
|
||||
//On page first load
|
||||
var sOldMode = databap.vars.mode;
|
||||
if(!sOldMode || sOldMode=='')
|
||||
{
|
||||
sOldMode = (sNewMode=='read')?'edit':'read';
|
||||
}
|
||||
sNewMode = sNewMode || '';
|
||||
|
||||
//On page first load
|
||||
if(sOldMode=='') sOldMode = (sNewMode=='read')?'edit':'read';
|
||||
|
||||
//default behaviour : switch to alternative display
|
||||
if(!sNewMode)
|
||||
{
|
||||
sNewMode = (sOldMode=='read')?'edit':'read';
|
||||
}
|
||||
if(!sNewMode) sNewMode = (sOldMode=='read')?'edit':'read';
|
||||
|
||||
//Set new Display
|
||||
if(sNewMode!=sOldMode)
|
||||
@@ -167,14 +166,11 @@ function setDisplay(sNewMode)
|
||||
var sDisabled;
|
||||
|
||||
//Set read mode data
|
||||
if(sNewMode=='read')
|
||||
{
|
||||
syncReadModeData();
|
||||
}
|
||||
if(sNewMode=='read' && databap.vars.mode!='') syncReadModeData();
|
||||
|
||||
//Hide / show boxes
|
||||
var $EditBoxes = databap.getMainElem('.uploader_box, .step_buttons, #add_step, #submit_procedure, #titles_edit');
|
||||
var $ReadBoxes = databap.getMainElem('#share, #titles_read');
|
||||
var $EditBoxes = databap.getMainElem('.uploader_box, .step_buttons, #add_step, #submit_procedure, #titles_edit, textarea[id$="step_text"]');
|
||||
var $ReadBoxes = databap.getMainElem('#share, #titles_read, div[id$="step_text_read"]');
|
||||
|
||||
switch(sNewMode)
|
||||
{
|
||||
@@ -210,13 +206,14 @@ function setDisplay(sNewMode)
|
||||
|
||||
function syncReadModeData()
|
||||
{
|
||||
//Title & description
|
||||
var $EditBox = databap.getMainElem('#titles_edit');
|
||||
var $ReadBox = databap.getMainElem('#titles_read');
|
||||
$ReadBox.find('#titles_read_title').text($EditBox.find('#title').val());
|
||||
$ReadBox.find('#titles_read_description').text($EditBox.find('#description').val());
|
||||
|
||||
//Steps
|
||||
$('.read').each(function()
|
||||
{
|
||||
$This = $(this);
|
||||
var sEditValue = $('#'+$This.attr('id').substr(0, $This.attr('id').length - '_read'.length)).val();
|
||||
var sReadValue = sEditValue.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
||||
$This.html(sReadValue);
|
||||
});
|
||||
databap.feedback('warning', 'Le formattage du texte reviendra lors de la validation');
|
||||
}
|
||||
|
||||
function setThumbnails(bShow)
|
||||
@@ -288,7 +285,7 @@ function getImageUrl(sImageName, bThumbnail)
|
||||
return sImageUrl;
|
||||
}
|
||||
|
||||
function addStep(stepId, sPosition, sDesc)
|
||||
function addStep(stepId, sPosition, sDesc, sFormatedDesc)
|
||||
{
|
||||
//Set Step Count
|
||||
iCurrentStep = '0';
|
||||
@@ -298,6 +295,7 @@ function addStep(stepId, sPosition, sDesc)
|
||||
|
||||
//Add Step text
|
||||
if(sDesc) $step.find('#step_text').val(sDesc);
|
||||
if(sFormatedDesc) $step.find('#step_text_read').html(sFormatedDesc);
|
||||
|
||||
//Insert new step before this step
|
||||
$step.find('#insert_step_before').click
|
||||
@@ -449,7 +447,6 @@ function saveProcedure()
|
||||
|
||||
databap.addSuccessBefore('La procédure est enregistrée', '#bottom_menu');
|
||||
databap.addSuccessIcon();
|
||||
//setDisplay('read');
|
||||
|
||||
//Unblock exit & go
|
||||
databap.tmp('started', false);
|
||||
@@ -507,7 +504,7 @@ function loadProcedure(iProcId, fOnSuccess)
|
||||
proc_info.steps,
|
||||
function(iStepId, sStepDesc)
|
||||
{
|
||||
iDisplayedStepId = addStep(false, false, sStepDesc.description);
|
||||
iDisplayedStepId = addStep(false, false, sStepDesc.description, sStepDesc.formated_description);
|
||||
|
||||
//Image
|
||||
if(iStepId in proc_info.images)
|
||||
@@ -544,10 +541,15 @@ function loadProcedure(iProcId, fOnSuccess)
|
||||
);
|
||||
}
|
||||
|
||||
//TODO delete this silly function and rethink the whole thing
|
||||
function addExtraReadElements(data)
|
||||
{
|
||||
debug(data);
|
||||
|
||||
//Add extra read-mode data
|
||||
$ReadTitles = databap.getMainElem('#titles_read');
|
||||
$ReadTitles.find('#title_read').text(data.title);
|
||||
$ReadTitles.find('#description_read').text(data.description);
|
||||
$ReadTitles.find('#titles_read_user').text(data.name);
|
||||
$ReadTitles.find('#titles_read_company').text(data.company);
|
||||
$ReadTitles.find('#titles_read_led').text(data.led);
|
||||
|
||||
Reference in New Issue
Block a user