| jQuery. I'm the sole developer on a "rails monolith" (254 tables, 540 models/classes, 4 years old), with enterprise-like architecture (ecommerce, event ticket sales, booking engine, access control, etc) and I'm positive the only way I'm able handle it all is because I stick to basic jquery. My secrets: - The rails-ujs adapter - $(document).on('event', '.element', ..) is fantastic. Never debug events ever again - selectize select's for "find or create" relationships - cocoon gem for nested form relationships - parsley for form validation (hooks into html5 validators) - bootstrap 3 - datatables.net + following the pattern of ajax-datatables-rails (gem - separate classes for each table) - a single javascript function that accepts a DOM element (body, a modal, section) and initializes all the elements the app knows of (selectize elements, date/time pickers, etc) inside that container - above function is hooked into by bootstrap's 'bs.modal.shown, bs.modal.hide, tab's, cocoon's 'cocoon:after-insert', etc. rake stats says:
33k LOC models, 8k LOC controllers, 23k Javascript (though this must be all plugins. I'd guess 3-6k lines of javascript, max) Needless to say, I don't believe in the frontend javascript hype. |
> - $(document).on('event', '.element', ..) is fantastic. Never debug events ever again
> - a single javascript function that accepts a DOM element (body, a modal, section) and initializes all the elements the app knows of (selectize elements, date/time pickers, etc) inside that container