{"action":"created","issue":{"url":"https://api.github.com/repos/adaptlearning/adapt_framework/issues/694","labels_url":"https://api.github.com/repos/adaptlearning/adapt_framework/issues/694/labels{/name}","comments_url":"https://api.github.com/repos/adaptlearning/adapt_framework/issues/694/comments","events_url":"https://api.github.com/repos/adaptlearning/adapt_framework/issues/694/events","html_url":"https://github.com/adaptlearning/adapt_framework/pull/694","id":100096892,"number":694,"title":"ABU-674: Locking as optional utility","user":{"login":"oliverfoster","id":7974663,"avatar_url":"https://avatars.githubusercontent.com/u/7974663?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverfoster","html_url":"https://github.com/oliverfoster","followers_url":"https://api.github.com/users/oliverfoster/followers","following_url":"https://api.github.com/users/oliverfoster/following{/other_user}","gists_url":"https://api.github.com/users/oliverfoster/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverfoster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverfoster/subscriptions","organizations_url":"https://api.github.com/users/oliverfoster/orgs","repos_url":"https://api.github.com/users/oliverfoster/repos","events_url":"https://api.github.com/users/oliverfoster/events{/privacy}","received_events_url":"https://api.github.com/users/oliverfoster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-10T15:39:38Z","updated_at":"2015-09-22T12:14:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/adaptlearning/adapt_framework/pulls/694","html_url":"https://github.com/adaptlearning/adapt_framework/pull/694","diff_url":"https://github.com/adaptlearning/adapt_framework/pull/694.diff","patch_url":"https://github.com/adaptlearning/adapt_framework/pull/694.patch"},"body":"* changes Adapt object from _.extend({}, Backbone.Events) to Backbone.Model to accommodate run-time variables in a consistent way\r\n* extended Backbone.Model to include optional attribute locking, the locking mechanism is one lock per plugin name, to set or unset\r\n* added _canScroll to Adapt model to block Adapt.scrollTo function from performing the scroll (useful for block sliders when they should manage their own scrolling)\r\n* made Adapt.get(\"_canScroll\") a locked attribute\r\n* made Adapt.router.get(\"_canNavigate\") a locked attribute (to overcome brians issue (https://github.com/adaptlearning/adapt_framework/issues/587)\r\n* extended router to block all navigation events when using Adapt.router.set(\"_canNavigate\", false, { pluginName: \"plugin\" });\r\n* made router block navigation events when content is loading (to solve media element issue in ie8 on a navigate+back in quick succession)\r\n* kept .set(attributeName, value, options) to old backboneModel.js implementation using {pluginName: ''}\r\n\r\nThis is the long awaited re-implementation of backboneModel.js. Rather than being a mediator, this is a locking mechanism. It is not enabled for every model, only for models where is it explicitly enabled. It is enabled on the Adapt and Adapt.router models at present, for _canScroll and _canNavigate respectively.\r\n\r\n\r\nNew backbone model functions can be found in https://github.com/adaptlearning/adapt_framework/blob/ABU-674/src/core/js/models/lockingModel.js\r\n\r\nDescription of new Backbone.Model functions:\r\n\r\n```\r\nset(attrName, attrVal, options)  : an extension to the original function\r\n\r\n  Model.set(\"_canNavigate\", false, { pluginName: \"plugin\" });\r\n  Model.set(\"_canNavigate\", true, { pluginName: \"plugin\" });\r\n\r\n\r\nsetLocking(attrName, defaultLockValue) : add locking to a model attribute\r\n\r\n    Model.setLocking(\"_isVisible\", false);\r\n\r\n\r\nunsetLocking(attrName) : remove locking from a model attribute\r\n\r\n    Model.unsetLocking(\"_isVisible\");\r\n\r\n\r\nisLocking(attrName) : returns t/f if the attribute is a locking attribute\r\n\r\n    Model.isLocking(\"_isVisible\");\r\n\r\n\r\nisLocked(attributeName, options) : returns t/f/undefined is the attribute it locked, if it is locked for the supplied pluginName or undefined if it is not a locking attribute\r\n\r\n    Model.isLocked(\"_isVisible\");\r\n    Model.isLocked(\"_isVisible\", {pluginName: \"plugin\"});\r\n\r\n\r\ngetLockCount(attributeName, options) : returns an integer/undefined for the number of locks held in total for the attribute, or for the supplied pluginName or undefined if the attribute is not a locking attribute\r\n\r\n    Model.getLockValue(\"_isVisible\");\r\n    Model.getLockValue(\"_isVisible\", {pluginName: \"plugin\"});\r\n\r\n\r\nsetLockState(attributeName, value, options) : sets the locking value for the given pluginName to value (t/f)\r\n\r\n    Model.setLockValue(\"_isVisible\", true, {pluginName: \"plugin\"});\r\n\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/adaptlearning/adapt_framework/issues/comments/142270768","html_url":"https://github.com/adaptlearning/adapt_framework/pull/694#issuecomment-142270768","issue_url":"https://api.github.com/repos/adaptlearning/adapt_framework/issues/694","id":142270768,"user":{"login":"oliverfoster","id":7974663,"avatar_url":"https://avatars.githubusercontent.com/u/7974663?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverfoster","html_url":"https://github.com/oliverfoster","followers_url":"https://api.github.com/users/oliverfoster/followers","following_url":"https://api.github.com/users/oliverfoster/following{/other_user}","gists_url":"https://api.github.com/users/oliverfoster/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverfoster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverfoster/subscriptions","organizations_url":"https://api.github.com/users/oliverfoster/orgs","repos_url":"https://api.github.com/users/oliverfoster/repos","events_url":"https://api.github.com/users/oliverfoster/events{/privacy}","received_events_url":"https://api.github.com/users/oliverfoster/received_events","type":"User","site_admin":false},"created_at":"2015-09-22T12:14:30Z","updated_at":"2015-09-22T12:14:30Z","body":"in terms of the number of untested lines? the breadth of it's footprint in adapt? how it changes adapt's behaviour?"}}