Refactor edit-post JavaScript

Change-Id: Ice4ef62f762567d234eb92f894ec14b2b85ba357
Merge "Refactor edit-post JavaScript"