Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50166

Add a way to pass arguments to mustache helpers (php and js)

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.9
    • None
    • Themes
    • MOODLE_29_STABLE
    • MDL-50166-master
    • Hide

      Checkout each of the branches mentioned below - run the unit tests for each of the projects (mustache.php and mustache.js).

      Checkout this branch - view the template library - make sure all existing templates still work.

      (There will be more issues blocked by this that verify the new behaviour).

      Show
      Checkout each of the branches mentioned below - run the unit tests for each of the projects (mustache.php and mustache.js). Checkout this branch - view the template library - make sure all existing templates still work. (There will be more issues blocked by this that verify the new behaviour).

    Description

      right now - a helper will only receive the block of text from a section.

      Handlebars, (and others) allow helpers to receive arguments - e.g.

      str error filenotfound
      vs
      #str}}error filenotfound{{/str

      if we want to implement a conditional helper it will require this
      e.g.
      #if contextvara "eq" "5"
      /if

      This allows us to have presentation logic in the templates, which will make the templates more re-usable.

      Attachments

        Issue Links

          Activity

            People

              damyon Damyon Wiese
              damyon Damyon Wiese
              Ryan Wyllie Ryan Wyllie
              Huong Nguyen, Bas Brands, Mathew May
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: