Browse Source

HUE-265. Add a linker that can hide its parent element.

Aaron Newton 15 years ago
parent
commit
2d384612b8

+ 33 - 0
apps/jframegallery/src/jframegallery/templates/Hide.parent.linker.html

@@ -0,0 +1,33 @@
+{% comment %}
+Licensed to Cloudera, Inc. under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  Cloudera, Inc. licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+  <head>
+    <title>Hide Parent Linker</title>
+  </head>
+  <body>
+  <div class="jframe_padded">
+		<p>Clicking the link below will hide the box that contains it.</p>
+		<div class="foo" style="width: 200px; height: 200px; border: 1px solid #000; padding: 8px;">
+			<p>
+				<a data-hide-parent="div.foo">Hide this box</a>
+			</p>
+		</div>
+  </div>
+</body>
+</html>

+ 1 - 0
desktop/core/static/js/Source/CCS/CCS.JBrowser.js

@@ -37,6 +37,7 @@ requires:
  - /CCS.JFrame.Chooser
  - /CCS.JFrame.ConfirmAndPost
  - /CCS.JFrame.FakeRefresh
+ - /CCS.JFrame.HideParent
  - /CCS.JFrame.LivePath
  - /CCS.JFrame.Nav
  - /CCS.JFrame.NoScroll

+ 32 - 0
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.HideParent.js

@@ -0,0 +1,32 @@
+/*
+---
+description: Hides the parent of a link when clicked.
+provides: [CCS.JFrame.HideParent]
+requires: [/CCS.JFrame]
+script: CCS.JFrame.HideParent.js
+
+...
+*/
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+CCS.JFrame.addGlobalLinkers({
+
+	'[data-hide-parent]': function(event, link){
+		link.getParent(link.getData('hide-parent')).hide();
+	}
+
+});

+ 1 - 0
desktop/core/static/js/package.yml

@@ -38,6 +38,7 @@ sources: [
   Source/JFrameLinkers/CCS.JFrame.Chooser.js,
   Source/JFrameLinkers/CCS.JFrame.ConfirmAndPost.js,
   Source/JFrameLinkers/CCS.JFrame.FakeRefresh.js,
+  Source/JFrameLinkers/CCS.JFrame.HideParent.js,
   Source/JFrameLinkers/CCS.JFrame.LivePath.js,
   Source/JFrameLinkers/CCS.JFrame.Nav.js,
   Source/JFrameLinkers/CCS.JFrame.NoScroll.js,