Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Apr 27 18:34

    dependabot[bot] on npm_and_yarn

    (compare)

  • Apr 27 18:34
    dependabot[bot] closed #46
  • Apr 27 18:34
    dependabot[bot] commented #46
  • Apr 27 18:34
    dependabot[bot] labeled #47
  • Apr 27 18:34
    dependabot[bot] opened #47
  • Apr 27 18:34

    dependabot[bot] on npm_and_yarn

    Bump async from 0.2.9 to 2.6.4 … (compare)

  • Apr 27 18:34

    dependabot[bot] on npm_and_yarn

    (compare)

  • Apr 27 18:34
    dependabot[bot] closed #186
  • Apr 27 18:34
    dependabot[bot] commented #186
  • Apr 27 18:34
    dependabot[bot] labeled #187
  • Apr 27 18:34
    dependabot[bot] opened #187
  • Apr 27 18:34

    dependabot[bot] on npm_and_yarn

    Bump async from 2.6.0 to 2.6.4 … (compare)

  • Apr 13 00:00
    dependabot[bot] labeled #46
  • Apr 13 00:00
    dependabot[bot] opened #46
  • Apr 13 00:00
    dependabot[bot] labeled #186
  • Apr 13 00:00

    dependabot[bot] on npm_and_yarn

    Bump async from 0.2.9 to 3.2.2 … (compare)

  • Apr 13 00:00
    dependabot[bot] opened #186
  • Apr 13 00:00

    dependabot[bot] on npm_and_yarn

    Bump async from 2.6.0 to 3.2.2 … (compare)

  • Feb 28 21:02
    sabymike closed #7
  • Jan 15 01:01
    dependabot[bot] labeled #45
v1rt
@v1rt
I posted this question in Backbone channel thinking that there might be non-ampersand devs on that channel.
Good evening folks. We're using backbonejs, marionette and ampersand state. I was tasked replace internationalization/localization that my teammate wrote from scratch. 5 years ago, I used i18next on a jquery/php project. I'd like to know which library I should use this time. I'd like something that is easy to implement. I'd like to be able to just update a json file rather than changing or assigning values during runtime(like what my teammate did).
v1rt
@v1rt
Does this mean we are not using BackboneJS nor Ampersand but rather Backbone.Marionette? This is from our package.json
    "ampersand-router": "^3.0.2",
    "backbone.marionette": "^2.4.4",
    "bluebird": "^3.3.4",
    "lodash": "^4.17.4",
    "marionette.component": "0.0.1",
    "moment": "^2.14.1",
Richard Butler
@RickButler
@v1rt do you use a templating library (handlebars, mustache, jade, etc)? Some have i18n plugins. If you use static html files, you could make them into handlebars files for example, and then precompile them back to static html with your replacement values from json.
@doerrie I just looks like a test coverage error, I wouldn't worry about it. Open an issue if you are concerned. Personally I would use the cli generated project as an example, a lot of the refs are out of date. The server side stuff (hapi, express) is nothing like what you would use in production imo.
Richard Butler
@RickButler
@doerrie wouldn't* use the cli generated project
v1rt
@v1rt
hi @RickButler , yes we do use handlebars
we import the template in every component using import. Here is one of our components called Status
import {LayoutView} from 'backbone.marionette';
import template from './template';

export default LayoutView.extend({

  modelEvents: {
    change: 'render'
  },

  template: template,

  templateHelpers() {
    return this.model.toJSON();
  }

});
Richard Butler
@RickButler
@v1rt there are i18n plugins for handlebars, if you are using require.js there is a i18n plugin for it too. If I was writing it, I would precompile the the internationalization part, so you would have seperate templates per language. I don't know how your system is setup though, so that may not be feasible.
hsimah
@hsimah
when I hit save() on my ampersand-model the derived and children fields are posted to the api along with the props. is there a way to stop this happening? I have a projectId prop and a project is one of the model's children. I only want to send the projectId to the api on save, not the project model
Richard Butler
@RickButler
@hsimah derived fields shouldn't be going by default. If you want to change what gets sent you can overwrite the serialize method.
hsimah
@hsimah
@RickButler you're right, the derived fields aren't being submitted. only the children and collections. I will look at the serialize method.
hsimah
@hsimah
many thanks
v1rt
@v1rt
@RickButler I learned yesterday that they want to get rid of handlebars and instead just use ES6 template literals/strings
Richard Butler
@RickButler
@v1rt something like http://i18n-tag.kolmer.net would work then.
Template literals doesn't come with some of the logicalutility functions that handlebars does. You will have to build your own, or use something like that project I linked where someone has done it already
v1rt
@v1rt
Thank you @RickButler
v1rt
@v1rt
This is the reason why I always join forums/irc/chats like this. People are very helpful and most of them have already done projects similar to what I'm looking for. The team I am on does not listen to me. They would rather write it from scratch. Sigh! :( Our app was delayed for 18 months because it was overly engineered by devs who claimed they know what they're doing. On the start of the project, I already told them they're making it too intelligent and I'm sure it's going to hurt us in the future. And today, we're f*ck'd up very badly and we are now slowly implementing what I suggested 18 months ago. LMAO!
hsimah
@hsimah
@v1rt I know the feeling. engineering manager on one of our apps "didn't believe" in client side frameworks so we had to do it ourselves. it's one of the worst messes i've ever seen. what takes seconds in ampersand, backbone or angular takes a day in our code. It's embarrassing.
Richard Butler
@RickButler
@v1rt delivering is a feature as they say.
v1rt
@v1rt
yup :)
Gennaro Landolfi
@rinodrummer
Hi guys, I've got a question: is possible to integrate Ampersand in Electron.
*?
Samuil Gospodinov
@samuil4_twitter
Yes, you can use ampersand with any framework. Personally I use Ampersand model in all of my angular projects.
Gennaro Landolfi
@rinodrummer
Thanks!
Jeremy Connor
@LordSyntax
Quick question, is it possible to set props from the view which is calling renderCollection on the collection views themselves? I have a view which calls renderCollection on a given collection, but I need to set a prop so that I can bind to it's values on the inner collections views; I can't see a way of passing the prop to the individual item views..
Richard Butler
@RickButler
@LordSyntax you can pass in values from renderCollection by using viewOptions. But if you want to keep the property in sync between the top level view and the collection views you will need to wrap that value in a model or state object. If you pass it in just as a value that the collection views have props for, the view will pick up the value but not a reference. This means a change in the parent view's value won't be reflected in the collection view. If you place your value in model or state object in the parent view and pass that in viewOptions it will be a reference to the same object and track your changes.
I will take a look and see if I can find a simpler solution. But if you want to track changes in both the parent and collection views you need to store it in state or a model. If you don't then just declare it as a prop on the collection view and pass it in with viewOptions.
Jeremy Connor
@LordSyntax
Perfect; thank you very much @RickButler
Jeremy Connor
@LordSyntax
Anyone know if it is possible to create a binding to a collection; I have a prop for my view of type object; which has a reference to an ampersand collection passed into it.. I want my view to bind to the collection; so that any changes to the collection trigger a custom function to run updating the UI. I'm currently using this.listenTo in an initialize method on a variety of events (e.g. add/remove/reset), but I'd rather use binding if that is possible.
Richard Butler
@RickButler
@LordSyntax all you can really do is propogate the events youself either by adding your own listeners like you said, or you can bubble everything by copying what _initChildren does javascript this.listenTo(this[child], 'all', this._getCachedEventBubblingHandler(child));
I don't recommended that though because this._getCachedEventBubblingHandler is a private method and breaking changes to it might not result in a semver major bump because it is marked as private.
If you are storing it as an object type in state or session, you might consider converting it to state, you would get bubbling for free then.
Richard Butler
@RickButler
*storing it as an object type in props or session
Jeremy Connor
@LordSyntax
Interesting, thank you! I'll stick with the listenTo approach for now!
v1rt
@v1rt
Is it ok to ask regarding ampersand-state and webpack?
Anyways, I'll post it because someone might know :)

My friend told me that when constructor is used in a function, Webpack spits out an error on the console saying Uncaught TypeError: _WEBPACK_IMPORTED_MODULE_0_ thatmodule__.a is not a constructor. He showed me the error. He said, in order to fix it, the word constructor should be replaced with initialize. The module being used and exported is ampersand-state and it's in src/profile/index.js.

import State from 'ampersand-state';
export default State.extend({......
// blah blah, code removed for clarity

Then on the outer index.js(not src/profile/index.js), the code is

import Profile from 'src/profile';
export default module.exports = Profile;

What are your thoughts on the constructor issue?

Richard Butler
@RickButler
@v1rt I would have to set something up to repro, I don't think that's ampersand, I think you need to set up webpack to treat that as a
A commonjs import
Maybe webpack is trying to treat that as an es6 class when it isn't
Richard Butler
@RickButler
export default module.exports = Profile; that line doesn't make any sense.
I saw the error when I was playing around, but once I used the correct export syntax it went away.
v1rt
@v1rt
got it
good morning @RickButler :) that's what I see in our code :worried:
let me double check to make sure i'm telling the truth
yes it's what I see
Richard Butler
@RickButler
@v1rt yeah it should be one or the other not both, since you are using es6 style imports, you should be using es6 style exports.
v1rt
@v1rt
ok
the dev even added a comment before it saying "will both work in es6 and commonjs"
Richard Butler
@RickButler
You are using webpack so it really doesn't matter. Webpack can understand either.