aboutsummaryrefslogtreecommitdiff
path: root/js/document/mediators
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-06-14 22:11:39 -0700
committerNivesh Rajbhandari2012-06-14 22:11:39 -0700
commit965557ffb8e11918ebc1215738a8a9657a172a84 (patch)
tree7267472ab7b6d8fb89e237d1bfed4eada80292a0 /js/document/mediators
parentb39e13b9a53e6c75f4f9364e686dc90df02b09bb (diff)
downloadninja-965557ffb8e11918ebc1215738a8a9657a172a84.tar.gz
Remove ninja's author-time styles for banner and animation templates on publish/save.
Missed the banner and animation case in the previous checkin. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/document/mediators')
-rwxr-xr-xjs/document/mediators/template.js29
1 files changed, 22 insertions, 7 deletions
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js
index e770e07f..c5b46c3a 100755
--- a/js/document/mediators/template.js
+++ b/js/document/mediators/template.js
@@ -146,13 +146,28 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
146 } 146 }
147 } 147 }
148 // 148 //
149 if (template.body && template.body.getAttribute('data-ninja-style') !== null) { 149 if(template.template) {
150 template.file.content.document.body.setAttribute('style', template.body.getAttribute('data-ninja-style')); 150 //
151 template.file.content.document.body.removeAttribute('data-ninja-style'); 151 // TODO - Need to handle banner and animation templates.
152 } else if (template.body && template.body.getAttribute('data-ninja-style') === null) { 152 //Copying attributes to maintain same properties as <ninja-content>
153 template.file.content.document.body.removeAttribute('style'); 153 var ninjaContentTagMem = template.document.getElementsByTagName('ninja-content')[0], ninjaContentTagDoc = template.file.content.document.getElementsByTagName('ninja-content')[0];
154 template.file.content.document.body.removeAttribute('data-ninja-style'); 154 if (ninjaContentTagMem && ninjaContentTagMem.getAttribute('data-ninja-style') !== null) {
155 } 155 ninjaContentTagDoc.setAttribute('style', ninjaContentTagMem.getAttribute('data-ninja-style'));
156 ninjaContentTagDoc.removeAttribute('data-ninja-style');
157 } else if (ninjaContentTagMem && ninjaContentTagMem.getAttribute('data-ninja-style') === null) {
158 ninjaContentTagDoc.removeAttribute('style');
159 ninjaContentTagDoc.removeAttribute('data-ninja-style');
160 }
161 } else {
162 if (template.body && template.body.getAttribute('data-ninja-style') !== null) {
163 template.file.content.document.body.setAttribute('style', template.body.getAttribute('data-ninja-style'));
164 template.file.content.document.body.removeAttribute('data-ninja-style');
165 } else if (template.body && template.body.getAttribute('data-ninja-style') === null) {
166 template.file.content.document.body.removeAttribute('style');
167 template.file.content.document.body.removeAttribute('data-ninja-style');
168 }
169 }
170
156 wipeAttributes(template.file.content.document.head); 171 wipeAttributes(template.file.content.document.head);
157 //Copying attributes to maintain same properties as the <head> 172 //Copying attributes to maintain same properties as the <head>
158 for (var m in template.document.head.attributes) { 173 for (var m in template.document.head.attributes) {