These are chat archives for canjs/canjs

16th
Oct 2015
Justin Meyer
@justinbmeyer
Oct 16 2015 18:06
    <pre>url={{ routeUrl(undefined,true) }}</pre>

    <a    {{# routeCurrent(page='home') }}class='active'{{/routeCurrent}}
        href="{{ routeUrl(page='home') }}">home</a>

    <a  {{^ routeCurrent(page='restaurants') }}href="{{routeUrl page='restaurants'}}"{{/routeCurrent}}
        >restaurants</a>

    {{#eq page 'home'}}
        <h1>Home page</h1>

    {{else}}
        <h1>Restaurants page</h1>
    {{/eq}}
I'm adding routeUrl and routeCurrent as helpers
Matthew Phillips
@matthewp
Oct 16 2015 18:09
are you talking about possible replacements for {{}} in attribute values?
meaning instead of
href="{{routeUrl page='restaurants' }}" 

href=`routeUrl page='restaurants'`
you'd still have to wrap in double quotes though
I like that it's bash-like
But readability might be worse
with ```
"`foo`"
harder to see than the braces
Justin Meyer
@justinbmeyer
Oct 16 2015 18:15
yeah, this isn't something we'd do probably for a super long time
I'm more looking to discuss:
<a    {{^ routeCurrent(page='home') }}
            href="{{ routeUrl(page='home') }}"
        {{/routeCurrent}}
        >home</a>
which I think is pretty cool
also
    <a  {{^routeCurrent page='restaurants'}}
            href="{{routeUrl page='restaurants'}}"
        {{/routeCurrent}}
        >restaurants</a>
works
which is sweet
I'm thinking of a helper like
<a {{routeUrlIfNotCurrent page='restaurants'}}>
could use this stuff a bit
<a {{routeAddClassIfActive page='restaurants'}}>
Matthew Phillips
@matthewp
Oct 16 2015 18:24
so what becomes of can.view.attrs
i would use one in that case
  • would have before I mean
Justin Meyer
@justinbmeyer
Oct 16 2015 19:39
<pre>url={{ routeUrl(undefined,true) }}</pre>

<a    {{^ routeCurrent(page='home') }}
        href="{{ routeUrl(page='home') }}"
    {{/routeCurrent}}
    >home</a>

<a  {{^routeCurrent page='restaurants'}}
        href="{{routeUrl page='restaurants'}}"
    {{/routeCurrent}}
    >restaurants</a>

{{#eq page 'home'}}
    <h1>Home page</h1>
{{else}}
    <h1>Restaurants page</h1>
{{/eq}}
@matthewp nothing becomes of it
<pre>url={ routeUrl(undefined,true) }</pre>

<a {^ routeCurrent(page='home') }
        href="{ routeUrl(page='home') }"
    {/routeCurrent}
    >home</a>

<a {^routeCurrent page='restaurants'}
        href="{routeUrl page='restaurants'}"
    {/routeCurrent}
    >restaurants</a>

{#eq page 'home'}
    <h1>Home page</h1>
{else}
    <h1>Restaurants page</h1>
{/eq}