Commit Graph

12894 Commits

Author SHA1 Message Date
George Stephanis d8fdfe4c87 Manually trigger change event. Why?
Unsure why this needs to be manually triggered, but its seems to.
2015-08-12 12:59:12 -04:00
George Stephanis a8b1cabc0b Be more specific as to what we're listening for. 2015-08-12 12:59:12 -04:00
George Stephanis 8dc2126718 Update the tablenav so the gotos are never out of range. 2015-08-12 12:59:12 -04:00
George Stephanis ca13f5785b Listen for changes in form inputs.
When one is found, update the model to reflect the data in the dom.
2015-08-12 12:59:12 -04:00
George Stephanis efcb9f5048 Give the Model a setRateAttribute method.
This should simplify updating when listening for changes in the form.
2015-08-12 12:59:12 -04:00
George Stephanis 1332ef4a71 String.trim() polyfill. 2015-08-12 12:59:12 -04:00
George Stephanis 837931f99a Check for truthiness.
This avoids silliness where `’0’` evaluates to true.  Just parse it as
an int and evaluate that.
2015-08-12 12:59:11 -04:00
George Stephanis 2a0951e4e5 Add more data attributes to the rows and fields. 2015-08-12 12:59:11 -04:00
George Stephanis d52c4d1fde Don't base size of news off the dom. 2015-08-12 12:59:11 -04:00
George Stephanis 1a066ebbe0 Swap to associative array for model. 2015-08-12 12:59:11 -04:00
George Stephanis 388a584914 Not actually used, comment it out. 2015-08-12 12:59:11 -04:00
George Stephanis 9887fbaf50 Probably tidier to use `event` and not `e` 2015-08-12 12:59:11 -04:00
George Stephanis 0996778567 Figured out how to avoid hardcoding the instance. 2015-08-12 12:59:11 -04:00
George Stephanis 5783a20794 Don't use `this` in a callback with the wrong context.
@todo: Find a way to stop needing to refer to the specific instance
from the abstract class.
2015-08-12 12:59:11 -04:00
George Stephanis 0fb85f4656 Use $(window).on() instead of window.addEventListener. Because ¯\_(ツ)_/¯ 2015-08-12 12:59:10 -04:00
George Stephanis dc649e2964 JS objects + trailing commas = sad IE 2015-08-12 12:59:10 -04:00
George Stephanis 187e253177 Remove some debugging 2015-08-12 12:59:10 -04:00
George Stephanis ce7cb1f65d Add a `beforeunload` event to prompt before leaving with unsaved changes. 2015-08-12 12:59:10 -04:00
George Stephanis b4682d7f2d Change how things are called to the new bb render. 2015-08-12 12:59:10 -04:00
George Stephanis f7c2223a23 Change the structure to Backbone models/views. 2015-08-12 12:59:10 -04:00
George Stephanis 9e5abc22ad Whoops! Comma, not semicolon. 2015-08-12 12:59:10 -04:00
George Stephanis c6e3a577c0 Set backbone and underscore as script dependencies. 2015-08-12 12:59:10 -04:00
George Stephanis 8a416f105b Should be comparing to `'1'` not `1`. 2015-08-12 12:59:10 -04:00
George Stephanis b75093b640 Optimization, save the $table selector to avoid some dom lookups. 2015-08-12 12:59:09 -04:00
George Stephanis 386ec26fb9 Whitespace tweaks. 2015-08-12 12:59:09 -04:00
George Stephanis e197bc242f Retool the export to use the global object, not parsing out of the dom. 2015-08-12 12:59:09 -04:00
George Stephanis ddba588987 Migrate the logic and queries out of the template file.
Move them where they belong, in the class that calls it.
2015-08-12 12:59:09 -04:00
George Stephanis 5f4cbf78d0 Remove the legacy pagination. 2015-08-12 12:59:09 -04:00
George Stephanis a1d7121c99 Update the current page when the number is changed. 2015-08-12 12:59:09 -04:00
George Stephanis 4df13e6ffb Don't set them for unexistent rates. 2015-08-12 12:59:09 -04:00
George Stephanis 7bebbaff9e Pagination now works by first, prev, next, last.
Still need to get number based pagination working.
2015-08-12 12:59:09 -04:00
George Stephanis cf59aec17d Add in and populate pagination template.
The buttons don’t actually do anything yet, but it outputs accurately
and inherits core styles.
2015-08-12 12:59:09 -04:00
George Stephanis d9b2907ae2 Begin to handle pagination.
This lets the initial view display only a single page, future commits
will add in the paginater.
2015-08-12 12:59:08 -04:00
George Stephanis be4c7db8bd Pass rates in as an array, not an associative array, so it's an Array in js. 2015-08-12 12:59:08 -04:00
George Stephanis 0608bcce19 The name resetter should also be run after each render. 2015-08-12 12:59:08 -04:00
George Stephanis c9a1ba2f39 A default placeholder to show until the rendering code replaces it. 2015-08-12 12:59:08 -04:00
George Stephanis f9fd4ada58 Wrap the rendering code inside a function that the data can be passed to. 2015-08-12 12:59:08 -04:00
George Stephanis 7985aec296 Ernest the JS so none of it evaluates before dom ready. 2015-08-12 12:59:08 -04:00
George Stephanis 26b95a4d80 Inline documentation explaining some functionality. 2015-08-12 12:59:08 -04:00
George Stephanis 7c60e48b0c Add some code comments. 2015-08-12 12:59:08 -04:00
George Stephanis 37f10c18cd Reposition when autocomplete is triggered.
Also, instead of searching through the whole dom, only search in the
tbody.
2015-08-12 12:59:07 -04:00
George Stephanis 536402c183 Insert placeholder divs for search and pagination. 2015-08-12 12:59:07 -04:00
George Stephanis 308c7f8676 Whitespace tweaks 2015-08-12 12:59:07 -04:00
George Stephanis ea0b9b96b9 Optimization: Don't use $.size(), use native Object.length instead. 2015-08-12 12:59:07 -04:00
George Stephanis 676af1f308 JSHint fixes.
The other advantage of splitting js out of php files — jshint can run
on it! :) :) :)
2015-08-12 12:59:07 -04:00
George Stephanis d3922a96cd Don't constantly rescan the dom for tbody
We have a cached version of $tbody a level up.
2015-08-12 12:59:07 -04:00
George Stephanis 1b035b43a3 Swap `jQuery` to `$`
It’s more readable, and safe to do as we’ve aliased it back in the
enclosure.
2015-08-12 12:59:07 -04:00
George Stephanis 8c47c0df1d Migrate current_class from php to js 2015-08-12 12:59:07 -04:00
George Stephanis 52d4ea822c Extract 'No Rows Selected' string 2015-08-12 12:59:07 -04:00
George Stephanis 973348d6ad Whitespace tidy! 2015-08-12 12:59:06 -04:00