vojtajina / helpdesk-client

Helpdesk application - simple JS client, written in angularjs, working with REST service
www.angularjs.org
59 stars 23 forks source link

Disable sending empty ticket / project #10

Open alenkacz opened 13 years ago

alenkacz commented 13 years ago

But I am afraid you are not going to like it. Also ... not sure, that this is the right way to test, that resource was not added (and XHR request was not fired)

vojtajina commented 13 years ago

Why are you sending pull request with something you think I don't like ? :-D

I can see three ways of doing this:

  1. in the controller, which means you have to do it twice and test it twice as well (tickets, projects)
  2. in the $resource service - must be general
  3. as form validation

The third option sounds as the best solution to me, unfortunately, there isn't currently enough flexible form system in angular which would allow us to make it easily... (Misko is working hard on that...)

So I like your decision to do it in $resource, but then, it must be flexible enough...

Your code does not send empty ticket, which is fine, but it allows me to create a project with empty name, that's odd...

$resource service is general purpose service, it knows nothing about tickets neither projects. So we need to add a configuration property, something like "mandatory fields" and then, if any of mandatory field is empty ignore creating...

WRT test, I commented in the commit...