Giter Club home page Giter Club logo

meteor-astronomy-examples's People

Contributors

darko-mijic avatar lukejagodzinski avatar sanderdatema avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

meteor-astronomy-examples's Issues

How to get the parent doc ?

const DiscountCodes = Class.create({
    name: 'DiscountCodes',
    fields: {
        percent: {
            type: Number,
            default:1,
            validators: [{
                    type: 'gte',
                    resolveParam(args) {
                    return parent(args.doc,level);
                }
            }]
        },
});

export const Widgets = Class.create({
    name: 'Widgets',
    collection: new Mongo.Collection('widgets'),
    behaviors: ['timestamp'],
    fields: {
        discountCodes:{
            type: [DiscountCodes],
            default: function () {
                return []
            }

        },
    },

});

Form Helper Label

For forms, I would like to make a helper, e.g. inputElement, so I can use it like this:

{{> input field='firstName'}}
  <div>
    <label for="firstName">First name {{HERE}}</label>
    <input id="firstName" type="text" value="{{firstName}}" class="{{#if hasError 'firstName'}}error{{/if}}" />
  </div>
  {{#if hasError 'firstName'}}
    <div class="error">{{getError 'firstName'}}</div>
  {{/if}}

Inside, I would like to have a Label (instead of First name), taken from the object. So, that I don't need to pass it to create input, edit input. How can this be done?

Error Instalation

W20150915-16:31:03.427(7)? (STDERR) /Users/user/.meteor/packages/meteor-tool/.1.1.3.dzw9kd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150915-16:31:03.427(7)? (STDERR)                         throw(ex);
W20150915-16:31:03.427(7)? (STDERR)                               ^
W20150915-16:31:03.484(7)? (STDERR) TypeError: Object #<Object> has no method 'findInClass'
W20150915-16:31:03.484(7)? (STDERR)     at Object.Astro.utils.findBehavior (packages/jagi:astronomy-behaviors/lib/module/utils.js:2:1)
W20150915-16:31:03.484(7)? (STDERR)     at Function.checks.added (packages/jagi:astronomy-behaviors/lib/module/init_class.js:31:1)
W20150915-16:31:03.484(7)? (STDERR)     at Function.methods.addBehavior (packages/jagi:astronomy-behaviors/lib/module/init_class.js:69:1)
W20150915-16:31:03.484(7)? (STDERR)     at Function.<anonymous> (packages/jagi:astronomy-behaviors/lib/module/init_class.js:87:1)
W20150915-16:31:03.484(7)? (STDERR)     at Array.forEach (native)
W20150915-16:31:03.485(7)? (STDERR)     at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
W20150915-16:31:03.485(7)? (STDERR)     at Function.methods.addBehaviors (packages/jagi:astronomy-behaviors/lib/module/init_class.js:86:1)
W20150915-16:31:03.485(7)? (STDERR)     at Function.onInitClass (packages/jagi:astronomy-behaviors/lib/module/init_class.js:117:1)
W20150915-16:31:03.485(7)? (STDERR)     at packages/jagi:astronomy/lib/core/class.js:81:1
W20150915-16:31:03.485(7)? (STDERR)     at packages/jagi:astronomy/lib/core/events.js:55:1

How to ensure security in Meteor methods

In the example, the Meteor methods doesn't check the type of the argument passed in:

Meteor.methods({
  '/user/save': function(user) {
    if (user.validate()) {
      user.save();
      return user;
    }
  }
};

In such case, I feel the client could easily trick the system by defining the custom user object. Of course this is just a toy example that is not full-fledged, but I'm wondering if there is a way to ensure that the user object passed in is in desired format.

I'm now thinking of check the argument with user instanceof User. Is that sufficient?

Thanks.

Misleading name of the variable

I think that the name of the variable user is misleading for understanding this example.

Template.Form.events({
  'change input': function(e, tmpl) {
    var user = this;

    var field = e.currentTarget;
    user.set(field.id, field.value);
    user.validate(field.id);
  }
});

Variable user is mapped to current data context of the template instance. So it is assigned to User, Address or Phone Astro class since this example is handling change input event on Form template level so it is handling that event for nested templates AddressForm and PhoneForm also which have different data context.

[FR] React example

Given all the traction react gets, it would be great to see first-class-citizen react support (react counterparts of the spacebars helpers etc) and accompanying examples.

I'm not yet familiar with react but I'll soon be starting yet another meteor project with which I really want to give react and astronomy a go. I had been waiting for [email protected] for a few months now and I'm excited to try the astronomy+react combo.

Submit button does not work

Steps to reproduce:

  1. git clone https://github.com/jagi/meteor-astronomy-examples.git
  2. cd meteor-astronomy-examples
  3. meteor npm install
  4. meteor
  5. In the UI, press the + button
  6. fill out form with valid data (no phone numbers)
  7. press submit
  8. nothing happens.

Let me know what other details I should provide, thanks!.

valueAsDate not supported in Firefox?

It seems that valueAsDate is not supported in Firefox (evidence here and here ). Therefore, in Firefox, the program will always think that the birth date is wrong.

Do you think this is a strong enough reason to switch to another way of converting the date input to a Date() object? I'm concerned that people will try this example in Firefox, and decide that Astronomy is broken when they try to submit the form and it does not work.

Let me know what you think, thanks!

Flowrouter integration

I was trying to integrate this example in one of my project features but I use flow-router with template level subscriptions.
I could not put it to work because I can't get the object data in the events method save.
Moreover with the reactivevar (curValue) i cannot access getValidationErrors et. al..somehow they do not come with the submit.

Is there any issues with Flowrouter when working with this? Any reference I could check besides the flowrouter wiki?

Thank you in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.