Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 20 21:04
    m-mujica commented #5303
  • Sep 20 20:23
    m-mujica opened #5303
  • Sep 20 20:23

    m-mujica on upgrade-deps

    Update can-type and can-stache-… (compare)

  • Sep 20 20:05
    m-mujica edited #5302
  • Sep 20 20:03
    m-mujica synchronize #5302
  • Sep 20 20:03

    m-mujica on upgrade

    Upgrade routing guide to Can 6 Fix incorrect highlight Use svg images (instead of .png) (compare)

  • Sep 20 19:32
    m-mujica opened #5302
  • Sep 20 19:29

    m-mujica on upgrade

    Upgrade routing guide to Can 6 Fix incorrect highlight (compare)

  • Sep 20 17:42

    m-mujica on upgrade

    WIP: Upgrade (compare)

  • Sep 20 17:06
    do-adams starred canjs/canjs
  • Sep 20 13:34

    chasenlehara on 5119-testing-guide

    Update the Testing guide for Ca… (compare)

  • Sep 20 13:21
    cherifGsoul commented #5295
  • Sep 20 13:18
    cherifGsoul synchronize #5295
  • Sep 20 13:18

    cherifGsoul on update-theme-new-buttons

    Theme pre-release 2 (compare)

  • Sep 20 10:29

    greenkeeper[bot] on socket.io-client-2.3.0

    (compare)

  • Sep 20 10:26

    greenkeeper[bot] on socket.io-client-2.3.0

    chore(package): update socket.i… (compare)

  • Sep 20 06:40
    HellMagic starred canjs/canjs
  • Sep 19 20:42
    m-mujica commented #5119
  • Sep 19 18:40
    phillipskevin closed #5300
  • Sep 19 18:40
    phillipskevin commented #5300
Julian
@pYr0x
better use the define plugin... getter and setter
for making sideeffects
Christopher Oliphant
@RALifeCoach
The first suggestion didn’t work.
    can.Component.extend({
        tag: 'feature-icon',
        template: can.view('/modules/components/feature-icon/feature-icon.stache'),
        viewModel: can.Map.extend({
            hasMedia: false
        }),
        events: {
            '{viewModel} hasMedia': function () {
                debugger;
            }
        }
    });
Julian
@pYr0x
and how do you change hasMedia?
please notice, that the viewModel is an external var
Christopher Oliphant
@RALifeCoach
It is contained within another component and set by the parent when the data changes.
In debug, when I examine the component, I can see the value in the attribute has changed, but I don’t see the change within the component.
    var Model = can.Map.extend({
        define: {
            hasMedia: {
                type: 'boolean',
                set: function () {
                    debugger;
                }
            }
        }
    });
    can.Component.extend({
        tag: 'feature-icon',
        template: can.view('/modules/components/feature-icon/feature-icon.stache'),
        viewModel: Model
    });
Christopher Oliphant
@RALifeCoach
Still no luck
BTW, I included can/stache/system, but <can-import> didn’t work
Julian
@pYr0x
how do you mean , inclueded can/stache/system?
how do you use canjs?
AMD?
global?
Christopher Oliphant
@RALifeCoach
global
Julian
@pYr0x
and how could you include can/stache/system ?
Christopher Oliphant
@RALifeCoach
so when I built the custom file, I included can/stache/system
Mohamed Cherif Bouchelaghem
@cherifGsoul
I think a dependency manager (steal,requirejs,webpack) is required to use can/stache/system
Julian
@pYr0x
ok
Christopher Oliphant
@RALifeCoach
@cherifGsoul any suggestions on my delema
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach I didnt follow from the bginning
:/
Christopher Oliphant
@RALifeCoach

okay - I have a component:

<feature-icon type="article" types="articles" 
                                  isActive="{{isActive}}" 
                                  hasMedia="{{hasMediaContent('articles')}}" 
                                  profilesURL="options.profilesURL"></feature-icon>

with the component defined as:

    var Model = can.Map.extend({
        define: {
            hasMedia: {
                type: 'boolean',
                set: function () {
                    debugger;
                }
            }
        }
    });
    can.Component.extend({
        tag: 'feature-icon',
        template: can.view('/modules/components/feature-icon/feature-icon.stache'),
        viewModel: Model
    });

The debugger is never called

I know the value in hasMedia is initially set to false and is later set to true
Mohamed Cherif Bouchelaghem
@cherifGsoul
use has-mediaas attribute in the component
Christopher Oliphant
@RALifeCoach
The attribute value never seems to get changed in the viewModel
Mohamed Cherif Bouchelaghem
@cherifGsoul
change it to what I sugget
<feature-icon type="article" types="articles" 
                                  is-active="{{isActive}}" 
                                  has-media="{{hasMediaContent('articles')}}" 
                                  profiles-URL="options.profilesURL"></feature-icon>
Christopher Oliphant
@RALifeCoach
Thanks - that was all it took
Mohamed Cherif Bouchelaghem
@cherifGsoul
works?
Christopher Oliphant
@RALifeCoach
It is better, not sure if all is working yet
Julian
@pYr0x
@cherifGsoul great job :)
Veni vidi vici
:clap:
Mohamed Cherif Bouchelaghem
@cherifGsoul
thank you I dont know if those points exist in the docs
Christopher Oliphant
@RALifeCoach
Yes - it is working now. the attribute is has-media, but when I use it in the stache file it is hasMedia. A bit confusing.
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach it'scanjs recommandation properties camel cased like hasMediaand template attributes hypenated like has-media
dont be confused bro :)
Christopher Oliphant
@RALifeCoach
I am easily confused. (And I am having a lot of fun.)
I just hope I am not being too much of a bother. I really appreciate all the assistance I am getting from folks here.
Matthew Phillips
@matthewp
Every time I come here and see 50+ recent messages i'm terrified but mostly excited :)
CanJS is blowing up!
Mohamed Cherif Bouchelaghem
@cherifGsoul
@matthewp we are the night watch :D
but it's the efternoon here
Matthew Phillips
@matthewp
hehe
Christopher Oliphant
@RALifeCoach
Me again. I am trying to access the view model from an event.
the view model has a function, the events tries:
this.viewModel.vmFunction();
The message is vmFunction is not a function