From 064d49a717725d330974d4e13c2cc9aa944b9d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EF=A3=BF=20Arana=20Jhonny?= Date: Mon, 17 Aug 2015 22:15:57 -0700 Subject: [PATCH 1/5] Change YUM package manager for DNF DNF is now the default package manager in Fedora --- docs/build-instructions/linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build-instructions/linux.md b/docs/build-instructions/linux.md index 13b03a9bf..fd53b9612 100644 --- a/docs/build-instructions/linux.md +++ b/docs/build-instructions/linux.md @@ -24,7 +24,7 @@ Ubuntu LTS 12.04 64-bit is the recommended platform. ### Fedora / CentOS / RHEL -* `sudo yum --assumeyes install make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel rpmdevtools` +* `sudo dnf --assumeyes install make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel rpmdevtools` * Instructions for [Node.js](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#fedora). ### Arch From 22ca33a3b1edc6c1a9d1df34d64e52794dd1b537 Mon Sep 17 00:00:00 2001 From: Thomas Johansen Date: Tue, 18 Aug 2015 21:38:00 +0200 Subject: [PATCH 2/5] Extend ViewRegistry with support for objects with an element property By adding this extension to ViewRegistry::getView we're paving the way for Etch-like view frameworks which promotes the usage of plain objects and classes with an element property which is an instance of HTMLElement. --- spec/view-registry-spec.coffee | 8 ++++++++ src/view-registry.coffee | 2 ++ 2 files changed, 10 insertions(+) diff --git a/spec/view-registry-spec.coffee b/spec/view-registry-spec.coffee index a12d46dde..fa3e5ba1f 100644 --- a/spec/view-registry-spec.coffee +++ b/spec/view-registry-spec.coffee @@ -26,6 +26,14 @@ describe "ViewRegistry", -> expect(node.textContent).toBe "Hello" expect(node.spacePenView).toBe view + describe "when passed an object with an element property", -> + it "returns the element property if it's an instance of HTMLElement", -> + class TestComponent + constructor: -> @element = document.createElement('div') + + component = new TestComponent + expect(registry.getView(component)).toBe component.element + describe "when passed a model object", -> describe "when a view provider is registered matching the object's constructor", -> it "constructs a view element and assigns the model on it", -> diff --git a/src/view-registry.coffee b/src/view-registry.coffee index ca9b7cdb7..0c533e9a8 100644 --- a/src/view-registry.coffee +++ b/src/view-registry.coffee @@ -138,6 +138,8 @@ class ViewRegistry createView: (object) -> if object instanceof HTMLElement object + else if object?.element instanceof HTMLElement + object.element else if object?.jquery object[0] else if provider = @findProvider(object) From 66d0e7c7524200de78c4e7fa4a3ec4dd61bc8041 Mon Sep 17 00:00:00 2001 From: Thomas Johansen Date: Wed, 19 Aug 2015 15:44:16 +0200 Subject: [PATCH 3/5] :memo: Attempt to document view resolution algorithm --- src/view-registry.coffee | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/view-registry.coffee b/src/view-registry.coffee index 0c533e9a8..67170d3b8 100644 --- a/src/view-registry.coffee +++ b/src/view-registry.coffee @@ -124,6 +124,24 @@ class ViewRegistry # * `object` The object for which you want to retrieve a view. This can be a # pane item, a pane, or the workspace itself. # + # ## View Resolution Algorithm + # + # The view associated with the object is resolved using the following + # heuristic sequence + # + # 1. Is the object an instance of `HTMLElement`? If true, return the object. + # 2. Does the object have a property named `element` with a value which is + # an instance of `HTMLElement`? If true, return the property value. + # 3. Is the object a SpacePen view, which means it has a `jquery` property? + # If true, return the root DOM node (i.e. `object[0]`). + # 4. Has a view provider been registered for the object? If true, use the + # provider to create a view associated with the object, and return the + # view. + # 5. Does the object have a `getViewClass` method? If true, use the method + # to create a view associated with the object, and return the view. + # + # If no associated view is returned by the sequence an error is thrown. + # # Returns a DOM element. getView: (object) -> return unless object? From 675e9be262645da5b99cc07666b9db717ae0e239 Mon Sep 17 00:00:00 2001 From: Thomas Johansen Date: Wed, 19 Aug 2015 20:46:24 +0200 Subject: [PATCH 4/5] :fire: Remove mention of semi-deprecated view resolution step --- src/view-registry.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/view-registry.coffee b/src/view-registry.coffee index 67170d3b8..b02f3b600 100644 --- a/src/view-registry.coffee +++ b/src/view-registry.coffee @@ -137,8 +137,6 @@ class ViewRegistry # 4. Has a view provider been registered for the object? If true, use the # provider to create a view associated with the object, and return the # view. - # 5. Does the object have a `getViewClass` method? If true, use the method - # to create a view associated with the object, and return the view. # # If no associated view is returned by the sequence an error is thrown. # From c16f252ab7fd79e77c11433f87926717ef3ef29e Mon Sep 17 00:00:00 2001 From: Thomas Johansen Date: Wed, 19 Aug 2015 20:54:39 +0200 Subject: [PATCH 5/5] :memo: Rephrase view resolution docs --- src/view-registry.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/view-registry.coffee b/src/view-registry.coffee index b02f3b600..6af7bd024 100644 --- a/src/view-registry.coffee +++ b/src/view-registry.coffee @@ -127,13 +127,13 @@ class ViewRegistry # ## View Resolution Algorithm # # The view associated with the object is resolved using the following - # heuristic sequence + # sequence # # 1. Is the object an instance of `HTMLElement`? If true, return the object. # 2. Does the object have a property named `element` with a value which is # an instance of `HTMLElement`? If true, return the property value. - # 3. Is the object a SpacePen view, which means it has a `jquery` property? - # If true, return the root DOM node (i.e. `object[0]`). + # 3. Is the object a jQuery object, indicated by the presence of a `jquery` + # property? If true, return the root DOM element (i.e. `object[0]`). # 4. Has a view provider been registered for the object? If true, use the # provider to create a view associated with the object, and return the # view.