mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-24 01:36:10 +01:00
* Apply unobtrusive javascript principles to _item partial, and reduce the amount of inline javascript throughout the app by a lot.
* Cleaned up the _item partial, moving logic into todo_helper methods. * Patched the unobtrusive_javascript plugin to avoid overflow of the session storage. I've submitted this patch by email to Luke Redpath, and hopefully, the plugin will incorporate this or similar functionality in the future. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@433 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
87e08a10e8
commit
3070d280ea
9 changed files with 112 additions and 104 deletions
|
|
@ -8,7 +8,7 @@ class UJS::BehaviourScript
|
|||
|
||||
def add_rule(selector, javascript, cancel_default=false)
|
||||
javascript = javascript << cancel_default_js if cancel_default
|
||||
@rules << [selector, javascript]
|
||||
@rules << [selector, javascript] unless rule_exists(selector, javascript)
|
||||
end
|
||||
|
||||
def cache?
|
||||
|
|
@ -51,4 +51,8 @@ class UJS::BehaviourScript
|
|||
def cancel_default_js
|
||||
" return false;"
|
||||
end
|
||||
|
||||
def rule_exists(selector, javascript)
|
||||
@rules.detect{|r| r[0] == selector && r[1] == javascript} != nil
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue