File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,9 @@ $( window ).unload(function() {
313
313
314
314
//Happens after refresh
315
315
//confused about when this happens exactly
316
+
317
+ // TODO: Refactoring. This function contains code that exists elsewhere (see addToSandwich). Is it wise to have
318
+ // buttons within an each() loop?
316
319
function reloadSandwich ( ) {
317
320
console . log ( "Reloading sandwich menu..." ) ;
318
321
var sidebarHTML = localStorage . getItem ( 'sidebarHTML' ) ;
@@ -327,9 +330,14 @@ function reloadSandwich () {
327
330
if ( currId . length == 1 ) {
328
331
//It's a subgoal
329
332
//console.log("subgoal");
330
- sidebarBody ( ) . find ( "#sideSubgoal" + currId ) . unbind ( "click" ) . click ( function ( ) {
333
+ sidebarBody ( ) . find ( "#sideSubgoal" + currId ) . unbind ( "click" ) . click ( function ( ) {
334
+ var subArr = getSubgoalArrayFromLocal ( ) ; // in case something changes before the button is clicked
335
+ // do not enter drawSubgoal with a different id until the current subgoal is saved
336
+ if ( statusIsTrue ( "gotSubgoalQuestions" ) || currId == subArr . length ) {
331
337
drawSubgoal ( currId ) ;
332
- } ) ;
338
+ }
339
+ sideSubgoalExpandy ( currId , 0 ) ;
340
+ } ) ;
333
341
//todo: add collapse onclick function here.
334
342
}
335
343
You can’t perform that action at this time.
0 commit comments