Update detail template - move buttons and tweak visibility
Merging upstream master