func BeforeTransition(repo *model.Repo) jqeventrouter.HandlerFunc {
	return func(_ *jquery.Event, ui *js.Object, _ url.Values) bool {
		log.Debugf("index handler")
		container := jQuery(ui.Get("toPage"))
		// container := jQuery(":mobile-pagecontainer")

		tmpl, err := deckListTemplate()
		if err != nil {
			log.Printf("Failed to read/parse desk list template: %s", err)
			return false
		}

		go func() {
			decks, err := repo.DeckList(context.TODO())
			if err != nil {
				if kivik.StatusCode(err) == kivik.StatusNotFound {
					jQuery("#deck-list", container).SetHtml("Please synchronize")
					jQuery(".show-until-load", container).Hide()
					jQuery(".hide-until-load", container).Show()
					return
				}
				log.Printf("Failed to read deck list: %s", err)
			}

			buf := &bytes.Buffer{}
			if err := tmpl.Execute(buf, decks); err != nil {
				log.Printf("Failed to execute template: %s", err)
				return
			}

			jQuery("#deck-list", container).SetHtml(buf.String())
			jQuery(".show-until-load", container).Hide()
			jQuery(".hide-until-load", container).Show()
		}()
		return true
	}
}
// BeforeTransition loads the index for display.
BeforeTransition loads the index for display.
// BeforeTransition loads the index for display .
func BeforeTransition(repo *model.Repo) jqeventrouter.HandlerFunc {
	return func(_ *jquery.Event, ui *js.Object, _ url.Values) bool {
		log.Debugf("index handler")
		container := jQuery(ui.Get("toPage"))
		tmpl, err := deckListTemplate()
		if err != nil {
			log.Printf("Failed to read/parse desk list template: %s", err)
			return false
		}
		go func() {
			decks, err := repo.DeckList(context.TODO())
			if err != nil {
				if kivik.StatusCode(err) == kivik.StatusNotFound {
					jQuery("#deck-list", container).SetHtml("Please synchronize")
					jQuery(".show-until-load", container).Hide()
					jQuery(".hide-until-load", container).Show()
					return
				}
				log.Printf("Failed to read deck list: %s", err)
			}
			buf := &bytes.Buffer{}
			if err := tmpl.Execute(buf, decks); err != nil {
				log.Printf("Failed to execute template: %s", err)
				return
			}
			jQuery("#deck-list", container).SetHtml(buf.String())
			jQuery(".show-until-load", container).Hide()
			jQuery(".hide-until-load", container).Show()
		}()
		return true
	}
}
func BeforeTransition ( repo * model . Repo ) jqeventrouter . HandlerFunc { return func ( _ * jquery . Event , ui * js . Object , _ url . Values ) bool { log . Debugf ( " " ) container := jQuery ( ui . Get ( " " ) ) tmpl , err := deckListTemplate ( ) if err != nil { log . Printf ( " " , err ) return false } go func ( ) { decks , err := repo . DeckList ( context . TODO ( ) ) if err != nil { if kivik . StatusCode ( err ) == kivik . StatusNotFound { jQuery ( " " , container ) . SetHtml ( " " ) jQuery ( " " , container ) . Hide ( ) jQuery ( " " , container ) . Show ( ) return } log . Printf ( " " , err ) } buf := & bytes . Buffer { } if err := tmpl . Execute ( buf , decks ) ; err != nil { log . Printf ( " " , err ) return } jQuery ( " " , container ) . SetHtml ( buf . String ( ) ) jQuery ( " " , container ) . Hide ( ) jQuery ( " " , container ) . Show ( ) } ( ) return true } }
BeforeTransition loads the index for display.
BeforeTransition loads the index for display .
// container := jQuery(":mobile-pagecontainer")