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

Add a conditional helper to mustache (php and js)

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • 2.9
    • Themes
    • MOODLE_29_STABLE
    • MDL-50167-master
    • Hide

      Pull the entire branch, including the testing commit on the end.

      Go to the template library - at the bottom of the page there will be a list of "WIN" lines on the page. This is the result of a template that uses all these conditionals. Any line with no text, or "LOSE" is a fail for the test.

      Now click on the "core/conditional" template to see the same template rendered by javascript. The result should be identical.

      Show
      Pull the entire branch, including the testing commit on the end. Go to the template library - at the bottom of the page there will be a list of "WIN" lines on the page. This is the result of a template that uses all these conditionals. Any line with no text, or "LOSE" is a fail for the test. Now click on the "core/conditional" template to see the same template rendered by javascript. The result should be identical.

      This would be a set of generic helpers that will evaluate a conditional and either print a section, or skip it.

      Example

      {{#lt replyCount "3"}}
        "Less than 3 replies"
      {{/lt}}
      

      Full set of new conditionals are:
      eq, neq, lt, gt, lte, gte, and, or

      The arguments for these conditionals are resolved to variables in the current context by default, but strings, numbers and booleans are recognised and passed as their correct types.

            damyon Damyon Wiese
            damyon Damyon Wiese
            Ryan Wyllie Ryan Wyllie
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.