Generalise Add Another dialog for any type of entity

Issue #102 resolved
Brian Lewis repo owner created an issue

Add another dialog: My intention for the ApiUi service is that it can provide standard dialogs and reports complementing the data persistence architecture as it is implemented in EditController, our standards for REST exchange, and in particular, the error responses coming back. I'd like us to be able to use these dialogs Everywhere.

So - Add another hardcodes 'Successfully created School:

when in future I'd like this dialog to be capable of saying:

Sucessfully created Teacher: <name>

Comments (3)

  1. Brian Lewis reporter
    • edited description

    So needs a bit of refactoring.

    Note that model is already passed in , and being a Restangularized object it contains member route = schools, and can retrieve the primary key using a restangular.getIdforElem()

    but I don't think this approach can be made to fully get where we want to be because :

    • don't want to have to parse from schools to get back to school - every ORM tries to do it but still seems problematic
    • when primary key is an autonumber, that may not be what you want to display in the confirmation.

    I think the "gold-taps" answer may be to have Restangular add a method to each entity (school, teacher, ....) as it is constructed:

    _description() { return this.schName ; };
    

    or

    _description() { return this.tFullname; };
    

    as well as

    _type() { return "school" ;};
    

    or

    _type() { return "teacher;" }
    
  2. Log in to comment