Tag Info

New answers tagged

3

Although the right solution depends on your context, here is my approach: When designing classes one should always consider their single responsibility. In case of the PostsController it could probably be described "create, read update and delete" posts. Formatting of the output is a global problem of your application that should not be solved individually ...


1

You have outlined the two main approaches, and each have their advantages and disadvantages. If you combine both in the same controller, and all you are doing is changing the output, then using a single controller makes sense. The logic is the same, but the output changes. If the logic has to change because the output is different, then go with two ...


2

Depending on which browsers you need to support, you may be able to take advantage of the HTML 5 template tag. The template tag allows you to keep your partial HTML elements in the HTML file but not have them rendered in the browser. In order to actually display the contents, you clone the template's contents and add it to the DOM using javascript. You can ...


5

Use a mvw (model/view/whatever) pattern model: "pure" javascript library modelling abstract concepts. This part usually contains objects & methods names related to the application domain (car business -> car objects / insurance contracts) and the data access logic. view: a custom language describing how your UI look like. Preferably, the language ...


0

My initial thoughts extract HTML from JS, and place HTML in HTML file (same with CSS) load JS in parent container's HTML file in JS file use JS/jQuery to show/hide DIVs in HTML as needed as per selection var use JS/jQuery to bind navigational events to buttons have navigational events populate table cells via assigned id attributes. A bit of a pain to ...


0

The one solution I have come up with is to create "View" Models. I create simple versions of the database models that do not include the reference to the parent class. These view models each have method to return the Database Version and a constructor that takes the database model as a parameter (viewmodel.name = databasemodel.name). This method ...



Top 50 recent answers are included