From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- .../layout/document-entry.reel/document-entry.css | 22 ++++++++--- .../layout/document-entry.reel/document-entry.html | 14 +++++-- .../layout/document-entry.reel/document-entry.js | 44 ++++++++-------------- 3 files changed, 41 insertions(+), 39 deletions(-) (limited to 'js/components/layout/document-entry.reel') diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css index 4601974f..010e1da7 100755 --- a/js/components/layout/document-entry.reel/document-entry.css +++ b/js/components/layout/document-entry.reel/document-entry.css @@ -19,7 +19,20 @@ min-width:0px; } -.documentEntry img { +.mybutton { + display: inline; + -webkit-appearance: none; + outline: none; + + font-size: 9px; + cursor: pointer; + border: 0px; + background-color: #474747; + background-image: -webkit-linear-gradient(top, #505050 0%, #3c3c3c 100%); + +} + +.documentEntry button { opacity: 0.5; /* 50% */ width: 12px; max-width:12px; @@ -29,17 +42,14 @@ transition: opacity 0.2s ease; } -.documentEntry:hover, -.documentEntry:active, -.documentEntry.activeTab { - /*background-color: #7f7f7f; *//* rgb(127, 127, 127); */ +.documentEntry.selected { + background-color:#7F7F7F; } .documentEntry img:hover { opacity: 1.0; /* 100% */ } - .documentEntry span.dirty:before{ content: "*"; display:inline; diff --git a/js/components/layout/document-entry.reel/document-entry.html b/js/components/layout/document-entry.reel/document-entry.html index 679ebb62..bd8c25cb 100755 --- a/js/components/layout/document-entry.reel/document-entry.html +++ b/js/components/layout/document-entry.reel/document-entry.html @@ -15,8 +15,14 @@ "prototype": "js/components/layout/document-entry.reel", "properties": { "element": {"#": "documentEntry"}, - "label": {"#": "name"}, - "activeBack": {"#": "isActive"} + "label": {"#": "name"} + } + }, + + "closeButton": { + "prototype": "montage/ui/button.reel", + "properties": { + "element": {"#": "close-btn"} } } } @@ -24,9 +30,9 @@
  • -
    - + +
  • \ No newline at end of file diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 50b3624c..2e66c7cd 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -58,25 +58,6 @@ exports.DocumentEntry = Montage.create(Component, { } }, - _active: { - enumerable: false, - value: null - }, - - active: { - get: function() { - return this._active; - }, - set: function(value) { - var previousValue = this._active; - this._active = value; - - if (previousValue !== this._active) { - this.needsDraw = true; - } - } - }, - _saveFlag: { value: false }, @@ -96,7 +77,8 @@ exports.DocumentEntry = Montage.create(Component, { prepareForDraw: { enumerable: false, value: function() { - this.element.addEventListener("click", this, false); +// this.element.addEventListener("click", this, false); +// this.closeBtn.addEventListener("click", this, true); } }, @@ -106,7 +88,7 @@ exports.DocumentEntry = Montage.create(Component, { value: function() { this.label.innerText = this._name ? this._name : ""; - this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); +// this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); if(this.saveFlag) { this.label.classList.add("dirty"); @@ -116,15 +98,19 @@ exports.DocumentEntry = Montage.create(Component, { } }, - handleClick: { + captureClick: { value: function(event) { - if(event._event.target.nodeName === "IMG") { - this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); - } else { - if(!this.active) { - this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); - } - } + console.log("clicked on the X"); + event.preventDefault(); + event.stopImmediatePropagation(); + event.stopPropagation(); +// if(event._event.target.nodeName === "IMG") { +// this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); +// } else { +// if(!this.active) { +// this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); +// } +// } } } -- cgit v1.2.3