Browse Source

HUE-11. jframegallery should show the html source

- Only a small portion of the gallery have JS resource declarations.
  We should add more later.
bc Wong 15 years ago
parent
commit
a8d1e9a846
75 changed files with 621 additions and 162 deletions
  1. 82 82
      apps/beeswax/static/js/Source/Beeswax/CCS.Beeswax.js
  2. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/Hide.parent.linker.html
  3. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/Load_without_scrolling.html
  4. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/Refresh.with.params.mako
  5. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/accordion.html
  6. 7 7
      apps/jframegallery/src/jframegallery/templates/gallery/ajax-target.html
  7. 1 1
      apps/jframegallery/src/jframegallery/templates/gallery/ajax.spinner.target.html
  8. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/anchor_tags_that_scroll.html
  9. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/app-launcher.html
  10. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/art-button.html
  11. 18 0
      apps/jframegallery/src/jframegallery/templates/gallery/art-button.yml
  12. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/art-inputs.html
  13. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/autocomplete.html
  14. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/check.all.or.none.html
  15. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/chooser.linker.html
  16. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/collapser.html
  17. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/context-menu.html
  18. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/css.widget.graph.html
  19. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/data.group.toggle.html
  20. 1 1
      apps/jframegallery/src/jframegallery/templates/gallery/double.click-delegator.html
  21. 7 7
      apps/jframegallery/src/jframegallery/templates/gallery/errors.html
  22. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/filter.input.html
  23. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/fit.text.(table).html
  24. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/fit.text.html
  25. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/flash.html
  26. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/form.validation.html
  27. 1 1
      apps/jframegallery/src/jframegallery/templates/gallery/form_popup_interaction.html
  28. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/forms_with_dependencies.mako
  29. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/forwarding.html
  30. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/frame.tips.html
  31. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/growl.redirect.html
  32. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.check.selected.html
  33. 20 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.check.selected.yml
  34. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.configurable.columns.mako
  35. 19 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.configurable.columns.yml
  36. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.html
  37. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.multi-select.menu.html
  38. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.resizable.columns.html
  39. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.treeview.ajax.mako
  40. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/html-table.treeview.html
  41. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/ignored-links.html
  42. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/jframe.sizeTo.html
  43. 1 1
      apps/jframegallery/src/jframegallery/templates/gallery/meta-refresh.html
  44. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/multi-checks.html
  45. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/overtext.html
  46. 1 1
      apps/jframegallery/src/jframegallery/templates/gallery/partial_refresh.mako
  47. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/post-load.alert.popup.html
  48. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/post-load.alert.popup.jframe.renders.html
  49. 1 1
      apps/jframegallery/src/jframegallery/templates/gallery/post-load.prompt.popup.html
  50. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/posteditor.html
  51. 1 1
      apps/jframegallery/src/jframegallery/templates/gallery/redirect.html
  52. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/resizables.html
  53. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/select_with_other.mako
  54. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/show.and.hide.history.html
  55. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/side.by.side.select.html
  56. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/sortables.html
  57. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/split-view-with-header.html
  58. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/splitview.(explicit.size).html
  59. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/splitview.(vertical).html
  60. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/splitview.html
  61. 19 0
      apps/jframegallery/src/jframegallery/templates/gallery/splitview.yml
  62. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/stand-alone.nav.buttons.html
  63. 2 2
      apps/jframegallery/src/jframegallery/templates/gallery/submit.form.on.change.html
  64. 1 1
      apps/jframegallery/src/jframegallery/templates/gallery/submit.link.html
  65. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/tabs-toolbar.html
  66. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/tabs.html
  67. 18 0
      apps/jframegallery/src/jframegallery/templates/gallery/tabs.yml
  68. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/timer.html
  69. 0 0
      apps/jframegallery/src/jframegallery/templates/gallery/tips.html
  70. 57 0
      apps/jframegallery/src/jframegallery/templates/source.mako
  71. 62 0
      apps/jframegallery/src/jframegallery/test.py
  72. 16 15
      apps/jframegallery/src/jframegallery/urls.py
  73. 154 35
      apps/jframegallery/src/jframegallery/views.py
  74. 81 1
      apps/jframegallery/static/css/jframegallery.css
  75. 51 5
      apps/jframegallery/static/js/Source/JFrameGallery/CCS.JFrameGallery.js

+ 82 - 82
apps/beeswax/static/js/Source/Beeswax/CCS.Beeswax.js

@@ -63,90 +63,90 @@ ART.Sheet.define('splitview.bw-editor', {
 					description: 'Open the selected item.'
 				}
 			});
-                        this.jframe.addBehaviors({
-                                // breadcrumb pattern; has to set z-index programatically for layout
-                                'Breadcrumb': function(element, methods) {
-                                        var items = element.getElements('li');
-                                        items.reverse().each(function(item, i){
-                                                item.setStyle('z-index', i+1);
-                                        });
-                                },
+			this.jframe.addBehaviors({
+				// breadcrumb pattern; has to set z-index programatically for layout
+				'Breadcrumb': function(element, methods) {
+					var items = element.getElements('li');
+					items.reverse().each(function(item, i){
+						item.setStyle('z-index', i+1);
+					});
+				},
 				//breadcrumb form; displays a breadcrumb that grows as you fill out the form
-                                'BreadcrumbForm': function(element, methods) {
-                                /*
-                                        The element is a UL with LI items for each breadcrumb; looks like this:
-                                        <ul data-filters="Breadcrumb, BreadcrumbForm" class="clearfix" data-bc-sections=".ccs-bc-section" data-bc-form="form">
-                                                <li><a href="#step1">One</a></li>
-                                                <li><a href="#step2">Two</a></li>
-                                                <li><a href="#step3">Ect</a></li>
-                                        </ul>
-                                        
-                                        it has a data-bc-sections definition which is a selector to select the sections that correlate to the bc links
-                                        it has a data-bc-form selector that correlates to the form for this bc form.
-                                */
-                                        container = methods.getContentElement();
-                                        var items = element.getElements('li');
-                                        var form = container.getElement(element.get('data', 'bc-form')) || container.getElement('form');
-                                        var sections = container.getElements(element.get('data', 'bc-sections'));
-                                        //extend tab swapper; we need to manage things like OverText and FormValidator when we change sections
-                                        var TS = new Class({
-                                                Extends: TabSwapper,
-                                                showSection: function(index) {
-                                                        //we validate the form when the user pages forward and not on the first display when this.now is still undefined
-                                                        //(where this.now is the current index of the TabSwapper; it's undefined on init)
-                                                        var validate = index > this.now && this.now != undefined;
-                                                        if (!validate) {
-                                                                //reset the error state
-                                                                form.get('validator').reset();
-                                                                if (this.now != undefined) items[this.now].removeClass('ccs-bc-error');
-                                                        }
-                                                        if (!validate || getValidator(form).validate()) {
-                                                                //show the section if we're valid
-                                                                this.parent(index);
-                                                                //show the overtext that might have been hidden
-                                                                OverText.update();
-                                                        }
-                                                        return this;
-                                                }
-                                        });
+				'BreadcrumbForm': function(element, methods) {
+				/*
+					The element is a UL with LI items for each breadcrumb; looks like this:
+					<ul data-filters="Breadcrumb, BreadcrumbForm" class="clearfix" data-bc-sections=".ccs-bc-section" data-bc-form="form">
+						<li><a href="#step1">One</a></li>
+						<li><a href="#step2">Two</a></li>
+						<li><a href="#step3">Ect</a></li>
+					</ul>
+					
+					it has a data-bc-sections definition which is a selector to select the sections that correlate to the bc links
+					it has a data-bc-form selector that correlates to the form for this bc form.
+				*/
+					container = methods.getContentElement();
+					var items = element.getElements('li');
+					var form = container.getElement(element.get('data', 'bc-form')) || container.getElement('form');
+					var sections = container.getElements(element.get('data', 'bc-sections'));
+					//extend tab swapper; we need to manage things like OverText and FormValidator when we change sections
+					var TS = new Class({
+						Extends: TabSwapper,
+						showSection: function(index) {
+							//we validate the form when the user pages forward and not on the first display when this.now is still undefined
+							//(where this.now is the current index of the TabSwapper; it's undefined on init)
+							var validate = index > this.now && this.now != undefined;
+							if (!validate) {
+								//reset the error state
+								form.get('validator').reset();
+								if (this.now != undefined) items[this.now].removeClass('ccs-bc-error');
+							}
+							if (!validate || getValidator(form).validate()) {
+								//show the section if we're valid
+								this.parent(index);
+								//show the overtext that might have been hidden
+								OverText.update();
+							}
+							return this;
+						}
+					});
 
-                                        //get the form validator and add an event for when elements are validated
-                                        //if the element fails, get the nav item and breadcrumb section and add an error class for styling
-                                        getValidator(form).addEvents({
-                                                elementValidate: function(valid, field){
-                                                        var section = field.getParent(element.get('data', 'bc-sections'));
-                                                        var nav = items[sections.indexOf(section)];
-                                                        if (valid) nav.removeClass('ccs-bc-error');
-                                                        else nav.addClass('ccs-bc-error');
-                                                }
-                                        });
+					//get the form validator and add an event for when elements are validated
+					//if the element fails, get the nav item and breadcrumb section and add an error class for styling
+					getValidator(form).addEvents({
+						elementValidate: function(valid, field){
+							var section = field.getParent(element.get('data', 'bc-sections'));
+							var nav = items[sections.indexOf(section)];
+							if (valid) nav.removeClass('ccs-bc-error');
+							else nav.addClass('ccs-bc-error');
+						}
+					});
 
-                                        //create our modified tabswapper
-                                        var tabs = new TS({
-                                                tabs: items,
-                                                sections: sections,
-                                                smooth: true
-                                        });
-                                        //find any sections with an element with the class .ccs-multipart-next and make that
-                                        //next button change tabs; note that this is the only way the user can progress forward (for now)
-                                        //todo: add some keyboard love; enter, tab, arrows, etc.
-                                        sections.each(function(section, i) {
-                                                section.getElements('.ccs-multipart-next').addEvent('click', function(e){
-                                                        e.stop();
-                                                        if (getValidator(form).validate()) tabs.show(i+1);
-                                                });
-                                        });
-                                }
-                        });
-                        this.jframe.addBehaviorPlugin('SelectWithOther', 'SelectWithOtherValidation', function(element, methods) {
-                                //adds validation upon hiding the 'other' field
-                                var select = element.getElement('select');
-                                select.addEvent('change', function() {
-                                        if(!select.getSelected()[0].get('value') == '__other__') {
-                                                getValidator(element.getParent('form')).validate();
-                                        }
-                                });
-                        });
+					//create our modified tabswapper
+					var tabs = new TS({
+						tabs: items,
+						sections: sections,
+						smooth: true
+					});
+					//find any sections with an element with the class .ccs-multipart-next and make that
+					//next button change tabs; note that this is the only way the user can progress forward (for now)
+					//todo: add some keyboard love; enter, tab, arrows, etc.
+					sections.each(function(section, i) {
+						section.getElements('.ccs-multipart-next').addEvent('click', function(e){
+							e.stop();
+							if (getValidator(form).validate()) tabs.show(i+1);
+						});
+					});
+				}
+			});
+			this.jframe.addBehaviorPlugin('SelectWithOther', 'SelectWithOtherValidation', function(element, methods) {
+				//adds validation upon hiding the 'other' field
+				var select = element.getElement('select');
+				select.addEvent('change', function() {
+					if(!select.getSelected()[0].get('value') == '__other__') {
+						getValidator(element.getParent('form')).validate();
+					}
+				});
+			});
 			this.jframe.addFilters({
 				visible: function(container){
 					if(!container.get('html').contains('ccs-visible')) return;
@@ -458,7 +458,7 @@ ART.Sheet.define('splitview.bw-editor', {
 			var saveIt = function(){
 				//grab the container of the save as inputs and clone them
 				//(clone them because our windows destroy themselves on hide)
-                                //Hide on clone to ensure that display property is set to none.
+				//Hide on clone to ensure that display property is set to none.
 				var form = saver.clone().hide();
 				//prompt the user w/ the form
 				var prompt = this.prompt('Save This Query', form.show(), function(){

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


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/Load_without_scrolling.html → apps/jframegallery/src/jframegallery/templates/gallery/Load_without_scrolling.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/Refresh.with.params.mako → apps/jframegallery/src/jframegallery/templates/gallery/Refresh.with.params.mako


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/accordion.html → apps/jframegallery/src/jframegallery/templates/gallery/accordion.html


+ 7 - 7
apps/jframegallery/src/jframegallery/templates/ajax-target.html → apps/jframegallery/src/jframegallery/templates/gallery/ajax-target.html

@@ -22,7 +22,7 @@ limitations under the License.
 	</head>
 	<body>
 		<div class="jframe_padded">
-			<a href="/jframegallery/partial_refresh.mako?sleep=1" data-ajax-target=".ajax_target">Load some content into the div below</a>
+			<a href="/jframegallery/gallery/partial_refresh.mako?sleep=1" data-ajax-target=".ajax_target">Load some content into the div below</a>
 			<div style="border: 1px solid #000; padding: 10px; margin: 10px 0px;" class="ajax_target">
 				This content is replaced whenever you click the link above.
 			</div>
@@ -30,33 +30,33 @@ limitations under the License.
 				Note that once you load content into the div above, hitting refresh destroys that content.
 			</p>
 			<hr/>
-			<a href="/jframegallery/partial_refresh.mako?sleep=1" data-ajax-replace=".ajax_replace div">Replace the blue box below.</a>
+			<a href="/jframegallery/gallery/partial_refresh.mako?sleep=1" data-ajax-replace=".ajax_replace div">Replace the blue box below.</a>
 			<div style="border: 1px solid #000; padding: 10px; margin: 10px 0px;" class="ajax_replace">
 				<div style="padding: 10px; background: #99f;">This gets replaced by the response</div>
 			</div>
-			<a href="/jframegallery/partial_refresh.mako?sleep=1" data-ajax-append=".ajax_append div">Add the response after the blue box below.</a>
+			<a href="/jframegallery/gallery/partial_refresh.mako?sleep=1" data-ajax-append=".ajax_append div">Add the response after the blue box below.</a>
 			<div style="border: 1px solid #000; padding: 10px; margin: 10px 0px;" class="ajax_append">
 				<div style="padding: 10px; background: #99f;">The response gets appended after this box</div>
 			</div>
 			<hr/>
-			<a href="/jframegallery/partial_refresh.mako?sleep=1" data-ajax-after=".ajax_after"><em>Also</em> adds the response after the blue box below.</a>
+			<a href="/jframegallery/gallery/partial_refresh.mako?sleep=1" data-ajax-after=".ajax_after"><em>Also</em> adds the response after the blue box below.</a>
 			<div style="border: 1px solid #000; padding: 10px; margin: 10px 0px;">
 				<div style="padding: 10px; background: #99f;" class="ajax_after">The response gets appended after this box</div>
 			</div>
 			<hr/>
-			<a href="/jframegallery/partial_refresh.mako?sleep=1" data-ajax-before=".ajax_before">Add the response <em>before</em> the blue box below.</a>
+			<a href="/jframegallery/gallery/partial_refresh.mako?sleep=1" data-ajax-before=".ajax_before">Add the response <em>before</em> the blue box below.</a>
 			<div style="border: 1px solid #000; padding: 10px; margin: 10px 0px;">
 				<div style="padding: 10px; background: #99f;" class="ajax_before">The response gets prepended <em>before</em> this box</div>
 			</div>
 			<hr/>
 
 
-			<a href="/jframegallery/partial_refresh.mako?sleep=1" data-ajax-target=".ajax_filter" data-ajax-filter="textarea">This link loads the same url as the others, but only the textarea is inserted into the box below</a>
+			<a href="/jframegallery/gallery/partial_refresh.mako?sleep=1" data-ajax-target=".ajax_filter" data-ajax-filter="textarea">This link loads the same url as the others, but only the textarea is inserted into the box below</a>
 			<div style="border: 1px solid #000; padding: 10px; margin: 10px 0px;" class="ajax_filter">
 				This box is replaced with a textarea when you click the 
 			</div>
 			<hr/>
-			<a href="/jframegallery/partial_refresh.mako" data-ajax-target=".nothing_here">This is also an ajax link, but it's target is not found, so it falls back to being a regular link.</a>
+			<a href="/jframegallery/gallery/partial_refresh.mako" data-ajax-target=".nothing_here">This is also an ajax link, but it's target is not found, so it falls back to being a regular link.</a>
 		</div>
 	</body>
 </html>

+ 1 - 1
apps/jframegallery/src/jframegallery/templates/ajax.spinner.target.html → apps/jframegallery/src/jframegallery/templates/gallery/ajax.spinner.target.html

@@ -22,7 +22,7 @@ limitations under the License.
 	</head>
 	<body>
 		<div class="jframe_padded">
-			<a style="display:block; border: 1px solid #000; width: 100px; padding: 50px 10px; text-align:center;" href="/jframegallery/ajax.spinner.target.html?sleep=1" data-spinner-target=".spinnerTarget" class="spinnerTarget">Click to reload with the spinner only on this box</a>
+			<a style="display:block; border: 1px solid #000; width: 100px; padding: 50px 10px; text-align:center;" href="{{request_path}}?sleep=1" data-spinner-target=".spinnerTarget" class="spinnerTarget">Click to reload with the spinner only on this box</a>
 		</div>
 	</body>
 </html>

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/anchor_tags_that_scroll.html → apps/jframegallery/src/jframegallery/templates/gallery/anchor_tags_that_scroll.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/app-launcher.html → apps/jframegallery/src/jframegallery/templates/gallery/app-launcher.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/art-button.html → apps/jframegallery/src/jframegallery/templates/gallery/art-button.html


+ 18 - 0
apps/jframegallery/src/jframegallery/templates/gallery/art-button.yml

@@ -0,0 +1,18 @@
+# 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.
+
+js-references:
+  - "Widgets/Behavior.ArtButton"

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/art-inputs.html → apps/jframegallery/src/jframegallery/templates/gallery/art-inputs.html


File diff suppressed because it is too large
+ 0 - 0
apps/jframegallery/src/jframegallery/templates/gallery/autocomplete.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/check.all.or.none.html → apps/jframegallery/src/jframegallery/templates/gallery/check.all.or.none.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/chooser.linker.html → apps/jframegallery/src/jframegallery/templates/gallery/chooser.linker.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/collapser.html → apps/jframegallery/src/jframegallery/templates/gallery/collapser.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/context-menu.html → apps/jframegallery/src/jframegallery/templates/gallery/context-menu.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/css.widget.graph.html → apps/jframegallery/src/jframegallery/templates/gallery/css.widget.graph.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/data.group.toggle.html → apps/jframegallery/src/jframegallery/templates/gallery/data.group.toggle.html


+ 1 - 1
apps/jframegallery/src/jframegallery/templates/double.click-delegator.html → apps/jframegallery/src/jframegallery/templates/gallery/double.click-delegator.html

@@ -25,7 +25,7 @@ limitations under the License.
 			<p>Note that to use double click delegation on a container with links in it, if you don't want the links to fire on single click, you must add the css class "jframe_ignore" to them and configure the double click delegator to point to the desired link. This is especially useful with HtmlTables with selectable rows if you don't want a single click on the row to load another page, even if the user clicks on a link.</p>
 			
 			<div data-dblclick-delegate="{'dblclick_loads':'.dblme'}" style="width: 200px; height: 100px; padding: 40px; background: #ccc; border: 1px solid #000; float: left; margin: 0px 10px;">
-				<a class="dblme jframe_ignore" href="/jframegallery/post-load.alert.popup.html">I show an alert if you double click anywhere inside the box around me. Note that I have the css class "jframe_ignore" which means a single click on me does nothing.</a>
+				<a class="dblme jframe_ignore" href="/jframegallery/gallery/post-load.alert.popup.html">I show an alert if you double click anywhere inside the box around me. Note that I have the css class "jframe_ignore" which means a single click on me does nothing.</a>
 			</div>
 
 			<div data-dblclick-delegate="{'dblclick_loads':'.dblme'}" style="width: 200px; height: 100px; padding: 40px; background: #ccc; border: 1px solid #000; float: left; margin: 0px 10px;">

+ 7 - 7
apps/jframegallery/src/jframegallery/templates/errors.html → apps/jframegallery/src/jframegallery/templates/gallery/errors.html

@@ -24,14 +24,14 @@ limitations under the License.
           <ul>
             Clicking on any of these should trigger an error popup.
             <li><a id=e_1 href="/">A request for /</a> </li>
-            <li><a id=e_1 href="/jframegallery/error_404">Explicit 404</a> </li>
-            <li><a id=e_2 href="/jframegallery/error_message_exception">Explict message exception</a> </li>
-            <li><a id=e_3 href="/jframegallery/error_popup_exception">Explict popup exception</a> </li>
-            <li><a id=e_4 href="/jframegallery/error_500">500 (trapped by middleware)</a></li>
-            <li><a id=e_5 href="/jframegallery/error_real_500">500 (not trapped by middleware)</a></li>
+            <li><a id=e_1 href="/jframegallery/gallery/error_404">Explicit 404</a> </li>
+            <li><a id=e_2 href="/jframegallery/gallery/error_message_exception">Explict message exception</a> </li>
+            <li><a id=e_3 href="/jframegallery/gallery/error_popup_exception">Explict popup exception</a> </li>
+            <li><a id=e_4 href="/jframegallery/gallery/error_500">500 (trapped by middleware)</a></li>
+            <li><a id=e_5 href="/jframegallery/gallery/error_real_500">500 (not trapped by middleware)</a></li>
             <li><a id=e_6 href="/test/does_not_exist/404">404 because link doesn't exist</a> </li>
-            <li><a id=e_7 href="/jframegallery/error_python">Code doesn't work</a> </li>
-            <li><a id=e_8 href="/jframegallery/error_redirect">Redirect to bad location</a> </li>
+            <li><a id=e_7 href="/jframegallery/gallery/error_python">Code doesn't work</a> </li>
+            <li><a id=e_8 href="/jframegallery/gallery/error_redirect">Redirect to bad location</a> </li>
           </ul>
 	</body>
 </html>

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/filter.input.html → apps/jframegallery/src/jframegallery/templates/gallery/filter.input.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/fit.text.(table).html → apps/jframegallery/src/jframegallery/templates/gallery/fit.text.(table).html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/fit.text.html → apps/jframegallery/src/jframegallery/templates/gallery/fit.text.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/flash.html → apps/jframegallery/src/jframegallery/templates/gallery/flash.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/form.validation.html → apps/jframegallery/src/jframegallery/templates/gallery/form.validation.html


+ 1 - 1
apps/jframegallery/src/jframegallery/templates/form_popup_interaction.html → apps/jframegallery/src/jframegallery/templates/gallery/form_popup_interaction.html

@@ -18,6 +18,6 @@ limitations under the License.
 A bug with the interaction of Form.Request and Hue's handling
 of Requests caused the following button to only work once
 in this jframe gallery.
-<form action="/jframegallery/post-load.alert.popup">
+<form action="/jframegallery/gallery/post-load.alert.popup">
 <input type="submit">button</input>
 </form>

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/forms_with_dependencies.mako → apps/jframegallery/src/jframegallery/templates/gallery/forms_with_dependencies.mako


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/forwarding.html → apps/jframegallery/src/jframegallery/templates/gallery/forwarding.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/frame.tips.html → apps/jframegallery/src/jframegallery/templates/gallery/frame.tips.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/growl.redirect.html → apps/jframegallery/src/jframegallery/templates/gallery/growl.redirect.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/html-table.check.selected.html → apps/jframegallery/src/jframegallery/templates/gallery/html-table.check.selected.html


+ 20 - 0
apps/jframegallery/src/jframegallery/templates/gallery/html-table.check.selected.yml

@@ -0,0 +1,20 @@
+# 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.
+
+js-references:
+  - "More-Behaviors/Behavior.HtmlTable"
+  - "More/HtmlTable"
+  - "More/HtmlTable.Select"

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/html-table.configurable.columns.mako → apps/jframegallery/src/jframegallery/templates/gallery/html-table.configurable.columns.mako


+ 19 - 0
apps/jframegallery/src/jframegallery/templates/gallery/html-table.configurable.columns.yml

@@ -0,0 +1,19 @@
+# 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.
+
+js-references:
+  - "More-Behaviors/Behavior.HtmlTable"
+  - "More/HtmlTable"

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/html-table.html → apps/jframegallery/src/jframegallery/templates/gallery/html-table.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/html-table.multi-select.menu.html → apps/jframegallery/src/jframegallery/templates/gallery/html-table.multi-select.menu.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/html-table.resizable.columns.html → apps/jframegallery/src/jframegallery/templates/gallery/html-table.resizable.columns.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/html-table.treeview.ajax.mako → apps/jframegallery/src/jframegallery/templates/gallery/html-table.treeview.ajax.mako


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/html-table.treeview.html → apps/jframegallery/src/jframegallery/templates/gallery/html-table.treeview.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/ignored-links.html → apps/jframegallery/src/jframegallery/templates/gallery/ignored-links.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/jframe.sizeTo.html → apps/jframegallery/src/jframegallery/templates/gallery/jframe.sizeTo.html


+ 1 - 1
apps/jframegallery/src/jframegallery/templates/meta-refresh.html → apps/jframegallery/src/jframegallery/templates/gallery/meta-refresh.html

@@ -19,7 +19,7 @@ limitations under the License.
 <html>
   <head>
     <title>Meta Refresh</title>
-    <meta http-equiv="refresh" content="5;/jframegallery/meta-refresh.html?sleep=2" />
+		<meta http-equiv="refresh" content="5;{{request_path}}?sleep=2" />
   </head>
   <body>
     <div class="jframe_padded">

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/multi-checks.html → apps/jframegallery/src/jframegallery/templates/gallery/multi-checks.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/overtext.html → apps/jframegallery/src/jframegallery/templates/gallery/overtext.html


+ 1 - 1
apps/jframegallery/src/jframegallery/templates/partial_refresh.mako → apps/jframegallery/src/jframegallery/templates/gallery/partial_refresh.mako

@@ -23,7 +23,7 @@ count = int(get_var('count', 0))
 <html>
   <head>
     <title>Partial Refresh</title>
-    <xmeta http-equiv="refresh" content="2;/jframegallery/partial_refresh.mako?sleep=1&count=${count + 1}" />
+    <xmeta http-equiv="refresh" content="2;{{request_path}}?sleep=1&count=${count + 1}" />
   </head>
   <body>
     <div class="jframe_padded highlight-partial-updates">

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/post-load.alert.popup.html → apps/jframegallery/src/jframegallery/templates/gallery/post-load.alert.popup.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/post-load.alert.popup.jframe.renders.html → apps/jframegallery/src/jframegallery/templates/gallery/post-load.alert.popup.jframe.renders.html


+ 1 - 1
apps/jframegallery/src/jframegallery/templates/post-load.prompt.popup.html → apps/jframegallery/src/jframegallery/templates/gallery/post-load.prompt.popup.html

@@ -33,7 +33,7 @@ limitations under the License.
 		{% else %}
 		<div class="prompt_popup">
 				I'm a post-load prompt. Enter a value please.
-				<form action="/jframegallery/post-load.prompt.popup.html" method="post" style="margin: 6px 0px 0px;">
+				<form action="{{request_path}}" method="post" style="margin: 6px 0px 0px;">
 					<input type="text" name="prompt_value"/>
 					<input type="submit" class="ccs-hidden" name="submit"/>
 				</form>

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/posteditor.html → apps/jframegallery/src/jframegallery/templates/gallery/posteditor.html


+ 1 - 1
apps/jframegallery/src/jframegallery/templates/redirect.html → apps/jframegallery/src/jframegallery/templates/gallery/redirect.html

@@ -21,7 +21,7 @@ limitations under the License.
 		<title>Redirects</title>
 	</head>
 	<body>
-          <a href="/jframegallery/redirect_301">Clicking here</a> 
+          <a href="/jframegallery/gallery/redirect_301">Clicking here</a> 
           should redirect you back to this page, through two requests.
 	</body>
 </html>

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/resizables.html → apps/jframegallery/src/jframegallery/templates/gallery/resizables.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/select_with_other.mako → apps/jframegallery/src/jframegallery/templates/gallery/select_with_other.mako


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/show.and.hide.history.html → apps/jframegallery/src/jframegallery/templates/gallery/show.and.hide.history.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/side.by.side.select.html → apps/jframegallery/src/jframegallery/templates/gallery/side.by.side.select.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/sortables.html → apps/jframegallery/src/jframegallery/templates/gallery/sortables.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/split-view-with-header.html → apps/jframegallery/src/jframegallery/templates/gallery/split-view-with-header.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/splitview.(explicit.size).html → apps/jframegallery/src/jframegallery/templates/gallery/splitview.(explicit.size).html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/splitview.(vertical).html → apps/jframegallery/src/jframegallery/templates/gallery/splitview.(vertical).html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/splitview.html → apps/jframegallery/src/jframegallery/templates/gallery/splitview.html


+ 19 - 0
apps/jframegallery/src/jframegallery/templates/gallery/splitview.yml

@@ -0,0 +1,19 @@
+# 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.
+
+js-references:
+  - "Widgets/ART.SplitView"
+  - "Widgets/Behavior.SplitView"

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/stand-alone.nav.buttons.html → apps/jframegallery/src/jframegallery/templates/gallery/stand-alone.nav.buttons.html


+ 2 - 2
apps/jframegallery/src/jframegallery/templates/submit.form.on.change.html → apps/jframegallery/src/jframegallery/templates/gallery/submit.form.on.change.html

@@ -34,7 +34,7 @@ limitations under the License.
 		<p>
 			The form below will submit as soon as you select a value.
 		</p>
-		<form action="/jframegallery/submit.form.on.change.html" method="post" style="margin: 6px 0px 0px;" data-filters="SubmitOnChange">
+		<form action="{{request_path}}" method="post" style="margin: 6px 0px 0px;" data-filters="SubmitOnChange">
 			<select name="select_list">
 				<option value="option 1">option 1</option>
 				<option value="option 2">option 2</option>
@@ -45,7 +45,7 @@ limitations under the License.
 		
 		<hr/>
 		<p>This form works exactly as the one above, but the SubmitOnChange data filter is on the select, rather than the form.</p>
-		<form action="/jframegallery/submit.form.on.change.html" method="post" style="margin: 6px 0px 0px;">
+		<form action="{{request_path}}" method="post" style="margin: 6px 0px 0px;">
 			<select name="select_list" data-filters="SubmitOnChange">
 				<option value="option 1">option 1</option>
 				<option value="option 2">option 2</option>

+ 1 - 1
apps/jframegallery/src/jframegallery/templates/submit.link.html → apps/jframegallery/src/jframegallery/templates/gallery/submit.link.html

@@ -24,7 +24,7 @@ limitations under the License.
 
 		<p>Click either submit button to update the box below. The box should have an ajax spinner and then update with the content in the button.</p>
 
-		<form action="/jframegallery/submit.link.html" method="post" style="margin: 6px 0px 0px;">
+		<form action="{{request_path}}" method="post" style="margin: 6px 0px 0px;">
 			<input type="submit" name="button" value="fetch html (button 1)"/>
 			<input type="submit" name="button" value="fetch html (button 2)"/>
 			<a class="ccs-submit_form" data-extra-data="{'link':'fetch html (link 1)'}">fetch html (link 1)</a>

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/tabs-toolbar.html → apps/jframegallery/src/jframegallery/templates/gallery/tabs-toolbar.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/tabs.html → apps/jframegallery/src/jframegallery/templates/gallery/tabs.html


+ 18 - 0
apps/jframegallery/src/jframegallery/templates/gallery/tabs.yml

@@ -0,0 +1,18 @@
+# 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.
+
+js-references:
+  - "ccs-shared/Behavior.Tabs"

+ 0 - 0
apps/jframegallery/src/jframegallery/templates/timer.html → apps/jframegallery/src/jframegallery/templates/gallery/timer.html


+ 0 - 0
apps/jframegallery/src/jframegallery/templates/tips.html → apps/jframegallery/src/jframegallery/templates/gallery/tips.html


+ 57 - 0
apps/jframegallery/src/jframegallery/templates/source.mako

@@ -0,0 +1,57 @@
+## 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.
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+  <head>
+    <title>JFrame Gallery Source -- ${name}</title>
+    </head>
+    <body>
+      <div class="jf-src_view">
+	<div data-filters="Tabs" data-tabs-selector=".tab" data-sections-selector=".section">
+	  <div data-filters="SplitView">
+	    <div class="left_col jframe_padded">
+	      <ul>
+		<li class="tab html-tab"><a>HTML/Template</a></li>
+		%for js_name in js_data.iterkeys():
+		  <li class="tab">
+		    <a>${js_name}</a>
+		  </li>
+		%endfor
+	      </ul>
+	    </div>
+	    <div class="right_col jframe_padded">
+	      <ul class="ccs-clear">
+		## Template data
+		<li class="section">
+		  <h3>Source for HTML</h3>
+		  <hr/>
+		  ${data|n}
+		</li>
+		## JS data
+		%for js_name, js in js_data.iteritems():
+		  <li class="section">
+		    <h3>Source for <code>${js_name}</code></h3>
+		    <hr/>
+		    ${js|n}
+		  </li>
+		%endfor
+	      </ul>
+	    </div>
+	  </div>
+	</div>
+      </div>
+    </body>
+</html>

+ 62 - 0
apps/jframegallery/src/jframegallery/test.py

@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+# 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.
+
+"""
+Tests for jframegallery
+"""
+
+import logging
+import os
+import os.path
+
+from nose.tools import assert_equals, assert_true
+from desktop.lib.django_test_util import make_logged_in_client
+
+LOG = logging.getLogger(__name__)
+CWD = os.path.dirname(__file__)
+
+def _get_all_gallery_files():
+  """Return a list of files in the gallery directory"""
+  gallery_dir = os.path.join(CWD, 'templates', 'gallery')
+  return os.listdir(gallery_dir)
+
+
+def test_galleries():
+  cli = make_logged_in_client()
+  resp = cli.get('/jframegallery/')
+
+  # Hit index. Make sure that all the galleries are there
+  all_files = resp.context['files']
+  all_paths = [ f['filename'] for f in all_files ]
+  all_paths.sort()
+
+  assert_true('gallery/html-table.html' in all_paths)
+  assert_true('gallery/errors.html' in all_paths)
+  assert_true('gallery/fit.text.(table).html' in all_paths)
+  assert_true('gallery/partial_refresh.mako' in all_paths)
+
+  # Hit all views
+  for path in all_paths:
+    LOG.debug('Testing %s' % (path,))
+    demo_url = '/jframegallery/gallery/' + os.path.basename(path)
+    source_url = '/jframegallery/source/' + os.path.basename(path)
+
+    # Check that the demo renders
+    cli.get(demo_url)
+
+    # Check that the source renders
+    cli.get(source_url)

+ 16 - 15
apps/jframegallery/src/jframegallery/urls.py

@@ -19,19 +19,20 @@ from django.conf.urls.defaults import patterns, url
 
 urlpatterns = patterns('jframegallery',
   url(r'^$', 'views.index'),
-  url(r'^autocomplete$', 'views.autocomplete'),
-  url(r'^flash.redirect.*$', 'views.flash_redirect'),
-  url(r'^flash.*$', 'views.flash'),
-  url(r'^error_404.*$', 'views.error_404'),
-  url(r'^error_500.*$', 'views.error_500'),
-  url(r'^error_real_500.*$', 'views.error_real_500'),
-  url(r'^error_python.*$', 'views.error_python'),
-  url(r'^error_redirect.*$', 'views.error_redirect'),
-  url(r'^redirect_301.*$', 'views.redirect_301'),
-  url(r'^forwarding.*$', 'views.forwarding'),
-  url(r'^error_message_exception.*$', 'views.error_message_exception'),
-  url(r'^error_popup_exception.*$', 'views.error_popup_exception'),
-  url(r'^forms_with_dependencies.*$', 'views.forms_with_dependencies'),
-  url(r'^html-table.treeview.ajax.*$', 'views.pstree'),
-  url(r'^(?P<path>.*)$', 'views.show')
+  url(r'^source/(?P<path>.*)$', 'views.view_source'),
+  url(r'^gallery/autocomplete$', 'views.autocomplete'),
+  url(r'^gallery/flash.redirect.*$', 'views.flash_redirect'),
+  url(r'^gallery/flash.*$', 'views.flash'),
+  url(r'^gallery/error_404.*$', 'views.error_404'),
+  url(r'^gallery/error_500.*$', 'views.error_500'),
+  url(r'^gallery/error_real_500.*$', 'views.error_real_500'),
+  url(r'^gallery/error_python.*$', 'views.error_python'),
+  url(r'^gallery/error_redirect.*$', 'views.error_redirect'),
+  url(r'^gallery/redirect_301.*$', 'views.redirect_301'),
+  url(r'^gallery/forwarding.*$', 'views.forwarding'),
+  url(r'^gallery/error_message_exception.*$', 'views.error_message_exception'),
+  url(r'^gallery/error_popup_exception.*$', 'views.error_popup_exception'),
+  url(r'^gallery/forms_with_dependencies.*$', 'views.forms_with_dependencies'),
+  url(r'^gallery/html-table.treeview.ajax.*$', 'views.pstree'),
+  url(r'^gallery/(?P<path>.*)$', 'views.show')
 )

File diff suppressed because it is too large
+ 154 - 35
apps/jframegallery/src/jframegallery/views.py


+ 81 - 1
apps/jframegallery/static/css/jframegallery.css

@@ -6,4 +6,84 @@
 	left: 6px;
 	background: url(/jframegallery/static/art/jframegallery.png) no-repeat;
 	display:block;
-}
+}
+
+.jframe-gallery .jf-buttonbar {
+	position: relative;
+	top: 0px;
+	left: 70px;
+}
+
+.jframe-gallery .jf-src_view .tabSelected {
+	font-weight: bold;
+}
+
+.jframe-gallery .jf-src_view .html-tab {
+	margin-bottom: 5px;
+}
+
+/*
+ * Styles from Pygments
+ */
+.jframe-gallery .highlight .hll { background-color: #ffffcc }
+.jframe-gallery .highlight  { background: #f8f8f8; }
+.jframe-gallery .highlight .c { color: #408080; font-style: italic } /* Comment */
+.jframe-gallery .highlight .err { border: 1px solid #FF0000 } /* Error */
+.jframe-gallery .highlight .k { color: #008000; font-weight: bold } /* Keyword */
+.jframe-gallery .highlight .o { color: #666666 } /* Operator */
+.jframe-gallery .highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+.jframe-gallery .highlight .cp { color: #BC7A00 } /* Comment.Preproc */
+.jframe-gallery .highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
+.jframe-gallery .highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
+.jframe-gallery .highlight .gd { color: #A00000 } /* Generic.Deleted */
+.jframe-gallery .highlight .ge { font-style: italic } /* Generic.Emph */
+.jframe-gallery .highlight .gr { color: #FF0000 } /* Generic.Error */
+.jframe-gallery .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.jframe-gallery .highlight .gi { color: #00A000 } /* Generic.Inserted */
+.jframe-gallery .highlight .go { color: #808080 } /* Generic.Output */
+.jframe-gallery .highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+.jframe-gallery .highlight .gs { font-weight: bold } /* Generic.Strong */
+.jframe-gallery .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.jframe-gallery .highlight .gt { color: #0040D0 } /* Generic.Traceback */
+.jframe-gallery .highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.jframe-gallery .highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.jframe-gallery .highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.jframe-gallery .highlight .kp { color: #008000 } /* Keyword.Pseudo */
+.jframe-gallery .highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.jframe-gallery .highlight .kt { color: #B00040 } /* Keyword.Type */
+.jframe-gallery .highlight .m { color: #666666 } /* Literal.Number */
+.jframe-gallery .highlight .s { color: #BA2121 } /* Literal.String */
+.jframe-gallery .highlight .na { color: #7D9029 } /* Name.Attribute */
+.jframe-gallery .highlight .nb { color: #008000 } /* Name.Builtin */
+.jframe-gallery .highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
+.jframe-gallery .highlight .no { color: #880000 } /* Name.Constant */
+.jframe-gallery .highlight .nd { color: #AA22FF } /* Name.Decorator */
+.jframe-gallery .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
+.jframe-gallery .highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.jframe-gallery .highlight .nf { color: #0000FF } /* Name.Function */
+.jframe-gallery .highlight .nl { color: #A0A000 } /* Name.Label */
+.jframe-gallery .highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+.jframe-gallery .highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
+.jframe-gallery .highlight .nv { color: #19177C } /* Name.Variable */
+.jframe-gallery .highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+.jframe-gallery .highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.jframe-gallery .highlight .mf { color: #666666 } /* Literal.Number.Float */
+.jframe-gallery .highlight .mh { color: #666666 } /* Literal.Number.Hex */
+.jframe-gallery .highlight .mi { color: #666666 } /* Literal.Number.Integer */
+.jframe-gallery .highlight .mo { color: #666666 } /* Literal.Number.Oct */
+.jframe-gallery .highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
+.jframe-gallery .highlight .sc { color: #BA2121 } /* Literal.String.Char */
+.jframe-gallery .highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
+.jframe-gallery .highlight .s2 { color: #BA2121 } /* Literal.String.Double */
+.jframe-gallery .highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.jframe-gallery .highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
+.jframe-gallery .highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.jframe-gallery .highlight .sx { color: #008000 } /* Literal.String.Other */
+.jframe-gallery .highlight .sr { color: #BB6688 } /* Literal.String.Regex */
+.jframe-gallery .highlight .s1 { color: #BA2121 } /* Literal.String.Single */
+.jframe-gallery .highlight .ss { color: #19177C } /* Literal.String.Symbol */
+.jframe-gallery .highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
+.jframe-gallery .highlight .vc { color: #19177C } /* Name.Variable.Class */
+.jframe-gallery .highlight .vg { color: #19177C } /* Name.Variable.Global */
+.jframe-gallery .highlight .vi { color: #19177C } /* Name.Variable.Instance */
+.jframe-gallery .highlight .il { color: #666666 } /* Literal.Number.Integer.Long */

+ 51 - 5
apps/jframegallery/static/js/Source/JFrameGallery/CCS.JFrameGallery.js

@@ -1,12 +1,12 @@
 // Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
+// or more contributor license agreements.	See the NOTICE file
 // distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// 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
+// with the License.	You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+//		 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,
@@ -35,6 +35,8 @@ CCS.JFrameGallery = new Class({
 	},
 
 	initialize: function(path, options){
+		this.parent(path || '/jframegallery/', options);
+
 		this.addEvent('load', function(){
 			this.toolbar.adopt(
 				new Element('a', {
@@ -42,8 +44,52 @@ CCS.JFrameGallery = new Class({
 					'class': 'jf-logo'
 				})
 			);
+
+			/* Inject demo/source button bar */
+			var path = this.jframe.currentPath;
+			var do_inject = false;
+			var demopath;
+			var sourcepath;
+
+			if (path.indexOf('/jframegallery/gallery') === 0) {
+				/* This is the view of a demo */
+				demopath = path;
+				sourcepath = path.replace('/jframegallery/gallery', '/jframegallery/source');
+				do_inject = true;
+			} else if (path.indexOf('/jframegallery/source') === 0) {
+				/* This is the view of a demo source */
+				demopath = path.replace('/jframegallery/source', '/jframegallery/gallery');
+				sourcepath = path;
+				do_inject = true;
+			}
+
+			if (do_inject) {
+				var buttonBar = new Element('ul', {
+					'class': 'jf-buttonbar',
+					'data-filters': 'ArtButtonBar'
+				});
+
+				var demoLink = new Element('a', {
+					href: demopath,
+					'class': 'jf-button',
+					'data-filters': 'ArtButton',
+					'text': "View Demo"
+				});
+
+				var sourceLink = new Element('a', {
+					href: sourcepath,
+					'class': 'jf-button',
+					'data-filters': 'ArtButton',
+					'text': "View Source"
+				});
+
+				buttonBar.adopt(new Element('li').adopt(demoLink));
+				buttonBar.adopt(new Element('li').adopt(sourceLink));
+				this.toolbar.adopt(buttonBar);
+				this.jframe.behavior.apply(this.toolbar);
+			}
+			sourcepath = "foo";
 		}.bind(this));
-		this.parent(path || '/jframegallery/', options);
 	}
 
 });

Some files were not shown because too many files changed in this diff