Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 03:58

    greenkeeper[bot] on @octokit

    (compare)

  • 03:57

    greenkeeper[bot] on @octokit

    chore(package): update @octokit… (compare)

  • 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
Justin Meyer
@justinbmeyer
the problem you just said you'll create an issue for
in hipchat
basically ... when a child changes it's parent ... wait until the next batch for a parent to be able to update that child property
Mohamed Cherif Bouchelaghem
@cherifGsoul
hello does can.viewModel to add can-EVENT handker work only when using jquery? because it dosent work for me with zepto?
handler*
Aggelos Karalias
@mehiel
hi all.. I'm trying to 2-way bind a component's attr with a parent scope's attr.. is this the intention of https://github.com/bitovi/canjs/blob/minor/view/bindings/bindings.js#L545 ? Could something like that do the job? <my-component #par-attr-name="comp-attr-name" />Or I should implement something from scratch?
Aggelos Karalias
@mehiel
I just found it in the 2.3-pre docs
Aggelos Karalias
@mehiel
but it doesn't work 2-way.. That .getRefs() in line 559 returns an empty map which even though it's being updated correctly it doesn't reflect in parent viewModel's attr..
if I apply this patch it does work but as I'm not really aware of that Refs concept in Scope I'm not sure if that breaks something else..
@@ -537,7 +537,7 @@

         var viewModel = can.viewModel(el);
         var scope = new can.view.Scope(viewModel);
-        var refs = attrData.scope.getRefs();
+        var refs = attrData.scope.getViewModel();

         var computeData = scope.computeData(prop, {
         args: [],
Andrei Balmus
@abalmush

Gusy, please help: Is it possible to set current context to a custom attribut of the Component? just Like this:

{{#products}}
    <product productdata={{.}}></product>
{{/products}}

inside product Component I’m getting ‘[object Object]’ :(

oh forgot to tell you, I’m using stache
Aggelos Karalias
@mehiel
@abalmush try productdata="{.}"
Andrei Balmus
@abalmush
@mehiel ok thanks!
Andrei Balmus
@abalmush
@mehiel, {.} doesnt work for me, it’s just renders ‘{.}'
I just created jsfiddle to test: https://jsfiddle.net/ghdc74gx/
Aggelos Karalias
@mehiel
that's because of prod: '@'
can you remove that and try again
Andrei Balmus
@abalmush
sure one sec
yes it works now @mehiel thank you so much!!
Aggelos Karalias
@mehiel

from viewModel's doc

Prototype properties that have values of "@" are not looked up in the current viewModel

Andrei Balmus
@abalmush
allright, i used only string before so didnt have any issues, but now I need object and you save my life, thank you!
espretto
@espretto
quick question: would one produce zombie views if a components template changed? i have a large app which loads components only when needed and one parent component to manage that like so:
Component.extend({
    tag: 'oa-articles',
    leakScope: true,
    scope: {
      // articles: <model>,
      request: compute(function () {
        var scope = this;
        ArticleModel.findAll({
          categoryId: scope.attr('categoryId')
        }).then(function (articles) {
          scope.attr('articles', articles);
        });  
      })
    },
    events: {
      // request's dependency tracking for `categoryId` is only set-up when bound
      '{scope} request': function () {},

      '{scope} articles': function (ctx, evt, articles) {
        var $elem = this.element,
                tags = articles.pluck('tag');
        $.when(tags.map(function (tag) {
          return requestComponentByTag(tag);
        }).then(function () {
          $elem.html(tags.map(function (tag) {
            return '<'+tag+'></'+tag'>';
           }).join(''));
        });
      }
    }
  });
});
espretto
@espretto
i meant to write $elem.html(stache(tags.map(function (tag) { ... }).join('')));
Aggelos Karalias
@mehiel
@espretto I'm pretty confident that's not leaking.. .html() should call destroy in the included components.. I suppose a naive test is to create a destroy method in the events of an inner component and see if that's called when you replace stuff with .html()
Nezar Fadle
@nezarfadle
Hi guys , Is there any articles for newbie explain how to make the components globally available to the system and the other components as well :)
Jan Jorgensen
@ramblinjan
@nezarfadle could you give an example of what you're trying to do?
Nezar Fadle
@nezarfadle

Let's assume that I have a generic message component which is gonna display a simple message
with a title:

components/message/message.js
components/message/message.stache

var MessageModel = can.Map.extend({
title: "",
message: ""
});

can.Component.extend({
tag: 'message-widget',
viewModel: MessageModel,
template: can.view('/components/message/message.stache')
});

And I have another component called Order:

components/order/order.js
components/order/order.stache

I want the message component to be available to the order component and both of them available globally to the system or any other component calling them

dylanrtt
@dylanrtt
@nezarfadle you could make a "lib" module for example that imports all of the modules you want to be "global". Anything needing to use the message component for example could import "lib"
I'm not sure of a way to make them truly global since you would have to ensure they load first somehow
Nezar Fadle
@nezarfadle
Let me make it more clear ... In other words .. I wanna build a modular application, But I didn't know what is the right way to deal with the Modules Loader :'(
dylanrtt
@dylanrtt
Now I'm more confused... are you saying you don't know how to use a module loader? Which one are you using?
Nezar Fadle
@nezarfadle
I tried to use require.js, But I had no luck, And now I'm trying to play with steal.js, But there are too many stuff are not clear !!
Marshall Thompson
@marshallswain
@nezarfadle Have you gone through the getting started guide?
Nezar Fadle
@nezarfadle
Yes, But most of it just shows you how to build everything in on single page,, It doesn't show you how to build a modules and make them call and pass data to each other + The routing part is not that clear
dylanrtt
@dylanrtt
Passing data between modules in CanJS is usually done by passing data between Components in the template. You can even import your components in the template layer if you want. Simply importing them should register the custom tag for use.
Nezar Fadle
@nezarfadle
The problem the I'm coming from a PHP background ,, I'm just looking for example shows me how to do a very simple primitive modular app in the right way specially with Loading modules and routing :)
Any way .. I will try to do more research and I will see how .. because I feel that the problem in me ,, maybe I lack some knowledge,, Thanks guys ,, ^_^
@dylanrtt ,, tnx man .. I'm gonna take a look at it :)
dylanrtt
@dylanrtt
@nezarfadle here's are some examples of modular components with demo pages showing how they are used https://github.com/bitovi-components
place-my-order is designed to be a more complex example including more features like routing https://github.com/donejs/place-my-order
Nezar Fadle
@nezarfadle
@dylanrtt I will take a look at them ,, tnx man :+1: :+1:
Andrei Balmus
@abalmush
hey guys is there a way to writing Can.JS app with ES6?
Adam L Barrett
@BigAB
@abalmush You can use stealjs ( http://blog.bitovi.com/get-started-with-stealjs ) and then load can with es6 syntax
import can from ‘can’;
Andrei Balmus
@abalmush
great! Thank you @BigAB
Nezar Fadle
@nezarfadle

When I tried to install Steal and CanJS using Bower it didn't work perfectly, And after I made a bit of research I found out that I have to tell Bower to install a specific tag release that supports the new version of Steal.

Stuff like this must be mentioned in the documentation or better to be fixed :worried:

http://stackoverflow.com/questions/26388857/canjs-with-stealjs-0-3-0

Nezar Fadle
@nezarfadle
CanJS is gonna be more awesome if it has a command line tool to take care of generating, registering the components and ( routing if possible ) :smile:
Matthew Phillips
@matthewp
@nezarfadle We actually have a command line tool in the works, will release in about a month that helps with application initialization, has generators, etc.
Nezar Fadle
@nezarfadle
@matthewp thats's gonna be really awesome :smile: