Add Ruby on Rails comment (#) to Dreamweaver coding toolbar

Ha! I figured it out. To add the comment type you apparently have to edit not only the main configuration files, but also the local user configuration files (under C:\Documents and Settings\Sara\Application Data\Macromedia\Dreamweaver 8\Configuration).

To make a long story short, in order to add the # comment type to Dreamweaver 8 context menu and coding toolbar, I made the following changes:

In C:\Program Files\Macromedia\Dreamweaver 8\Configuration\Menus\menus.xml, add the following lines:

918: menuitem id="DWContext_HTML_Selection_ApplyRubyComment" name="Apply # Comment" enabled="dw.getFocus(true) == 'textView' || dw.getFocus(true) == 'html'" command="dw.getDocumentDOM().source.applyComment('# ', '')" domRequired="false"

924: menuitem id="DWContext_HTML_Selection_removeRubyComment" name="Remove # Comment" enabled="dw.getFocus(true) == 'textView' || dw.getFocus(true) == 'html'" command="dw.getDocumentDOM().source.removeComment('# ')" domRequired="false"

1559: menuitem name="Apply # Comment" domRequired="false" enabled="dw.getFocus(true) != 'document'" command="dw.getDocumentDOM().source.applyComment('# ', '')" id="DWPopup_ApplyRubyComment"

In C:\Program Files\Macromedia\Dreamweaver 8\Configuration\Toolbars\toolbars.xml (changes in bold text):

485: command="dw.getDocumentDOM().source.removeComment(); dw.getDocumentDOM().source.removeComment('# ')"

685: command="dw.getDocumentDOM().source.removeComment(); dw.getDocumentDOM().source.removeComment('# ')"

In C:\Documents and Settings\[username]\Application Data\Macromedia\Dreamweaver 8\Configuration\Menus\Menus.xml, add the following lines:

886: menuitem id="DWContext_HTML_Selection_ApplyRubyComment" name="Apply # Comment" enabled="dw.getFocus(true) == 'textView' || dw.getFocus(true) == 'html'" command="dw.getDocumentDOM().source.applyComment('# ', '')" domRequired="false"

892: menuitem id="DWContext_HTML_Selection_removeRubyComment" name="Remove # Comment" enabled="dw.getFocus(true) == 'textView' || dw.getFocus(true) == 'html'" command="dw.getDocumentDOM().source.removeComment('# ')" domRequired="false"

1557: menuitem id="DWPopup_ApplyRubyComment" name="Apply # Comment" enabled="dw.getFocus(true) != 'document'" command="dw.getDocumentDOM().source.applyComment('# ', '')" domRequired="false"

And in C:\Documents and Settings\[username]\Application Data\Macromedia\Dreamweaver 8\Configuration\Toolbars\toolbars.xml (changes in bold text):

57: button command="dw.getDocumentDOM().source.removeComment(); dw.getDocumentDOM().source.removeComment('# ')"

79: button command="dw.getDocumentDOM().source.removeComment(); dw.getDocumentDOM().source.removeComment('# ')"

That should do it. Now when you click on either the context (right-click) menu or the Apply Comment button (in Code View), you should see the option to add a Ruby-style # comment.

Again, I hope this helps someone else out there, because I know Ruby on Rails info is still incomplete, and hard to find at that.

🙂

Leave a Reply

Your email address will not be published.