The Unified and Autonomous Development Platform
Source page
steve410cfc117377
diff --git a/gitop.product/system/conf/logback.xml b/gitop.product/system/conf/logback.xmlindex f431756f3a..a0133c0d7d 100644--- a/gitop.product/system/conf/logback.xml+++ b/gitop.product/system/conf/logback.xml@@ -29,6 +29,7 @@<logger name="com.jolbox.bonecp.BoneCPConfig" level="WARN" /><logger name="com.sun.jersey" level="WARN" /><logger name="org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl" level="ERROR"></logger>+ <logger name="org.reflections" level="WARN"></logger><root level="INFO"><appender-ref ref="FILE" />diff --git a/gitop.web/pom.xml b/gitop.web/pom.xmlindex baf2a3ae91..51bf5e950f 100644--- a/gitop.web/pom.xml+++ b/gitop.web/pom.xml@@ -81,8 +81,52 @@<groupId>com.pmease</groupId><artifactId>gitop.rest</artifactId><version>1.0.0</version>- </dependency>- </dependencies>+ </dependency>++ <!-- Google Closure Dependencies -->+ <dependency>+ <groupId>com.google.closure</groupId>+ <artifactId>closure-soy</artifactId>+ <version>20130228</version>+ </dependency>++ <dependency>+ <groupId>rhino</groupId>+ <artifactId>js</artifactId>+ <version>1.7R2</version>+ </dependency>++ <dependency>+ <groupId>cglib</groupId>+ <artifactId>cglib-nodep</artifactId>+ <version>2.2.2</version>+ </dependency>++ <dependency>+ <groupId>aopalliance</groupId>+ <artifactId>aopalliance</artifactId>+ <version>1.0</version>+ </dependency>++ <dependency>+ <groupId>com.ibm.icu</groupId>+ <artifactId>icu4j</artifactId>+ <version>4.8.1.1</version>+ </dependency>++ <dependency>+ <groupId>org.objenesis</groupId>+ <artifactId>objenesis</artifactId>+ <version>1.3</version>+ </dependency>++ <dependency>+ <groupId>org.reflections</groupId>+ <artifactId>reflections</artifactId>+ <version>0.9.8</version>+ </dependency>+ </dependencies>+<repositories><repository><id>pmeaseRepo</id>@@ -98,7 +142,20 @@<checksumPolicy>fail</checksumPolicy></snapshots><url>http://artifact.pmease.com/</url>- </repository>+ </repository>++ <repository>+ <id>local-repo</id>+ <name>Local Closure Repo</name>+ <releases>+ <enabled>true</enabled>+ <checksumPolicy>ignore</checksumPolicy>+ </releases>+ <snapshots>+ <enabled>false</enabled>+ </snapshots>+ <url>file://${project.basedir}/repo</url>+ </repository></repositories><properties><moduleClass>com.pmease.gitop.web.WebModule</moduleClass>diff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jar b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jarnew file mode 100644index 0000000000..668414ecddBinary files /dev/null and b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jar differdiff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jar.md5 b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jar.md5new file mode 100644index 0000000000..35b886d74e--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jar.md5@@ -0,0 +1 @@+b6591c2c2085c69ebc052ff28413e05f\ No newline at end of filediff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jar.sha1 b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jar.sha1new file mode 100644index 0000000000..df7e46bb2f--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228-sources.jar.sha1@@ -0,0 +1 @@+23cbb32b10907c644dc34fe102efcffc77ea936d\ No newline at end of filediff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jar b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jarnew file mode 100644index 0000000000..caf463ced0Binary files /dev/null and b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jar differdiff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jar.md5 b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jar.md5new file mode 100644index 0000000000..fbd5490100--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jar.md5@@ -0,0 +1 @@+565de555b7ad3cb9c87c0f4b4e065816\ No newline at end of filediff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jar.sha1 b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jar.sha1new file mode 100644index 0000000000..713f7aaa0e--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.jar.sha1@@ -0,0 +1 @@+cc28da103845a0f08cfd3fa5abdd45899b0adae1\ No newline at end of filediff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pom b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pomnew file mode 100644index 0000000000..ce890d5091--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pom@@ -0,0 +1,9 @@+<?xml version="1.0" encoding="UTF-8"?>+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">+ <modelVersion>4.0.0</modelVersion>+ <groupId>com.google.closure</groupId>+ <artifactId>closure-soy</artifactId>+ <version>20130228</version>+ <description>POM was created from install:install-file</description>+</project>diff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pom.md5 b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pom.md5new file mode 100644index 0000000000..6c20ca39bb--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pom.md5@@ -0,0 +1 @@+c2ee0d122ec1baff532a184256a5fcdc\ No newline at end of filediff --git a/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pom.sha1 b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pom.sha1new file mode 100644index 0000000000..226779de40--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/20130228/closure-soy-20130228.pom.sha1@@ -0,0 +1 @@+bafc480c52cf64f1838109baef4091f4628e4f71\ No newline at end of filediff --git a/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xml b/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xmlnew file mode 100644index 0000000000..0532c707e1--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xml@@ -0,0 +1,12 @@+<?xml version="1.0" encoding="UTF-8"?>+<metadata>+ <groupId>com.google.closure</groupId>+ <artifactId>closure-soy</artifactId>+ <versioning>+ <release>20130228</release>+ <versions>+ <version>20130228</version>+ </versions>+ <lastUpdated>20130227161111</lastUpdated>+ </versioning>+</metadata>diff --git a/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xml.md5 b/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xml.md5new file mode 100644index 0000000000..e0d4c3c29c--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xml.md5@@ -0,0 +1 @@+193f2ca76f1a724326be64216d094081\ No newline at end of filediff --git a/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xml.sha1 b/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xml.sha1new file mode 100644index 0000000000..215e987638--- /dev/null+++ b/gitop.web/repo/com/google/closure/closure-soy/maven-metadata-local.xml.sha1@@ -0,0 +1 @@+c94eebab1e4061d592af5119e288d67f734b073e\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java b/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.javaindex ee90ac494f..4cb8abe056 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java@@ -73,13 +73,14 @@ import com.pmease.gitop.web.page.project.settings.ProjectHooksPage;import com.pmease.gitop.web.page.project.settings.ProjectOptionsPage;import com.pmease.gitop.web.page.project.settings.ProjectPermissionsPage;import com.pmease.gitop.web.page.project.settings.PullRequestSettingsPage;-import com.pmease.gitop.web.page.project.source.SourceBlobPage;-import com.pmease.gitop.web.page.project.source.ProjectHomePage;import com.pmease.gitop.web.page.project.source.BranchesPage;import com.pmease.gitop.web.page.project.source.CommitsPage;import com.pmease.gitop.web.page.project.source.ContributorsPage;-import com.pmease.gitop.web.page.project.source.TagsPage;+import com.pmease.gitop.web.page.project.source.ProjectHomePage;+import com.pmease.gitop.web.page.project.source.SourceBlobPage;+import com.pmease.gitop.web.page.project.source.SourceCommitPage;import com.pmease.gitop.web.page.project.source.SourceTreePage;+import com.pmease.gitop.web.page.project.source.TagsPage;import com.pmease.gitop.web.page.project.stats.ProjectForksPage;import com.pmease.gitop.web.page.project.stats.ProjectGraphsPage;import com.pmease.gitop.web.page.project.wiki.ProjectWikiPage;@@ -246,6 +247,7 @@ public class GitopWebApp extends AbstractWicketConfig {mount(new PageParameterAwareMountedMapper("${user}/${project}/tree/${objectId}", SourceTreePage.class));mount(new PageParameterAwareMountedMapper("${user}/${project}/blob/${objectId}", SourceBlobPage.class));+ mount(new PageParameterAwareMountedMapper("${user}/${project}/commit/${objectId}", SourceCommitPage.class));mount(new PageParameterAwareMountedMapper("${user}/${project}/commits", CommitsPage.class));mount(new PageParameterAwareMountedMapper("${user}/${project}/branches", BranchesPage.class));mount(new PageParameterAwareMountedMapper("${user}/${project}/tags", TagsPage.class));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/WebModule.java b/gitop.web/src/main/java/com/pmease/gitop/web/WebModule.javaindex f5e309f2e5..1f5e65a6ae 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/WebModule.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/WebModule.java@@ -2,12 +2,14 @@ package com.pmease.gitop.web;import javax.inject.Singleton;+import com.google.common.collect.ImmutableSet;import com.pmease.commons.jersey.JerseyConfigurator;import com.pmease.commons.jersey.JerseyEnvironment;import com.pmease.commons.jetty.ServletConfigurator;import com.pmease.commons.loader.AbstractPluginModule;import com.pmease.commons.wicket.AbstractWicketConfig;import com.pmease.gitop.core.validation.UserNameReservation;+import com.pmease.gitop.web.common.soy.impl.SoyTemplateModule;import com.pmease.gitop.web.resource.TestResource;/**@@ -35,6 +37,8 @@ public class WebModule extends AbstractPluginModule {}});++ install(new SoyTemplateModule(ImmutableSet.<String>of(GitopWebApp.class.getPackage().getName())));}}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/assets/BaseResourcesBehavior.java b/gitop.web/src/main/java/com/pmease/gitop/web/assets/BaseResourcesBehavior.javaindex 2d3349a233..4901aa3ff4 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/assets/BaseResourcesBehavior.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/assets/BaseResourcesBehavior.java@@ -13,14 +13,6 @@ import com.pmease.commons.wicket.asset.bootstrap.BootstrapHeaderItem;public class BaseResourcesBehavior extends Behavior {private static final long serialVersionUID = 1L;-// static final ResourceReference MODERNIZR_JS = new JavaScriptResourceReference(BaseResourceBehavior.class, "js/vendor/modernizr-2.6.2.js");-// static final ResourceReference PAGE_JS = new JavaScriptResourceReference(BaseResourceBehavior.class, "js/page.js");-//-// static final ResourceReference FONT_AWESOME_CSS = new CssResourceReference(BaseResourceBehavior.class, "css/font-awesome.css");-// static final ResourceReference FONT_AWESOME_MIN_CSS = new CssResourceReference(BaseResourceBehavior.class, "css/font-awesome.min.css");-// static final ResourceReference BASE_CSS = new CssResourceReference(BaseResourceBehavior.class, "css/base.css");-// static final ResourceReference PAGE_CSS = new CssResourceReference(BaseResourceBehavior.class, "css/page.css");-@Overridepublic void renderHead(Component component, IHeaderResponse response) {super.renderHead(component, response);@@ -33,7 +25,7 @@ public class BaseResourcesBehavior extends Behavior {// render bootstrapresponse.render(new PriorityHeaderItem(BootstrapHeaderItem.get()));- // render font-awesome+ // render iconsresponse.render(new PriorityHeaderItem(CssReferenceHeaderItem.forReference(AssetLocator.ICONS_CSS)));response.render(new PriorityHeaderItem(CssReferenceHeaderItem.forReference(AssetLocator.BASE_CSS)));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.cssindex 7d29e51252..eeb34cfbcc 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css+++ b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css@@ -349,4 +349,6 @@ ul.repo-actions { margin: 8px 4px 8px 0; padding: 0; list-style: none; }.breadcrumb-paths em { font-style: normal; font-weight: bold; color: #333; }.breadcrumb-paths > li+li:before {color: #999; font-weight: bold;-}\ No newline at end of file+}++table.files td.file-icon { width: 18px; padding-right: 2px; }\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/FoundationDropDownResourceReference.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/FoundationDropDownResourceReference.javaindex 10900f1eeb..e1c42ffed3 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/FoundationDropDownResourceReference.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/FoundationDropDownResourceReference.java@@ -3,7 +3,6 @@ package com.pmease.gitop.web.common.component.foundation;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.HeaderItem;import org.apache.wicket.markup.head.JavaScriptHeaderItem;-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;import org.apache.wicket.request.resource.CssResourceReference;import org.apache.wicket.request.resource.JavaScriptResourceReference;import org.apache.wicket.request.resource.ResourceReference;@@ -24,10 +23,9 @@ public class FoundationDropDownResourceReference extends JavaScriptResourceRefer@Overridepublic Iterable<? extends HeaderItem> getDependencies() {return Iterables.concat(super.getDependencies(),- ImmutableList.of(+ ImmutableList.<HeaderItem>of(JavaScriptHeaderItem.forReference(FoundationResourceReference.get()),- CssHeaderItem.forReference(CSS),- OnDomReadyHeaderItem.forScript("$(document).foundation()")));+ CssHeaderItem.forReference(CSS)));}private static FoundationDropDownResourceReference instance =diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/css/dropdown.css b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/css/dropdown.cssindex 806e73125d..23e5407d96 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/css/dropdown.css+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/css/dropdown.css@@ -1,8 +1,8 @@-/* FOUNDATIOIN DROPDOWN */-@media only screen and (max-width: 767px) {+@media only screen and (max-width: 40em) {.f-dropdown {max-width: 100%;left: 0; } }+/* Foundation Dropdowns */.f-dropdown {position: absolute;@@ -14,7 +14,7 @@height: auto;background: white;border: solid 1px #cccccc;- font-size: 16;+ font-size: 16px;z-index: 99;margin-top: 2px;max-width: 200px; }@@ -53,28 +53,28 @@left: auto;right: 9px; }.f-dropdown li {- font-size: 0.875em;+ font-size: 0.875rem;cursor: pointer;- line-height: 1.125em;+ line-height: 1.125rem;margin: 0; }.f-dropdown li:hover, .f-dropdown li:focus {background: #eeeeee; }.f-dropdown li a {display: block;- padding: 0.3125em 0.625em;+ padding: 0.5rem;color: #555555; }.f-dropdown.content {position: absolute;top: -9999px;list-style: none;margin-left: 0;- padding: 1.25em;+ padding: 1.25rem;width: 100%;height: auto;max-height: none;background: white;border: solid 1px #cccccc;- font-size: 16;+ font-size: 16px;z-index: 99;max-width: 200px; }.f-dropdown.content > *:first-child {diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.abide.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.abide.jsindex 232b0460ed..1478b18e57 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.abide.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.abide.js@@ -1,15 +1,12 @@-/*jslint unparam: true, browser: true, indent: 2 */-;(function ($, window, document, undefined) {'use strict';Foundation.libs.abide = {name : 'abide',- version : '4.3.3',+ version : '5.0.0',settings : {- live_validate : true,focus_on_invalid : true,timeout : 1000,patterns : {@@ -49,43 +46,32 @@timer : null,init : function (scope, method, options) {- if (typeof method === 'object') {- $.extend(true, this.settings, method);- }-- if (typeof method !== 'string') {- if (!this.settings.init) { this.events(); }-- } else {- return this[method].call(this, options);- }+ this.bindings(method, options);},- events : function () {+ events : function (scope) {var self = this,- forms = $('form[data-abide]', this.scope).attr('novalidate', 'novalidate');+ form = $(scope).attr('novalidate', 'novalidate'),+ settings = form.data('abide-init');- forms- .on('submit validate', function (e) {+ form+ .off('.abide')+ .on('submit.fndtn.abide validate.fndtn.abide', function (e) {var is_ajax = /ajax/i.test($(this).attr('data-abide'));return self.validate($(this).find('input, textarea, select').get(), e, is_ajax);- });-- this.settings.init = true;-- if (!this.settings.live_validate) return;-- forms- .find('input, textarea, select')- .on('blur change', function (e) {- self.validate([this], e);})- .on('keydown', function (e) {- clearTimeout(self.timer);- self.timer = setTimeout(function () {+ .find('input, textarea, select')+ .off('.abide')+ .on('blur.fndtn.abide change.fndtn.abide', function (e) {self.validate([this], e);- }.bind(this), self.settings.timeout);- });+ })+ .on('keydown.fndtn.abide', function (e) {+ var settings = $(this).closest('form').data('abide-init');+ clearTimeout(self.timer);+ self.timer = setTimeout(function () {+ self.validate([this], e);+ }.bind(this), settings.timeout);+ });},validate : function (els, e, is_ajax) {@@ -154,11 +140,14 @@var el = el_patterns[i][0],required = el_patterns[i][2],value = el.value,+ is_equal = el.getAttribute('data-equalto'),is_radio = el.type === "radio",valid_length = (required) ? (el.value.length > 0) : true;if (is_radio && required) {validations.push(this.valid_radio(el, required));+ } else if (is_equal && required) {+ validations.push(this.valid_equal(el, required));} else {if (el_patterns[i][1].test(value) && valid_length ||!required && el.value.length < 1) {@@ -192,7 +181,21 @@}}+ return valid;+ },++ valid_equal: function(el, required) {+ var from = document.getElementById(el.getAttribute('data-equalto')).value,+ to = el.value,+ valid = (from === to);++ if (valid) {+ $(el).removeAttr('data-invalid').parent().removeClass('error');+ } else {+ $(el).attr('data-invalid', '').parent().addClass('error');+ }+return valid;}};-}(Foundation.zj, this, this.document));\ No newline at end of file+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.accordion.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.accordion.jsnew file mode 100644index 0000000000..c36d0b113c--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.accordion.js@@ -0,0 +1,41 @@+;(function ($, window, document, undefined) {+ 'use strict';++ Foundation.libs.accordion = {+ name : 'accordion',++ version : '5.0.1',++ settings : {+ active_class: 'active',+ toggleable: true+ },++ init : function (scope, method, options) {+ this.bindings(method, options);+ },++ events : function () {+ $(this.scope).off('.accordion').on('click.fndtn.accordion', '[data-accordion] > dd > a', function (e) {+ var accordion = $(this).parent(),+ target = $('#' + this.href.split('#')[1]),+ siblings = $('> dd > .content', target.closest('[data-accordion]')),+ settings = accordion.parent().data('accordion-init'),+ active = $('> dd > .content.' + settings.active_class, accordion.parent());++ e.preventDefault();++ if (active[0] == target[0] && settings.toggleable) {+ return target.toggleClass(settings.active_class);+ }++ siblings.removeClass(settings.active_class);+ target.addClass(settings.active_class);+ });+ },++ off : function () {},++ reflow : function () {}+ };+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.alert.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.alert.jsnew file mode 100644index 0000000000..1bb404a169--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.alert.js@@ -0,0 +1,34 @@+;(function ($, window, document, undefined) {+ 'use strict';++ Foundation.libs.alert = {+ name : 'alert',++ version : '5.0.0',++ settings : {+ animation: 'fadeOut',+ speed: 300, // fade out speed+ callback: function (){}+ },++ init : function (scope, method, options) {+ this.bindings(method, options);+ },++ events : function () {+ $(this.scope).off('.alert').on('click.fndtn.alert', '[data-alert] a.close', function (e) {+ var alertBox = $(this).closest("[data-alert]"),+ settings = alertBox.data('alert-init');++ e.preventDefault();+ alertBox[settings.animation](settings.speed, function () {+ $(this).trigger('closed').remove();+ settings.callback();+ });+ });+ },++ reflow : function () {}+ };+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.alerts.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.alerts.jsdeleted file mode 100644index 63dada016c..0000000000--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.alerts.js+++ /dev/null@@ -1,57 +0,0 @@-/*jslint unparam: true, browser: true, indent: 2 */--;(function ($, window, document, undefined) {- 'use strict';-- Foundation.libs.alerts = {- name : 'alerts',-- version : '4.3.2',-- settings : {- animation: 'fadeOut',- speed: 300, // fade out speed- callback: function (){}- },-- init : function (scope, method, options) {- this.scope = scope || this.scope;- Foundation.inherit(this, 'data_options');-- if (typeof method === 'object') {- $.extend(true, this.settings, method);- }-- if (typeof method !== 'string') {- if (!this.settings.init) { this.events(); }-- return this.settings.init;- } else {- return this[method].call(this, options);- }- },-- events : function () {- var self = this;-- $(this.scope).on('click.fndtn.alerts', '[data-alert] a.close', function (e) {- var alertBox = $(this).closest("[data-alert]"),- settings = $.extend({}, self.settings, self.data_options(alertBox));-- e.preventDefault();- alertBox[settings.animation](settings.speed, function () {- $(this).remove();- settings.callback();- });- });-- this.settings.init = true;- },-- off : function () {- $(this.scope).off('.fndtn.alerts');- },-- reflow : function () {}- };-}(Foundation.zj, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.clearing.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.clearing.jsindex 71f5c1a729..75daf44bb6 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.clearing.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.clearing.js@@ -1,12 +1,10 @@-/*jslint unparam: true, browser: true, indent: 2 */-;(function ($, window, document, undefined) {'use strict';Foundation.libs.clearing = {name : 'clearing',- version: '4.3.3',+ version: '5.0.0',settings : {templates : {@@ -27,55 +25,38 @@init : function (scope, method, options) {var self = this;- Foundation.inherit(this, 'set_data get_data remove_data throttle data_options');-- if (typeof method === 'object') {- options = $.extend(true, this.settings, method);- }-- if (typeof method !== 'string') {- $(this.scope).find('ul[data-clearing]').each(function () {- var $el = $(this),- options = options || {},- lis = $el.find('li'),- settings = self.get_data($el);-- if (!settings && lis.length > 0) {- options.$parent = $el.parent();+ Foundation.inherit(this, 'throttle loaded');- self.set_data($el, $.extend({}, self.settings, options, self.data_options($el)));+ this.bindings(method, options);- self.assemble($el.find('li'));-- if (!self.settings.init) {- self.events().swipe_events();- }- }- });-- return this.settings.init;+ if ($(this.scope).is('[data-clearing]')) {+ this.assemble($('li', this.scope));} else {- // fire method- return this[method].call(this, options);+ $('[data-clearing]', this.scope).each(function () {+ self.assemble($('li', this));+ });}},- // event binding and initial setup-- events : function () {+ events : function (scope) {var self = this;$(this.scope)+ .off('.clearing').on('click.fndtn.clearing', 'ul[data-clearing] li',function (e, current, target) {var current = current || $(this),target = target || current,next = current.next('li'),- settings = self.get_data(current.parent()),+ settings = current.closest('[data-clearing]').data('clearing-init'),image = $(e.target);e.preventDefault();- if (!settings) self.init();++ if (!settings) {+ self.init();+ settings = current.closest('[data-clearing]').data('clearing-init');+ }// if clearing is open and the current image is// clicked, go to the next image in sequence@@ -83,7 +64,7 @@current[0] === target[0] &&next.length > 0 && self.is_open(current)) {target = next;- image = target.find('img');+ image = $('img', target);}// set current and target to the clicked li if not otherwise defined.@@ -92,22 +73,21 @@}).on('click.fndtn.clearing', '.clearing-main-next',- function (e) { this.nav(e, 'next') }.bind(this))+ function (e) { self.nav(e, 'next') }).on('click.fndtn.clearing', '.clearing-main-prev',- function (e) { this.nav(e, 'prev') }.bind(this))+ function (e) { self.nav(e, 'prev') }).on('click.fndtn.clearing', this.settings.close_selectors,function (e) { Foundation.libs.clearing.close(e, this) }).on('keydown.fndtn.clearing',- function (e) { this.keydown(e) }.bind(this));+ function (e) { self.keydown(e) });- $(window).on('resize.fndtn.clearing',- function () { this.resize() }.bind(this));+ $(window).off('.clearing').on('resize.fndtn.clearing',+ function () { self.resize() });- this.settings.init = true;- return this;+ this.swipe_events(scope);},- swipe_events : function () {+ swipe_events : function (scope) {var self = this;$(this.scope)@@ -156,13 +136,15 @@assemble : function ($li) {var $el = $li.parent();++ if ($el.parent().hasClass('carousel')) return;$el.after('<div id="foundationClearingHolder"></div>');var holder = $('#foundationClearingHolder'),- settings = this.get_data($el),+ settings = $el.data('clearing-init'),grid = $el.detach(),data = {- grid: '<div class="carousel">' + this.outerHTML(grid[0]) + '</div>',+ grid: '<div class="carousel">' + grid[0].outerHTML + '</div>',viewing: settings.templates.viewing},wrapper = '<div class="clearing-assembled"><div>' + data.viewing +@@ -171,16 +153,13 @@return holder.after(wrapper).remove();},- // event callbacks-open : function ($image, current, target) {var root = target.closest('.clearing-assembled'),- container = root.find('div').first(),- visible_image = container.find('.visible-img'),- image = visible_image.find('img').not($image);+ container = $('div', root).first(),+ visible_image = $('.visible-img', container),+ image = $('img', visible_image).not($image);if (!this.locked()) {- visible_image.trigger('open.fndtn.clearing', $image.attr('id'));// set the image to the selected thumbnailimage.attr('src', this.load($image))@@ -193,13 +172,12 @@container.addClass('clearing-container');visible_image.show();this.fix_height(target)- .caption(visible_image.find('.clearing-caption'), $image)+ .caption($('.clearing-caption', visible_image), $image).center(image).shift(current, target, function () {target.siblings().removeClass('visible');target.addClass('visible');});- visible_image.trigger('opened.fndtn.clearing')}.bind(this));}},@@ -216,16 +194,14 @@}($(el))), container, visible_image;if (el === e.target && root) {- container = root.find('div').first();- visible_image = container.find('.visible-img');- visible_image.trigger('close.fndtn.clearing');+ container = $('div', root).first();+ visible_image = $('.visible-img', container);this.settings.prev_index = 0;- root.find('ul[data-clearing]')+ $('ul[data-clearing]', root).attr('style', '').closest('.clearing-blackout').removeClass('clearing-blackout');container.removeClass('clearing-container');visible_image.hide();- visible_image.trigger('closed.fndtn.clearing');}return false;@@ -236,7 +212,7 @@},keydown : function (e) {- var clearing = $('.clearing-blackout').find('ul[data-clearing]');+ var clearing = $('ul[data-clearing]', '.clearing-blackout');if (e.which === 39) this.go(clearing, 'next');if (e.which === 37) this.go(clearing, 'prev');@@ -244,18 +220,17 @@},nav : function (e, direction) {- var clearing = $('.clearing-blackout').find('ul[data-clearing]');+ var clearing = $('ul[data-clearing]', '.clearing-blackout');e.preventDefault();this.go(clearing, direction);},resize : function () {- var image = $('.clearing-blackout .visible-img').find('img');+ var image = $('img', '.clearing-blackout .visible-img');if (image.length) {this.center(image);- image.trigger('resized.fndtn.clearing')}},@@ -268,7 +243,7 @@var li = $(this),image = li.find('img');- if (li.height() > self.outerHeight(image)) {+ if (li.height() > image.outerHeight()) {li.addClass('fix-height');}})@@ -284,22 +259,18 @@.siblings('.visible-img');if (target.next().length > 0) {- visible_image- .find('.clearing-main-next')+ $('.clearing-main-next', visible_image).removeClass('disabled');} else {- visible_image- .find('.clearing-main-next')+ $('.clearing-main-next', visible_image).addClass('disabled');}if (target.prev().length > 0) {- visible_image- .find('.clearing-main-prev')+ $('.clearing-main-prev', visible_image).removeClass('disabled');} else {- visible_image- .find('.clearing-main-prev')+ $('.clearing-main-prev', visible_image).addClass('disabled');}},@@ -307,13 +278,13 @@center : function (target) {if (!this.rtl) {target.css({- marginLeft : -(this.outerWidth(target) / 2),- marginTop : -(this.outerHeight(target) / 2)+ marginLeft : -(target.outerWidth() / 2),+ marginTop : -(target.outerHeight() / 2)});} else {target.css({- marginRight : -(this.outerWidth(target) / 2),- marginTop : -(this.outerHeight(target) / 2)+ marginRight : -(target.outerWidth() / 2),+ marginTop : -(target.outerHeight() / 2)});}return this;@@ -340,47 +311,15 @@.img($image.closest('li').prev());},- loaded : function (image, callback) {- // based on jquery.imageready.js- // @weblinc, @jsantell, (c) 2012-- function loaded () {- callback();- }-- function bindLoad () {- this.one('load', loaded);-- if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {- var src = this.attr( 'src' ),- param = src.match( /\?/ ) ? '&' : '?';-- param += 'random=' + (new Date()).getTime();- this.attr('src', src + param);- }- }-- if (!image.attr('src')) {- loaded();- return;- }-- if (image[0].complete || image[0].readyState === 4) {- loaded();- } else {- bindLoad.call(image);- }- },-img : function (img) {if (img.length) {var new_img = new Image(),- new_a = img.find('a');+ new_a = $('a', img);if (new_a.length) {new_img.src = new_a.attr('href');} else {- new_img.src = img.find('img').attr('src');+ new_img.src = $('img', img).attr('src');}}return this;@@ -406,14 +345,12 @@// directional methodsgo : function ($ul, direction) {- var current = $ul.find('.visible'),+ var current = $('.visible', $ul),target = current[direction]();if (target.length) {- target- .find('img')- .trigger('click', [current, target])- .trigger('change.fndtn.clearing');+ $('img', target)+ .trigger('click', [current, target]);}},@@ -422,7 +359,7 @@old_index = this.settings.prev_index || target.index(),direction = this.direction(clearing, current, target),left = parseInt(clearing.css('left'), 10),- width = this.outerWidth(target),+ width = target.outerWidth(),skip_shift;// we use jQuery animate instead of CSS transitions because we@@ -452,9 +389,9 @@},direction : function ($el, current, target) {- var lis = $el.find('li'),- li_width = this.outerWidth(lis) + (this.outerWidth(lis) / 4),- up_count = Math.floor(this.outerWidth($('.clearing-container')) / li_width) - 1,+ var lis = $('li', $el),+ li_width = lis.outerWidth() + (lis.outerWidth() / 4),+ up_count = Math.floor($('.clearing-container').outerWidth() / li_width) - 1,target_index = lis.index(target),response;@@ -500,18 +437,9 @@return this.settings.locked;},- // plugin management/browser quirks-- outerHTML : function (el) {- // support FireFox < 11- return el.outerHTML || new XMLSerializer().serializeToString(el);- },-off : function () {$(this.scope).off('.fndtn.clearing');$(window).off('.fndtn.clearing');- this.remove_data(); // empty settings cache- this.settings.init = false;},reflow : function () {@@ -519,4 +447,4 @@}};-}(Foundation.zj, this, this.document));+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.cookie.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.cookie.jsdeleted file mode 100644index b196e764a9..0000000000--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.cookie.js+++ /dev/null@@ -1,74 +0,0 @@-/*!- * jQuery Cookie Plugin v1.3- * https://github.com/carhartl/jquery-cookie- *- * Copyright 2011, Klaus Hartl- * Dual licensed under the MIT or GPL Version 2 licenses.- * http://www.opensource.org/licenses/mit-license.php- * http://www.opensource.org/licenses/GPL-2.0- *- * Modified to work with Zepto.js by ZURB- */-(function ($, document, undefined) {-- var pluses = /\+/g;-- function raw(s) {- return s;- }-- function decoded(s) {- return decodeURIComponent(s.replace(pluses, ' '));- }-- var config = $.cookie = function (key, value, options) {-- // write- if (value !== undefined) {- options = $.extend({}, config.defaults, options);-- if (value === null) {- options.expires = -1;- }-- if (typeof options.expires === 'number') {- var days = options.expires, t = options.expires = new Date();- t.setDate(t.getDate() + days);- }-- value = config.json ? JSON.stringify(value) : String(value);-- return (document.cookie = [- encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE- options.path ? '; path=' + options.path : '',- options.domain ? '; domain=' + options.domain : '',- options.secure ? '; secure' : ''- ].join(''));- }-- // read- var decode = config.raw ? raw : decoded;- var cookies = document.cookie.split('; ');- for (var i = 0, l = cookies.length; i < l; i++) {- var parts = cookies[i].split('=');- if (decode(parts.shift()) === key) {- var cookie = decode(parts.join('='));- return config.json ? JSON.parse(cookie) : cookie;- }- }-- return null;- };-- config.defaults = {};-- $.removeCookie = function (key, options) {- if ($.cookie(key) !== null) {- $.cookie(key, null, options);- return true;- }- return false;- };--})(Foundation.zj, document);\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.dropdown.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.dropdown.jsindex 62f116433c..622db932d0 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.dropdown.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.dropdown.js@@ -1,92 +1,95 @@-/*jslint unparam: true, browser: true, indent: 2 */-;(function ($, window, document, undefined) {'use strict';Foundation.libs.dropdown = {name : 'dropdown',- version : '4.3.2',+ version : '5.0.0',settings : {- activeClass: 'open',+ active_class: 'open',is_hover: false,opened: function(){},closed: function(){}},init : function (scope, method, options) {- this.scope = scope || this.scope;- Foundation.inherit(this, 'throttle scrollLeft data_options');-- if (typeof method === 'object') {- $.extend(true, this.settings, method);- }-- if (typeof method !== 'string') {-- if (!this.settings.init) {- this.events();- }+ Foundation.inherit(this, 'throttle');- return this.settings.init;- } else {- return this[method].call(this, options);- }+ this.bindings(method, options);},- events : function () {+ events : function (scope) {var self = this;$(this.scope)+ .off('.dropdown').on('click.fndtn.dropdown', '[data-dropdown]', function (e) {- var settings = $.extend({}, self.settings, self.data_options($(this)));+ var settings = $(this).data('dropdown-init');e.preventDefault();- if (!settings.is_hover) self.toggle($(this));+ if (!settings.is_hover || Modernizr.touch) self.toggle($(this));})- .on('mouseenter', '[data-dropdown]', function (e) {- var settings = $.extend({}, self.settings, self.data_options($(this)));- if (settings.is_hover) self.toggle($(this));+ .on('mouseenter.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {+ var $this = $(this);+ clearTimeout(self.timeout);++ if ($this.data('dropdown')) {+ var dropdown = $('#' + $this.data('dropdown')),+ target = $this;+ } else {+ var dropdown = $this;+ target = $("[data-dropdown='" + dropdown.attr('id') + "']");+ }++ var settings = target.data('dropdown-init');+ if (settings.is_hover) self.open.apply(self, [dropdown, target]);})- .on('mouseleave', '[data-dropdown-content]', function (e) {- var target = $('[data-dropdown="' + $(this).attr('id') + '"]'),- settings = $.extend({}, self.settings, self.data_options(target));- if (settings.is_hover) self.close.call(self, $(this));+ .on('mouseleave.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {+ var $this = $(this);+ self.timeout = setTimeout(function () {+ if ($this.data('dropdown')) {+ var settings = $this.data('dropdown-init');+ if (settings.is_hover) self.close.call(self, $('#' + $this.data('dropdown')));+ } else {+ var target = $('[data-dropdown="' + $(this).attr('id') + '"]'),+ settings = target.data('dropdown-init');+ if (settings.is_hover) self.close.call(self, $this);+ }+ }.bind(this), 150);})- .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened)- .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed);+ .on('click.fndtn.dropdown', function (e) {+ var parent = $(e.target).closest('[data-dropdown-content]');- $(document).on('click.fndtn.dropdown', function (e) {- var parent = $(e.target).closest('[data-dropdown-content]');-- if ($(e.target).data('dropdown') || $(e.target).parent().data('dropdown')) {- return;- }- if (!($(e.target).data('revealId')) &&- (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') ||- $.contains(parent.first()[0], e.target)))) {- e.stopPropagation();- return;- }-- self.close.call(self, $('[data-dropdown-content]'));- });+ if ($(e.target).data('dropdown') || $(e.target).parent().data('dropdown')) {+ return;+ }+ if (!($(e.target).data('revealId')) &&+ (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') ||+ $.contains(parent.first()[0], e.target)))) {+ e.stopPropagation();+ return;+ }- $(window).on('resize.fndtn.dropdown', self.throttle(function () {- self.resize.call(self);- }, 50)).trigger('resize');+ self.close.call(self, $('[data-dropdown-content]'));+ })+ .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened)+ .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed);- this.settings.init = true;+ $(window)+ .off('.dropdown')+ .on('resize.fndtn.dropdown', self.throttle(function () {+ self.resize.call(self);+ }, 50)).trigger('resize');},close: function (dropdown) {var self = this;dropdown.each(function () {- if ($(this).hasClass(self.settings.activeClass)) {+ if ($(this).hasClass(self.settings.active_class)) {$(this).css(Foundation.rtl ? 'right':'left', '-99999px')- .removeClass(self.settings.activeClass);+ .removeClass(self.settings.active_class);$(this).trigger('closed');}});@@ -95,7 +98,7 @@open: function (dropdown, target) {this.css(dropdown- .addClass(this.settings.activeClass), target);+ .addClass(this.settings.active_class), target);dropdown.trigger('opened');},@@ -108,7 +111,7 @@this.close.call(this, $('[data-dropdown-content]').not(dropdown));- if (dropdown.hasClass(this.settings.activeClass)) {+ if (dropdown.hasClass(this.settings.active_class)) {this.close.call(this, dropdown);} else {this.close.call(this, $('[data-dropdown-content]'))@@ -126,25 +129,22 @@},css : function (dropdown, target) {- var offset_parent = dropdown.offsetParent();- // if (offset_parent.length > 0 && /body/i.test(dropdown.offsetParent()[0].nodeName)) {- var position = target.offset();- position.top -= offset_parent.offset().top;- position.left -= offset_parent.offset().left;- // } else {- // var position = target.position();- // }+ var offset_parent = dropdown.offsetParent(),+ position = target.offset();++ position.top -= offset_parent.offset().top;+ position.left -= offset_parent.offset().left;if (this.small()) {dropdown.css({position : 'absolute',width: '95%','max-width': 'none',- top: position.top + this.outerHeight(target)+ top: position.top + target.outerHeight()});dropdown.css(Foundation.rtl ? 'right':'left', '2.5%');} else {- if (!Foundation.rtl && $(window).width() > this.outerWidth(dropdown) + target.offset().left && !this.data_options(target).align_right) {+ if (!Foundation.rtl && $(window).width() > dropdown.outerWidth() + target.offset().left) {var left = position.left;if (dropdown.hasClass('right')) {dropdown.removeClass('right');@@ -153,12 +153,12 @@if (!dropdown.hasClass('right')) {dropdown.addClass('right');}- var left = position.left - (this.outerWidth(dropdown) - this.outerWidth(target));+ var left = position.left - (dropdown.outerWidth() - target.outerWidth());}dropdown.attr('style', '').css({position : 'absolute',- top: position.top + this.outerHeight(target),+ top: position.top + target.outerHeight(),left: left});}@@ -167,7 +167,8 @@},small : function () {- return $(window).width() < 768 || $('html').hasClass('lt-ie9');+ return matchMedia(Foundation.media_queries.small).matches &&+ !matchMedia(Foundation.media_queries.medium).matches;},off: function () {@@ -180,4 +181,4 @@reflow : function () {}};-}(Foundation.zj, this, this.document));+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.forms.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.forms.jsdeleted file mode 100644index b58e92c339..0000000000--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.forms.js+++ /dev/null@@ -1,556 +0,0 @@-(function ($, window, document, undefined) {- 'use strict';-- Foundation.libs.forms = {- name : 'forms',-- version: '4.3.2',-- cache: {},-- settings: {- disable_class: 'no-custom',- last_combo : null- },-- init: function (scope, method, options) {-- if (typeof method === 'object') {- $.extend(true, this.settings, method);- }-- if (typeof method !== 'string') {- if (!this.settings.init) {- this.events();- }-- this.assemble();-- return this.settings.init;- } else {- return this[method].call(this, options);- }- },-- assemble: function () {-- var forms = this;-- $('form.custom input[type="radio"],[type="checkbox"]', $(this.scope))- .not('[data-customforms="disabled"]')- .not('.' + this.settings.disable_class)- .each(function(idx, sel){- forms.set_custom_markup(sel);- })- .change(function(){- forms.set_custom_markup(this);- });-- $('form.custom select', $(this.scope))- .not('[data-customforms="disabled"]')- .not('.' + this.settings.disable_class)- .not('[multiple=multiple]')- .each(this.append_custom_select);- },-- events: function () {- var self = this;-- $(this.scope)- .on('click.fndtn.forms', 'form.custom span.custom.checkbox', function (e) {- e.preventDefault();- e.stopPropagation();- self.toggle_checkbox($(this));- })- .on('click.fndtn.forms', 'form.custom span.custom.radio', function (e) {- e.preventDefault();- e.stopPropagation();- self.toggle_radio($(this));- })- .on('change.fndtn.forms', 'form.custom select', function (e, force_refresh) {- if ($(this).is('[data-customforms="disabled"]')) return;- self.refresh_custom_select($(this), force_refresh);- })- .on('click.fndtn.forms', 'form.custom label', function (e) {- if ($(e.target).is('label')) {- var $associatedElement = $('#' + self.escape($(this).attr('for'))).not('[data-customforms="disabled"]'),- $customCheckbox,- $customRadio;-- if ($associatedElement.length !== 0) {- if ($associatedElement.attr('type') === 'checkbox') {- e.preventDefault();- $customCheckbox = $(this).find('span.custom.checkbox');- //the checkbox might be outside after the label or inside of another element- if ($customCheckbox.length === 0) {- $customCheckbox = $associatedElement.add(this).siblings('span.custom.checkbox').first();- }- self.toggle_checkbox($customCheckbox);- } else if ($associatedElement.attr('type') === 'radio') {- e.preventDefault();- $customRadio = $(this).find('span.custom.radio');- //the radio might be outside after the label or inside of another element- if ($customRadio.length === 0) {- $customRadio = $associatedElement.add(this).siblings('span.custom.radio').first();- }- self.toggle_radio($customRadio);- }- }- }- })- .on('mousedown.fndtn.forms', 'form.custom div.custom.dropdown', function () {- return false;- })- .on('click.fndtn.forms', 'form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector', function (e) {- var $this = $(this),- $dropdown = $this.closest('div.custom.dropdown'),- $select = getFirstPrevSibling($dropdown, 'select');-- // make sure other dropdowns close- if (!$dropdown.hasClass('open')) $(self.scope).trigger('click');-- e.preventDefault();- if (false === $select.is(':disabled')) {- $dropdown.toggleClass('open');-- if ($dropdown.hasClass('open')) {- $(self.scope).on('click.fndtn.forms.customdropdown', function () {- $dropdown.removeClass('open');- $(self.scope).off('.fndtn.forms.customdropdown');- });- } else {- $(self.scope).on('.fndtn.forms.customdropdown');- }- return false;- }- })- .on('click.fndtn.forms touchend.fndtn.forms', 'form.custom div.custom.dropdown li', function (e) {- var $this = $(this),- $customDropdown = $this.closest('div.custom.dropdown'),- $select = getFirstPrevSibling($customDropdown, 'select'),- selectedIndex = 0;-- e.preventDefault();- e.stopPropagation();-- if (!$(this).hasClass('disabled')) {- $('div.dropdown').not($customDropdown).removeClass('open');-- var $oldThis = $this.closest('ul')- .find('li.selected');- $oldThis.removeClass('selected');-- $this.addClass('selected');-- $customDropdown.removeClass('open')- .find('a.current')- .text($this.text());-- $this.closest('ul').find('li').each(function (index) {- if ($this[0] === this) {- selectedIndex = index;- }- });- $select[0].selectedIndex = selectedIndex;-- //store the old value in data- $select.data('prevalue', $oldThis.html());-- // Kick off full DOM change event- if (typeof (document.createEvent) != 'undefined') {- var event = document.createEvent('HTMLEvents');- event.initEvent('change', true, true);- $select[0].dispatchEvent(event);- } else {- $select[0].fireEvent('onchange'); // for IE- }- }- });-- $(window).on('keydown', function (e) {- var focus = document.activeElement,- self = Foundation.libs.forms,- dropdown = $('.custom.dropdown'),- select = getFirstPrevSibling(dropdown, 'select'),- inputs = $('input,select,textarea,button'); // Zepto-compatible jQuery(":input")-- if (dropdown.length > 0 && dropdown.hasClass('open')) {- e.preventDefault();-- if (e.which === 9) {- $(inputs[$(inputs).index(select) + 1]).focus();- dropdown.removeClass('open');- }-- if (e.which === 13) {- dropdown.find('li.selected').trigger('click');- }-- if (e.which === 27) {- dropdown.removeClass('open');- }-- if (e.which >= 65 && e.which <= 90) {- var next = self.go_to(dropdown, e.which),- current = dropdown.find('li.selected');-- if (next) {- current.removeClass('selected');- self.scrollTo(next.addClass('selected'), 300);- }- }-- if (e.which === 38) {- var current = dropdown.find('li.selected'),- prev = current.prev(':not(.disabled)');-- if (prev.length > 0) {- prev.parent()[0].scrollTop = prev.parent().scrollTop() - self.outerHeight(prev);- current.removeClass('selected');- prev.addClass('selected');- }- } else if (e.which === 40) {- var current = dropdown.find('li.selected'),- next = current.next(':not(.disabled)');-- if (next.length > 0) {- next.parent()[0].scrollTop = next.parent().scrollTop() + self.outerHeight(next);- current.removeClass('selected');- next.addClass('selected');- }- }- }- });-- $(window).on('keyup', function (e) {- var focus = document.activeElement,- dropdown = $('.custom.dropdown');-- if (focus === dropdown.find('.current')[0]) {- dropdown.find('.selector').focus().click();- }- });-- this.settings.init = true;- },-- go_to: function (dropdown, character) {- var lis = dropdown.find('li'),- count = lis.length;-- if (count > 0) {- for (var i = 0; i < count; i++) {- var first_letter = lis.eq(i).text().charAt(0).toLowerCase();- if (first_letter === String.fromCharCode(character).toLowerCase()) return lis.eq(i);- }- }- },-- scrollTo: function (el, duration) {- if (duration < 0) return;- var parent = el.parent();- var li_height = this.outerHeight(el);- var difference = (li_height * (el.index())) - parent.scrollTop();- var perTick = difference / duration * 10;-- this.scrollToTimerCache = setTimeout(function () {- if (!isNaN(parseInt(perTick, 10))) {- parent[0].scrollTop = parent.scrollTop() + perTick;- this.scrollTo(el, duration - 10);- }- }.bind(this), 10);- },-- set_custom_markup: function (sel) {- var $this = $(sel),- type = $this.attr('type'),- $span = $this.next('span.custom.' + type);-- if (!$this.parent().hasClass('switch')) {- $this.addClass('hidden-field');- }-- if ($span.length === 0) {- $span = $('<span class="custom ' + type + '"></span>').insertAfter($this);- }-- $span.toggleClass('checked', $this.is(':checked'));- $span.toggleClass('disabled', $this.is(':disabled'));- },-- append_custom_select: function (idx, sel) {- var self = Foundation.libs.forms,- $this = $(sel),- $customSelect = $this.next('div.custom.dropdown'),- $customList = $customSelect.find('ul'),- $selectCurrent = $customSelect.find(".current"),- $selector = $customSelect.find(".selector"),- $options = $this.find('option'),- $selectedOption = $options.filter(':selected'),- copyClasses = $this.attr('class') ? $this.attr('class').split(' ') : [],- maxWidth = 0,- liHtml = '',- $listItems,- $currentSelect = false;-- if ($customSelect.length === 0) {- var customSelectSize = $this.hasClass('small') ? 'small' : $this.hasClass('medium') ? 'medium' : $this.hasClass('large') ? 'large' : $this.hasClass('expand') ? 'expand' : '';-- $customSelect = $('<div class="' + ['custom', 'dropdown', customSelectSize].concat(copyClasses).filter(function (item, idx, arr) {- if (item === '') return false;- return arr.indexOf(item) === idx;- }).join(' ') + '"><a href="#" class="selector"></a><ul /></div>');-- $selector = $customSelect.find(".selector");- $customList = $customSelect.find("ul");-- liHtml = $options.map(function () {- var copyClasses = $(this).attr('class') ? $(this).attr('class') : '';- return "<li class='" + copyClasses + "'>" + $(this).html() + "</li>";- }).get().join('');-- $customList.append(liHtml);-- $currentSelect = $customSelect- .prepend('<a href="#" class="current">' + ($selectedOption.html() || '') + '</a>')- .find(".current");-- $this.after($customSelect)- .addClass('hidden-field');- } else {- liHtml = $options.map(function () {- return "<li>" + $(this).html() + "</li>";- })- .get().join('');-- $customList.html('')- .append(liHtml);-- } // endif $customSelect.length === 0-- self.assign_id($this, $customSelect);- $customSelect.toggleClass('disabled', $this.is(':disabled'));- $listItems = $customList.find('li');-- // cache list length- self.cache[$customSelect.data('id')] = $listItems.length;-- $options.each(function (index) {- if (this.selected) {- $listItems.eq(index).addClass('selected');-- if ($currentSelect) {- $currentSelect.html($(this).html());- }- }- if ($(this).is(':disabled')) {- $listItems.eq(index).addClass('disabled');- }- });-- //- // If we're not specifying a predetermined form size.- //- if (!$customSelect.is('.small, .medium, .large, .expand')) {-- // ------------------------------------------------------------------------------------- // This is a work-around for when elements are contained within hidden parents.- // For example, when custom-form elements are inside of a hidden reveal modal.- //- // We need to display the current custom list element as well as hidden parent elements- // in order to properly calculate the list item element's width property.- // --------------------------------------------------------------------------------------- $customSelect.addClass('open');- //- // Quickly, display all parent elements.- // This should help us calcualate the width of the list item's within the drop down.- //- var self = Foundation.libs.forms;- self.hidden_fix.adjust($customList);-- maxWidth = (self.outerWidth($listItems) > maxWidth) ? self.outerWidth($listItems) : maxWidth;-- Foundation.libs.forms.hidden_fix.reset();-- $customSelect.removeClass('open');-- } // endif-- },-- assign_id: function ($select, $customSelect) {- var id = [+new Date(), Foundation.random_str(5)].join('-');- $select.attr('data-id', id);- $customSelect.attr('data-id', id);- },-- refresh_custom_select: function ($select, force_refresh) {- var self = this;- var maxWidth = 0,- $customSelect = $select.next(),- $options = $select.find('option'),- $customList = $customSelect.find('ul'),- $listItems = $customSelect.find('li');-- if ($options.length !== this.cache[$customSelect.data('id')] || force_refresh) {- $customList.html('');-- // rebuild and re-populate all at once- var customSelectHtml = '';- $options.each(function () {- var $this = $(this), thisHtml = $this.html(), thisSelected = this.selected;- customSelectHtml += '<li class="' + (thisSelected ? ' selected ' : '') + ($this.is(':disabled') ? ' disabled ' : '') + '">' + thisHtml + '</li>';- if (thisSelected) {- $customSelect.find('.current').html(thisHtml);- }- });-- $customList.html(customSelectHtml);-- // fix width- $customSelect.removeAttr('style');- $customList.removeAttr('style');- $customSelect.find('li').each(function () {- $customSelect.addClass('open');- if (self.outerWidth($(this)) > maxWidth) {- maxWidth = self.outerWidth($(this));- }- $customSelect.removeClass('open');- });-- $listItems = $customSelect.find('li');- // cache list length- this.cache[$customSelect.data('id')] = $listItems.length;- }- },-- refresh_custom_selection: function ($select) {- var selectedValue = $('option:selected', $select).text();- $('a.current', $select.next()).text(selectedValue);- },-- toggle_checkbox: function ($element) {- var $input = $element.prev(),- input = $input[0];-- if (false === $input.is(':disabled')) {- input.checked = ((input.checked) ? false : true);- $element.toggleClass('checked');-- $input.trigger('change');- }- },-- toggle_radio: function ($element) {- var $input = $element.prev(),- $form = $input.closest('form.custom'),- input = $input[0];-- if (false === $input.is(':disabled')) {- $form.find('input[type="radio"][name="' + this.escape($input.attr('name')) + '"]')- .next().not($element).removeClass('checked');-- if (!$element.hasClass('checked')) {- $element.toggleClass('checked');- }-- input.checked = $element.hasClass('checked');-- $input.trigger('change');- }- },-- escape: function (text) {- if (!text) return '';- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");- },-- hidden_fix: {- /**- * Sets all hidden parent elements and self to visibile.- *- * @method adjust- * @param {jQuery Object} $child- */-- // We'll use this to temporarily store style properties.- tmp: [],-- // We'll use this to set hidden parent elements.- hidden: null,-- adjust: function ($child) {- // Internal reference.- var _self = this;-- // Set all hidden parent elements, including this element.- _self.hidden = $child.parents();- _self.hidden = _self.hidden.add($child).filter(":hidden");-- // Loop through all hidden elements.- _self.hidden.each(function () {-- // Cache the element.- var $elem = $(this);-- // Store the style attribute.- // Undefined if element doesn't have a style attribute.- _self.tmp.push($elem.attr('style'));-- // Set the element's display property to block,- // but ensure it's visibility is hidden.- $elem.css({- 'visibility': 'hidden',- 'display': 'block'- });- });-- }, // end adjust-- /**- * Resets the elements previous state.- *- * @method reset- */- reset: function () {- // Internal reference.- var _self = this;- // Loop through our hidden element collection.- _self.hidden.each(function (i) {- // Cache this element.- var $elem = $(this),- _tmp = _self.tmp[i]; // Get the stored 'style' value for this element.-- // If the stored value is undefined.- if (_tmp === undefined)- // Remove the style attribute.- $elem.removeAttr('style');- else- // Otherwise, reset the element style attribute.- $elem.attr('style', _tmp);- });- // Reset the tmp array.- _self.tmp = [];- // Reset the hidden elements variable.- _self.hidden = null;-- } // end reset- },-- off: function () {- $(this.scope).off('.fndtn.forms');- },-- reflow : function () {}- };-- var getFirstPrevSibling = function($el, selector) {- var $el = $el.prev();- while ($el.length) {- if ($el.is(selector)) return $el;- $el = $el.prev();- }- return $();- };-}(Foundation.zj, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.interchange.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.interchange.jsindex 31274a03ad..73b46a2d93 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.interchange.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.interchange.js@@ -1,25 +1,26 @@-/*jslint unparam: true, browser: true, indent: 2 */-;(function ($, window, document, undefined) {'use strict';Foundation.libs.interchange = {name : 'interchange',- version : '4.3.3',+ version : '5.0.0',cache : {},images_loaded : false,+ nodes_loaded : false,settings : {load_attr : 'interchange',named_queries : {- 'default' : 'only screen and (min-width: 1px)',- small : 'only screen and (min-width: 768px)',- medium : 'only screen and (min-width: 1280px)',- large : 'only screen and (min-width: 1440px)',+ 'default' : Foundation.media_queries.small,+ small : Foundation.media_queries.small,+ medium : Foundation.media_queries.medium,+ large : Foundation.media_queries.large,+ xlarge : Foundation.media_queries.xlarge,+ xxlarge: Foundation.media_queries.xxlarge,landscape : 'only screen and (orientation: landscape)',portrait : 'only screen and (orientation: portrait)',retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +@@ -31,7 +32,18 @@},directives : {- replace: function (el, path) {+ replace: function (el, path, trigger) {+ // The trigger argument, if called within the directive, fires+ // an event named after the directive on the element, passing+ // any parameters along to the event that you pass to trigger.+ //+ // ex. trigger(), trigger([a, b, c]), or trigger(a, b, c)+ //+ // This allows you to bind a callback like so:+ // $('#interchangeContainer').on('replace', function (e, a, b, c) {+ // console.log($(this).html(), a, b, c);+ // });+if (/IMG/.test(el[0].nodeName)) {var orig_path = el[0].src;@@ -39,8 +51,18 @@el[0].src = path;- return el.trigger('replace', [el[0].src, orig_path]);+ return trigger(el[0].src);}+ var last_path = el.data('interchange-last-path');++ if (last_path == path) return;++ return $.get(path, function (response) {+ el.html(response);+ el.data('interchange-last-path', path);+ trigger();+ });+}}},@@ -48,32 +70,29 @@init : function (scope, method, options) {Foundation.inherit(this, 'throttle');- if (typeof method === 'object') {- $.extend(true, this.settings, method);- }-- this.events();- this.images();+ this.data_attr = 'data-' + this.settings.load_attr;- if (typeof method !== 'string') {- return this.settings.init;- } else {- return this[method].call(this, options);- }+ this.bindings(method, options);+ this.load('images');+ this.load('nodes');},events : function () {var self = this;- $(window).on('resize.fndtn.interchange', self.throttle(function () {- self.resize.call(self);- }, 50));+ $(window)+ .off('.interchange')+ .on('resize.fndtn.interchange', self.throttle(function () {+ self.resize.call(self);+ }, 50));++ return this;},resize : function () {var cache = this.cache;- if(!this.images_loaded) {+ if(!this.images_loaded || !this.nodes_loaded) {setTimeout($.proxy(this.resize, this), 50);return;}@@ -84,7 +103,15 @@if (passed) {this.settings.directives[passed- .scenario[1]](passed.el, passed.scenario[0]);+ .scenario[1]](passed.el, passed.scenario[0], function () {+ if (arguments[0] instanceof Array) {+ var args = arguments[0];+ } else {+ var args = Array.prototype.slice.call(arguments, 0);+ }++ passed.el.trigger(passed.scenario[1], args);+ });}}}@@ -95,7 +122,7 @@var count = scenarios.length;if (count > 0) {- var el = $('[data-uuid="' + uuid + '"]');+ var el = this.S('[data-uuid="' + uuid + '"]');for (var i = count - 1; i >= 0; i--) {var mq, rule = scenarios[i][2];@@ -113,22 +140,23 @@return false;},- images : function (force_update) {- if (typeof this.cached_images === 'undefined' || force_update) {- return this.update_images();+ load : function (type, force_update) {+ if (typeof this['cached_' + type] === 'undefined' || force_update) {+ this['update_' + type]();}- return this.cached_images;+ return this['cached_' + type];},update_images : function () {- var images = document.getElementsByTagName('img'),+ var images = this.S('img[' + this.data_attr + ']'),count = images.length,loaded_count = 0,- data_attr = 'data-' + this.settings.load_attr;+ data_attr = this.data_attr;+ this.cache = {};this.cached_images = [];- this.images_loaded = false;+ this.images_loaded = (count === 0);for (var i = count - 1; i >= 0; i--) {loaded_count++;@@ -142,18 +170,47 @@if(loaded_count === count) {this.images_loaded = true;- this.enhance();+ this.enhance('images');+ }+ }++ return this;+ },++ update_nodes : function () {+ var nodes = this.S('[' + this.data_attr + ']:not(img)'),+ count = nodes.length,+ loaded_count = 0,+ data_attr = this.data_attr;++ this.cached_nodes = [];+ // Set nodes_loaded to true if there are no nodes+ // this.nodes_loaded = false;+ this.nodes_loaded = (count === 0);+++ for (var i = count - 1; i >= 0; i--) {+ loaded_count++;+ var str = nodes[i].getAttribute(data_attr) || '';++ if (str.length > 0) {+ this.cached_nodes.push(nodes[i]);+ }++ if(loaded_count === count) {+ this.nodes_loaded = true;+ this.enhance('nodes');}}- return 'deferred';+ return this;},- enhance : function () {- var count = this.images().length;+ enhance : function (type) {+ var count = this['cached_' + type].length;for (var i = count - 1; i >= 0; i--) {- this.object($(this.images()[i]));+ this.object($(this['cached_' + type][i]));}return $(window).trigger('resize');@@ -238,9 +295,10 @@},reflow : function () {- this.images(true);+ this.load('images', true);+ this.load('nodes', true);}};-}(Foundation.zj, this, this.document));\ No newline at end of file+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.joyride.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.joyride.jsindex 627561c430..f7140aab9d 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.joyride.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.joyride.js@@ -1,6 +1,4 @@-/*jslint unparam: true, browser: true, indent: 2 */--(function ($, window, document, undefined) {+;(function ($, window, document, undefined) {'use strict';var Modernizr = Modernizr || false;@@ -8,32 +6,39 @@Foundation.libs.joyride = {name : 'joyride',- version : '4.3.2',+ version : '5.0.0',defaults : {expose : false, // turn on or off the expose feature- modal : false, // Whether to cover page with modal during the tour- tipLocation : 'bottom', // 'top' or 'bottom' in relation to parent- nubPosition : 'auto', // override on a per tooltip bases- scrollSpeed : 300, // Page scrolling speed in milliseconds, 0 = no scroll animation+ modal : true, // Whether to cover page with modal during the tour+ tip_location : 'bottom', // 'top' or 'bottom' in relation to parent+ nub_position : 'auto', // override on a per tooltip bases+ scroll_speed : 1500, // Page scrolling speed in milliseconds, 0 = no scroll animation+ scroll_animation : 'linear', // supports 'swing' and 'linear', extend with jQuery UI.timer : 0, // 0 = no timer , all other numbers = timer in milliseconds- startTimerOnClick : true, // true or false - true requires clicking the first button start the timer- startOffset : 0, // the index of the tooltip you want to start on (index of the li)- nextButton : true, // true or false to control whether a next button is used- tipAnimation : 'fade', // 'pop' or 'fade' in each tip- pauseAfter : [], // array of indexes where to pause the tour after+ start_timer_on_click : true, // true or false - true requires clicking the first button start the timer+ start_offset : 0, // the index of the tooltip you want to start on (index of the li)+ next_button : true, // true or false to control whether a next button is used+ tip_animation : 'fade', // 'pop' or 'fade' in each tip+ pause_after : [], // array of indexes where to pause the tour afterexposed : [], // array of expose elements- tipAnimationFadeSpeed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition- cookieMonster : false, // true or false to control whether cookies are used- cookieName : 'joyride', // Name the cookie you'll use- cookieDomain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'- cookieExpires : 365, // set when you would like the cookie to expire.- tipContainer : 'body', // Where will the tip be attached- postRideCallback : function (){}, // A method to call once the tour closes (canceled or complete)- postStepCallback : function (){}, // A method to call after each step- preStepCallback : function (){}, // A method to call before each step- preRideCallback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element)- postExposeCallback : function (){}, // A method to call after an element has been exposed+ tip_animation_fade_speed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition+ cookie_monster : false, // true or false to control whether cookies are used+ cookie_name : 'joyride', // Name the cookie you'll use+ cookie_domain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'+ cookie_expires : 365, // set when you would like the cookie to expire.+ tip_container : 'body', // Where will the tip be attached+ tip_location_patterns : {+ top: ['bottom'],+ bottom: [], // bottom should not need to be repositioned+ left: ['right', 'top', 'bottom'],+ right: ['left', 'top', 'bottom']+ },+ post_ride_callback : function (){}, // A method to call once the tour closes (canceled or complete)+ post_step_callback : function (){}, // A method to call after each step+ pre_step_callback : function (){}, // A method to call before each step+ pre_ride_callback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element)+ post_expose_callback : function (){}, // A method to call after an element has been exposedtemplate : { // HTML segments for tip layoutlink : '<a href="#close" class="joyride-close-tip">×</a>',timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',@@ -42,37 +47,25 @@button : '<a href="#" class="small button joyride-next-tip"></a>',modal : '<div class="joyride-modal-bg"></div>',expose : '<div class="joyride-expose-wrapper"></div>',- exposeCover: '<div class="joyride-expose-cover"></div>'+ expose_cover: '<div class="joyride-expose-cover"></div>'},- exposeAddClass : '' // One or more space-separated class names to be added to exposed element+ expose_add_class : '' // One or more space-separated class names to be added to exposed element},- settings : {},-init : function (scope, method, options) {- this.scope = scope || this.scope;- Foundation.inherit(this, 'throttle data_options scrollTo scrollLeft delay');-- if (typeof method === 'object') {- $.extend(true, this.settings, this.defaults, method);- } else {- $.extend(true, this.settings, this.defaults, options);- }+ Foundation.inherit(this, 'throttle delay');- if (typeof method !== 'string') {- if (!this.settings.init) this.events();+ this.settings = this.defaults;- return this.settings.init;- } else {- return this[method].call(this, options);- }+ this.bindings(method, options)},events : function () {var self = this;$(this.scope)- .on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {+ .off('.joyride')+ .on('click.fndtn.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {e.preventDefault();if (this.settings.$li.next().length < 1) {@@ -89,67 +82,65 @@}.bind(this))- .on('click.joyride', '.joyride-close-tip', function (e) {+ .on('click.fndtn.joyride', '.joyride-close-tip', function (e) {e.preventDefault();this.end();}.bind(this));- $(window).on('resize.fndtn.joyride', self.throttle(function () {- if ($('[data-joyride]').length > 0 && self.settings.$next_tip) {- if (self.settings.exposed.length > 0) {- var $els = $(self.settings.exposed);-- $els.each(function () {- var $this = $(this);- self.un_expose($this);- self.expose($this);- });- }+ $(window)+ .off('.joyride')+ .on('resize.fndtn.joyride', self.throttle(function () {+ if ($('[data-joyride]').length > 0 && self.settings.$next_tip) {+ if (self.settings.exposed.length > 0) {+ var $els = $(self.settings.exposed);++ $els.each(function () {+ var $this = $(this);+ self.un_expose($this);+ self.expose($this);+ });+ }- if (self.is_phone()) {- self.pos_phone();- } else {- self.pos_default(false, true);+ if (self.is_phone()) {+ self.pos_phone();+ } else {+ self.pos_default(false, true);+ }}- }- }, 100));-- this.settings.init = true;+ }, 100));},start : function () {var self = this,- $this = $(this.scope).find('[data-joyride]'),+ $this = $('[data-joyride]', this.scope),integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],int_settings_count = integer_settings.length;+ if (!$this.length > 0) return;+if (!this.settings.init) this.events();+ this.settings = $this.data('joyride-init');+// non configureable settingsthis.settings.$content_el = $this;- this.settings.$body = $(this.settings.tipContainer);- this.settings.body_offset = $(this.settings.tipContainer).position();+ this.settings.$body = $(this.settings.tip_container);+ this.settings.body_offset = $(this.settings.tip_container).position();this.settings.$tip_content = this.settings.$content_el.find('> li');this.settings.paused = false;this.settings.attempts = 0;- this.settings.tipLocationPatterns = {- top: ['bottom'],- bottom: [], // bottom should not need to be repositioned- left: ['right', 'top', 'bottom'],- right: ['left', 'top', 'bottom']- };-// can we create cookies?if (typeof $.cookie !== 'function') {- this.settings.cookieMonster = false;+ this.settings.cookie_monster = false;}// generate the tips and insert into dom.- if (!this.settings.cookieMonster || this.settings.cookieMonster && $.cookie(this.settings.cookieName) === null) {+ if (!this.settings.cookie_monster || this.settings.cookie_monster && $.cookie(this.settings.cookie_name) === null) {this.settings.$tip_content.each(function (index) {var $this = $(this);- $.extend(true, self.settings, self.data_options($this));+ this.settings = $.extend({}, self.defaults, self.data_options($this))+// Make sure that settings parsed from data_options are integers where necessaryfor (var i = int_settings_count - 1; i >= 0; i--) {self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);@@ -158,7 +149,7 @@});// show first tip- if (!this.settings.startTimerOnClick && this.settings.timer > 0) {+ if (!this.settings.start_timer_on_click && this.settings.timer > 0) {this.show('init');this.startTimer();} else {@@ -194,18 +185,18 @@timer_instance : function (index) {var txt;- if ((index === 0 && this.settings.startTimerOnClick && this.settings.timer > 0) || this.settings.timer === 0) {+ if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) {txt = '';} else {- txt = this.outerHTML($(this.settings.template.timer)[0]);+ txt = $(this.settings.template.timer)[0].outerHTML;}return txt;},button_text : function (txt) {- if (this.settings.nextButton) {+ if (this.settings.next_button) {txt = $.trim(txt) || 'Next';- txt = this.outerHTML($(this.settings.template.button).append(txt)[0]);+ txt = $(this.settings.template.button).append(txt)[0].outerHTML;} else {txt = '';}@@ -222,7 +213,7 @@li : opts.$li}));- $(this.settings.tipContainer).append($tip_content);+ $(this.settings.tip_container).append($tip_content);},show : function (init) {@@ -230,7 +221,7 @@// are we paused?if (this.settings.$li === undefined- || ($.inArray(this.settings.$li.index(), this.settings.pauseAfter) === -1)) {+ || ($.inArray(this.settings.$li.index(), this.settings.pause_after) === -1)) {// don't go to the next li if the tour was pausedif (this.settings.paused) {@@ -243,23 +234,23 @@if (this.settings.$li.length && this.settings.$target.length > 0) {if (init) { //run when we first start- this.settings.preRideCallback(this.settings.$li.index(), this.settings.$next_tip);+ this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip);if (this.settings.modal) {this.show_modal();}}- this.settings.preStepCallback(this.settings.$li.index(), this.settings.$next_tip);+ this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip);if (this.settings.modal && this.settings.expose) {this.expose();}- this.settings.tipSettings = $.extend(this.settings, this.data_options(this.settings.$li));+ this.settings.tip_settings = $.extend({}, this.settings, this.data_options(this.settings.$li));this.settings.timer = parseInt(this.settings.timer, 10);- this.settings.tipSettings.tipLocationPattern = this.settings.tipLocationPatterns[this.settings.tipSettings.tipLocation];+ this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location];// scroll if not modalif (!/body/i.test(this.settings.$target.selector)) {@@ -274,7 +265,7 @@$timer = this.settings.$next_tip.find('.joyride-timer-indicator');- if (/pop/i.test(this.settings.tipAnimation)) {+ if (/pop/i.test(this.settings.tip_animation)) {$timer.width(0);@@ -286,7 +277,7 @@$timer.animate({width: $timer.parent().width()}, this.settings.timer, 'linear');- }.bind(this), this.settings.tipAnimationFadeSpeed);+ }.bind(this), this.settings.tip_animation_fade_speed);} else {this.settings.$next_tip.show();@@ -294,25 +285,24 @@}- } else if (/fade/i.test(this.settings.tipAnimation)) {+ } else if (/fade/i.test(this.settings.tip_animation)) {$timer.width(0);if (this.settings.timer > 0) {this.settings.$next_tip- .fadeIn(this.settings.tipAnimationFadeSpeed)+ .fadeIn(this.settings.tip_animation_fade_speed).show();this.delay(function () {$timer.animate({width: $timer.parent().width()}, this.settings.timer, 'linear');- }.bind(this), this.settings.tipAnimationFadeSpeed);+ }.bind(this), this.settings.tip_animation_fadeSpeed);} else {- this.settings.$next_tip.fadeIn(this.settings.tipAnimationFadeSpeed);-+ this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed);}}@@ -337,11 +327,8 @@},is_phone : function () {- if (Modernizr) {- return Modernizr.mq('only screen and (max-width: 767px)') || $('.lt-ie9').length > 0;- }-- return ($(window).width() < 767);+ return matchMedia(Foundation.media_queries.small).matches &&+ !matchMedia(Foundation.media_queries.medium).matches;},hide : function () {@@ -359,13 +346,13 @@this.hide();this.css('visibility', 'visible');}, this.settings.$current_tip), 0);- this.settings.postStepCallback(this.settings.$li.index(),+ this.settings.post_step_callback(this.settings.$li.index(),this.settings.$current_tip);},set_li : function (init) {if (init) {- this.settings.$li = this.settings.$tip_content.eq(this.settings.startOffset);+ this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset);this.set_next_tip();this.settings.$current_tip = this.settings.$next_tip;} else {@@ -377,7 +364,7 @@},set_next_tip : function () {- this.settings.$next_tip = $(".joyride-tip-guide[data-index='" + this.settings.$li.index() + "']");+ this.settings.$next_tip = $(".joyride-tip-guide").eq(this.settings.$li.index());this.settings.$next_tip.data('closed', '');},@@ -401,14 +388,17 @@var window_half, tipOffset;window_half = $(window).height() / 2;- tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.outerHeight(this.settings.$next_tip));+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());+if (tipOffset > 0) {- this.scrollTo($('html, body'), tipOffset, this.settings.scrollSpeed);+ $('html, body').animate({+ scrollTop: tipOffset+ }, this.settings.scroll_speed, 'swing');}},paused : function () {- return ($.inArray((this.settings.$li.index() + 1), this.settings.pauseAfter) === -1);+ return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1);},restart : function () {@@ -421,8 +411,8 @@var half_fold = Math.ceil($(window).height() / 2),tip_position = this.settings.$next_tip.offset(),$nub = this.settings.$next_tip.find('.joyride-nub'),- nub_width = Math.ceil(this.outerWidth($nub) / 2),- nub_height = Math.ceil(this.outerHeight($nub) / 2),+ nub_width = Math.ceil($nub.outerWidth() / 2),+ nub_height = Math.ceil($nub.outerHeight() / 2),toggle = init || false;// tip must not be "display: none" to calculate position@@ -443,10 +433,10 @@leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;}this.settings.$next_tip.css({- top: (this.settings.$target.offset().top + nub_height + this.outerHeight(this.settings.$target)),+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),left: leftOffset});- this.nub_position($nub, this.settings.tipSettings.nubPosition, 'top');+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');} else if (this.top()) {var leftOffset = this.settings.$target.offset().left;@@ -454,10 +444,10 @@leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;}this.settings.$next_tip.css({- top: (this.settings.$target.offset().top - this.outerHeight(this.settings.$next_tip) - nub_height),+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),left: leftOffset});- this.nub_position($nub, this.settings.tipSettings.nubPosition, 'bottom');+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');} else if (this.right()) {@@ -465,7 +455,7 @@top: this.settings.$target.offset().top,left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)});- this.nub_position($nub, this.settings.tipSettings.nubPosition, 'left');+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');} else if (this.left()) {@@ -473,18 +463,18 @@top: this.settings.$target.offset().top,left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)});- this.nub_position($nub, this.settings.tipSettings.nubPosition, 'right');+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');}- if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tipSettings.tipLocationPattern.length) {+ if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {$nub.removeClass('bottom').removeClass('top').removeClass('right').removeClass('left');- this.settings.tipSettings.tipLocation = this.settings.tipSettings.tipLocationPattern[this.settings.attempts];+ this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];this.settings.attempts++;@@ -506,11 +496,11 @@},pos_phone : function (init) {- var tip_height = this.outerHeight(this.settings.$next_tip),+ var tip_height = this.settings.$next_tip.outerHeight(),tip_offset = this.settings.$next_tip.offset(),- target_height = this.outerHeight(this.settings.$target),+ target_height = this.settings.$target.outerHeight(),$nub = $('.joyride-nub', this.settings.$next_tip),- nub_height = Math.ceil(this.outerHeight($nub) / 2),+ nub_height = Math.ceil($nub.outerHeight() / 2),toggle = init || false;$nub.removeClass('bottom')@@ -561,10 +551,10 @@$('body').append(this.settings.template.modal).show();}- if (/pop/i.test(this.settings.tipAnimation)) {+ if (/pop/i.test(this.settings.tip_animation)) {joyridemodalbg.show();} else {- joyridemodalbg.fadeIn(this.settings.tipAnimationFadeSpeed);+ joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);}}},@@ -597,11 +587,11 @@expose.css({top: el.offset().top,left: el.offset().left,- width: this.outerWidth(el, true),- height: this.outerHeight(el, true)+ width: el.outerWidth(true),+ height: el.outerHeight(true)});- exposeCover = $(this.settings.template.exposeCover);+ exposeCover = $(this.settings.template.expose_cover);origCSS = {zIndex: el.css('z-index'),@@ -618,20 +608,22 @@el.data('expose-css',origCSS);el.data('orig-class', origClasses);- el.attr('class', origClasses + ' ' + this.settings.exposeAddClass);+ el.attr('class', origClasses + ' ' + this.settings.expose_add_class);exposeCover.css({top: el.offset().top,left: el.offset().left,- width: this.outerWidth(el, true),- height: this.outerHeight(el, true)+ width: el.outerWidth(true),+ height: el.outerHeight(true)});+ if (this.settings.modal) this.show_modal();+this.settings.$body.append(exposeCover);expose.addClass(randId);exposeCover.addClass(randId);el.data('expose', randId);- this.settings.postExposeCallback(this.settings.$li.index(), this.settings.$next_tip, el);+ this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);this.add_exposed(el);},@@ -728,27 +720,27 @@var $w = $(window);this.settings.$next_tip.css({- top : ((($w.height() - this.outerHeight(this.settings.$next_tip)) / 2) + $w.scrollTop()),- left : ((($w.width() - this.outerWidth(this.settings.$next_tip)) / 2) + this.scrollLeft($w))+ top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),+ left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())});return true;},bottom : function () {- return /bottom/i.test(this.settings.tipSettings.tipLocation);+ return /bottom/i.test(this.settings.tip_settings.tip_location);},top : function () {- return /top/i.test(this.settings.tipSettings.tipLocation);+ return /top/i.test(this.settings.tip_settings.tip_location);},right : function () {- return /right/i.test(this.settings.tipSettings.tipLocation);+ return /right/i.test(this.settings.tip_settings.tip_location);},left : function () {- return /left/i.test(this.settings.tipSettings.tipLocation);+ return /left/i.test(this.settings.tip_settings.tip_location);},corners : function (el) {@@ -756,7 +748,7 @@window_half = w.height() / 2,//using this to calculate since scroll may not have finished yet.tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),- right = w.width() + this.scrollLeft(w),+ right = w.width() + w.scrollLeft(),offsetBottom = w.height() + tipOffset,bottom = w.height() + w.scrollTop(),top = w.scrollTop();@@ -777,7 +769,7 @@el.offset().top < top,right < el.offset().left + el.outerWidth(),bottom < el.offset().top + el.outerHeight(),- this.scrollLeft(w) > el.offset().left+ w.scrollLeft() > el.offset().left];},@@ -812,8 +804,8 @@},end : function () {- if (this.settings.cookieMonster) {- $.cookie(this.settings.cookieName, 'ridden', { expires: this.settings.cookieExpires, domain: this.settings.cookieDomain });+ if (this.settings.cookie_monster) {+ $.cookie(this.settings.cookie_name, 'ridden', { expires: this.settings.cookie_expires, domain: this.settings.cookie_domain });}if (this.settings.timer > 0) {@@ -828,16 +820,11 @@$('.joyride-modal-bg').hide();this.settings.$current_tip.hide();- this.settings.postStepCallback(this.settings.$li.index(), this.settings.$current_tip);- this.settings.postRideCallback(this.settings.$li.index(), this.settings.$current_tip);+ this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);+ this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);$('.joyride-tip-guide').remove();},- outerHTML : function (el) {- // support FireFox < 11- return el.outerHTML || new XMLSerializer().serializeToString(el);- },-off : function () {$(this.scope).off('.joyride');$(window).off('.joyride');@@ -849,4 +836,4 @@reflow : function () {}};-}(Foundation.zj, this, this.document));+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.jsindex e9050c54aa..c2d031f3e9 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.js@@ -6,42 +6,58 @@* http://www.opensource.org/licenses/mit-license.php*/-/*jslint unparam: true, browser: true, indent: 2 */--// Accommodate running jQuery or Zepto in noConflict() mode by-// using an anonymous function to redefine the $ shorthand name.-// See http://docs.jquery.com/Using_jQuery_with_Other_Libraries-// and http://zeptojs.com/-var libFuncName = null;--if (typeof jQuery === "undefined" &&- typeof Zepto === "undefined" &&- typeof $ === "function") {- libFuncName = $;-} else if (typeof jQuery === "function") {- libFuncName = jQuery;-} else if (typeof Zepto === "function") {- libFuncName = Zepto;-} else {- throw new TypeError();-}-(function ($, window, document, undefined) {'use strict';- /*- matchMedia() polyfill - Test a CSS media- type/query in JS. Authors & copyright (c) 2012:- Scott Jehl, Paul Irish, Nicholas Zakas.- Dual MIT/BSD license+ // Used to retrieve Foundation media queries from CSS.+ if($('head').has('.foundation-mq-small').length === 0) {+ $('head').append('<meta class="foundation-mq-small">');+ }++ if($('head').has('.foundation-mq-medium').length === 0) {+ $('head').append('<meta class="foundation-mq-medium">');+ }++ if($('head').has('.foundation-mq-large').length === 0) {+ $('head').append('<meta class="foundation-mq-large">');+ }++ if($('head').has('.foundation-mq-xlarge').length === 0) {+ $('head').append('<meta class="foundation-mq-xlarge">');+ }++ if($('head').has('.foundation-mq-xxlarge').length === 0) {+ $('head').append('<meta class="foundation-mq-xxlarge">');+ }++ // Embed FastClick (this should be removed later)+ function FastClick(layer){'use strict';var oldOnClick,self=this;this.trackingClick=false;this.trackingClickStart=0;this.targetElement=null;this.touchStartX=0;this.touchStartY=0;this.lastTouchIdentifier=0;this.touchBoundary=10;this.layer=layer;if(!layer||!layer.nodeType){throw new TypeError('Layer must be a document node');}this.onClick=function(){return FastClick.prototype.onClick.apply(self,arguments)};this.onMouse=function(){return FastClick.prototype.onMouse.apply(self,arguments)};this.onTouchStart=function(){return FastClick.prototype.onTouchStart.apply(self,arguments)};this.onTouchMove=function(){return FastClick.prototype.onTouchMove.apply(self,arguments)};this.onTouchEnd=function(){return FastClick.prototype.onTouchEnd.apply(self,arguments)};this.onTouchCancel=function(){return FastClick.prototype.onTouchCancel.apply(self,arguments)};if(FastClick.notNeeded(layer)){return}if(this.deviceIsAndroid){layer.addEventListener('mouseover',this.onMouse,true);layer.addEventListener('mousedown',this.onMouse,true);layer.addEventListener('mouseup',this.onMouse,true)}layer.addEventListener('click',this.onClick,true);layer.addEventListener('touchstart',this.onTouchStart,false);layer.addEventListener('touchmove',this.onTouchMove,false);layer.addEventListener('touchend',this.onTouchEnd,false);layer.addEventListener('touchcancel',this.onTouchCancel,false);if(!Event.prototype.stopImmediatePropagation){layer.removeEventListener=function(type,callback,capture){var rmv=Node.prototype.removeEventListener;if(type==='click'){rmv.call(layer,type,callback.hijacked||callback,capture)}else{rmv.call(layer,type,callback,capture)}};layer.addEventListener=function(type,callback,capture){var adv=Node.prototype.addEventListener;if(type==='click'){adv.call(layer,type,callback.hijacked||(callback.hijacked=function(event){if(!event.propagationStopped){callback(event)}}),capture)}else{adv.call(layer,type,callback,capture)}}}if(typeof layer.onclick==='function'){oldOnClick=layer.onclick;layer.addEventListener('click',function(event){oldOnClick(event)},false);layer.onclick=null}}FastClick.prototype.deviceIsAndroid=navigator.userAgent.indexOf('Android')>0;FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent);FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&(/OS 4_\d(_\d)?/).test(navigator.userAgent);FastClick.prototype.deviceIsIOSWithBadTarget=FastClick.prototype.deviceIsIOS&&(/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent);FastClick.prototype.needsClick=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'button':case'select':case'textarea':if(target.disabled){return true}break;case'input':if((this.deviceIsIOS&&target.type==='file')||target.disabled){return true}break;case'label':case'video':return true}return(/\bneedsclick\b/).test(target.className)};FastClick.prototype.needsFocus=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'textarea':case'select':return true;case'input':switch(target.type){case'button':case'checkbox':case'file':case'image':case'radio':case'submit':return false}return!target.disabled&&!target.readOnly;default:return(/\bneedsfocus\b/).test(target.className)}};FastClick.prototype.sendClick=function(targetElement,event){'use strict';var clickEvent,touch;if(document.activeElement&&document.activeElement!==targetElement){document.activeElement.blur()}touch=event.changedTouches[0];clickEvent=document.createEvent('MouseEvents');clickEvent.initMouseEvent('click',true,true,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,false,false,false,false,0,null);clickEvent.forwardedTouchEvent=true;targetElement.dispatchEvent(clickEvent)};FastClick.prototype.focus=function(targetElement){'use strict';var length;if(this.deviceIsIOS&&targetElement.setSelectionRange){length=targetElement.value.length;targetElement.setSelectionRange(length,length)}else{targetElement.focus()}};FastClick.prototype.updateScrollParent=function(targetElement){'use strict';var scrollParent,parentElement;scrollParent=targetElement.fastClickScrollParent;if(!scrollParent||!scrollParent.contains(targetElement)){parentElement=targetElement;do{if(parentElement.scrollHeight>parentElement.offsetHeight){scrollParent=parentElement;targetElement.fastClickScrollParent=parentElement;break}parentElement=parentElement.parentElement}while(parentElement)}if(scrollParent){scrollParent.fastClickLastScrollTop=scrollParent.scrollTop}};FastClick.prototype.getTargetElementFromEventTarget=function(eventTarget){'use strict';if(eventTarget.nodeType===Node.TEXT_NODE){return eventTarget.parentNode}return eventTarget};FastClick.prototype.onTouchStart=function(event){'use strict';var targetElement,touch,selection;if(event.targetTouches.length>1){return true}targetElement=this.getTargetElementFromEventTarget(event.target);touch=event.targetTouches[0];if(this.deviceIsIOS){selection=window.getSelection();if(selection.rangeCount&&!selection.isCollapsed){return true}if(!this.deviceIsIOS4){if(touch.identifier===this.lastTouchIdentifier){event.preventDefault();return false}this.lastTouchIdentifier=touch.identifier;this.updateScrollParent(targetElement)}}this.trackingClick=true;this.trackingClickStart=event.timeStamp;this.targetElement=targetElement;this.touchStartX=touch.pageX;this.touchStartY=touch.pageY;if((event.timeStamp-this.lastClickTime)<200){event.preventDefault()}return true};FastClick.prototype.touchHasMoved=function(event){'use strict';var touch=event.changedTouches[0],boundary=this.touchBoundary;if(Math.abs(touch.pageX-this.touchStartX)>boundary||Math.abs(touch.pageY-this.touchStartY)>boundary){return true}return false};FastClick.prototype.onTouchMove=function(event){'use strict';if(!this.trackingClick){return true}if(this.targetElement!==this.getTargetElementFromEventTarget(event.target)||this.touchHasMoved(event)){this.trackingClick=false;this.targetElement=null}return true};FastClick.prototype.findControl=function(labelElement){'use strict';if(labelElement.control!==undefined){return labelElement.control}if(labelElement.htmlFor){return document.getElementById(labelElement.htmlFor)}return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea')};FastClick.prototype.onTouchEnd=function(event){'use strict';var forElement,trackingClickStart,targetTagName,scrollParent,touch,targetElement=this.targetElement;if(!this.trackingClick){return true}if((event.timeStamp-this.lastClickTime)<200){this.cancelNextClick=true;return true}this.lastClickTime=event.timeStamp;trackingClickStart=this.trackingClickStart;this.trackingClick=false;this.trackingClickStart=0;if(this.deviceIsIOSWithBadTarget){touch=event.changedTouches[0];targetElement=document.elementFromPoint(touch.pageX-window.pageXOffset,touch.pageY-window.pageYOffset)||targetElement;targetElement.fastClickScrollParent=this.targetElement.fastClickScrollParent}targetTagName=targetElement.tagName.toLowerCase();if(targetTagName==='label'){forElement=this.findControl(targetElement);if(forElement){this.focus(targetElement);if(this.deviceIsAndroid){return false}targetElement=forElement}}else if(this.needsFocus(targetElement)){if((event.timeStamp-trackingClickStart)>100||(this.deviceIsIOS&&window.top!==window&&targetTagName==='input')){this.targetElement=null;return false}this.focus(targetElement);if(!this.deviceIsIOS4||targetTagName!=='select'){this.targetElement=null;event.preventDefault()}return false}if(this.deviceIsIOS&&!this.deviceIsIOS4){scrollParent=targetElement.fastClickScrollParent;if(scrollParent&&scrollParent.fastClickLastScrollTop!==scrollParent.scrollTop){return true}}if(!this.needsClick(targetElement)){event.preventDefault();this.sendClick(targetElement,event)}return false};FastClick.prototype.onTouchCancel=function(){'use strict';this.trackingClick=false;this.targetElement=null};FastClick.prototype.onMouse=function(event){'use strict';if(!this.targetElement){return true}if(event.forwardedTouchEvent){return true}if(!event.cancelable){return true}if(!this.needsClick(this.targetElement)||this.cancelNextClick){if(event.stopImmediatePropagation){event.stopImmediatePropagation()}else{event.propagationStopped=true}event.stopPropagation();event.preventDefault();return false}return true};FastClick.prototype.onClick=function(event){'use strict';var permitted;if(this.trackingClick){this.targetElement=null;this.trackingClick=false;return true}if(event.target.type==='submit'&&event.detail===0){return true}permitted=this.onMouse(event);if(!permitted){this.targetElement=null}return permitted};FastClick.prototype.destroy=function(){'use strict';var layer=this.layer;if(this.deviceIsAndroid){layer.removeEventListener('mouseover',this.onMouse,true);layer.removeEventListener('mousedown',this.onMouse,true);layer.removeEventListener('mouseup',this.onMouse,true)}layer.removeEventListener('click',this.onClick,true);layer.removeEventListener('touchstart',this.onTouchStart,false);layer.removeEventListener('touchmove',this.onTouchMove,false);layer.removeEventListener('touchend',this.onTouchEnd,false);layer.removeEventListener('touchcancel',this.onTouchCancel,false)};FastClick.notNeeded=function(layer){'use strict';var metaViewport;if(typeof window.ontouchstart==='undefined'){return true}if((/Chrome\/[0-9]+/).test(navigator.userAgent)){if(FastClick.prototype.deviceIsAndroid){metaViewport=document.querySelector('meta[name=viewport]');if(metaViewport&&metaViewport.content.indexOf('user-scalable=no')!==-1){return true}}else{return true}}if(layer.style.msTouchAction==='none'){return true}return false};FastClick.attach=function(layer){'use strict';return new FastClick(layer)};if(typeof define!=='undefined'&&define.amd){define(function(){'use strict';return FastClick})}else if(typeof module!=='undefined'&&module.exports){module.exports=FastClick.attach;module.exports.FastClick=FastClick}else{window.FastClick=FastClick}+++ // Enable FastClick+ if(typeof FastClick !== 'undefined') {+ FastClick.attach(document.body);+ }+ // private Fast Selector wrapper,+ // returns jQuery object. Only use where+ // getElementById is not available.+ var S = function (selector, context) {+ if (typeof selector === 'string') {+ if (context) {+ return $(context.querySelectorAll(selector));+ }++ return $(document.querySelectorAll(selector));+ }++ return $(selector, context);+ };++ /*https://github.com/paulirish/matchMedia.js*/- $('head').append('<meta class="foundation-mq-small">');- $('head').append('<meta class="foundation-mq-medium">');- $('head').append('<meta class="foundation-mq-large">');-window.matchMedia = window.matchMedia || (function( doc, undefined ) {"use strict";@@ -75,195 +91,144 @@ if (typeof jQuery === "undefined" &&}( document ));- // add dusty browser stuff- if (!Array.prototype.filter) {- Array.prototype.filter = function(fun /*, thisp */) {- "use strict";-- if (this == null) {- throw new TypeError();- }-- var t = Object(this),- len = t.length >>> 0;- if (typeof fun !== "function") {- return;- }-- var res = [],- thisp = arguments[1];- for (var i = 0; i < len; i++) {- if (i in t) {- var val = t[i]; // in case fun mutates this- if (fun && fun.call(thisp, val, i, t)) {- res.push(val);- }- }- }+ /*+ * jquery.requestAnimationFrame+ * https://github.com/gnarf37/jquery-requestAnimationFrame+ * Requires jQuery 1.8++ *+ * Copyright (c) 2012 Corey Frang+ * Licensed under the MIT license.+ */++ (function( $ ) {++ // requestAnimationFrame polyfill adapted from Erik Möller+ // fixes from Paul Irish and Tino Zijdel+ // http://paulirish.com/2011/requestanimationframe-for-smart-animating/+ // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating+++ var animating,+ lastTime = 0,+ vendors = ['webkit', 'moz'],+ requestAnimationFrame = window.requestAnimationFrame,+ cancelAnimationFrame = window.cancelAnimationFrame;++ for(; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {+ requestAnimationFrame = window[ vendors[lastTime] + "RequestAnimationFrame" ];+ cancelAnimationFrame = cancelAnimationFrame ||+ window[ vendors[lastTime] + "CancelAnimationFrame" ] ||+ window[ vendors[lastTime] + "CancelRequestAnimationFrame" ];+ }- return res;+ function raf() {+ if ( animating ) {+ requestAnimationFrame( raf );+ jQuery.fx.tick();}}- if (!Function.prototype.bind) {- Function.prototype.bind = function (oThis) {- if (typeof this !== "function") {- // closest thing possible to the ECMAScript 5 internal IsCallable function- throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");+ if ( requestAnimationFrame ) {+ // use rAF+ window.requestAnimationFrame = requestAnimationFrame;+ window.cancelAnimationFrame = cancelAnimationFrame;+ jQuery.fx.timer = function( timer ) {+ if ( timer() && jQuery.timers.push( timer ) && !animating ) {+ animating = true;+ raf();}-- var aArgs = Array.prototype.slice.call(arguments, 1),- fToBind = this,- fNOP = function () {},- fBound = function () {- return fToBind.apply(this instanceof fNOP && oThis- ? this- : oThis,- aArgs.concat(Array.prototype.slice.call(arguments)));- };-- fNOP.prototype = this.prototype;- fBound.prototype = new fNOP();-- return fBound;};++ jQuery.fx.stop = function() {+ animating = false;+ };+ } else {+ // polyfill+ window.requestAnimationFrame = function( callback, element ) {+ var currTime = new Date().getTime(),+ timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ),+ id = window.setTimeout( function() {+ callback( currTime + timeToCall );+ }, timeToCall );+ lastTime = currTime + timeToCall;+ return id;+ };++ window.cancelAnimationFrame = function(id) {+ clearTimeout(id);+ };+}- if (!Array.prototype.indexOf) {- Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {- "use strict";- if (this == null) {- throw new TypeError();- }- var t = Object(this);- var len = t.length >>> 0;- if (len === 0) {- return -1;- }- var n = 0;- if (arguments.length > 1) {- n = Number(arguments[1]);- if (n != n) { // shortcut for verifying if it's NaN- n = 0;- } else if (n != 0 && n != Infinity && n != -Infinity) {- n = (n > 0 || -1) * Math.floor(Math.abs(n));- }- }- if (n >= len) {- return -1;- }- var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);- for (; k < len; k++) {- if (k in t && t[k] === searchElement) {- return k;- }- }- return -1;+ }( jQuery ));+++ function removeQuotes (string) {+ if (typeof string === 'string' || string instanceof String) {+ string = string.replace(/^[\\/'"]+|(;\s?})+|[\\/'"]+$/g, '');}- }- // fake stop() for zepto.- $.fn.stop = $.fn.stop || function() {- return this;- };+ return string;+ }window.Foundation = {name : 'Foundation',- version : '4.3.2',-- cache : {},+ version : '5.0.0',media_queries : {- small : $('.foundation-mq-small').css('font-family').replace(/\'/g, ''),- medium : $('.foundation-mq-medium').css('font-family').replace(/\'/g, ''),- large : $('.foundation-mq-large').css('font-family').replace(/\'/g, '')+ small : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),+ medium : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),+ large : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),+ xlarge: S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),+ xxlarge: S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')},stylesheet : $('<style></style>').appendTo('head')[0].sheet,- init : function (scope, libraries, method, options, response, /* internal */ nc) {+ init : function (scope, libraries, method, options, response) {var library_arr,args = [scope, method, options, response],- responses = [],- nc = nc || false;-- // disable library error catching,- // used for development only- if (nc) this.nc = nc;+ responses = [];// check RTL- this.rtl = /rtl/i.test($('html').attr('dir'));+ this.rtl = /rtl/i.test(S('html').attr('dir'));// set foundation global scopethis.scope = scope || this.scope;if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {- if (/off/i.test(libraries)) return this.off();-- library_arr = libraries.split(' ');-- if (library_arr.length > 0) {- for (var i = library_arr.length - 1; i >= 0; i--) {- responses.push(this.init_lib(library_arr[i], args));- }+ if (this.libs.hasOwnProperty(libraries)) {+ responses.push(this.init_lib(libraries, args));}} else {- if (/reflow/i.test(libraries)) args[1] = 'reflow';-for (var lib in this.libs) {- responses.push(this.init_lib(lib, args));+ responses.push(this.init_lib(lib, libraries));}}- // if first argument is callback, add to args- if (typeof libraries === 'function') {- args.unshift(libraries);- }-- return this.response_obj(responses, args);- },-- response_obj : function (response_arr, args) {- for (var i = 0, len = args.length; i < len; i++) {- if (typeof args[i] === 'function') {- return args[i]({- errors: response_arr.filter(function (s) {- if (typeof s === 'string') return s;- })- });- }- }-- return response_arr;+ return scope;},init_lib : function (lib, args) {- return this.trap(function () {- if (this.libs.hasOwnProperty(lib)) {- this.patch(this.libs[lib]);- return this.libs[lib].init.apply(this.libs[lib], args);- } else {- return function () {};- }- }.bind(this), lib);- },+ if (this.libs.hasOwnProperty(lib)) {+ this.patch(this.libs[lib]);- trap : function (fun, lib) {- if (!this.nc) {- try {- return fun();- } catch (e) {- return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message});+ if (args && args.hasOwnProperty(lib)) {+ return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);}++ return this.libs[lib].init.apply(this.libs[lib], args);}- return fun();+ return function () {};},patch : function (lib) {- this.fix_outer(lib);lib.scope = this.scope;+ lib['data_options'] = this.lib_methods.data_options;+ lib['bindings'] = this.lib_methods.bindings;+ lib['S'] = S;lib.rtl = this.rtl;},@@ -295,35 +260,12 @@ if (typeof jQuery === "undefined" &&// methods that can be inherited in librarieslib_methods : {- set_data : function (node, data) {- // this.name references the name of the library calling this method- var id = [this.name,+new Date(),Foundation.random_str(5)].join('-');-- Foundation.cache[id] = data;- node.attr('data-' + this.name + '-id', id);- return data;- },-- get_data : function (node) {- return Foundation.cache[node.attr('data-' + this.name + '-id')];- },-- remove_data : function (node) {- if (node) {- delete Foundation.cache[node.attr('data-' + this.name + '-id')];- node.attr('data-' + this.name + '-id', '');- } else {- $('[data-' + this.name + '-id]').each(function () {- delete Foundation.cache[$(this).attr('data-' + this.name + '-id')];- $(this).attr('data-' + this.name + '-id', '');- });- }- },-throttle : function(fun, delay) {var timer = null;+return function () {var context = this, args = arguments;+clearTimeout(timer);timer = setTimeout(function () {fun.apply(context, args);@@ -331,12 +273,17 @@ if (typeof jQuery === "undefined" &&};},- // parses data-options attribute on nodes and turns- // them into an object+ // parses data-options attributedata_options : function (el) {- var opts = {}, ii, p,- opts_arr = (el.attr('data-options') || ':').split(';'),- opts_len = opts_arr.length;+ var opts = {}, ii, p, opts_arr, opts_len,+ data_options = el.data('options');++ if (typeof data_options === 'object') {+ return data_options;+ }++ opts_arr = (data_options || ':').split(';'),+ opts_len = opts_arr.length;function isNumber (o) {return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;@@ -367,26 +314,6 @@ if (typeof jQuery === "undefined" &&return setTimeout(fun, delay);},- // animated scrolling- scrollTo : function (el, to, duration) {- if (duration < 0) return;- var difference = to - $(window).scrollTop();- var perTick = difference / duration * 10;-- this.scrollToTimerCache = setTimeout(function() {- if (!isNaN(parseInt(perTick, 10))) {- window.scrollTo(0, $(window).scrollTop() + perTick);- this.scrollTo(el, to, duration - 10);- }- }.bind(this), 10);- },-- // not supported in core Zepto- scrollLeft : function (el) {- if (!el.length) return;- return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset;- },-// test for empty object or arrayempty : function (obj) {if (obj.length && obj.length > 0) return false;@@ -399,6 +326,13 @@ if (typeof jQuery === "undefined" &&return true;},+ register_media : function(media, media_class) {+ if(Foundation.media_queries[media] === undefined) {+ $('head').append('<meta class="' + media_class + '">');+ Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));+ }+ },+addCustomRule : function(rule, media) {if(media === undefined) {Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);@@ -409,47 +343,65 @@ if (typeof jQuery === "undefined" &&Foundation.media_queries[media] + '{ ' + rule + ' }');}}- }- },+ },- fix_outer : function (lib) {- lib.outerHeight = function (el, bool) {- if (typeof Zepto === 'function') {- return el.height();+ loaded : function (image, callback) {+ function loaded () {+ callback(image[0]);}- if (typeof bool !== 'undefined') {- return el.outerHeight(bool);+ function bindLoad () {+ this.one('load', loaded);++ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {+ var src = this.attr( 'src' ),+ param = src.match( /\?/ ) ? '&' : '?';++ param += 'random=' + (new Date()).getTime();+ this.attr('src', src + param);+ }}- return el.outerHeight();- };+ if (!image.attr('src')) {+ loaded();+ return;+ }- lib.outerWidth = function (el, bool) {- if (typeof Zepto === 'function') {- return el.width();+ if (image[0].complete || image[0].readyState === 4) {+ loaded();+ } else {+ bindLoad.call(image);}+ },- if (typeof bool !== 'undefined') {- return el.outerWidth(bool);+ bindings : function (method, options) {+ var self = this,+ should_bind_events = !S(this).data(this.name + '-init');++ if (typeof method === 'string') {+ return this[method].call(this);}- return el.outerWidth();- };- },+ if (S(this.scope).is('[data-' + this.name +']')) {+ S(this.scope).data(this.name + '-init', $.extend({}, this.settings, (options || method), this.data_options(S(this.scope))));- error : function (error) {- return error.name + ' ' + error.message + '; ' + error.more;- },+ if (should_bind_events) {+ this.events(this.scope);+ }- // remove all foundation events.- off: function () {- $(this.scope).off('.fndtn');- $(window).off('.fndtn');- return true;- },+ } else {+ S('[data-' + this.name + ']', this.scope).each(function () {+ var should_bind_events = !S(this).data(self.name + '-init');- zj : $+ S(this).data(self.name + '-init', $.extend({}, self.settings, (options || method), self.data_options(S(this))));++ if (should_bind_events) {+ self.events(this);+ }+ });+ }+ }+ }};$.fn.foundation = function () {@@ -461,4 +413,4 @@ if (typeof jQuery === "undefined" &&});};-}(libFuncName, this, this.document));+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.magellan.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.magellan.jsindex 179478abe3..586741b710 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.magellan.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.magellan.js@@ -1,69 +1,54 @@-/*jslint unparam: true, browser: true, indent: 2 */-;(function ($, window, document, undefined) {'use strict';Foundation.libs.magellan = {name : 'magellan',- version : '4.3.2',+ version : '5.0.0',settings : {- activeClass: 'active',+ active_class: 'active',threshold: 0},init : function (scope, method, options) {- this.scope = scope || this.scope;- Foundation.inherit(this, 'data_options');-- if (typeof method === 'object') {- $.extend(true, this.settings, method);- }-- if (typeof method !== 'string') {- if (!this.settings.init) {- this.fixed_magellan = $("[data-magellan-expedition]");- this.set_threshold();- this.last_destination = $('[data-magellan-destination]').last();- this.events();- }-- return this.settings.init;- } else {- return this[method].call(this, options);- }+ this.fixed_magellan = $("[data-magellan-expedition]");+ this.set_threshold();+ this.last_destination = $('[data-magellan-destination]').last();+ this.events();},events : function () {var self = this;- $(this.scope).on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {- var $destination = $(this),- $expedition = $destination.closest('[data-magellan-expedition]'),- activeClass = $expedition.attr('data-magellan-active-class')- || self.settings.activeClass;-- $destination- .closest('[data-magellan-expedition]')- .find('[data-magellan-arrival]')- .not($destination)- .removeClass(activeClass);- $destination.addClass(activeClass);- });++ $(this.scope)+ .off('.magellan')+ .on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {+ var $destination = $(this),+ $expedition = $destination.closest('[data-magellan-expedition]'),+ active_class = $expedition.attr('data-magellan-active-class')+ || self.settings.active_class;++ $destination+ .closest('[data-magellan-expedition]')+ .find('[data-magellan-arrival]')+ .not($destination)+ .removeClass(active_class);+ $destination.addClass(active_class);+ });this.fixed_magellan- .on('update-position.fndtn.magellan', function(){+ .off('.magellan')+ .on('update-position.fndtn.magellan', function() {var $el = $(this);- // $el.data("magellan-fixed-position","");- // $el.data("magellan-top-offset", "");}).trigger('update-position');$(window)+ .off('.magellan').on('resize.fndtn.magellan', function() {this.fixed_magellan.trigger('update-position');}.bind(this))-.on('scroll.fndtn.magellan', function() {var windowScrollTop = $(window).scrollTop();self.fixed_magellan.each(function() {@@ -72,7 +57,7 @@$expedition.data('magellan-top-offset', $expedition.offset().top);}if (typeof $expedition.data('magellan-fixed-position') === 'undefined') {- $expedition.data('magellan-fixed-position', false)+ $expedition.data('magellan-fixed-position', false);}var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset");var attr = $expedition.attr('data-magellan-top-offset');@@ -103,8 +88,7 @@$('[data-magellan-destination]').each(function () {var $destination = $(this),destination_name = $destination.attr('data-magellan-destination'),- topOffset = $destination.offset().top - windowScrollTop;-+ topOffset = $destination.offset().top - $destination.outerHeight(true) - windowScrollTop;if (topOffset <= self.settings.threshold) {$("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');}@@ -115,14 +99,12 @@});});}-- this.settings.init = true;},set_threshold : function () {if (typeof this.settings.threshold !== 'number') {- this.settings.threshold = (this.fixed_magellan.length > 0) ?- this.outerHeight(this.fixed_magellan, true) : 0;+ this.settings.threshold = (this.fixed_magellan.length > 0) ?+ this.fixed_magellan.outerHeight(true) : 0;}},@@ -133,4 +115,4 @@reflow : function () {}};-}(Foundation.zj, this, this.document));+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.offcanvas.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.offcanvas.jsnew file mode 100644index 0000000000..0ce07c0ee4--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.offcanvas.js@@ -0,0 +1,37 @@+;(function ($, window, document, undefined) {+ 'use strict';++ Foundation.libs.offcanvas = {+ name : 'offcanvas',++ version : '5.0.0',++ settings : {},++ init : function (scope, method, options) {+ this.events();+ },++ events : function () {+ $(this.scope).off('.offcanvas')+ .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {+ e.preventDefault();+ $(this).closest('.off-canvas-wrap').toggleClass('move-right');+ })+ .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {+ e.preventDefault();+ $(".off-canvas-wrap").removeClass("move-right");+ })+ .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {+ e.preventDefault();+ $(this).closest(".off-canvas-wrap").toggleClass("move-left");+ })+ .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {+ e.preventDefault();+ $(".off-canvas-wrap").removeClass("move-left");+ });+ },++ reflow : function () {}+ };+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.orbit.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.orbit.jsindex c6e6f0fa0d..c9dc14c579 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.orbit.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.orbit.js@@ -67,6 +67,7 @@if (settings.bullets) {bullets_container = $('<ol>').addClass(settings.bullets_container_class);container.append(bullets_container);+ bullets_container.wrap('<div class="orbit-bullets-container"></div>');slides_container.children().each(function(idx, el) {var bullet = $('<li>').attr('data-orbit-slide', idx);bullets_container.append(bullet);@@ -100,7 +101,7 @@current.removeClass(settings.active_slide_class);next.css('zIndex', 4).addClass(settings.active_slide_class);- slides_container.trigger('orbit:before-slide-change');+ slides_container.trigger('before-slide-change.fndtn.orbit');settings.before_slide_change();self.update_active_link(next_idx);@@ -110,7 +111,7 @@locked = false;if (start_timer === true) {timer = self.create_timer(); timer.start();}self.update_slide_number(idx);- slides_container.trigger('orbit:after-slide-change',[{slide_number: idx, total_slides: slides.length}]);+ slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);settings.after_slide_change(idx, slides.length);};if (slides_container.height() != next.height() && settings.variable_height) {@@ -267,7 +268,7 @@$(window).on('load', function(){container.prev('.preloader').css('display', 'none');});- slides_container.trigger('orbit:ready');+ slides_container.trigger('ready.fndtn.orbit');};self.init();@@ -306,7 +307,7 @@self.restart();callback();}, left);- el.trigger('orbit:timer-started')+ el.trigger('timer-started.fndtn.orbit')};this.stop = function() {@@ -317,7 +318,7 @@left = left - (end - start);var w = 100 - ((left / duration) * 100);self.update_progress(w);- el.trigger('orbit:timer-stopped');+ el.trigger('timer-stopped.fndtn.orbit');};};@@ -327,23 +328,22 @@var margin = is_rtl ? 'marginRight' : 'marginLeft';var animMargin = {};animMargin[margin] = '0%';- var easing = (typeof jQuery === 'undefined') ? 'ease-in-out' : undefined;this.next = function(current, next, callback) {- next.animate(animMargin, duration, easing, function() {+ current.animate({marginLeft:'-100%'}, duration);+ next.animate(animMargin, duration, function() {current.css(margin, '100%');callback();});- current.animate({marginLeft:'-100%'}, duration, easing);};this.prev = function(current, prev, callback) {+ current.animate({marginLeft:'100%'}, duration);prev.css(margin, '-100%');- prev.animate(animMargin, duration, easing, function() {+ prev.animate(animMargin, duration, function() {current.css(margin, '100%');callback();});- current.animate({marginLeft:'100%'}, duration, easing);};};@@ -375,7 +375,7 @@Foundation.libs.orbit = {name: 'orbit',- version: '4.3.2',+ version: '5.0.0',settings: {animation: 'slide',@@ -411,7 +411,6 @@init: function (scope, method, options) {var self = this;- Foundation.inherit(self, 'data_options');if (typeof method === 'object') {$.extend(true, self.settings, method);@@ -432,4 +431,4 @@};-}(Foundation.zj, this, this.document));+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.placeholder.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.placeholder.jsdeleted file mode 100644index d65812eef9..0000000000--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.placeholder.js+++ /dev/null@@ -1,426 +0,0 @@-/*- * The MIT License- *- * Copyright (c) 2012 James Allardice- *- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),- * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:- *- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.- *- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN- * THE SOFTWARE.- */--// Defines the global Placeholders object along with various utility methods-(function (global) {-- "use strict";-- // Cross-browser DOM event binding- function addEventListener(elem, event, fn) {- if (elem.addEventListener) {- return elem.addEventListener(event, fn, false);- }- if (elem.attachEvent) {- return elem.attachEvent("on" + event, fn);- }- }-- // Check whether an item is in an array (we don't use Array.prototype.indexOf so we don't clobber any existing polyfills - this is a really simple alternative)- function inArray(arr, item) {- var i, len;- for (i = 0, len = arr.length; i < len; i++) {- if (arr[i] === item) {- return true;- }- }- return false;- }-- // Move the caret to the index position specified. Assumes that the element has focus- function moveCaret(elem, index) {- var range;- if (elem.createTextRange) {- range = elem.createTextRange();- range.move("character", index);- range.select();- } else if (elem.selectionStart) {- elem.focus();- elem.setSelectionRange(index, index);- }- }-- // Attempt to change the type property of an input element- function changeType(elem, type) {- try {- elem.type = type;- return true;- } catch (e) {- // You can't change input type in IE8 and below- return false;- }- }-- // Expose public methods- global.Placeholders = {- Utils: {- addEventListener: addEventListener,- inArray: inArray,- moveCaret: moveCaret,- changeType: changeType- }- };--}(this));--(function (global) {-- "use strict";-- var validTypes = [- "text",- "search",- "url",- "tel",- "email",- "password",- "number",- "textarea"- ],-- // The list of keycodes that are not allowed when the polyfill is configured to hide-on-input- badKeys = [-- // The following keys all cause the caret to jump to the end of the input value- 27, // Escape- 33, // Page up- 34, // Page down- 35, // End- 36, // Home-- // Arrow keys allow you to move the caret manually, which should be prevented when the placeholder is visible- 37, // Left- 38, // Up- 39, // Right- 40, // Down-- // The following keys allow you to modify the placeholder text by removing characters, which should be prevented when the placeholder is visible- 8, // Backspace- 46 // Delete- ],-- // Styling variables- placeholderStyleColor = "#ccc",- placeholderClassName = "placeholdersjs",- classNameRegExp = new RegExp("(?:^|\\s)" + placeholderClassName + "(?!\\S)"),-- // These will hold references to all elements that can be affected. NodeList objects are live, so we only need to get those references once- inputs, textareas,-- // The various data-* attributes used by the polyfill- ATTR_CURRENT_VAL = "data-placeholder-value",- ATTR_ACTIVE = "data-placeholder-active",- ATTR_INPUT_TYPE = "data-placeholder-type",- ATTR_FORM_HANDLED = "data-placeholder-submit",- ATTR_EVENTS_BOUND = "data-placeholder-bound",- ATTR_OPTION_FOCUS = "data-placeholder-focus",- ATTR_OPTION_LIVE = "data-placeholder-live",-- // Various other variables used throughout the rest of the script- test = document.createElement("input"),- head = document.getElementsByTagName("head")[0],- root = document.documentElement,- Placeholders = global.Placeholders,- Utils = Placeholders.Utils,- hideOnInput, liveUpdates, keydownVal, styleElem, styleRules, placeholder, timer, form, elem, len, i;-- // No-op (used in place of public methods when native support is detected)- function noop() {}-- // Hide the placeholder value on a single element. Returns true if the placeholder was hidden and false if it was not (because it wasn't visible in the first place)- function hidePlaceholder(elem) {- var type;- if (elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === "true") {- elem.setAttribute(ATTR_ACTIVE, "false");- elem.value = "";- elem.className = elem.className.replace(classNameRegExp, "");-- // If the polyfill has changed the type of the element we need to change it back- type = elem.getAttribute(ATTR_INPUT_TYPE);- if (type) {- elem.type = type;- }- return true;- }- return false;- }-- // Show the placeholder value on a single element. Returns true if the placeholder was shown and false if it was not (because it was already visible)- function showPlaceholder(elem) {- var type,- val = elem.getAttribute(ATTR_CURRENT_VAL);- if (elem.value === "" && val) {- elem.setAttribute(ATTR_ACTIVE, "true");- elem.value = val;- elem.className += " " + placeholderClassName;-- // If the type of element needs to change, change it (e.g. password inputs)- type = elem.getAttribute(ATTR_INPUT_TYPE);- if (type) {- elem.type = "text";- } else if (elem.type === "password") {- if (Utils.changeType(elem, "text")) {- elem.setAttribute(ATTR_INPUT_TYPE, "password");- }- }- return true;- }- return false;- }-- function handleElem(node, callback) {-- var handleInputs, handleTextareas, elem, len, i;-- // Check if the passed in node is an input/textarea (in which case it can't have any affected descendants)- if (node && node.getAttribute(ATTR_CURRENT_VAL)) {- callback(node);- } else {-- // If an element was passed in, get all affected descendants. Otherwise, get all affected elements in document- handleInputs = node ? node.getElementsByTagName("input") : inputs;- handleTextareas = node ? node.getElementsByTagName("textarea") : textareas;-- // Run the callback for each element- for (i = 0, len = handleInputs.length + handleTextareas.length; i < len; i++) {- elem = i < handleInputs.length ? handleInputs[i] : handleTextareas[i - handleInputs.length];- callback(elem);- }- }- }-- // Return all affected elements to their normal state (remove placeholder value if present)- function disablePlaceholders(node) {- handleElem(node, hidePlaceholder);- }-- // Show the placeholder value on all appropriate elements- function enablePlaceholders(node) {- handleElem(node, showPlaceholder);- }-- // Returns a function that is used as a focus event handler- function makeFocusHandler(elem) {- return function () {-- // Only hide the placeholder value if the (default) hide-on-focus behaviour is enabled- if (hideOnInput && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === "true") {-- // Move the caret to the start of the input (this mimics the behaviour of all browsers that do not hide the placeholder on focus)- Utils.moveCaret(elem, 0);-- } else {-- // Remove the placeholder- hidePlaceholder(elem);- }- };- }-- // Returns a function that is used as a blur event handler- function makeBlurHandler(elem) {- return function () {- showPlaceholder(elem);- };- }-- // Functions that are used as a event handlers when the hide-on-input behaviour has been activated - very basic implementation of the "input" event- function makeKeydownHandler(elem) {- return function (e) {- keydownVal = elem.value;-- //Prevent the use of the arrow keys (try to keep the cursor before the placeholder)- if (elem.getAttribute(ATTR_ACTIVE) === "true") {- if (keydownVal === elem.getAttribute(ATTR_CURRENT_VAL) && Utils.inArray(badKeys, e.keyCode)) {- if (e.preventDefault) {- e.preventDefault();- }- return false;- }- }- };- }- function makeKeyupHandler(elem) {- return function () {- var type;-- if (elem.getAttribute(ATTR_ACTIVE) === "true" && elem.value !== keydownVal) {-- // Remove the placeholder- elem.className = elem.className.replace(classNameRegExp, "");- elem.value = elem.value.replace(elem.getAttribute(ATTR_CURRENT_VAL), "");- elem.setAttribute(ATTR_ACTIVE, false);-- // If the type of element needs to change, change it (e.g. password inputs)- type = elem.getAttribute(ATTR_INPUT_TYPE);- if (type) {- elem.type = type;- }- }-- // If the element is now empty we need to show the placeholder- if (elem.value === "") {- elem.blur();- Utils.moveCaret(elem, 0);- }- };- }- function makeClickHandler(elem) {- return function () {- if (elem === document.activeElement && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === "true") {- Utils.moveCaret(elem, 0);- }- };- }-- // Returns a function that is used as a submit event handler on form elements that have children affected by this polyfill- function makeSubmitHandler(form) {- return function () {-- // Turn off placeholders on all appropriate descendant elements- disablePlaceholders(form);- };- }-- // Bind event handlers to an element that we need to affect with the polyfill- function newElement(elem) {-- // If the element is part of a form, make sure the placeholder string is not submitted as a value- if (elem.form) {- form = elem.form;-- // Set a flag on the form so we know it's been handled (forms can contain multiple inputs)- if (!form.getAttribute(ATTR_FORM_HANDLED)) {- Utils.addEventListener(form, "submit", makeSubmitHandler(form));- form.setAttribute(ATTR_FORM_HANDLED, "true");- }- }-- // Bind event handlers to the element so we can hide/show the placeholder as appropriate- Utils.addEventListener(elem, "focus", makeFocusHandler(elem));- Utils.addEventListener(elem, "blur", makeBlurHandler(elem));-- // If the placeholder should hide on input rather than on focus we need additional event handlers- if (hideOnInput) {- Utils.addEventListener(elem, "keydown", makeKeydownHandler(elem));- Utils.addEventListener(elem, "keyup", makeKeyupHandler(elem));- Utils.addEventListener(elem, "click", makeClickHandler(elem));- }-- // Remember that we've bound event handlers to this element- elem.setAttribute(ATTR_EVENTS_BOUND, "true");- elem.setAttribute(ATTR_CURRENT_VAL, placeholder);-- // If the element doesn't have a value, set it to the placeholder string- showPlaceholder(elem);- }-- Placeholders.nativeSupport = test.placeholder !== void 0;-- if (!Placeholders.nativeSupport) {-- // Get references to all the input and textarea elements currently in the DOM (live NodeList objects to we only need to do this once)- inputs = document.getElementsByTagName("input");- textareas = document.getElementsByTagName("textarea");-- // Get any settings declared as data-* attributes on the root element (currently the only options are whether to hide the placeholder on focus or input and whether to auto-update)- hideOnInput = root.getAttribute(ATTR_OPTION_FOCUS) === "false";- liveUpdates = root.getAttribute(ATTR_OPTION_LIVE) !== "false";-- // Create style element for placeholder styles (instead of directly setting style properties on elements - allows for better flexibility alongside user-defined styles)- styleElem = document.createElement("style");- styleElem.type = "text/css";-- // Create style rules as text node- styleRules = document.createTextNode("." + placeholderClassName + " { color:" + placeholderStyleColor + "; }");-- // Append style rules to newly created stylesheet- if (styleElem.styleSheet) {- styleElem.styleSheet.cssText = styleRules.nodeValue;- } else {- styleElem.appendChild(styleRules);- }-- // Prepend new style element to the head (before any existing stylesheets, so user-defined rules take precedence)- head.insertBefore(styleElem, head.firstChild);-- // Set up the placeholders- for (i = 0, len = inputs.length + textareas.length; i < len; i++) {- elem = i < inputs.length ? inputs[i] : textareas[i - inputs.length];-- // Get the value of the placeholder attribute, if any. IE10 emulating IE7 fails with getAttribute, hence the use of the attributes node- placeholder = elem.attributes.placeholder;- if (placeholder) {-- // IE returns an empty object instead of undefined if the attribute is not present- placeholder = placeholder.nodeValue;-- // Only apply the polyfill if this element is of a type that supports placeholders, and has a placeholder attribute with a non-empty value- if (placeholder && Utils.inArray(validTypes, elem.type)) {- newElement(elem);- }- }- }-- // If enabled, the polyfill will repeatedly check for changed/added elements and apply to those as well- timer = setInterval(function () {- for (i = 0, len = inputs.length + textareas.length; i < len; i++) {- elem = i < inputs.length ? inputs[i] : textareas[i - inputs.length];-- // Only apply the polyfill if this element is of a type that supports placeholders, and has a placeholder attribute with a non-empty value- placeholder = elem.attributes.placeholder;- if (placeholder) {- placeholder = placeholder.nodeValue;- if (placeholder && Utils.inArray(validTypes, elem.type)) {-- // If the element hasn't had event handlers bound to it then add them- if (!elem.getAttribute(ATTR_EVENTS_BOUND)) {- newElement(elem);- }-- // If the placeholder value has changed or not been initialised yet we need to update the display- if (placeholder !== elem.getAttribute(ATTR_CURRENT_VAL) || (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE))) {-- // Attempt to change the type of password inputs (fails in IE < 9)- if (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE) && Utils.changeType(elem, "text")) {- elem.setAttribute(ATTR_INPUT_TYPE, "password");- }-- // If the placeholder value has changed and the placeholder is currently on display we need to change it- if (elem.value === elem.getAttribute(ATTR_CURRENT_VAL)) {- elem.value = placeholder;- }-- // Keep a reference to the current placeholder value in case it changes via another script- elem.setAttribute(ATTR_CURRENT_VAL, placeholder);- }- }- }- }-- // If live updates are not enabled cancel the timer- if (!liveUpdates) {- clearInterval(timer);- }- }, 100);- }-- // Expose public methods- Placeholders.disable = Placeholders.nativeSupport ? noop : disablePlaceholders;- Placeholders.enable = Placeholders.nativeSupport ? noop : enablePlaceholders;--}(this));\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.reveal.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.reveal.jsindex 8447e7c573..a7521ec8d3 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.reveal.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.reveal.js@@ -1,22 +1,20 @@-/*jslint unparam: true, browser: true, indent: 2 */-;(function ($, window, document, undefined) {'use strict';Foundation.libs.reveal = {name : 'reveal',- version : '4.3.2',+ version : '5.0.0',locked : false,settings : {animation: 'fadeAndPop',- animationSpeed: 250,- closeOnBackgroundClick: true,- closeOnEsc: true,- dismissModalClass: 'close-reveal-modal',- bgClass: 'reveal-modal-bg',+ animation_speed: 250,+ close_on_background_click: true,+ close_on_esc: true,+ dismiss_modal_class: 'close-reveal-modal',+ bg_class: 'reveal-modal-bg',open: function(){},opened: function(){},close: function(){},@@ -37,29 +35,17 @@},init : function (scope, method, options) {- Foundation.inherit(this, 'data_options delay');-- if (typeof method === 'object') {- $.extend(true, this.settings, method);- } else if (typeof options !== 'undefined') {- $.extend(true, this.settings, options);- }-- if (typeof method !== 'string') {- this.events();+ Foundation.inherit(this, 'delay');- return this.settings.init;- } else {- return this[method].call(this, options);- }+ this.bindings(method, options);},- events : function () {+ events : function (scope) {var self = this;- $(this.scope)- .off('.fndtn.reveal')- .on('click.fndtn.reveal', '[data-reveal-id]', function (e) {+ $('[data-reveal-id]', this.scope)+ .off('.reveal')+ .on('click.fndtn.reveal', function (e) {e.preventDefault();if (!self.locked) {@@ -76,23 +62,30 @@self.open.call(self, element, {url: url});}}- })- .on('click.fndtn.reveal touchend', this.close_targets(), function (e) {+ });++ $(this.scope)+ .off('.reveal')+ .on('click.fndtn.reveal', this.close_targets(), function (e) {+e.preventDefault();+if (!self.locked) {- var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open'))),- bgClicked = $(e.target)[0] === $('.' + settings.bgClass)[0];- if (bgClicked && !settings.closeOnBackgroundClick) {+ var settings = $('[data-reveal].open').data('reveal-init'),+ bg_clicked = $(e.target)[0] === $('.' + settings.bg_class)[0];++ if (bg_clicked && !settings.close_on_background_click) {return;}self.locked = true;- self.close.call(self, bgClicked ? $('.reveal-modal.open') : $(this).closest('.reveal-modal'));+ self.close.call(self, bg_clicked ? $('[data-reveal].open') : $(this).closest('[data-reveal]'));}});- if($(this.scope).hasClass('reveal-modal')) {+ if($('[data-reveal]', this.scope).length > 0) {$(this.scope)+ // .off('.reveal').on('open.fndtn.reveal', this.settings.open).on('opened.fndtn.reveal', this.settings.opened).on('opened.fndtn.reveal', this.open_video)@@ -101,18 +94,19 @@.on('closed.fndtn.reveal', this.close_video);} else {$(this.scope)- .on('open.fndtn.reveal', '.reveal-modal', this.settings.open)- .on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened)- .on('opened.fndtn.reveal', '.reveal-modal', this.open_video)- .on('close.fndtn.reveal', '.reveal-modal', this.settings.close)- .on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)- .on('closed.fndtn.reveal', '.reveal-modal', this.close_video);+ // .off('.reveal')+ .on('open.fndtn.reveal', '[data-reveal]', this.settings.open)+ .on('opened.fndtn.reveal', '[data-reveal]', this.settings.opened)+ .on('opened.fndtn.reveal', '[data-reveal]', this.open_video)+ .on('close.fndtn.reveal', '[data-reveal]', this.settings.close)+ .on('closed.fndtn.reveal', '[data-reveal]', this.settings.closed)+ .on('closed.fndtn.reveal', '[data-reveal]', this.close_video);}- $( 'body' ).bind( 'keyup.reveal', function ( event ) {- var open_modal = $('.reveal-modal.open'),- settings = $.extend({}, self.settings, self.data_options(open_modal));- if ( event.which === 27 && settings.closeOnEsc) { // 27 is the keycode for the Escape key+ $('body').on('keyup.fndtn.reveal', function ( event ) {+ var open_modal = $('[data-reveal].open'),+ settings = open_modal.data('reveal-init');+ if ( event.which === 27 && settings.close_on_esc) { // 27 is the keycode for the Escape keyopen_modal.foundation('reveal', 'close');}});@@ -134,7 +128,7 @@}if (!modal.hasClass('open')) {- var open_modal = $('.reveal-modal.open');+ var open_modal = $('[data-reveal].open');if (typeof modal.data('css-top') === 'undefined') {modal.data('css-top', parseInt(modal.css('top'), 10))@@ -176,7 +170,7 @@close : function (modal) {var modal = modal && modal.length ? modal : $(this.scope),- open_modals = $('.reveal-modal.open');+ open_modals = $('[data-reveal].open');if (open_modals.length > 0) {this.locked = true;@@ -187,18 +181,18 @@},close_targets : function () {- var base = '.' + this.settings.dismissModalClass;+ var base = '.' + this.settings.dismiss_modal_class;- if (this.settings.closeOnBackgroundClick) {- return base + ', .' + this.settings.bgClass;+ if (this.settings.close_on_background_click) {+ return base + ', .' + this.settings.bg_class;}return base;},toggle_bg : function () {- if ($('.' + this.settings.bgClass).length === 0) {- this.settings.bg = $('<div />', {'class': this.settings.bgClass})+ if ($('.' + this.settings.bg_class).length === 0) {+ this.settings.bg = $('<div />', {'class': this.settings.bg_class}).appendTo('body');}@@ -232,12 +226,12 @@return this.delay(function () {return el.css(css)- .animate(end_css, this.settings.animationSpeed, 'linear', function () {+ .animate(end_css, this.settings.animation_speed, 'linear', function () {this.locked = false;el.trigger('opened');}.bind(this)).addClass('open');- }.bind(this), this.settings.animationSpeed / 2);+ }.bind(this), this.settings.animation_speed / 2);}if (/fade/i.test(this.settings.animation)) {@@ -246,12 +240,12 @@return this.delay(function () {return el.css(css)- .animate(end_css, this.settings.animationSpeed, 'linear', function () {+ .animate(end_css, this.settings.animation_speed, 'linear', function () {this.locked = false;el.trigger('opened');}.bind(this)).addClass('open');- }.bind(this), this.settings.animationSpeed / 2);+ }.bind(this), this.settings.animation_speed / 2);}return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');@@ -259,7 +253,7 @@// should we animate the background?if (/fade/i.test(this.settings.animation)) {- return el.fadeIn(this.settings.animationSpeed / 2);+ return el.fadeIn(this.settings.animation_speed / 2);}return el.show();@@ -276,12 +270,12 @@return this.delay(function () {return el- .animate(end_css, this.settings.animationSpeed, 'linear', function () {+ .animate(end_css, this.settings.animation_speed, 'linear', function () {this.locked = false;el.css(css).trigger('closed');}.bind(this)).removeClass('open');- }.bind(this), this.settings.animationSpeed / 2);+ }.bind(this), this.settings.animation_speed / 2);}if (/fade/i.test(this.settings.animation)) {@@ -289,12 +283,12 @@return this.delay(function () {return el- .animate(end_css, this.settings.animationSpeed, 'linear', function () {+ .animate(end_css, this.settings.animation_speed, 'linear', function () {this.locked = false;el.css(css).trigger('closed');}.bind(this)).removeClass('open');- }.bind(this), this.settings.animationSpeed / 2);+ }.bind(this), this.settings.animation_speed / 2);}return el.hide().css(css).removeClass('open').trigger('closed');@@ -302,7 +296,7 @@// should we animate the background?if (/fade/i.test(this.settings.animation)) {- return el.fadeOut(this.settings.animationSpeed / 2);+ return el.fadeOut(this.settings.animation_speed / 2);}return el.hide();@@ -350,4 +344,4 @@reflow : function () {}};-}(Foundation.zj, this, this.document));\ No newline at end of file+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.section.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.section.jsdeleted file mode 100644index 0f1e06e562..0000000000--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.section.js+++ /dev/null@@ -1,430 +0,0 @@-/*jslint unparam: true, browser: true, indent: 2 */--;-(function($, window, document) {- 'use strict';-- Foundation.libs.section = {- name : 'section',-- version : '4.3.2',-- settings: {- deep_linking: false,- small_breakpoint: 768,- one_up: true,- multi_expand: false,- section_selector: '[data-section]',- region_selector: 'section, .section, [data-section-region]',- title_selector: '.title, [data-section-title]',- //marker: container is resized- resized_data_attr: 'data-section-resized',- //marker: container should apply accordion style- small_style_data_attr: 'data-section-small-style',- content_selector: '.content, [data-section-content]',- nav_selector: '[data-section="vertical-nav"], [data-section="horizontal-nav"]',- active_class: 'active',- callback: function() {}- },-- init: function(scope, method, options) {- var self = this;- Foundation.inherit(this, 'throttle data_options position_right offset_right');-- if (typeof method === 'object') {- $.extend(true, self.settings, method);- }-- if (typeof method !== 'string') {- this.events();- return true;- } else {- return this[method].call(this, options);- }- },-- events: function() {- var self = this;-- //combine titles selector from settings for click event binding- var click_title_selectors = [],- section_selector = self.settings.section_selector,- region_selectors = self.settings.region_selector.split(","),- title_selectors = self.settings.title_selector.split(",");-- for (var i = 0, len = region_selectors.length; i < len; i++) {- var region_selector = region_selectors[i];-- for (var j = 0, len1 = title_selectors.length; j < len1; j++) {- var title_selector = section_selector + ">" + region_selector + ">" + title_selectors[j];-- click_title_selectors.push(title_selector + " a"); //or we can not do preventDefault for click event of <a>- click_title_selectors.push(title_selector);- }- }-- $(self.scope)- .on('click.fndtn.section', click_title_selectors.join(","), function(e) {- var title = $(this).closest(self.settings.title_selector);-- self.close_navs(title);- if (title.siblings(self.settings.content_selector).length > 0) {- self.toggle_active.call(title[0], e);- }- });-- $(window)- .on('resize.fndtn.section', self.throttle(function() { self.resize(); }, 30))- .on('hashchange.fndtn.section', self.set_active_from_hash);-- $(document).on('click.fndtn.section', function (e) {- if (e.isPropagationStopped && e.isPropagationStopped()) return;- if (e.target === document) return;- self.close_navs($(e.target).closest(self.settings.title_selector));- });-- $(window).triggerHandler('resize.fndtn.section');- $(window).triggerHandler('hashchange.fndtn.section');- },-- //close nav !one_up on click elsewhere- close_navs: function(except_nav_with_title) {- var self = Foundation.libs.section,- navsToClose = $(self.settings.nav_selector)- .filter(function() { return !$.extend({},- self.settings, self.data_options($(this))).one_up; });-- if (except_nav_with_title.length > 0) {- var section = except_nav_with_title.parent().parent();-- if (self.is_horizontal_nav(section) || self.is_vertical_nav(section)) {- //exclude current nav from list- navsToClose = navsToClose.filter(function() { return this !== section[0]; });- }- }- //close navs on click on title- navsToClose.children(self.settings.region_selector).removeClass(self.settings.active_class);- },-- toggle_active: function(e) {- var $this = $(this),- self = Foundation.libs.section,- region = $this.parent(),- content = $this.siblings(self.settings.content_selector),- section = region.parent(),- settings = $.extend({}, self.settings, self.data_options(section)),- prev_active_region = section.children(self.settings.region_selector).filter("." + self.settings.active_class);-- //for anchors inside [data-section-title]- if (!settings.deep_linking && content.length > 0) {- e.preventDefault();- }-- e.stopPropagation(); //do not catch same click again on parent-- if (!region.hasClass(self.settings.active_class)) {- if (!self.is_accordion(section) || (self.is_accordion(section) && !self.settings.multi_expand)) {- prev_active_region.removeClass(self.settings.active_class);- prev_active_region.trigger('closed.fndtn.section');- }- region.addClass(self.settings.active_class);- //force resize for better performance (do not wait timer)- self.resize(region.find(self.settings.section_selector).not("[" + self.settings.resized_data_attr + "]"), true);- region.trigger('opened.fndtn.section');- } else if (region.hasClass(self.settings.active_class) && self.is_accordion(section) || !settings.one_up && (self.small(section) || self.is_vertical_nav(section) || self.is_horizontal_nav(section) || self.is_accordion(section))) {- region.removeClass(self.settings.active_class);- region.trigger('closed.fndtn.section');- }- settings.callback(section);- },-- check_resize_timer: null,-- //main function that sets title and content positions; runs for :not(.resized) and :visible once when window width is medium up- //sections:- // selected sections to resize, are defined on resize forced by visibility changes- //ensure_has_active_region:- // is true when we force resize for no resized sections that were hidden and became visible,- // these sections can have no selected region, because all regions were hidden along with section on executing set_active_from_hash- resize: function(sections, ensure_has_active_region) {-- var self = Foundation.libs.section,- section_container = $(self.settings.section_selector),- is_small_window = self.small(section_container),- //filter for section resize- should_be_resized = function (section, now_is_hidden) {- return !self.is_accordion(section) &&- !section.is("[" + self.settings.resized_data_attr + "]") &&- (!is_small_window || self.is_horizontal_tabs(section)) &&- now_is_hidden === (section.css('display') === 'none' ||- !section.parent().is(':visible'));- };-- sections = sections || $(self.settings.section_selector);-- clearTimeout(self.check_resize_timer);-- if (!is_small_window) {- sections.removeAttr(self.settings.small_style_data_attr);- }-- //resize- sections.filter(function() { return should_be_resized($(this), false); })- .each(function() {- var section = $(this),- regions = section.children(self.settings.region_selector),- titles = regions.children(self.settings.title_selector),- content = regions.children(self.settings.content_selector),- titles_max_height = 0;-- if (ensure_has_active_region &&- section.children(self.settings.region_selector).filter("." + self.settings.active_class).length == 0) {- var settings = $.extend({}, self.settings, self.data_options(section));-- if (!settings.deep_linking && (settings.one_up || !self.is_horizontal_nav(section) &&- !self.is_vertical_nav(section) && !self.is_accordion(section))) {- regions.filter(":visible").first().addClass(self.settings.active_class);- }- }-- if (self.is_horizontal_tabs(section) || self.is_auto(section)) {- // region: position relative- // title: position absolute- // content: position static- var titles_sum_width = 0;-- titles.each(function() {- var title = $(this);-- if (title.is(":visible")) {- title.css(!self.rtl ? 'left' : 'right', titles_sum_width);- var title_h_border_width = parseInt(title.css("border-" + (self.rtl ? 'left' : 'right') + "-width"), 10);-- if (title_h_border_width.toString() === 'Nan') {- title_h_border_width = 0;- }-- titles_sum_width += self.outerWidth(title) - title_h_border_width;- titles_max_height = Math.max(titles_max_height, self.outerHeight(title));- }- });- titles.css('height', titles_max_height);- regions.each(function() {- var region = $(this),- region_content = region.children(self.settings.content_selector),- content_top_border_width = parseInt(region_content.css("border-top-width"), 10);-- if (content_top_border_width.toString() === 'Nan') {- content_top_border_width = 0;- }-- region.css('padding-top', titles_max_height - content_top_border_width);- });-- section.css("min-height", titles_max_height);- } else if (self.is_horizontal_nav(section)) {- var first = true;- // region: positon relative, float left- // title: position static- // content: position absolute- titles.each(function() {- titles_max_height = Math.max(titles_max_height, self.outerHeight($(this)));- });-- regions.each(function() {- var region = $(this);-- region.css("margin-left", "-" + (first ? section : region.children(self.settings.title_selector)).css("border-left-width"));- first = false;- });-- regions.css("margin-top", "-" + section.css("border-top-width"));- titles.css('height', titles_max_height);- content.css('top', titles_max_height);- section.css("min-height", titles_max_height);- } else if (self.is_vertical_tabs(section)) {- var titles_sum_height = 0;- // region: position relative, for .active: fixed padding==title.width- // title: fixed width, position absolute- // content: position static- titles.each(function() {- var title = $(this);-- if (title.is(":visible")) {- title.css('top', titles_sum_height);- var title_top_border_width = parseInt(title.css("border-top-width"), 10);-- if (title_top_border_width.toString() === 'Nan') {- title_top_border_width = 0;- }-- titles_sum_height += self.outerHeight(title) - title_top_border_width;- }- });-- content.css('min-height', titles_sum_height + 1);- } else if (self.is_vertical_nav(section)) {- var titles_max_width = 0,- first1 = true;- // region: positon relative- // title: position static- // content: position absolute- titles.each(function() {- titles_max_width = Math.max(titles_max_width, self.outerWidth($(this)));- });-- regions.each(function () {- var region = $(this);-- region.css("margin-top", "-" + (first1 ? section : region.children(self.settings.title_selector)).css("border-top-width"));- first1 = false;- });-- titles.css('width', titles_max_width);- content.css(!self.rtl ? 'left' : 'right', titles_max_width);- section.css('width', titles_max_width);- }-- section.attr(self.settings.resized_data_attr, true);- });-- //wait elements to become visible then resize- if ($(self.settings.section_selector).filter(function() { return should_be_resized($(this), true); }).length > 0)- self.check_resize_timer = setTimeout(function() {- self.resize(sections.filter(function() { return should_be_resized($(this), false); }), true);- }, 700);-- if (is_small_window) {- sections.attr(self.settings.small_style_data_attr, true);- }- },-- is_vertical_nav: function(el) {- return /vertical-nav/i.test(el.data('section'));- },-- is_horizontal_nav: function(el) {- return /horizontal-nav/i.test(el.data('section'));- },-- is_accordion: function(el) {- return /accordion/i.test(el.data('section'));- },-- is_horizontal_tabs: function(el) {- return /^tabs$/i.test(el.data('section'));- },-- is_vertical_tabs: function(el) {- return /vertical-tabs/i.test(el.data('section'));- },-- is_auto: function (el) {- var data_section = el.data('section');- return data_section === '' || /auto/i.test(data_section);- },-- set_active_from_hash: function() {- var self = Foundation.libs.section,- hash = window.location.hash.substring(1),- sections = $(self.settings.section_selector);-- var selectedSection;-- sections.each(function() {- var section = $(this),- regions = section.children(self.settings.region_selector);- regions.each(function() {- var region = $(this),- data_slug = region.children(self.settings.content_selector).data('slug');- if (new RegExp(data_slug, 'i').test(hash)) {- selectedSection=section;- return false;- }- });-- if (selectedSection != null) {- return false;- }- });-- if (selectedSection != null) {- sections.each(function() {- if (selectedSection == $(this)) {- var section = $(this),- settings = $.extend({}, self.settings, self.data_options(section)),- regions = section.children(self.settings.region_selector),- set_active_from_hash = settings.deep_linking && hash.length > 0,- selected = false;-- regions.each(function() {- var region = $(this);-- if (selected) {- region.removeClass(self.settings.active_class);- } else if (set_active_from_hash) {- var data_slug = region.children(self.settings.content_selector).data('slug');-- if (data_slug && new RegExp(data_slug, 'i').test(hash)) {- if (!region.hasClass(self.settings.active_class))- region.addClass(self.settings.active_class);- selected = true;- } else {- region.removeClass(self.settings.active_class);- }- } else if (region.hasClass(self.settings.active_class)) {- selected = true;- }- });-- if (!selected && (settings.one_up || !self.is_horizontal_nav(section) &&- !self.is_vertical_nav(section) && !self.is_accordion(section)))- regions.filter(":visible").first().addClass(self.settings.active_class);- }- });- }- },-- reflow: function() {- var self = Foundation.libs.section;-- $(self.settings.section_selector).removeAttr(self.settings.resized_data_attr);- self.throttle(function() { self.resize(); }, 30)();- },-- small: function(el) {- var settings = $.extend({}, this.settings, this.data_options(el));-- if (this.is_horizontal_tabs(el)) {- return false;- }- if (el && this.is_accordion(el)) {- return true;- }- if ($('html').hasClass('lt-ie9')) {- return true;- }- if ($('html').hasClass('ie8compat')) {- return true;- }- return $(this.scope).width() < settings.small_breakpoint;- },-- off: function() {- $(this.scope).off('.fndtn.section');- $(window).off('.fndtn.section');- $(document).off('.fndtn.section');- }- };-- //resize selected sections- $.fn.reflow_section = function(ensure_has_active_region) {- var section = this,- self = Foundation.libs.section;-- section.removeAttr(self.settings.resized_data_attr);- self.throttle(function() { self.resize(section, ensure_has_active_region); }, 30)();- return this;- };--}(Foundation.zj, window, document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tab.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tab.jsnew file mode 100644index 0000000000..f3dff806a9--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tab.js@@ -0,0 +1,37 @@+/*jslint unparam: true, browser: true, indent: 2 */+;(function ($, window, document, undefined) {+ 'use strict';++ Foundation.libs.tab = {+ name : 'tab',++ version : '5.0.1',++ settings : {+ active_class: 'active'+ },++ init : function (scope, method, options) {+ this.bindings(method, options);+ },++ events : function () {+ $(this.scope).off('.tab').on('click.fndtn.tab', '[data-tab] > dd > a', function (e) {+ e.preventDefault();++ var tab = $(this).parent(),+ target = $('#' + this.href.split('#')[1]),+ siblings = tab.siblings(),+ settings = tab.closest('[data-tab]').data('tab-init');++ tab.addClass(settings.active_class);+ siblings.removeClass(settings.active_class);+ target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);+ });+ },++ off : function () {},++ reflow : function () {}+ };+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tooltips.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tooltip.jssimilarity index 54%rename from gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tooltips.jsrename to gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tooltip.jsindex dba69ca39d..27429eef0e 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tooltips.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.tooltip.js@@ -1,23 +1,20 @@-/*jslint unparam: true, browser: true, indent: 2 */-;(function ($, window, document, undefined) {'use strict';- Foundation.libs.tooltips = {- name : 'tooltips',+ Foundation.libs.tooltip = {+ name : 'tooltip',- version : '4.3.2',+ version : '5.0.0',settings : {- selector : '.has-tip',- additionalInheritableClasses : [],- tooltipClass : '.tooltip',- touchCloseText: 'tap to close',- appendTo: 'body',- 'disable-for-touch': false,- tipTemplate : function (selector, content) {+ additional_inheritable_classes : [],+ tooltip_class : '.tooltip',+ append_to: 'body',+ touch_close_text: 'Tap To Close',+ disable_for_touch: false,+ tip_template : function (selector, content) {return '<span data-selector="' + selector + '" class="'- + Foundation.libs.tooltips.settings.tooltipClass.substring(1)+ + Foundation.libs.tooltip.settings.tooltip_class.substring(1)+ '">' + content + '<span class="nub"></span></span>';}},@@ -25,51 +22,43 @@cache : {},init : function (scope, method, options) {- Foundation.inherit(this, 'data_options');- var self = this;+ this.bindings(method, options);+ },- if (typeof method === 'object') {- $.extend(true, this.settings, method);- } else if (typeof options !== 'undefined') {- $.extend(true, this.settings, options);- }+ events : function () {+ var self = this;- if (typeof method !== 'string') {- if (Modernizr.touch) {- $(this.scope)- .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',- '[data-tooltip]', function (e) {- var settings = $.extend({}, self.settings, self.data_options($(this)));- if (!settings['disable-for-touch']) {- e.preventDefault();- $(settings.tooltipClass).hide();- self.showOrCreateTip($(this));- }- })- .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',- this.settings.tooltipClass, function (e) {+ if (Modernizr.touch) {+ $(this.scope)+ .off('.tooltip')+ .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',+ '[data-tooltip]', function (e) {+ var settings = $.extend({}, self.settings, self.data_options($(this)));+ if (!settings.disable_for_touch) {e.preventDefault();- $(this).fadeOut(150);- });- } else {- $(this.scope)- .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip',- '[data-tooltip]', function (e) {- var $this = $(this);-- if (/enter|over/i.test(e.type)) {- self.showOrCreateTip($this);- } else if (e.type === 'mouseout' || e.type === 'mouseleave') {- self.hide($this);- }- });- }-- // $(this.scope).data('fndtn-tooltips', true);+ $(settings.tooltip_class).hide();+ self.showOrCreateTip($(this));+ }+ })+ .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',+ this.settings.tooltip_class, function (e) {+ e.preventDefault();+ $(this).fadeOut(150);+ });} else {- return this[method].call(this, options);+ $(this.scope)+ .off('.tooltip')+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip',+ '[data-tooltip]', function (e) {+ var $this = $(this);++ if (/enter|over/i.test(e.type)) {+ self.showOrCreateTip($this);+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {+ self.hide($this);+ }+ });}-},showOrCreateTip : function ($target) {@@ -87,7 +76,7 @@tip = null;if (selector) {- tip = $('span[data-selector="' + selector + '"]' + this.settings.tooltipClass);+ tip = $('span[data-selector="' + selector + '"]' + this.settings.tooltip_class);}return (typeof tip === 'object') ? tip : false;@@ -106,12 +95,12 @@},create : function ($target) {- var $tip = $(this.settings.tipTemplate(this.selector($target), $('<div></div>').html($target.attr('title')).html())),+ var $tip = $(this.settings.tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),classes = this.inheritable_classes($target);- $tip.addClass(classes).appendTo(this.settings.appendTo);+ $tip.addClass(classes).appendTo(this.settings.append_to);if (Modernizr.touch) {- $tip.append('<span class="tap-to-close">'+this.settings.touchCloseText+'</span>');+ $tip.append('<span class="tap-to-close">'+this.settings.touch_close_text+'</span>');}$target.removeAttr('title').attr('title','');this.show($target);@@ -124,8 +113,8 @@width = target.data('width');nub = tip.children('.nub');- nubHeight = this.outerHeight(nub);- nubWidth = this.outerHeight(nub);+ nubHeight = nub.outerHeight();+ nubWidth = nub.outerHeight();objPos = function (obj, top, right, bottom, left, width) {return obj.css({@@ -137,27 +126,27 @@}).end();};- objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width);+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left, width);- if ($(window).width() < 767) {- objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', 12.5, $(this.scope).width());+ if (this.small()) {+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());tip.addClass('tip-override');objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);} else {var left = target.offset().left;if (Foundation.rtl) {- left = target.offset().left + target.offset().width - this.outerWidth(tip);+ left = target.offset().left + target.offset().width - tip.outerWidth();}- objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', left, width);+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left, width);tip.removeClass('tip-override');if (classes && classes.indexOf('tip-top') > -1) {- objPos(tip, (target.offset().top - this.outerHeight(tip)), 'auto', 'auto', left, width)+ objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left, width).removeClass('tip-override');} else if (classes && classes.indexOf('tip-left') > -1) {- objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left - this.outerWidth(tip) - nubHeight), width)+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight), width).removeClass('tip-override');} else if (classes && classes.indexOf('tip-right') > -1) {- objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left + this.outerWidth(target) + nubHeight), width)+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight), width).removeClass('tip-override');}}@@ -165,8 +154,12 @@tip.css('visibility', 'visible').hide();},+ small : function () {+ return matchMedia(Foundation.media_queries.small).matches;+ },+inheritable_classes : function (target) {- var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additionalInheritableClasses),+ var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additional_inheritable_classes),classes = target.attr('class'),filtered = classes ? $.map(classes.split(' '), function (el, i) {if ($.inArray(el, inheritables) !== -1) {@@ -199,11 +192,11 @@off : function () {$(this.scope).off('.fndtn.tooltip');- $(this.settings.tooltipClass).each(function (i) {+ $(this.settings.tooltip_class).each(function (i) {$('[data-tooltip]').get(i).attr('title', $(this).text());}).remove();},reflow : function () {}};-}(Foundation.zj, this, this.document));\ No newline at end of file+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.topbar.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.topbar.jsindex 5cb2d6c5d4..019471c165 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.topbar.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/foundation.topbar.js@@ -1,96 +1,88 @@-/*jslint unparam: true, browser: true, indent: 2 */-;(function ($, window, document, undefined) {'use strict';Foundation.libs.topbar = {name : 'topbar',- version: '4.3.2',+ version: '5.0.1',settings : {index : 0,- stickyClass : 'sticky',+ sticky_class : 'sticky',custom_back_text: true,back_text: 'Back',is_hover: true,mobile_show_parent_link: false,- scrolltop : true, // jump to top when sticky nav menu toggle is clicked- init : false+ scrolltop : true // jump to top when sticky nav menu toggle is clicked},init : function (section, method, options) {- Foundation.inherit(this, 'data_options addCustomRule');+ Foundation.inherit(this, 'addCustomRule register_media throttle');var self = this;- if (typeof method === 'object') {- $.extend(true, this.settings, method);- } else if (typeof options !== 'undefined') {- $.extend(true, this.settings, options);- }-- if (typeof method !== 'string') {+ self.register_media('topbar', 'foundation-mq-topbar');- $('.top-bar, [data-topbar]').each(function () {- $.extend(true, self.settings, self.data_options($(this)));- self.settings.$w = $(window);- self.settings.$topbar = $(this);- self.settings.$section = self.settings.$topbar.find('section');- self.settings.$titlebar = self.settings.$topbar.children('ul').first();- self.settings.$topbar.data('index', 0);+ this.bindings(method, options);- var topbarContainer = self.settings.$topbar.parent();- if(topbarContainer.hasClass('fixed') || topbarContainer.hasClass(self.settings.stickyClass)) {- self.settings.$topbar.data('height', self.outerHeight(topbarContainer));- self.settings.$topbar.data('stickyoffset', topbarContainer.offset().top);- } else {- self.settings.$topbar.data('height', self.outerHeight(self.settings.$topbar));- }+ $('[data-topbar]', this.scope).each(function () {+ var topbar = $(this),+ settings = topbar.data('topbar-init'),+ section = $('section', this),+ titlebar = $('> ul', this).first();- var breakpoint = $("<div class='top-bar-js-breakpoint'/>").insertAfter(self.settings.$topbar);- self.settings.breakPoint = breakpoint.width();- breakpoint.remove();+ topbar.data('index', 0);- self.assemble();+ var topbarContainer = topbar.parent();+ if(topbarContainer.hasClass('fixed') || topbarContainer.hasClass(settings.sticky_class)) {+ self.settings.sticky_class = settings.sticky_class;+ self.settings.stick_topbar = topbar;+ topbar.data('height', topbarContainer.outerHeight());+ topbar.data('stickyoffset', topbarContainer.offset().top);+ } else {+ topbar.data('height', topbar.outerHeight());+ }- if (self.settings.is_hover) {- self.settings.$topbar.find('.has-dropdown').addClass('not-click');- }+ if (!settings.assembled) self.assemble(topbar);- // Pad body when sticky (scrolled) or fixed.- self.addCustomRule('.f-topbar-fixed { padding-top: ' + self.settings.$topbar.data('height') + 'px }');+ if (settings.is_hover) {+ $('.has-dropdown', topbar).addClass('not-click');+ } else {+ $('.has-dropdown', topbar).removeClass('not-click');+ }- if (self.settings.$topbar.parent().hasClass('fixed')) {- $('body').addClass('f-topbar-fixed');- }- });+ // Pad body when sticky (scrolled) or fixed.+ self.addCustomRule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');- if (!self.settings.init) {- this.events();+ if (topbarContainer.hasClass('fixed')) {+ $('body').addClass('f-topbar-fixed');}+ });- return this.settings.init;- } else {- // fire method- return this[method].call(this, options);- }},- toggle: function() {+ toggle: function (toggleEl) {var self = this;- var topbar = $('.top-bar, [data-topbar]'),- section = topbar.find('section, .section');++ if (toggleEl) {+ var topbar = $(toggleEl).closest('[data-topbar]');+ } else {+ var topbar = $('[data-topbar]');+ }++ var settings = topbar.data('topbar-init');++ var section = $('section, .section', topbar);if (self.breakpoint()) {if (!self.rtl) {section.css({left: '0%'});- section.find('>.name').css({left: '100%'});+ $('>.name', section).css({left: '100%'});} else {section.css({right: '0%'});- section.find('>.name').css({right: '100%'});+ $('>.name', section).css({right: '100%'});}- section.find('li.moved').removeClass('moved');+ $('li.moved', section).removeClass('moved');topbar.data('index', 0);topbar@@ -98,8 +90,7 @@.css('height', '');}- if(self.settings.scrolltop)- {+ if (settings.scrolltop) {if (!topbar.hasClass('expanded')) {if (topbar.hasClass('fixed')) {topbar.parent().addClass('fixed');@@ -107,7 +98,7 @@$('body').addClass('f-topbar-fixed');}} else if (topbar.parent().hasClass('fixed')) {- if (self.settings.scrolltop) {+ if (settings.scrolltop) {topbar.parent().removeClass('fixed');topbar.addClass('fixed');$('body').removeClass('f-topbar-fixed');@@ -118,7 +109,7 @@}}} else {- if(topbar.parent().hasClass(self.settings.stickyClass)) {+ if(topbar.parent().hasClass(self.settings.sticky_class)) {topbar.parent().addClass('fixed');}@@ -126,7 +117,7 @@if (!topbar.hasClass('expanded')) {topbar.removeClass('fixed');topbar.parent().removeClass('expanded');- self.updateStickyPositioning();+ self.update_sticky_positioning();} else {topbar.addClass('fixed');topbar.parent().addClass('expanded');@@ -137,20 +128,19 @@timer : null,- events : function () {+ events : function (bar) {var self = this;$(this.scope)- .off('.fndtn.topbar')- .on('click.fndtn.topbar', '.top-bar .toggle-topbar, [data-topbar] .toggle-topbar', function (e) {+ .off('.topbar')+ .on('click.fndtn.topbar', '[data-topbar] .toggle-topbar', function (e) {e.preventDefault();- self.toggle();+ self.toggle(this);})-- .on('click.fndtn.topbar', '.top-bar li.has-dropdown', function (e) {+ .on('click.fndtn.topbar', '[data-topbar] li.has-dropdown', function (e) {var li = $(this),target = $(e.target),- topbar = li.closest('[data-topbar], .top-bar'),- is_hover = topbar.data('topbar');+ topbar = li.closest('[data-topbar]'),+ settings = topbar.data('topbar-init');if(target.data('revealId')) {self.toggle();@@ -158,14 +148,10 @@}if (self.breakpoint()) return;- if (self.settings.is_hover && !Modernizr.touch) return;+ if (settings.is_hover && !Modernizr.touch) return;e.stopImmediatePropagation();- if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {- e.preventDefault();- }-if (li.hasClass('hover')) {li.removeClass('hover')@@ -176,16 +162,19 @@.removeClass('hover');} else {li.addClass('hover');++ if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {+ e.preventDefault();+ }}})-- .on('click.fndtn.topbar', '.top-bar .has-dropdown>a, [data-topbar] .has-dropdown>a', function (e) {- if (self.breakpoint() && $(window).width() != self.settings.breakPoint) {+ .on('click.fndtn.topbar', '[data-topbar] .has-dropdown>a', function (e) {+ if (self.breakpoint()) {e.preventDefault();var $this = $(this),- topbar = $this.closest('.top-bar, [data-topbar]'),+ topbar = $this.closest('[data-topbar]'),section = topbar.find('section, .section'),dropdownHeight = $this.next('.dropdown').outerHeight(),$selectedLi = $this.closest('li');@@ -201,64 +190,32 @@section.find('>.name').css({right: 100 * topbar.data('index') + '%'});}- topbar.css('height', self.outerHeight($this.siblings('ul'), true) + self.settings.$topbar.data('height'));+ topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));}});++ $(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {+ self.resize.call(self);+ }, 50)).trigger('resize');- $(window).on('resize.fndtn.topbar', function () {- if (typeof self.settings.$topbar === 'undefined') { return; }- var stickyContainer = self.settings.$topbar.parent('.' + this.settings.stickyClass);- var stickyOffset;-- if (!self.breakpoint()) {- var doToggle = self.settings.$topbar.hasClass('expanded');- $('.top-bar, [data-topbar]')- .css('height', '')- .removeClass('expanded')- .find('li')- .removeClass('hover');-- if(doToggle) {- self.toggle();- }- }-- if(stickyContainer.length > 0) {- if(stickyContainer.hasClass('fixed')) {- // Remove the fixed to allow for correct calculation of the offset.- stickyContainer.removeClass('fixed');-- stickyOffset = stickyContainer.offset().top;- if($(document.body).hasClass('f-topbar-fixed')) {- stickyOffset -= self.settings.$topbar.data('height');- }-- self.settings.$topbar.data('stickyoffset', stickyOffset);- stickyContainer.addClass('fixed');- } else {- stickyOffset = stickyContainer.offset().top;- self.settings.$topbar.data('stickyoffset', stickyOffset);- }- }- }.bind(this));-- $('body').on('click.fndtn.topbar', function (e) {+ $('body').off('.topbar').on('click.fndtn.topbar touchstart.fndtn.topbar', function (e) {var parent = $(e.target).closest('li').closest('li.hover');if (parent.length > 0) {return;}- $('.top-bar li, [data-topbar] li').removeClass('hover');+ $('[data-topbar] li').removeClass('hover');});// Go up a level on Click- $(this.scope).on('click.fndtn', '.top-bar .has-dropdown .back, [data-topbar] .has-dropdown .back', function (e) {+ $(this.scope).on('click.fndtn.topbar', '[data-topbar] .has-dropdown .back', function (e) {e.preventDefault();var $this = $(this),- topbar = $this.closest('.top-bar, [data-topbar]'),+ topbar = $this.closest('[data-topbar]'),section = topbar.find('section, .section'),+ settings = topbar.data('topbar-init'),$movedLi = $this.closest('li.moved'),$previousLevelUl = $movedLi.parent();@@ -275,7 +232,7 @@if (topbar.data('index') === 0) {topbar.css('height', '');} else {- topbar.css('height', self.outerHeight($previousLevelUl, true) + self.settings.$topbar.data('height'));+ topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));}setTimeout(function () {@@ -284,47 +241,100 @@});},+ resize : function () {+ var self = this;+ $('[data-topbar]').each(function () {+ var topbar = $(this),+ settings = topbar.data('topbar-init');++ var stickyContainer = topbar.parent('.' + self.settings.sticky_class);+ var stickyOffset;++ if (!self.breakpoint()) {+ var doToggle = topbar.hasClass('expanded');+ topbar+ .css('height', '')+ .removeClass('expanded')+ .find('li')+ .removeClass('hover');++ if(doToggle) {+ self.toggle(topbar);+ }+ }++ if(stickyContainer.length > 0) {+ if(stickyContainer.hasClass('fixed')) {+ // Remove the fixed to allow for correct calculation of the offset.+ stickyContainer.removeClass('fixed');++ stickyOffset = stickyContainer.offset().top;+ if($(document.body).hasClass('f-topbar-fixed')) {+ stickyOffset -= topbar.data('height');+ }++ topbar.data('stickyoffset', stickyOffset);+ stickyContainer.addClass('fixed');+ } else {+ stickyOffset = stickyContainer.offset().top;+ topbar.data('stickyoffset', stickyOffset);+ }+ }++ });+ },+breakpoint : function () {- return $(document).width() <= this.settings.breakPoint || $('html').hasClass('lt-ie9');+ return !matchMedia(Foundation.media_queries['topbar']).matches;},- assemble : function () {- var self = this;+ assemble : function (topbar) {+ var self = this,+ settings = topbar.data('topbar-init'),+ section = $('section', topbar),+ titlebar = $('> ul', topbar).first();+// Pull element out of the DOM for manipulation- this.settings.$section.detach();+ section.detach();- this.settings.$section.find('.has-dropdown>a').each(function () {+ $('.has-dropdown>a', section).each(function () {var $link = $(this),$dropdown = $link.siblings('.dropdown'),url = $link.attr('href');- if (self.settings.mobile_show_parent_link && url && url.length > 1) {+ if (settings.mobile_show_parent_link && url && url.length > 1) {var $titleLi = $('<li class="title back js-generated"><h5><a href="#"></a></h5></li><li><a class="parent-link js-generated" href="' + url + '">' + $link.text() +'</a></li>');} else {var $titleLi = $('<li class="title back js-generated"><h5><a href="#"></a></h5></li>');}// Copy link to subnav- if (self.settings.custom_back_text == true) {- $titleLi.find('h5>a').html(self.settings.back_text);+ if (settings.custom_back_text == true) {+ $('h5>a', $titleLi).html(settings.back_text);} else {- $titleLi.find('h5>a').html('« ' + $link.html());+ $('h5>a', $titleLi).html('« ' + $link.html());}$dropdown.prepend($titleLi);});// Put element back in the DOM- this.settings.$section.appendTo(this.settings.$topbar);+ section.appendTo(topbar);// check for stickythis.sticky();++ this.assembled(topbar);+ },++ assembled : function (topbar) {+ topbar.data('topbar-init', $.extend({}, topbar.data('topbar-init'), {assembled: true}));},height : function (ul) {var total = 0,self = this;- ul.find('> li').each(function () { total += self.outerHeight($(this), true); });+ $('> li', ul).each(function () { total += $(this).outerHeight(true); });return total;},@@ -333,17 +343,17 @@var $window = $(window),self = this;- $window.scroll(function() {- self.updateStickyPositioning();+ $(window).on('scroll', function() {+ self.update_sticky_positioning();});},- updateStickyPositioning: function() {- var klass = '.' + this.settings.stickyClass;+ update_sticky_positioning: function() {+ var klass = '.' + this.settings.sticky_class;var $window = $(window);if ($(klass).length > 0) {- var distance = this.settings.$topbar.data('stickyoffset');+ var distance = this.settings.sticky_topbar.data('stickyoffset');if (!$(klass).hasClass('expanded')) {if ($window.scrollTop() > (distance)) {if (!$(klass).hasClass('fixed')) {@@ -367,4 +377,4 @@reflow : function () {}};-}(Foundation.zj, this, this.document));+}(jQuery, this, this.document));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/index.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/index.jsdeleted file mode 100644index c01d9b09ce..0000000000--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/index.js+++ /dev/null@@ -1,18 +0,0 @@-/*-=require foundation/foundation-=require foundation/foundation.alerts-=require foundation/foundation.clearing-=require foundation/foundation.cookie-=require foundation/foundation.dropdown-=require foundation/foundation.forms-=require foundation/foundation.joyride-=require foundation/foundation.magellan-=require foundation/foundation.orbit-=require foundation/foundation.reveal-=require foundation/foundation.section-=require foundation/foundation.tooltips-=require foundation/foundation.topbar-=require foundation/foundation.interchange-=require foundation/foundation.placeholder-=require foundation/foundation.abide-*/\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/jquery.cookie.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/jquery.cookie.jsnew file mode 100644index 0000000000..57473a113b--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/foundation/res/js/jquery.cookie.js@@ -0,0 +1,107 @@+/*!+ * jQuery Cookie Plugin v1.3.1+ * https://github.com/carhartl/jquery-cookie+ *+ * Copyright 2013 Klaus Hartl+ * Released under the MIT license+ */+(function (factory) {+ if (typeof define === 'function' && define.amd) {+ // AMD. Register as anonymous module.+ define(['jquery'], factory);+ } else {+ // Browser globals.+ factory(jQuery);+ }+}(function ($) {++ var pluses = /\+/g;++ function decode(s) {+ if (config.raw) {+ return s;+ }+ try {+ // If we can't decode the cookie, ignore it, it's unusable.+ return decodeURIComponent(s.replace(pluses, ' '));+ } catch(e) {}+ }++ function decodeAndParse(s) {+ if (s.indexOf('"') === 0) {+ // This is a quoted cookie as according to RFC2068, unescape...+ s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');+ }++ s = decode(s);++ try {+ // If we can't parse the cookie, ignore it, it's unusable.+ return config.json ? JSON.parse(s) : s;+ } catch(e) {}+ }++ var config = $.cookie = function (key, value, options) {++ // Write+ if (value !== undefined) {+ options = $.extend({}, config.defaults, options);++ if (typeof options.expires === 'number') {+ var days = options.expires, t = options.expires = new Date();+ t.setDate(t.getDate() + days);+ }++ value = config.json ? JSON.stringify(value) : String(value);++ return (document.cookie = [+ config.raw ? key : encodeURIComponent(key),+ '=',+ config.raw ? value : encodeURIComponent(value),+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE+ options.path ? '; path=' + options.path : '',+ options.domain ? '; domain=' + options.domain : '',+ options.secure ? '; secure' : ''+ ].join(''));+ }++ // Read++ var result = key ? undefined : {};++ // To prevent the for loop in the first place assign an empty array+ // in case there are no cookies at all. Also prevents odd result when+ // calling $.cookie().+ var cookies = document.cookie ? document.cookie.split('; ') : [];++ for (var i = 0, l = cookies.length; i < l; i++) {+ var parts = cookies[i].split('=');+ var name = decode(parts.shift());+ var cookie = parts.join('=');++ if (key && key === name) {+ result = decodeAndParse(cookie);+ break;+ }++ // Prevent storing a cookie that we couldn't decode.+ if (!key && (cookie = decodeAndParse(cookie)) !== undefined) {+ result[name] = cookie;+ }+ }++ return result;+ };++ config.defaults = {};++ $.removeCookie = function (key, options) {+ if ($.cookie(key) !== undefined) {+ // Must not alter options, thus extending a fresh object...+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));+ return true;+ }+ return false;+ };++}));diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/tab/BootstrapTabbedPanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/tab/BootstrapTabbedPanel.javaindex 247449de2c..8ad2d7a7e1 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/component/tab/BootstrapTabbedPanel.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/component/tab/BootstrapTabbedPanel.java@@ -6,6 +6,8 @@ import org.apache.wicket.AttributeModifier;import org.apache.wicket.Component;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.extensions.markup.html.tabs.ITab;+import org.apache.wicket.markup.head.IHeaderResponse;+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;import org.apache.wicket.markup.html.list.Loop;@@ -16,6 +18,8 @@ import org.apache.wicket.model.AbstractReadOnlyModel;import org.apache.wicket.model.IModel;import org.apache.wicket.util.lang.Args;+import com.google.common.base.Strings;+public class BootstrapTabbedPanel<T extends ITab> extends Panel {private static final long serialVersionUID = 1L;@@ -27,8 +31,8 @@ public class BootstrapTabbedPanel<T extends ITab> extends Panel {}@SuppressWarnings("serial")- public BootstrapTabbedPanel(String id, List<T> tabs, IModel<Integer> model) {- super(id, model);+ public BootstrapTabbedPanel(String id, List<T> tabs, IModel<Integer> activeTab) {+ super(id, activeTab);this.tabs = Args.notNull(tabs, "tabs");@@ -98,11 +102,32 @@ public class BootstrapTabbedPanel<T extends ITab> extends Panel {return frag;}+ @Override+ public void renderHead(IHeaderResponse response) {+ super.renderHead(response);++ String onShownScript = getOnShownScript();+ if (!Strings.isNullOrEmpty(onShownScript)) {+ StringBuffer sb = new StringBuffer();+ sb.append("$('#" + getMarkupId(true) + " a[data-toggle=\"tab\"]')")+ .append(".on('shown.bs.tab', ")+ .append(onShownScript)+ .append(")");++ response.render(OnDomReadyHeaderItem.forScript(sb.toString()));+ }++ }++ protected String getOnShownScript() {+ return null;+ }+protected final boolean isTabSelected(int index) {- if (getActiveIndex() == null) {+ if (getActiveTab() == null) {return index == 0;} else {- return index == getActiveIndex();+ return index == getActiveTab();}}@@ -111,7 +136,7 @@ public class BootstrapTabbedPanel<T extends ITab> extends Panel {return tab.getPanel(id);}- Integer getActiveIndex() {+ public Integer getActiveTab() {return (Integer) getDefaultModelObject();}}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/SoyPanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/SoyPanel.javanew file mode 100644index 0000000000..bc4da4b970--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/SoyPanel.java@@ -0,0 +1,68 @@+package com.pmease.gitop.web.common.soy;++import java.util.Map;++import org.apache.wicket.MarkupContainer;+import org.apache.wicket.markup.IMarkupCacheKeyProvider;+import org.apache.wicket.markup.IMarkupResourceStreamProvider;+import org.apache.wicket.markup.html.panel.Panel;+import org.apache.wicket.model.IModel;+import org.apache.wicket.util.resource.IResourceStream;+import org.apache.wicket.util.resource.StringResourceStream;++import com.google.common.collect.Maps;+import com.pmease.gitop.core.Gitop;+import com.pmease.gitop.web.common.soy.api.SoyTemplateRenderer;+import com.pmease.gitop.web.common.soy.api.TemplateKey;++public class SoyPanel extends Panel implements IMarkupResourceStreamProvider,+ IMarkupCacheKeyProvider {++ private static final long serialVersionUID = 1L;++ private final TemplateKey templateKey;++ public SoyPanel(String id, TemplateKey key) {+ this(id, key, null);+ }++ public SoyPanel(String id, TemplateKey key, IModel<Map<String, Object>> data) {+ super(id, data);+ this.templateKey = key;+ }++ @Override+ public IResourceStream getMarkupResourceStream(MarkupContainer container,+ Class<?> containerClass) {+ StringBuffer sb = new StringBuffer();+ sb.append("<wicket:panel>");+ sb.append(evaluateSoyTemplate());+ sb.append("</wicket:panel>");+ return new StringResourceStream(sb.toString());+ }++ @SuppressWarnings("unchecked")+ protected Map<String, ?> getData() {+ if (getDefaultModel() == null) {+ return Maps.newHashMap();+ }++ return (Map<String, ?>) getDefaultModelObject();+ }++ protected Map<String, ?> getIjData() {+ return Maps.newHashMap();+ }++ protected String evaluateSoyTemplate() {+ SoyTemplateRenderer renderer = Gitop.getInstance(SoyTemplateRenderer.class);+ StringBuffer sb = new StringBuffer();+ renderer.render(templateKey, sb, getData(), getIjData());+ return sb.toString();+ }++ @Override+ public String getCacheKey(MarkupContainer container, Class<?> containerClass) {+ return null;+ }+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyDataCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyDataCodec.javanew file mode 100644index 0000000000..6267419205--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyDataCodec.java@@ -0,0 +1,43 @@+package com.pmease.gitop.web.common.soy.api;++import com.google.template.soy.data.SoyData;++/**+ * Encode/decode the data to/from the soy data. The concrete implementations should be thread-safe.+ * The concrete implementation should be registered to guice.+ *+ */+public interface SoyDataCodec<T> {++ /**+ * Encode an object to soy data+ *+ * @param object+ * @return encoded soy data+ */+ SoyData encode(T object);++ /**+ * Decode the soy data to an object+ *+ * @param data+ * @return decoded object+ */+ T decode(SoyData data);++ /**+ * Returns whether this codec can encode the type or not+ *+ * @param type+ * @return+ */+ boolean canEncode(Class<?> type);++ /**+ * Returns whether this codec can decode the type or not+ *+ * @param type+ * @return+ */+ boolean canDecode(Class<? extends SoyData> type);+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyDataMapper.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyDataMapper.javanew file mode 100644index 0000000000..6d3deea626--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyDataMapper.java@@ -0,0 +1,18 @@+package com.pmease.gitop.web.common.soy.api;++import java.lang.annotation.ElementType;+import java.lang.annotation.Retention;+import java.lang.annotation.RetentionPolicy;+import java.lang.annotation.Target;++/**+ * Marks a class as requiring a custom mapper to convert it to SoyData.+ *+ * @since 1.1+ */+@Retention(RetentionPolicy.RUNTIME)+@Target(ElementType.TYPE)+public @interface SoyDataMapper {+ @SuppressWarnings("rawtypes")+ Class<? extends SoyDataCodec> codec();+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyException.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyException.javanew file mode 100644index 0000000000..843cb148f4--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyException.java@@ -0,0 +1,17 @@+package com.pmease.gitop.web.common.soy.api;++public class SoyException extends RuntimeException {+ private static final long serialVersionUID = 1L;++ public SoyException(String message) {+ super(message);+ }++ public SoyException(String message, Throwable e) {+ super(message, e);+ }++ public SoyException(Throwable e) {+ super(e);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyTemplateRenderer.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyTemplateRenderer.javanew file mode 100644index 0000000000..c7c8d3d91c--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/SoyTemplateRenderer.java@@ -0,0 +1,29 @@+package com.pmease.gitop.web.common.soy.api;++import java.util.Map;++/**+ * Render google closure soy template on server side+ */+public interface SoyTemplateRenderer {++ /**+ * Render a single template with the supplied data and injected data to an appendable+ *+ * @param key+ * @param out+ * @param data+ * @param ijData+ */+ void render(TemplateKey key, Appendable out, Map<String, ?> data, Map<String, ?> ijData);++ /**+ * Render a single template with the supplied data to an appendable+ *+ * @param key+ * @param out+ * @param data+ */+ void render(TemplateKey key, Appendable out, Map<String, ?> data);++}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/TemplateKey.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/TemplateKey.javanew file mode 100644index 0000000000..501b7e018e--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/api/TemplateKey.java@@ -0,0 +1,49 @@+package com.pmease.gitop.web.common.soy.api;++import java.io.Serializable;++import com.google.common.base.Objects;++public class TemplateKey implements Serializable {+ private static final long serialVersionUID = 1L;++ private final String namespace;+ private final String templateName;++ TemplateKey(final String namespace, final String templateName) {+ this.namespace = namespace;+ this.templateName = templateName;+ }++ public static TemplateKey of(String namespace, String templateName) {+ return new TemplateKey(namespace, templateName);+ }++ public String getNamespace() {+ return namespace;+ }++ public String getTemplateName() {+ return templateName;+ }++ @Override+ public boolean equals(Object other) {+ if (!(other instanceof TemplateKey)) return false;+ if (this == other) return true;++ TemplateKey rhs = (TemplateKey) other;+ return Objects.equal(this.namespace, rhs.namespace)+ && Objects.equal(this.templateName, rhs.templateName);+ }++ @Override+ public int hashCode() {+ return Objects.hashCode(namespace, templateName);+ }++ @Override+ public String toString() {+ return namespace + "." + templateName;+ }+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/ClasspathFileSetSupplier.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/ClasspathFileSetSupplier.javanew file mode 100644index 0000000000..83761bb5fb--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/ClasspathFileSetSupplier.java@@ -0,0 +1,53 @@+package com.pmease.gitop.web.common.soy.impl;++import java.net.URL;+import java.util.Set;+import java.util.regex.Pattern;++import javax.inject.Inject;+import javax.inject.Named;+import javax.inject.Singleton;++import org.reflections.Reflections;+import org.reflections.scanners.ResourcesScanner;+import org.reflections.util.ClasspathHelper;+import org.reflections.util.ConfigurationBuilder;++import com.google.common.collect.Sets;+import com.google.common.io.Resources;++@Singleton+class ClasspathFileSetSupplier implements SoyFileSetSupplier {++ public static final String CFG_SOY_PACKAGES = "CFG_SOY_PACKAGES";+ private static final String SOY = ".*\\.soy";+ private static final Pattern PATTERN_SOY = Pattern.compile(SOY);++// private final Set<String> packageNames;++ private final Set<String> soyPackages;++ @Inject+ ClasspathFileSetSupplier(@Named(CFG_SOY_PACKAGES) Set<String> soyPackages) {+ this.soyPackages = soyPackages;+ }++ @Override+ public Set<URL> get() {+ ConfigurationBuilder builder = new ConfigurationBuilder();+ for (String each : soyPackages) {+ builder.addUrls(ClasspathHelper.forPackage(each));+ }++ builder.setScanners(new ResourcesScanner());+ Reflections reflections = new Reflections(builder);+ Set<URL> files = Sets.newHashSet();+ Set<String> set = reflections.getResources(PATTERN_SOY);++ for (String each : set) {+ files.add(Resources.getResource(each));+ }++ return files;+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/DefaultSoyDataConverter.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/DefaultSoyDataConverter.javanew file mode 100644index 0000000000..106955f151--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/DefaultSoyDataConverter.java@@ -0,0 +1,32 @@+package com.pmease.gitop.web.common.soy.impl;++import javax.inject.Inject;+import javax.inject.Singleton;++import com.google.template.soy.data.SoyData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;+import com.pmease.gitop.web.common.soy.impl.codec.SoyDataCodecFactory;++@Singleton+class DefaultSoyDataConverter implements SoyDataConverter {++ private final SoyDataCodecFactory codecs;++ @Inject+ DefaultSoyDataConverter(SoyDataCodecFactory codecs) {+ this.codecs = codecs;+ }++ @SuppressWarnings({"rawtypes", "unchecked"})+ @Override+ public SoyData toSoyData(Object obj) {+ SoyDataCodec codec = codecs.getCodec(obj);+ return codec.encode(obj);+ }++ @Override+ public Object fromSoyData(SoyData data) {+ SoyDataCodec<?> codec = codecs.getCodec(data);+ return codec.decode(data);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyDataConverter.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyDataConverter.javanew file mode 100644index 0000000000..27282b6d76--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyDataConverter.java@@ -0,0 +1,11 @@+package com.pmease.gitop.web.common.soy.impl;++import com.google.template.soy.data.SoyData;++public interface SoyDataConverter {++ SoyData toSoyData(Object obj);++ Object fromSoyData(SoyData data);++}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyFileSetSupplier.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyFileSetSupplier.javanew file mode 100644index 0000000000..3553093933--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyFileSetSupplier.java@@ -0,0 +1,10 @@+package com.pmease.gitop.web.common.soy.impl;++import java.net.URL;+import java.util.Set;++public interface SoyFileSetSupplier {++ Set<URL> get();++}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyManager.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyManager.javanew file mode 100644index 0000000000..7c85895ae0--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyManager.java@@ -0,0 +1,189 @@+package com.pmease.gitop.web.common.soy.impl;++import java.net.URL;+import java.util.Collections;+import java.util.Map;+import java.util.Set;++import javax.annotation.Nullable;+import javax.inject.Inject;+import javax.inject.Singleton;++import com.google.common.cache.CacheBuilder;+import com.google.common.cache.CacheLoader;+import com.google.common.cache.LoadingCache;+import com.google.common.collect.ImmutableSortedSet;+import com.google.inject.Injector;+import com.google.inject.Stage;+import com.google.template.soy.SoyFileSet;+import com.google.template.soy.data.SoyMapData;+import com.google.template.soy.msgs.SoyMsgBundle;+import com.google.template.soy.parseinfo.SoyTemplateInfo;+import com.google.template.soy.shared.SoyCssRenamingMap;+import com.google.template.soy.tofu.SoyTofu;+import com.pmease.gitop.web.common.soy.api.SoyTemplateRenderer;+import com.pmease.gitop.web.common.soy.api.TemplateKey;+import com.pmease.gitop.web.util.UrlUtils;++@Singleton+public class SoyManager implements SoyTemplateRenderer {+ private static final SoyTofu DIDNOTCOMPILE = new NullTofu();++ static class TofuInfo {+ final SoyTofu tofu;+ final long lastModified;++ TofuInfo(SoyTofu tofu, long lastModified) {+ this.tofu = tofu;+ this.lastModified = lastModified;+ }+ }++ private final LoadingCache<String, TofuInfo> tofuCache;++ private final Injector injector;+ private final Stage stage;+ private final SoyFileSetSupplier filesets;+ private final SoyDataConverter converter;+ private static final String DEFAULT_TOFU = SoyManager.class.getName() + ".tofu";++ @Inject+ SoyManager(final Injector injector,+ final Stage stage,+ final SoyFileSetSupplier filesets,+ final SoyDataConverter converter) {+ this.injector = injector;+ this.stage = stage;+ this.filesets = filesets;+ this.converter = converter;++ tofuCache = CacheBuilder.newBuilder().build(new CacheLoader<String, TofuInfo>() {++ @Override+ public TofuInfo load(String key) throws Exception {+ SoyFileSet.Builder builder = getSoyFileSetBuilder();+ Set<URL> urls = filesets.get();+ long lastModified = UrlUtils.getLastModified(urls);+ for (URL each : urls) {+ builder.add(each);+ }++ SoyTofu tofu = builder.build().compileToTofu();+ if (tofu != null) {+ return new TofuInfo(tofu, lastModified);+ } else {+ return new TofuInfo(DIDNOTCOMPILE, -1);+ }+ }+ });+ }++ private SoyFileSet.Builder getSoyFileSetBuilder() {+ return injector.getInstance(SoyFileSet.Builder.class);+ }++ private SoyTofu.Renderer getRenderer(TemplateKey key) {+ if (isDev()) {+ updateTofuCache(DEFAULT_TOFU);+ }++ SoyTofu tofu = tofuCache.getUnchecked(DEFAULT_TOFU).tofu;+ if (tofu == null) {+ tofu = DIDNOTCOMPILE;+ }++ return tofu.newRenderer(key.toString());+ }++ private void updateTofuCache(String key) {+ Set<URL> urls = filesets.get();+ long lastModified = UrlUtils.getLastModified(urls);+ TofuInfo info = tofuCache.getUnchecked(key);+ if (info.lastModified < lastModified || lastModified <= 0) {+ tofuCache.invalidate(key);+ }+ }++ private boolean isDev() {+ return stage == Stage.DEVELOPMENT;+ }++ @Override+ public void render(TemplateKey key, Appendable out, Map<String, ?> data, Map<String, ?> ijData) {+ SoyTofu.Renderer renderer = getRenderer(key);+ renderer.setData((SoyMapData) converter.toSoyData(data))+ .setIjData((SoyMapData) converter.toSoyData(ijData))+ .render(out);+ }++ @Override+ public void render(TemplateKey key, Appendable out, Map<String, ?> data) {+ render(key, out, data, Collections.<String, Object>emptyMap());+ }++ /*+ * Placeholder SoyTofu implementation to go into ConcurrentMap that can't take null.+ */+ private static class NullTofu implements SoyTofu {+ @Override+ public String getNamespace() {+ return null;+ }++ @Override+ public SoyTofu forNamespace(String namespace) {+ return null;+ }++ @Override+ public String render(SoyTemplateInfo templateInfo, Map<String, ?> data, SoyMsgBundle msgBundle) {+ return null;+ }++ @Override+ public String render(SoyTemplateInfo templateInfo, SoyMapData data, SoyMsgBundle msgBundle) {+ return null;+ }++ @Override+ public String render(String templateName, Map<String, ?> data, SoyMsgBundle msgBundle) {+ return null;+ }++ @Override+ public String render(String templateName, SoyMapData data, SoyMsgBundle msgBundle) {+ return null;+ }++ @Override+ public boolean isCaching() {+ return false;+ }++ @Override+ public Renderer newRenderer(SoyTemplateInfo soyTemplateInfo) {+ return null;+ }++ @Override+ public Renderer newRenderer(String s) {+ return null;+ }++ @Override+ public void addToCache(@Nullable SoyMsgBundle msgBundle,+ @Nullable SoyCssRenamingMap cssRenamingMap) {++ }++ @Override+ public ImmutableSortedSet<String> getUsedIjParamsForTemplate(SoyTemplateInfo templateInfo) {+ return null;+ }++ @Override+ public ImmutableSortedSet<String> getUsedIjParamsForTemplate(String templateName) {+ return null;+ }+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyTemplateModule.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyTemplateModule.javanew file mode 100644index 0000000000..a808f55cfc--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/SoyTemplateModule.java@@ -0,0 +1,42 @@+package com.pmease.gitop.web.common.soy.impl;++import java.util.Set;++import javax.inject.Singleton;++import com.google.common.collect.ImmutableSet;+import com.google.inject.AbstractModule;+import com.google.inject.Key;+import com.google.inject.TypeLiteral;+import com.google.inject.name.Names;+import com.google.template.soy.SoyModule;+import com.google.template.soy.xliffmsgplugin.XliffMsgPluginModule;+import com.pmease.gitop.web.common.soy.api.SoyTemplateRenderer;+import com.pmease.gitop.web.common.soy.impl.codec.SoyDataCodecModule;+import com.pmease.gitop.web.common.soy.impl.functions.SoyFunctionsModule;++public class SoyTemplateModule extends AbstractModule {++ private final Set<String> autoConfigPackages;++ public SoyTemplateModule(Set<String> autoConfigPackages) {+ this.autoConfigPackages = ImmutableSet.<String>copyOf(autoConfigPackages);+ }++ @Override+ protected void configure() {+ install(new SoyModule());+ install(new XliffMsgPluginModule());++ install(new SoyDataCodecModule());+ install(new SoyFunctionsModule());++ bind(Key.get(new TypeLiteral<Set<String>>() {}, Names.named("CFG_SOY_PACKAGES")))+ .toInstance(autoConfigPackages);++ bind(SoyFileSetSupplier.class).to(ClasspathFileSetSupplier.class);+ bind(SoyTemplateRenderer.class).to(SoyManager.class).in(Singleton.class);+ bind(SoyDataConverter.class).to(DefaultSoyDataConverter.class).in(Singleton.class);+ }++}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/ArrayCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/ArrayCodec.javanew file mode 100644index 0000000000..105f5618e6--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/ArrayCodec.java@@ -0,0 +1,49 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import java.util.List;++import javax.inject.Inject;++import com.google.common.collect.Lists;+import com.google.inject.Injector;+import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.SoyListData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;++public class ArrayCodec implements SoyDataCodec<Object> {++ final Injector injector;++ @Inject+ ArrayCodec(Injector injector) {+ this.injector = injector;+ }++ @Override+ public SoyData encode(Object object) {+ List<Object> list = Lists.newArrayList((Object[]) object);++ return injector.getInstance(ListCodec.class).encode(list);+ }++ @SuppressWarnings("unchecked")+ @Override+ public Object decode(SoyData data) {+ if (data instanceof SoyListData) {+ List<Object> objects = (List<Object>) injector.getInstance(ListCodec.class).decode(data);+ return objects.toArray(new Object[objects.size()]);+ }++ throw new UnsupportedOperationException("from [" + data + "] to array");+ }++ @Override+ public boolean canEncode(Class<?> clazz) {+ return clazz.isArray();+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return false;+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/BasicTypeCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/BasicTypeCodec.javanew file mode 100644index 0000000000..d2dfeb6174--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/BasicTypeCodec.java@@ -0,0 +1,26 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;+import com.pmease.gitop.web.util.Classes;+import com.pmease.gitop.web.util.Generics;++abstract class BasicTypeCodec<T> implements SoyDataCodec<T> {++ final Class<T> clazz;++ @SuppressWarnings("unchecked")+ BasicTypeCodec() {+ clazz = (Class<T>) Generics.getTypeParameter(getClass());+ }++ @Override+ public SoyData encode(T object) {+ return SoyData.createFromExistingData(object);+ }++ @Override+ public boolean canEncode(Class<?> kls) {+ return Classes.isAssignableFrom(clazz, kls);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/BooleanCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/BooleanCodec.javanew file mode 100644index 0000000000..9634cddaba--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/BooleanCodec.java@@ -0,0 +1,24 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.restricted.BooleanData;+import com.pmease.gitop.web.util.Classes;++class BooleanCodec extends BasicTypeCodec<Boolean> {++ @Override+ public Boolean decode(SoyData data) {+ return data.booleanValue();+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(BooleanData.class, type);+ }++// @Override+// public boolean canHandle(Class<?> clazz) {+// return Classes.isAssignableFrom(Boolean.class, clazz);+// }++}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/DefaultSoyDataCodecFactory.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/DefaultSoyDataCodecFactory.javanew file mode 100644index 0000000000..1c4396bbca--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/DefaultSoyDataCodecFactory.java@@ -0,0 +1,88 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import java.util.Set;++import javax.inject.Inject;+import javax.inject.Singleton;++import com.google.inject.Injector;+import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.SoyListData;+import com.google.template.soy.data.SoyMapData;+import com.google.template.soy.data.restricted.BooleanData;+import com.google.template.soy.data.restricted.FloatData;+import com.google.template.soy.data.restricted.IntegerData;+import com.google.template.soy.data.restricted.NullData;+import com.google.template.soy.data.restricted.StringData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;+import com.pmease.gitop.web.common.soy.api.SoyDataMapper;++@Singleton+@SuppressWarnings("rawtypes")+class DefaultSoyDataCodecFactory implements SoyDataCodecFactory {+ final Set<SoyDataCodec> codecs;+ final Injector injector;++ @Inject+ DefaultSoyDataCodecFactory(Injector injector, Set<SoyDataCodec> codecs) {+ this.codecs = codecs;+ this.injector = injector;+ }++ @Override+ public SoyDataCodec<?> getCodec(Object obj) {+ if (obj == null) {+ return injector.getInstance(NullValueCodec.class);+ }++ return getCodec(obj.getClass());+ }++ @Override+ @SuppressWarnings("unchecked")+ public SoyDataCodec<?> getCodec(Class<?> clazz) {+ for (SoyDataCodec each : codecs) {+ if (each.canEncode(clazz)) {+ return each;+ }+ }++ if (clazz.isAnnotationPresent(SoyDataMapper.class)) {+ SoyDataMapper mapper = clazz.getAnnotation(SoyDataMapper.class);+ return injector.getInstance(mapper.codec());+ }++ return getLazyObjectCodec();+ }++ private SoyDataCodec getLazyObjectCodec() {+ return injector.getInstance(PojoCodec.class);+ }++ @Override+ public SoyDataCodec<?> getCodec(SoyData data) {+ if (data == null || data == NullData.INSTANCE) {+ return injector.getInstance(NullValueCodec.class);+ }++ if (data instanceof LazySoyMapData) {+ return getLazyObjectCodec();+ } else if (data instanceof SoyMapData) {+ return injector.getInstance(MapCodec.class);+ } else if (data instanceof SoyListData) {+ return injector.getInstance(ListCodec.class);+ } else if (data instanceof EnumData) {+ return injector.getInstance(EnumCodec.class);+ } else if (data instanceof StringData) {+ return injector.getInstance(StringCodec.class);+ } else if (data instanceof BooleanData) {+ return injector.getInstance(BooleanCodec.class);+ } else if (data instanceof IntegerData) {+ return injector.getInstance(IntegerCodec.class);+ } else if (data instanceof FloatData) {+ return injector.getInstance(DoubleCodec.class);+ } else {+ throw new UnsupportedOperationException("Unknown soy data [" + data + "]");+ }+ }+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/DoubleCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/DoubleCodec.javanew file mode 100644index 0000000000..4ecdc56a15--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/DoubleCodec.java@@ -0,0 +1,18 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.restricted.FloatData;+import com.pmease.gitop.web.util.Classes;++class DoubleCodec extends BasicTypeCodec<Double> {++ @Override+ public Double decode(SoyData data) {+ return data.floatValue();+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(FloatData.class, type);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/EnumCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/EnumCodec.javanew file mode 100644index 0000000000..49868f526d--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/EnumCodec.java@@ -0,0 +1,34 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;+import com.pmease.gitop.web.util.Classes;++@SuppressWarnings("rawtypes")+class EnumCodec implements SoyDataCodec<Enum>{++ @Override+ public SoyData encode(Enum object) {+ return new EnumData(object);+ }++ @Override+ public Enum decode(SoyData data) {+ if (data instanceof EnumData) {+ return ((EnumData) data).getValue();+ }++ throw new UnsupportedOperationException("Unable to convert soydata [" + data + "] to enum");+ }++ @Override+ public boolean canEncode(Class<?> clazz) {+ return clazz.isEnum() || Enum.class.isAssignableFrom(clazz);+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(EnumData.class, type);+ }++}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/EnumData.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/EnumData.javanew file mode 100644index 0000000000..aaba1dc9d3--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/EnumData.java@@ -0,0 +1,34 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.restricted.StringData;++class EnumData extends SoyData {++ private final Enum<?> value;++ public EnumData(Enum<?> value) {+ this.value = value;+ }++ public Enum<?> getValue() {+ return value;+ }++ @Override+ public String toString() {+ return value.name();+ }++ @Override+ public boolean toBoolean() {+ return true;+ }++ @Override+ public boolean equals(Object other) {+ return this == other+ || (other instanceof EnumData && ((EnumData) other).getValue() == value)+ || (other instanceof StringData && value.name().equals(((StringData) other).getValue()));+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/FloatCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/FloatCodec.javanew file mode 100644index 0000000000..0cfe8e7213--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/FloatCodec.java@@ -0,0 +1,18 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.restricted.FloatData;+import com.pmease.gitop.web.util.Classes;++class FloatCodec extends BasicTypeCodec<Float> {++ @Override+ public Float decode(SoyData data) {+ return new Float(data.floatValue());+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(FloatData.class, type);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/IntegerCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/IntegerCodec.javanew file mode 100644index 0000000000..1fe922fa03--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/IntegerCodec.java@@ -0,0 +1,18 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.restricted.IntegerData;+import com.pmease.gitop.web.util.Classes;++public class IntegerCodec extends BasicTypeCodec<Integer> {++ @Override+ public Integer decode(SoyData data) {+ return data.integerValue();+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(IntegerData.class, type);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LazyReference.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LazyReference.javanew file mode 100644index 0000000000..0ce6de72ba--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LazyReference.java@@ -0,0 +1,305 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import java.io.Serializable;+import java.lang.ref.Reference;+import java.lang.ref.WeakReference;+import java.util.concurrent.CancellationException;+import java.util.concurrent.ExecutionException;+import java.util.concurrent.locks.AbstractQueuedSynchronizer;++/**+ * Lazily loaded reference that is not constructed until required. This class is used to maintain a+ * reference to an object that is expensive to create and must be constructed once and once only.+ * This reference behaves as though the <code>final</code> keyword has been used (you cannot reset+ * it once it has been constructed). Object creation is guaranteed to be thread-safe and the first+ * thread that calls {@link #get()} will be the one that creates it.+ * <p>+ * Usage: clients need to implement the {@link #create()} method to return the object this reference+ * will hold.+ * <p>+ * For instance:+ * <p>+ *+ * <pre>+ * final LazyReference<MyObject> ref = new LazyReference() {+ * protected MyObject create() throws Exception {+ * // Do expensive object construction here+ * return new MyObject();+ * }+ * };+ * </pre>+ *+ * Then call {@link #get()} to get a reference to the referenced object:+ *+ * <pre>+ * MyObject myLazyLoadedObject = ref.get()+ * </pre>+ *+ * NOTE: Interruption policy is that if you want to be cancellable while waiting for another thread+ * to create the value, instead of calling {@link #get()} call {@link #getInterruptibly()}. However,+ * If your {@link #create()} method is interrupted and throws an {@link InterruptedException}, it is+ * treated as an application exception and will be the causal exception inside the runtime+ * {@link InitializationException} that {@link #get()} or {@link #getInterruptibly()} throws and+ * your {@link #create()} will not be called again.+ * <p>+ * This class is NOT {@link Serializable}.+ * <p>+ * Implementation note. This class extends {@link WeakReference} as {@link Reference} does not have+ * a public constructor. WeakReference is preferable as it does not have any members and therefore+ * doesn't increase the memory footprint. As we never pass a referent through to the super-class and+ * override {@link #get()}, the garbage collection semantics of WeakReference are irrelevant. The+ * referenced object will not become eligible for GC unless the object holding the reference to this+ * object is collectible.+ *+ * @param T the type of the contained element.+ */+public abstract class LazyReference<T> extends WeakReference<T>+ implements+ com.google.common.base.Supplier<T> {++ private final Sync sync = new Sync();++ public LazyReference() {+ super(null);+ }++ /**+ * The object factory method, guaranteed to be called once and only once.+ *+ * @return the object that {@link #get()} and {@link #getInterruptibly()} will return.+ * @throws Exception if anything goes wrong, rethrown as an InitializationException from+ * {@link #get()} and {@link #getInterruptibly()}+ */+ protected abstract T create() throws Exception;++ /**+ * Get the lazily loaded reference in a non-cancellable manner. If your <code>create()</code>+ * method throws an Exception calls to <code>get()</code> will throw an InitializationException+ * which wraps the previously thrown exception.+ *+ * @return the object that {@link #create()} created.+ * @throws InitializationException if the {@link #create()} method throws an exception. The+ * {@link InitializationException#getCause()} will contain the exception thrown by the+ * {@link #create()} method+ */+ @Override+ public final T get() {+ boolean interrupted = false;+ try {+ while (true) {+ try {+ return getInterruptibly();+ } catch (final InterruptedException ignore) {+ // ignore and try again+ interrupted = true;+ }+ }+ } finally {+ if (interrupted) {+ Thread.currentThread().interrupt();+ }+ }+ }++ /**+ * Get the lazily loaded reference in a cancellable manner. If your <code>create()</code> method+ * throws an Exception, calls to <code>get()</code> will throw a RuntimeException which wraps the+ * previously thrown exception.+ *+ * @return the object that {@link #create()} created.+ * @throws InitializationException if the {@link #create()} method throws an exception. The+ * {@link InitializationException#getCause()} will contain the exception thrown by the+ * {@link #create()} method+ * @throws InterruptedException If the calling thread is Interrupted while waiting for another+ * thread to create the value (if the creating thread is interrupted while blocking on+ * something, the {@link InterruptedException} will be thrown as the causal exception of+ * the {@link InitializationException} to everybody calling this method).+ */+ public final T getInterruptibly() throws InterruptedException {+ if (!sync.isDone()) {+ sync.run();+ }++ try {+ return sync.get();+ } catch (final ExecutionException e) {+ throw new InitializationException(e);+ }+ }++ /**+ * Has the {@link #create()} reference been initialized.+ *+ * @return true if the task is complete+ */+ public boolean isInitialized() {+ return sync.isDone();+ }++ /**+ * Cancel the initializing operation if it has not already run. Will try and interrupt if it is+ * currently running.+ */+ public void cancel() {+ sync.cancel(true);+ }++ /**+ * If the factory {@link LazyReference#create()} method threw an exception, this wraps it.+ */+ public static class InitializationException extends RuntimeException {+ private static final long serialVersionUID = 3638376010285456759L;++ InitializationException(final ExecutionException e) {+ super((e.getCause() != null) ? e.getCause() : e);+ }+ }++ /**+ * Synchronization control for LazyReference. Note that this must be a non-static inner class in+ * order to invoke the protected <tt>create</tt> method. Taken from FutureTask AQS implementation+ * and pruned to be as compact as possible.+ *+ * Uses AQS sync state to represent run status.+ */+ private final class Sync extends AbstractQueuedSynchronizer {++ /**+ * only here to shut up the compiler warnings, the outer class is NOT serializable+ */+ private static final long serialVersionUID = -1645412544240373524L;++ /** State value representing that task is running */+ private static final int RUNNING = 1;+ /** State value representing that task ran */+ private static final int RAN = 2;+ /** State value representing that task was cancelled */+ private static final int CANCELLED = 4;++ /** The result to return from get() */+ private T result;+ /** The exception to throw from get() */+ private Throwable exception;++ /**+ * The thread running task. When nulled after set/cancel, this indicates that the results are+ * accessible. Must be volatile, to ensure visibility upon completion.+ */+ private volatile Thread runner;++ private boolean ranOrCancelled(final int state) {+ return (state & (RAN | CANCELLED)) != 0;+ }++ /**+ * Implements AQS base acquire to succeed if ran or cancelled+ */+ @Override+ protected int tryAcquireShared(final int ignore) {+ return isDone() ? 1 : -1;+ }++ /**+ * Implements AQS base release to always signal after setting final done status by nulling+ * runner thread.+ */+ @Override+ protected boolean tryReleaseShared(final int ignore) {+ runner = null;+ return true;+ }++ boolean isDone() {+ return ranOrCancelled(getState()) && (runner == null);+ }++ T get() throws InterruptedException, ExecutionException {+ acquireSharedInterruptibly(0);+ if (getState() == CANCELLED) {+ throw new CancellationException();+ }+ if (exception != null) {+ throw new ExecutionException(exception);+ }+ return result;+ }++ void set(final T v) {+ for (;;) {+ final int s = getState();+ if (s == RAN) {+ return;+ }+ if (s == CANCELLED) {+ // aggressively release to set runner to null,+ // in case we are racing with a cancel request+ // that will try to interrupt runner+ releaseShared(0);+ return;+ }+ if (compareAndSetState(s, RAN)) {+ result = v;+ releaseShared(0);+ return;+ }+ }+ }++ void setException(final Throwable t) {+ for (;;) {+ final int s = getState();+ if (s == RAN) {+ return;+ }+ if (s == CANCELLED) {+ // aggressively release to set runner to null,+ // in case we are racing with a cancel request+ // that will try to interrupt runner+ releaseShared(0);+ return;+ }+ if (compareAndSetState(s, RAN)) {+ exception = t;+ result = null;+ releaseShared(0);+ return;+ }+ }+ }++ void cancel(final boolean mayInterruptIfRunning) {+ for (;;) {+ final int s = getState();+ if (ranOrCancelled(s)) {+ return;+ }+ if (compareAndSetState(s, CANCELLED)) {+ break;+ }+ }+ if (mayInterruptIfRunning) {+ final Thread r = runner;+ if (r != null) {+ r.interrupt();+ }+ }+ releaseShared(0);+ }++ void run() {+ if (!compareAndSetState(0, RUNNING)) {+ return;+ }+ try {+ runner = Thread.currentThread();+ if (getState() == RUNNING) {+ set(create());+ } else {+ releaseShared(0); // cancel+ }+ } catch (final Throwable ex) {+ setException(ex);+ }+ }+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LazySoyMapData.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LazySoyMapData.javanew file mode 100644index 0000000000..69f8914bd1--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LazySoyMapData.java@@ -0,0 +1,66 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import java.lang.reflect.InvocationTargetException;+import java.util.concurrent.Callable;++import org.apache.commons.beanutils.PropertyUtils;++import com.google.common.cache.CacheBuilder;+import com.google.common.cache.CacheLoader;+import com.google.common.cache.LoadingCache;+import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.SoyMapData;+import com.google.template.soy.data.restricted.NullData;+import com.pmease.gitop.web.common.soy.impl.SoyDataConverter;++class LazySoyMapData extends SoyMapData {+ private final LoadingCache<String, SoyData> cache;+ private final LazyReference<Object> delegate;++ public LazySoyMapData(final Callable<?> objectSource, final SoyDataConverter soyDataConverter) {+ super();+ cache = CacheBuilder.newBuilder().build(new CacheLoader<String, SoyData>() {+ @Override+ public SoyData load(final String from) {+ Object value;+ try {+ value = "class".equals(from) ? null : PropertyUtils.getProperty(delegate.get(), from);+ } catch (IllegalAccessException e) {+ throw new RuntimeException(e);+ } catch (InvocationTargetException e) {+ throw new RuntimeException(e);+ } catch (NoSuchMethodException e) {+ value = null;+ }+ return soyDataConverter.toSoyData(value);+ }+ });++ this.delegate = new LazyReference<Object>() {+ @Override+ protected Object create() throws Exception {+ return objectSource.call();+ }+ };+ }++ public Object getDelegate() {+ return delegate.get();+ }++ @Override+ public SoyData getSingle(String key) {+ SoyData soyData = super.getSingle(key);+ if (soyData != null && soyData != NullData.INSTANCE) {+ return soyData;+ } else {+ return cache.getUnchecked(key);+ }+ }++ @Override+ public String toString() {+ return getDelegate().toString();+ }++}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/ListCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/ListCodec.javanew file mode 100644index 0000000000..1b341a222a--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/ListCodec.java@@ -0,0 +1,57 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import javax.inject.Inject;++import com.google.common.base.Function;+import com.google.common.collect.Lists;+import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.SoyListData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;+import com.pmease.gitop.web.util.Classes;++@SuppressWarnings("rawtypes")+public class ListCodec implements SoyDataCodec<Iterable> {++ final SoyDataCodecFactory codecs;++ @Inject+ ListCodec(SoyDataCodecFactory codecs) {+ this.codecs = codecs;+ }++ @SuppressWarnings("unchecked")+ @Override+ public SoyData encode(Iterable list) {+ SoyListData listData = new SoyListData();+ for (Object o : list) {+ SoyDataCodec codec = codecs.getCodec(o);+ listData.add(codec.encode(o));+ }++ return listData;+ }++ @Override+ public Iterable decode(SoyData data) {+ if (data instanceof SoyListData) {+ return Lists.transform(((SoyListData) data).asList(), new Function<SoyData, Object>() {+ @Override+ public Object apply(SoyData from) {+ return codecs.getCodec(from).decode(from);+ }+ });+ }++ throw new UnsupportedOperationException("from [" + data + "] to list");+ }++ @Override+ public boolean canEncode(Class<?> clazz) {+ return Classes.isAssignableFrom(Iterable.class, clazz);+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(SoyListData.class, type);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LongCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LongCodec.javanew file mode 100644index 0000000000..05db788e63--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/LongCodec.java@@ -0,0 +1,32 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;+import com.pmease.gitop.web.util.Classes;++class LongCodec implements SoyDataCodec<Long> {++ @Override+ public SoyData encode(Long object) {+ if (object >= Integer.MIN_VALUE && object <= Integer.MAX_VALUE) {+ return SoyData.createFromExistingData(object.intValue());+ } else {+ return SoyData.createFromExistingData(object.doubleValue());+ }+ }++ @Override+ public Long decode(SoyData data) {+ return ((Number) data.numberValue()).longValue();+ }++ @Override+ public boolean canEncode(Class<?> clazz) {+ return Classes.isAssignableFrom(Long.class, clazz);+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return false;+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/MapCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/MapCodec.javanew file mode 100644index 0000000000..94c2f817be--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/MapCodec.java@@ -0,0 +1,64 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import java.util.Map;++import javax.inject.Inject;++import com.google.common.base.Function;+import com.google.common.collect.Maps;+import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.SoyMapData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;+import com.pmease.gitop.web.util.Classes;++@SuppressWarnings("rawtypes")+class MapCodec implements SoyDataCodec<Map>{++ final SoyDataCodecFactory codecs;++ @Inject+ MapCodec(SoyDataCodecFactory codecs) {+ this.codecs = codecs;+ }++ @SuppressWarnings("unchecked")+ @Override+ public SoyData encode(Map map) {+ SoyMapData soyMapData = new SoyMapData();+ for (Object obj : map.entrySet()) {+ Map.Entry entry = (Map.Entry) obj;+ String key = entry.getKey().toString();+ Object value = entry.getValue();+ SoyDataCodec codec = codecs.getCodec(value);+ SoyData soyValue = codec.encode(value);+ soyMapData.put(key, soyValue);+ }++ return soyMapData;+ }++ @Override+ public Map decode(SoyData data) {+ if (data instanceof SoyMapData) {+ return Maps.transformValues(((SoyMapData) data).asMap(), new Function<SoyData, Object>() {++ @Override+ public Object apply(SoyData input) {+ return codecs.getCodec(input).decode(input);+ }+ });+ }++ throw new UnsupportedOperationException("from data [" + data + "] to map");+ }++ @Override+ public boolean canEncode(Class<?> clazz) {+ return Classes.isAssignableFrom(Map.class, clazz);+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(SoyMapData.class, type);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/NullValueCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/NullValueCodec.javanew file mode 100644index 0000000000..e013b8986f--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/NullValueCodec.java@@ -0,0 +1,22 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;++class NullValueCodec extends BasicTypeCodec<Object> {++ @Override+ public Object decode(SoyData data) {+ return null;+ }++ @Override+ public boolean canEncode(Class<?> clazz) {+ return false;+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return false;+ }++}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/PojoCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/PojoCodec.javanew file mode 100644index 0000000000..709e5cfd8c--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/PojoCodec.java@@ -0,0 +1,55 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import java.util.concurrent.Callable;++import javax.inject.Inject;++import com.google.common.util.concurrent.Callables;+import com.google.template.soy.data.SoyData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;+import com.pmease.gitop.web.common.soy.impl.SoyDataConverter;+import com.pmease.gitop.web.util.Classes;++public class PojoCodec implements SoyDataCodec<Object> {++ final SoyDataConverter convert;++ @Inject+ PojoCodec(SoyDataConverter convert) {+ this.convert = convert;+ }++ @Override+ public SoyData encode(Object object) {+ return new LazySoyMapData(makeCallable(object), convert);+ }++ private Callable<?> makeCallable(final Object value) {+ if (value instanceof Callable) {+ return (Callable<?>) value;+ }++ return Callables.returning(value);+ }++ @Override+ public Object decode(SoyData data) {+ if (data instanceof LazySoyMapData) {+ return ((LazySoyMapData) data).getDelegate();+ }++ throw new UnsupportedOperationException("from [" + data + "] to object");+ }++ @Override+ public boolean canEncode(Class<?> clazz) {+ // Always return false, we'll handle pojo case manually, see+ // {@class DefaultSoyDataCodecFactory}+ return false;+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(LazySoyMapData.class, type);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/SoyDataCodecFactory.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/SoyDataCodecFactory.javanew file mode 100644index 0000000000..88d745f95e--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/SoyDataCodecFactory.java@@ -0,0 +1,10 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;++public interface SoyDataCodecFactory {+ SoyDataCodec<?> getCodec(Object obj);+ SoyDataCodec<?> getCodec(Class<?> clazz);+ SoyDataCodec<?> getCodec(SoyData data);+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/SoyDataCodecModule.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/SoyDataCodecModule.javanew file mode 100644index 0000000000..0ce7d41a6c--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/SoyDataCodecModule.java@@ -0,0 +1,34 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import javax.inject.Singleton;++import com.google.inject.AbstractModule;+import com.google.inject.Binder;+import com.google.inject.multibindings.Multibinder;+import com.pmease.gitop.web.common.soy.api.SoyDataCodec;++public class SoyDataCodecModule extends AbstractModule {+ @Override+ protected void configure() {+ bind(SoyDataCodecFactory.class).to(DefaultSoyDataCodecFactory.class);++ requireBinding(SoyDataCodecFactory.class);+ register(binder(), BooleanCodec.class);+ register(binder(), DoubleCodec.class);+ register(binder(), EnumCodec.class);+ register(binder(), FloatCodec.class);+ register(binder(), IntegerCodec.class);+ register(binder(), ListCodec.class);+ register(binder(), ArrayCodec.class);+ register(binder(), PojoCodec.class);+ register(binder(), LongCodec.class);+ register(binder(), MapCodec.class);+ register(binder(), NullValueCodec.class);+ register(binder(), StringCodec.class);+ }++ public static void register(Binder binder, Class<? extends SoyDataCodec<?>> codecClass) {+ Multibinder.newSetBinder(binder, SoyDataCodec.class)+ .addBinding().to(codecClass).in(Singleton.class);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/StringCodec.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/StringCodec.javanew file mode 100644index 0000000000..df02c72e34--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/codec/StringCodec.java@@ -0,0 +1,18 @@+package com.pmease.gitop.web.common.soy.impl.codec;++import com.google.template.soy.data.SoyData;+import com.google.template.soy.data.restricted.StringData;+import com.pmease.gitop.web.util.Classes;++class StringCodec extends BasicTypeCodec<String> {++ @Override+ public String decode(SoyData data) {+ return data.stringValue();+ }++ @Override+ public boolean canDecode(Class<? extends SoyData> type) {+ return Classes.isAssignableFrom(StringData.class, type);+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/functions/SoyFunctionsModule.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/functions/SoyFunctionsModule.javanew file mode 100644index 0000000000..ec9dd67af3--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/functions/SoyFunctionsModule.java@@ -0,0 +1,17 @@+package com.pmease.gitop.web.common.soy.impl.functions;++import com.google.inject.AbstractModule;+import com.google.inject.multibindings.Multibinder;+import com.google.template.soy.shared.restricted.SoyFunction;++public class SoyFunctionsModule extends AbstractModule {++ @Override+ protected void configure() {+ Multibinder<SoyFunction> soyFunctionsSetBinder =+ Multibinder.newSetBinder(binder(), SoyFunction.class);++ soyFunctionsSetBinder.addBinding().to(ToLowercaseFunction.class);+ }++}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/functions/ToLowercaseFunction.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/functions/ToLowercaseFunction.javanew file mode 100644index 0000000000..ac6326b4cb--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/soy/impl/functions/ToLowercaseFunction.java@@ -0,0 +1,50 @@+package com.pmease.gitop.web.common.soy.impl.functions;++import static com.google.template.soy.shared.restricted.SoyJavaRuntimeFunctionUtils.toSoyData;++import java.util.List;+import java.util.Set;++import com.google.common.collect.ImmutableSet;+import com.google.inject.Singleton;+import com.google.template.soy.data.SoyData;+import com.google.template.soy.javasrc.restricted.JavaExpr;+import com.google.template.soy.javasrc.restricted.SoyJavaSrcFunction;+import com.google.template.soy.jssrc.restricted.JsExpr;+import com.google.template.soy.jssrc.restricted.SoyJsSrcFunction;+import com.google.template.soy.shared.restricted.SoyPureFunction;+import com.google.template.soy.tofu.restricted.SoyAbstractTofuFunction;++@Singleton+@SoyPureFunction+class ToLowercaseFunction extends SoyAbstractTofuFunction+ implements SoyJsSrcFunction, SoyJavaSrcFunction {++ @Override+ public String getName() {+ return "toLowercase";+ }++ @Override+ public Set<Integer> getValidArgsSizes() {+ return ImmutableSet.of(1);+ }++ @Override+ public SoyData compute(List<SoyData> args) {+ SoyData arg = args.get(0);++ String s = arg.stringValue();+ return toSoyData(s.toLowerCase());+ }++ @Override+ public JavaExpr computeForJavaSrc(List<JavaExpr> args) {+ throw new UnsupportedOperationException();+ }++ @Override+ public JsExpr computeForJsSrc(List<JsExpr> args) {+ throw new UnsupportedOperationException();+ }+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/link/CommitUserLink.html b/gitop.web/src/main/java/com/pmease/gitop/web/component/link/CommitUserLink.htmlnew file mode 100644index 0000000000..121a08b50d--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/link/CommitUserLink.html@@ -0,0 +1,5 @@+<html xmlns:wicket>+<wicket:panel>+ <span wicket:id="link"></span>+</wicket:panel>+</html>\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/link/CommitUserLink.java b/gitop.web/src/main/java/com/pmease/gitop/web/component/link/CommitUserLink.javanew file mode 100644index 0000000000..04f690f245--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/link/CommitUserLink.java@@ -0,0 +1,34 @@+package com.pmease.gitop.web.component.link;++import org.apache.wicket.markup.html.basic.Label;+import org.apache.wicket.markup.html.panel.Panel;+import org.apache.wicket.model.IModel;++import com.pmease.gitop.core.Gitop;+import com.pmease.gitop.core.manager.UserManager;+import com.pmease.gitop.core.model.User;+import com.pmease.gitop.web.model.UserModel;++public class CommitUserLink extends Panel {+ private static final long serialVersionUID = 1L;++ public CommitUserLink(String id, IModel<String> name) {+ super(id, name);+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ User user = Gitop.getInstance(UserManager.class).find(getName());+ if (user != null) {+ add(new UserAvatarLink("link", new UserModel(user)));+ } else {+ add(new Label("link", getDefaultModel()).setEscapeModelStrings(true));+ }+ }++ private String getName() {+ return (String) getDefaultModelObject();+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/ProjectCategoryPage.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/ProjectCategoryPage.javaindex c7de92950c..33c8727091 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/ProjectCategoryPage.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/ProjectCategoryPage.java@@ -26,10 +26,10 @@ import com.pmease.gitop.web.page.project.api.ProjectTabContribution;import com.pmease.gitop.web.page.project.api.ProjectTabGroup;import com.pmease.gitop.web.page.project.issue.ProjectPullRequestsPage;import com.pmease.gitop.web.page.project.settings.ProjectOptionsPage;-import com.pmease.gitop.web.page.project.source.ProjectHomePage;import com.pmease.gitop.web.page.project.source.BranchesPage;import com.pmease.gitop.web.page.project.source.CommitsPage;import com.pmease.gitop.web.page.project.source.ContributorsPage;+import com.pmease.gitop.web.page.project.source.ProjectHomePage;import com.pmease.gitop.web.page.project.source.TagsPage;import com.pmease.gitop.web.page.project.stats.ProjectForksPage;import com.pmease.gitop.web.page.project.stats.ProjectGraphsPage;@@ -59,7 +59,7 @@ public abstract class ProjectCategoryPage extends AbstractProjectPage {PULL_REQUESTS(ProjectTabGroup.ISSUES, "Pull Requests", ProjectPullRequestsPage.class, "fa-pull-request"),- GRAPHS(ProjectTabGroup.STATISTICS, "Graphs", ProjectGraphsPage.class, "fa-chart-bar") {+ GRAPHS(ProjectTabGroup.STATISTICS, "Graphs", ProjectGraphsPage.class, "fa-chart-area") {@OverrideComponent createBadge(String id, IModel<Project> project) {return new WebMarkupContainer(id).setVisibilityAllowed(false);diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/SourceCommitPage.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/SourceCommitPage.javanew file mode 100644index 0000000000..a9fb724e7d--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/SourceCommitPage.java@@ -0,0 +1,59 @@+package com.pmease.gitop.web.page.project.source;++import org.apache.wicket.model.AbstractReadOnlyModel;+import org.apache.wicket.model.IModel;+import org.apache.wicket.request.mapper.parameter.PageParameters;++import com.google.common.base.Strings;+import com.pmease.gitop.core.model.Project;+import com.pmease.gitop.web.page.PageSpec;+import com.pmease.gitop.web.page.project.ProjectCategoryPage;++@SuppressWarnings("serial")+public class SourceCommitPage extends ProjectCategoryPage {+ protected final IModel<String> revisionModel;++ public static PageParameters newParams(Project project, String revision) {+ PageParameters params = PageSpec.forProject(project);+ params.add(PageSpec.OBJECT_ID, revision);+ return params;+ }++ public SourceCommitPage(PageParameters params) {+ super(params);++ revisionModel = new AbstractReadOnlyModel<String>() {++ @Override+ public String getObject() {+ PageParameters params = SourceCommitPage.this.getPageParameters();+ String objectId = params.get(PageSpec.OBJECT_ID).toString();+ if (Strings.isNullOrEmpty(objectId)) {+ String branchName = getProject().getDefaultBranchName();+ if (Strings.isNullOrEmpty(branchName)) {+ return "master";+ } else {+ return branchName;+ }+ } else {+ return objectId;+ }+ }++ };+ }++ @Override+ protected Category getCategory() {+ return Category.CODE;+ }++ protected String getRevision() {+ return revisionModel.getObject();+ }++ @Override+ protected String getPageTitle() {+ return getRevision() + " - " + getProject().getPathName();+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/LiveFilterResourceReference.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/LiveFilterResourceReference.javanew file mode 100644index 0000000000..0f71d2a39d--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/LiveFilterResourceReference.java@@ -0,0 +1,19 @@+package com.pmease.gitop.web.page.project.source.component;++import org.apache.wicket.request.resource.JavaScriptResourceReference;++public class LiveFilterResourceReference extends JavaScriptResourceReference {++ private static final long serialVersionUID = 1L;++ public LiveFilterResourceReference() {+ super(LiveFilterResourceReference.class, "res/js/jquery.livefilter.js");+ }++ private static LiveFilterResourceReference instance =+ new LiveFilterResourceReference();++ public static LiveFilterResourceReference get() {+ return instance;+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.htmlindex 9ec3f55014..ee7618cc98 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.html@@ -19,7 +19,7 @@<div class="popup-content"><div class=""></div><form>- <input type="search" class="form-control focusable input-md" placeholder="Filter branches or create a branch ..." />+ <input type="search" class="form-control focusable input-md commitish-filter-field" placeholder="Filter branches ..." /></form><p></p><div wicket:id="tabs"></div>@@ -27,7 +27,7 @@</wicket:fragment><wicket:fragment wicket:id="revfrag">- <ul class="menu-ul">+ <ul class="menu-ul commitish-list"><li wicket:id="revs"><a wicket:id="link" class="menu-item checkable"><i class="fa fa-check"></i> <span wicket:id="name"></span></a></li>diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.javaindex ff9b3598b4..b7f4f51204 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.java@@ -1,6 +1,7 @@package com.pmease.gitop.web.page.project.source.component;import java.util.List;+import java.util.Map;import org.apache.commons.lang3.StringUtils;import org.apache.wicket.Component;@@ -8,6 +9,9 @@ import org.apache.wicket.Page;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;import org.apache.wicket.extensions.markup.html.tabs.ITab;+import org.apache.wicket.markup.head.IHeaderResponse;+import org.apache.wicket.markup.head.JavaScriptHeaderItem;+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;import org.apache.wicket.markup.html.link.BookmarkablePageLink;@@ -21,6 +25,7 @@ import org.apache.wicket.model.Model;import org.apache.wicket.request.mapper.parameter.PageParameters;import com.google.common.collect.Lists;+import com.google.common.collect.Maps;import com.pmease.commons.git.Git;import com.pmease.commons.wicket.behavior.dropdown.DropdownBehavior;import com.pmease.commons.wicket.behavior.dropdown.DropdownPanel;@@ -33,11 +38,25 @@ import com.pmease.gitop.web.page.project.source.SourceTreePage;@SuppressWarnings("serial")public class SourceBreadcrumbPanel extends AbstractSourcePagePanel {+ private final IModel<Map<RefType, List<String>>> refsModel;+public SourceBreadcrumbPanel(String id,IModel<Project> projectModel,IModel<String> revisionModel,IModel<List<String>> pathsModel) {super(id, projectModel, revisionModel, pathsModel);++ this.refsModel = new LoadableDetachableModel<Map<RefType, List<String>>>() {++ @Override+ protected Map<RefType, List<String>> load() {+ Git git = getProject().getCodeRepo();+ Map<RefType, List<String>> map = Maps.newHashMapWithExpectedSize(RefType.values().length);+ map.put(RefType.BRANCH, Lists.newArrayList(git.listBranches()));+ map.put(RefType.TAG, Lists.newArrayList(git.listTags()));+ return map;+ }+ };}@Override@@ -53,15 +72,21 @@ public class SourceBreadcrumbPanel extends AbstractSourcePagePanel {@Overrideprotected Component newContent(String id) {- Fragment frag = new Fragment(id, "dropdownfrag", SourceBreadcrumbPanel.this);+ Fragment frag = new Fragment(id, "dropdownfrag", SourceBreadcrumbPanel.this) {+ @Override+ public void renderHead(IHeaderResponse response) {+ super.renderHead(response);++ response.render(OnDomReadyHeaderItem.forScript("$('.commitish-list').liveFilter('.commitish-filter-field', 'li', {filterChildSelector: 'a.menu-item'})"));+ }+ };+List<ITab> tabs = Lists.newArrayList();tabs.add(new AbstractTab(Model.of("Branches")) {@Overridepublic WebMarkupContainer getPanel(String panelId) {- Fragment frag = new Fragment(panelId, "revfrag", SourceBreadcrumbPanel.this);- frag.add(createRefList("revs", RefType.BRANCH));- return frag;+ return createRefList(panelId, RefType.BRANCH);}});@@ -70,14 +95,30 @@ public class SourceBreadcrumbPanel extends AbstractSourcePagePanel {@Overridepublic WebMarkupContainer getPanel(String panelId) {- Fragment frag = new Fragment(panelId, "revfrag", SourceBreadcrumbPanel.this);- frag.add(createRefList("revs", RefType.TAG));- return frag;+ return createRefList(panelId, RefType.TAG);}});- frag.add(new BootstrapTabbedPanel<ITab>("tabs", tabs));+ frag.add(new BootstrapTabbedPanel<ITab>("tabs", tabs, new AbstractReadOnlyModel<Integer>() {++ @Override+ public Integer getObject() {+ String revision = getRevision();+ Map<RefType, List<String>> map = refsModel.getObject();+ for (RefType each : RefType.values()) {+ List<String> refs = map.get(each);+ for (String ref : refs) {+ if (ref.equalsIgnoreCase(revision)) {+ return each.ordinal();+ }+ }+ }++ return 0;+ }++ }));return frag;}@@ -130,21 +171,17 @@ public class SourceBreadcrumbPanel extends AbstractSourcePagePanel {BRANCH, TAG}- private Component createRefList(String id, final RefType type) {+ private Fragment createRefList(String id, final RefType type) {+ Fragment frag = new Fragment(id, "revfrag", SourceBreadcrumbPanel.this);IModel<List<String>> refs = new LoadableDetachableModel<List<String>>() {@Overrideprotected List<String> load() {- Git git = getProject().getCodeRepo();- if (type == RefType.BRANCH) {- return Lists.newArrayList(git.listBranches());- } else {- return Lists.newArrayList(git.listTags());- }+ return refsModel.getObject().get(type);}};- ListView<String> view = new ListView<String>(id, refs) {+ ListView<String> view = new ListView<String>("revs", refs) {@Overrideprotected void populateItem(ListItem<String> item) {final String ref = item.getModelObject();@@ -177,9 +214,16 @@ public class SourceBreadcrumbPanel extends AbstractSourcePagePanel {}};- return view;+ frag.add(view);+ return frag;}+ @Override+ public void renderHead(IHeaderResponse response) {+ super.renderHead(response);+ response.render(JavaScriptHeaderItem.forReference(LiveFilterResourceReference.get()));+ }+private Class<? extends Page> getPageClass() {Page page = getPage();if (page instanceof ProjectHomePage) {@@ -188,4 +232,13 @@ public class SourceBreadcrumbPanel extends AbstractSourcePagePanel {return page.getClass();}}++ @Override+ public void onDetach() {+ if (refsModel != null) {+ refsModel.detach();+ }++ super.onDetach();+ }}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceTreePanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceTreePanel.htmlindex 2ce9031b49..5ab4b170a8 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceTreePanel.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceTreePanel.html@@ -1,9 +1,25 @@<html xmlns:wicket><wicket:panel>- <table class="table table-condense sourcetree">- <tr>- <td>source files</td>- </tr>- </table>+ <section class="source-tree">+ <div class="commit">+ <pre class="short-message" wicket:id="shortMessage"></pre>+ <div class="commit-meta">+ <div class="commit-author">+ <span wicket:id="author"></span> authored <time class="age" wicket:id="author-date"></time>+ </div>+ <div class="commit-hash">+ <a wicket:id="commitlink">latest commit <span wicket:id="sha" class="sha"></span></a>+ </div>+ </div>+ </div>+ <table class="table table-condense files">+ <tr wicket:id="files">+ <td class="file-icon"><i class="" wicket:id="icon"></i></td>+ <td class="file-name"><a wicket:id="file"><span wicket:id="name"></span></a></td>+ <td class="message">[TODO] Retrieve the last commit message</td>+ <td class="age">[TODO] 24 days ago</td>+ </tr>+ </table>+ </section></wicket:panel></html>\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceTreePanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceTreePanel.javaindex 5d7d0db7a0..89a8e0c944 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceTreePanel.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceTreePanel.java@@ -2,16 +2,175 @@ package com.pmease.gitop.web.page.project.source.component;import java.util.List;+import org.apache.wicket.markup.html.basic.Label;+import org.apache.wicket.markup.html.link.AbstractLink;+import org.apache.wicket.markup.html.link.BookmarkablePageLink;+import org.apache.wicket.markup.html.list.ListItem;+import org.apache.wicket.markup.html.list.ListView;+import org.apache.wicket.model.AbstractReadOnlyModel;import org.apache.wicket.model.IModel;+import org.apache.wicket.model.LoadableDetachableModel;+import org.apache.wicket.request.mapper.parameter.PageParameters;+import com.google.common.base.Joiner;+import com.google.common.collect.Iterables;+import com.google.common.collect.Lists;+import com.pmease.commons.git.Commit;+import com.pmease.commons.git.Git;+import com.pmease.commons.git.TreeNode;import com.pmease.gitop.core.model.Project;+import com.pmease.gitop.web.common.bootstrap.Icon;+import com.pmease.gitop.web.component.link.CommitUserLink;+import com.pmease.gitop.web.page.PageSpec;+import com.pmease.gitop.web.page.project.source.SourceBlobPage;+import com.pmease.gitop.web.page.project.source.SourceCommitPage;+import com.pmease.gitop.web.page.project.source.SourceTreePage;+import com.pmease.gitop.web.util.DateUtils;+import com.pmease.gitop.web.util.GitUtils;@SuppressWarnings("serial")public class SourceTreePanel extends AbstractSourcePagePanel {++ private final IModel<Commit> lastCommitModel;+public SourceTreePanel(String id,IModel<Project> project,IModel<String> revisionModel,IModel<List<String>> pathsModel) {super(id, project, revisionModel, pathsModel);++ lastCommitModel = new LoadableDetachableModel<Commit>() {++ @Override+ protected Commit load() {+ Git git = getProject().getCodeRepo();+ List<String> paths = getPaths();+ List<Commit> commits = git.log(null, getRevision(), Joiner.on("/").join(paths), 1);+ return Iterables.getFirst(commits, null);+ }+ };+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ add(new Label("shortMessage", new AbstractReadOnlyModel<String>() {++ @Override+ public String getObject() {+ return GitUtils.getCommitSummary(getLastCommit());+ }+ }));+++ add(new CommitUserLink("author", new AbstractReadOnlyModel<String>() {+ @Override+ public String getObject() {+ return getLastCommit().getAuthor();+ }+ }));++ add(new Label("author-date", new AbstractReadOnlyModel<String>() {++ @Override+ public String getObject() {+ return DateUtils.formatAge(getLastCommit().getAuthorDate());+ }++ }));++ BookmarkablePageLink<Void> commitLink = new BookmarkablePageLink<Void>(+ "commitlink",+ SourceCommitPage.class,+ SourceCommitPage.newParams(getProject(), getRevision()));+ add(commitLink);+ commitLink.add(new Label("sha", new AbstractReadOnlyModel<String>() {++ @Override+ public String getObject() {+ return GitUtils.getShortSha(getLastCommit().getHash());+ }+ }));++ IModel<List<TreeNode>> nodes = new LoadableDetachableModel<List<TreeNode>>() {++ @Override+ protected List<TreeNode> load() {+ Git git = getProject().getCodeRepo();+ List<String> paths = getPaths();+ String path = Joiner.on("/").join(paths);+ return git.listTree(getRevision(), path, false);+ }+ };++ ListView<TreeNode> fileTree = new ListView<TreeNode>("files", nodes) {++ @Override+ protected void populateItem(ListItem<TreeNode> item) {+ TreeNode node = item.getModelObject();+ final TreeNode.Type type = node.getType();+ Icon icon = new Icon("icon", new AbstractReadOnlyModel<String>() {++ @Override+ public String getObject() {+ switch (type) {+ case DIRECTORY:+ return "folder-o";++ case FILE:+ return "file-text-o";++ case SUBMODULE:+ return "plus-square"; // FIXME: add submodule icon++ case SYMBOLLINK:+ return "folder-open-o"; // FIXME: add symbol link icon+ }++ return "";+ }+ });++ item.add(icon);++ PageParameters params = new PageParameters();+ params.add(PageSpec.USER, getProject().getOwner().getName());+ params.add(PageSpec.PROJECT, getProject().getName());+ params.add(PageSpec.OBJECT_ID, getRevision());++ List<String> paths = Lists.newArrayList(getPaths());+ paths.add(node.getName());++ for (int i = 0; i < paths.size(); i++) {+ params.set(i, paths.get(i));+ }++ AbstractLink link;+ if (type == TreeNode.Type.FILE) {+ link = new BookmarkablePageLink<Void>("file", SourceBlobPage.class, params);+ } else {+ link = new BookmarkablePageLink<Void>("file", SourceTreePage.class, params);+ }++ link.add(new Label("name", node.getName()));+ item.add(link);+ }+ };++ add(fileTree);+ }++ private Commit getLastCommit() {+ return lastCommitModel.getObject();+ }++ @Override+ public void onDetach() {+ if (lastCommitModel != null) {+ lastCommitModel.detach();+ }++ super.onDetach();}}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/res/js/jquery.livefilter.js b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/res/js/jquery.livefilter.jsnew file mode 100644index 0000000000..9976b6e303--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/res/js/jquery.livefilter.js@@ -0,0 +1,50 @@+/*+ * jQuery.liveFilter+ *+ * Copyright (c) 2009 Mike Merritt+ *+ * Forked by Lim Chee Aun (cheeaun.com)+ *+ */++(function($){+ $.fn.liveFilter = function(inputEl, filterEl, options){+ var defaults = {+ filterChildSelector: null,+ filter: function(el, val){+ return $(el).text().toUpperCase().indexOf(val.toUpperCase()) >= 0;+ },+ before: function(){},+ after: function(){}+ };+ var options = $.extend(defaults, options);++ var el = $(this).find(filterEl);+ if (options.filterChildSelector) el = el.find(options.filterChildSelector);++ var filter = options.filter;+ $(inputEl).keyup(function(){+ var val = $(this).val();+ var contains = el.filter(function(){+ return filter(this, val);+ });+ var containsNot = el.not(contains);+ if (options.filterChildSelector){+ contains = contains.parents(filterEl);+ containsNot = containsNot.parents(filterEl).hide();+ }++ options.before.call(this, contains, containsNot);++ contains.show();+ containsNot.hide();++ if (val === '') {+ contains.show();+ containsNot.show();+ }++ options.after.call(this, contains, containsNot);+ });+ }+})(jQuery);\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/util/Classes.java b/gitop.web/src/main/java/com/pmease/gitop/web/util/Classes.javanew file mode 100644index 0000000000..3252888469--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/util/Classes.java@@ -0,0 +1,338 @@+package com.pmease.gitop.web.util;++import java.lang.reflect.Constructor;+import java.lang.reflect.InvocationTargetException;+import java.lang.reflect.Method;+import java.util.Arrays;++/**+ * Utilities for working with {@link Class}es and reflection.+ */+public class Classes {++ /**+ * Creates a new instance of the given {@link Class}, using the given arguments.+ * <p/>+ * A new instance object of the given {@link Class} is created, using reflection, providing the+ * given arguments to the constructor.+ *+ * @param clazz the {@link Class} of the object to instantiate.+ * @param args the arguments to pass to the constructor, if any.+ * @param <T> the type of the {@link Class} to return.+ * @return a new instance of the given {@link Class}, constructed using the given <i>args</i>.+ *+ * @throws NoSuchMethodException if the given {@link Class} doesn't provide a constructor that can+ * be applied to the given arguments.+ * @throws IllegalAccessException if the appropriate constructor is inaccessible.+ * @throws IllegalArgumentException if the number of actual and formal parameters differ; if an+ * unwrapping conversion for primitive arguments fails; or if, after possible unwrapping,+ * a parameter value cannot be converted to the corresponding formal parameter type by a+ * method invocation conversion; if this constructor pertains to an enum type.+ * @throws InstantiationException if the given {@link Class} is <i>abstract</i>, an+ * <i>interface</i>, an array or doesn't define a nullary constructor.+ * @throws InvocationTargetException if the underlying constructor throws an exception.+ * @throws ExceptionInInitializerError if the initialization provoked by this method fails.+ */+ public static <T> T newInstance(final Class<T> clazz, final Object... args)+ throws NoSuchMethodException, InstantiationException, IllegalAccessException,+ InvocationTargetException {+ return getApplicableConstructor(clazz, Classes.of(args)).newInstance(args);+ }++ /**+ * Creates a new instance of the same {@link Class} as the given <i>template</i>, using the given+ * constructor arguments.+ * <p/>+ * Given an object of type <code>T</code>, a new instance of {@link Class<T>} will be created,+ * passing the given <i>args</i> to the constructor.+ *+ * @param template an object that provides the {@link Class} to instantiate.+ * @param args the arguments to pass to the constructor, if any.+ * @param <T> the type of the object to return+ * @return a new instance of the same {@link Class} as <i>template</i>, constructed using the+ * given <i>args</i>.+ *+ * @throws NoSuchMethodException if the given {@link Class} doesn't provide a constructor that can+ * be applied to the given arguments.+ * @throws IllegalAccessException if the appropriate constructor is inaccessible.+ * @throws IllegalArgumentException if the number of actual and formal parameters differ; if an+ * unwrapping conversion for primitive arguments fails; or if, after possible unwrapping,+ * a parameter value cannot be converted to the corresponding formal parameter type by a+ * method invocation conversion; if this constructor pertains to an enum type.+ * @throws InstantiationException if the given {@link Class} is <i>abstract</i>, an+ * <i>interface</i>, an array or doesn't define a nullary constructor.+ * @throws InvocationTargetException if the underlying constructor throws an exception.+ * @throws ExceptionInInitializerError if the initialization provoked by this method fails.+ */+ @SuppressWarnings("unchecked")+ public static <T> T newInstanceFrom(final T template, final Object... args)+ throws NoSuchMethodException, InstantiationException, IllegalAccessException,+ InvocationTargetException {+ return newInstance(((Class<? extends T>) template.getClass()), args);+ }++ /**+ * Creates a new instance of the given {@link Class}, using the given arguments, ignoring+ * visibility.+ * <p/>+ * A new instance object of the given {@link Class} is created, using reflection, providing the+ * given arguments to the constructor.+ * <p/>+ * The visibility of the {@link Constructor} defined by the arguments is ignored and a new+ * instance created irrespective of the defined visibility. This is potentially dangerous, as the+ * API likely makes no guarantee as to the behaviour when instantiating from a non-public+ * constructor.+ *+ * @param clazz the {@link Class} of the object to instantiate.+ * @param args the arguments to pass to the constructor, if any.+ * @param <T> the type of the {@link Class} to return.+ * @return a new instance of the given {@link Class}, constructed using the given <i>args</i>.+ *+ * @throws NoSuchMethodException if the given {@link Class} doesn't provide a constructor that can+ * be applied to the given arguments.+ * @throws IllegalArgumentException if the number of actual and formal parameters differ; if an+ * unwrapping conversion for primitive arguments fails; or if, after possible unwrapping,+ * a parameter value cannot be converted to the corresponding formal parameter type by a+ * method invocation conversion; if this constructor pertains to an enum type.+ * @throws InstantiationException if the given {@link Class} is <i>abstract</i>, an+ * <i>interface</i>, an array or doesn't define a nullary constructor.+ * @throws InvocationTargetException if the underlying constructor throws an exception.+ * @throws ExceptionInInitializerError if the initialization provoked by this method fails.+ */+ public static <T> T unsafeNewInstance(final Class<T> clazz, final Object... args)+ throws NoSuchMethodException, InstantiationException, InvocationTargetException {+ final Constructor<T> constructor = getApplicableConstructor(clazz, Classes.of(args));+ constructor.setAccessible(true);+ try {+ return constructor.newInstance(args);+ } catch (final IllegalAccessException e) {+ throw new AssertionError("IllegalAccessError while instantiating " + clazz+ + " with access controls disabled");+ }+ }++ /**+ * Creates a new instance of the same {@link Class} as the given <i>template</i>, using the given+ * constructor arguments and ignoring visibility.+ * <p/>+ * Given an object of type <code>T</code>, a new instance of {@link Class<T>} will be created,+ * passing the given <i>args</i> to the constructor.+ * <p/>+ * The visibility of the {@link Constructor} defined by the arguments is ignored and a new+ * instance created irrespective of the defined visibility. This is potentially dangerous, as the+ * API likely makes no guarantee as to the behaviour when instantiating from a non-public+ * constructor.+ *+ * @param template an object that provides the {@link Class} to instantiate.+ * @param args the arguments to pass to the constructor, if any.+ * @param <T> the type of the object to return+ * @return a new instance of the same {@link Class} as <i>template</i>, constructed using the+ * given <i>args</i>.+ *+ * @throws NoSuchMethodException if the given {@link Class} doesn't provide a constructor that can+ * be applied to the given arguments.+ * @throws IllegalArgumentException if the number of actual and formal parameters differ; if an+ * unwrapping conversion for primitive arguments fails; or if, after possible unwrapping,+ * a parameter value cannot be converted to the corresponding formal parameter type by a+ * method invocation conversion; if this constructor pertains to an enum type.+ * @throws InstantiationException if the given {@link Class} is <i>abstract</i>, an+ * <i>interface</i>, an array or doesn't define a nullary constructor.+ * @throws InvocationTargetException if the underlying constructor throws an exception.+ * @throws ExceptionInInitializerError if the initialization provoked by this method fails.+ */+ @SuppressWarnings("unchecked")+ public static <T> T unsafeNewInstanceFrom(final T template, final Object... args)+ throws NoSuchMethodException, InstantiationException, InvocationTargetException {+ return unsafeNewInstance((Class<? extends T>) template.getClass(), args);+ }++ /**+ * Gets the {@link Class} for multiple objects.+ * <p/>+ * The resulting array of {@link Class} objects that are ordered in parallel with the argument+ * list that produced it. This is especially useful for getting a {@link Constructor} for a given+ * set of arguments:+ * <p/>+ * <code>+ * clazz.getConstructor(Classes.of("abc", 123));+ * </code>+ *+ * @param arguments the objects to generate {@link Class}es for+ * @return an array of {@link Class} objects, in the same order as the argument list+ */+ @SuppressWarnings("rawtypes")+ public static Class[] of(final Object... arguments) {+ final Object[] args = resolveVarArgs(arguments);+ final Class[] classes = new Class[args.length];+ for (int i = 0; i < args.length; i++) {+ classes[i] = args[i] == null ? Null.class : args[i].getClass();+ }+ return classes;+ }++ /**+ * Ensures a variable argument list has been properly passed.+ * <p/>+ * Sometimes, you want to pass a single array-typed argument to a method that accepts variable+ * arguments. In these situations, that array will be unwrapped in to a list of multiple+ * arguments, instead of a single argument that is an array.+ * <p/>+ * Example: <code>+ * Classes.of(TableNotFoundException.class, tableName.getBytes());+ * </code>+ * <p/>+ * Resolving will differentiate a variable argument list from a single argument of the following+ * types:+ * <ul>+ * <li>All primitive array types: e.g. <i>byte[]</i>, <i>int[]</i>, <i>boolean[]</i>, etc.</li>+ * <li>Arrays of reference types that are not <i>Object</i>: e.g. <i>String[]</i>,+ * <i>java.lang.Integer[]</i>, <i>Class[]</i>; but <i>not</i> <i>Object[]</i></li>+ * </ul>+ * An argument of type <i>Object[]</i> is considered to be a variable list of arguments, each with+ * their own distinct type.+ *+ * @param args the argument list to resolve+ * @return the argument list, wrapped to protect single array-typed arguments+ */+ public static Object[] resolveVarArgs(final Object... args) {+ return args != null && args.getClass() == Object[].class ? args : new Object[] {args};+ }++ /**+ * Gets a {@link Constructor} from the given {@link Class} that is applicable to the given+ * arguments.+ * <p/>+ * If the types of the given arguments are not an exact match for any declared {@link Constructor}+ * s, a Constructor that will accept the arguments (e.g. because they are sub-types of the+ * parameters) will be searched for.+ * <p/>+ * If the given {@link Class} has no {@link Constructor} that is applicable to the given+ * arguments, a {@link NoSuchMethodException} will be thrown.+ * <p/>+ * No guarantees are made about the visibility of the {@link Constructor} returned; it may not be+ * accessible from the calling scope.+ *+ * @param clazz the {@link Class} to search for a {@link Constructor} for.+ * @param args the types the {@link Constructor} must be applicable to.+ * @param <T> the type of the objects instantiated by the {@link Constructor}.+ * @return a {@link Constructor} that is applicable to the given arguments for constructing+ * objects of type {@link T}.+ * @throws NoSuchMethodException if no {@link Constructor} is found that is applicable to the+ * given arguments.+ */+ @SuppressWarnings({"unchecked", "rawtypes"})+ public static <T> Constructor<T> getApplicableConstructor(final Class<T> clazz,+ final Class... args) throws NoSuchMethodException {+ final Constructor[] constructors = clazz.getDeclaredConstructors();+ for (final Constructor<T> constructor : constructors) {+ if (isAssignableFrom(constructor.getParameterTypes(), args)) {+ return constructor;+ }+ }+ throw new NoSuchMethodException(String.format(+ "No applicable constructor for %s found for argument types: %s", clazz.getName(),+ Arrays.toString(args)));+ }++ /**+ * Gets the {@link Method} of the given name from the given {@link Class} that is applicable to+ * the given argument types.+ * <p/>+ * If the types of the given arguments are not an exact match for any declared {@link Method}s, a+ * {@link Method} that will accept the arguments (e.g. because they are sub-types of the+ * parameters) will be searched for.+ * <p/>+ * If the given {@link Class} has no {@link Method} with the given name that is applicable to the+ * given arguments, a {@link NoSuchMethodException} will be thrown.+ * <p/>+ * No guarantees are made about the visibility of the {@link Method} returned; it may not be+ * accessible from the calling scope. Similarly, the {@link Method} may be static or may be an+ * instance method.+ *+ * @param clazz the {@link Class} to get the {@link Method} from.+ * @param name the name of the {@link Method} to get.+ * @param args the types the {@link Method} must be applicable to.+ * @return a {@link Method} of the given name from the given {@link Class} that is applicable to+ * the given arguments.+ * @throws NoSuchMethodException if no {@link Method} is found that is applicable to the given+ * arguments.+ */+ @SuppressWarnings("rawtypes")+ public static Method getApplicableMethod(final Class clazz, final String name,+ final Class... args) throws NoSuchMethodException {+ final Method[] methods = clazz.getDeclaredMethods();+ for (final Method m : methods) {+ if (m.getName().equals(name) && isAssignableFrom(m.getParameterTypes(), args)) {+ return m;+ }+ }+ throw new NoSuchMethodException(String.format(+ "No applicable method overload %s#%s found for argument types: %s", clazz.getName(), name,+ Arrays.toString(args)));+ }++ /**+ * Determines if the {@link Class}s for the given target types can be assigned to from the types+ * represented by the given source {@link Class}s.+ * <p/>+ * Each target type will be matched up with the corresponding source type. If the length of the+ * two arrays differ, they are considered not assignable.+ *+ * @param targets the {@link Class}s representing the types to assign to.+ * @param sources the {@link Class}s representing the types to assign from.+ * @return true if all source {@link Class}es represent a type that can be assigned to their+ * corresponding target {@link Class}.+ */+ @SuppressWarnings("rawtypes")+ public static boolean isAssignableFrom(final Class[] targets, final Class[] sources) {+ // must have same number of types+ if (sources.length != targets.length) {+ return false;+ }++ // quick check for exact matches+ if (Arrays.equals(sources, targets)) {+ return true;+ }++ // check if each source type can be assigned to each target type+ for (int i = 0; i < targets.length; i++) {+ if (!isAssignableFrom(targets[i], sources[i])) {+ return false;+ }+ }++ return true;+ }++ /***+ * Determines if the given source {@link Class} represents a type that can be assigned to the+ * given target {@link Class}.+ * <p/>+ * If the source {@link Class} represents null (via {@link Null}), it can be assigned to any+ * {@link Class} that represents a reference type.+ *+ * @param target the {@link Class} of the type to assign to.+ * @param source the {@link Class} of the type to assign from.+ * @return true if the source {@link Class} represents a type that can be assigned to the type+ * represented by the target {@link Class}.+ */+ public static boolean isAssignableFrom(final Class<?> target, final Class<?> source) {+ if (target.equals(Null.class)) {+ throw new NullPointerException("target for type assignment may not be the null type");+ }++ return Primitives.isPrimitive(target) ? Primitives.isAssignableFrom(target, source) : source+ .equals(Null.class) || target.isAssignableFrom(source);+ }++ /**+ * A placeholder Null type.+ * <p/>+ * This Null type provides a means to get a {@link Class} for null values. This should never be+ * used except for special-casing nulls.+ */+ static class Null {+ private Null() {}+ }+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/util/Generics.java b/gitop.web/src/main/java/com/pmease/gitop/web/util/Generics.javanew file mode 100644index 0000000000..c16cab44a6--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/util/Generics.java@@ -0,0 +1,78 @@+package com.pmease.gitop.web.util;++import static com.google.common.base.Preconditions.checkNotNull;++import java.lang.reflect.ParameterizedType;+import java.lang.reflect.Type;+import java.lang.reflect.TypeVariable;++/**+ * Copied from dropwizard-util+ * @author zhenyu+ *+ * Helper methods for class type parameters.+ * @see <a href="http://gafter.blogspot.com/2006/12/super-type-tokens.html">Super Type Tokens</a>+ */+public class Generics {+ private Generics() { /* singleton */ }++ /**+ * Finds the type parameter for the given class.+ *+ * @param klass a parameterized class+ * @return the class's type parameter+ */+ public static Class<?> getTypeParameter(Class<?> klass) {+ return getTypeParameter(klass, Object.class);+ }++ /**+ * Finds the type parameter for the given class which is assignable to the bound class.+ *+ * @param klass a parameterized class+ * @param bound the type bound+ * @param <T> the type bound+ * @return the class's type parameter+ */+ public static <T> Class<T> getTypeParameter(Class<?> klass, Class<? super T> bound) {+ Type t = checkNotNull(klass);+ while (t instanceof Class<?>) {+ t = ((Class<?>) t).getGenericSuperclass();+ }+ /* This is not guaranteed to work for all cases with convoluted piping+ * of type parameters: but it can at least resolve straight-forward+ * extension with single type parameter (as per [Issue-89]).+ * And when it fails to do that, will indicate with specific exception.+ */+ if (t instanceof ParameterizedType) {+ // should typically have one of type parameters (first one) that matches:+ for (Type param : ((ParameterizedType) t).getActualTypeArguments()) {+ if (param instanceof Class<?>) {+ final Class<T> cls = determineClass(bound, param);+ if (cls != null) { return cls; }+ }+ else if (param instanceof TypeVariable) {+ for (Type paramBound : ((TypeVariable<?>) param).getBounds()) {+ if (paramBound instanceof Class<?>) {+ final Class<T> cls = determineClass(bound, paramBound);+ if (cls != null) { return cls; }+ }+ }+ }+ }+ }+ throw new IllegalStateException("Cannot figure out type parameterization for " + klass.getName());+ }++ @SuppressWarnings("unchecked")+ private static <T> Class<T> determineClass(Class<? super T> bound, Type candidate) {+ if (candidate instanceof Class<?>) {+ final Class<?> cls = (Class<?>) candidate;+ if (bound.isAssignableFrom(cls)) {+ return (Class<T>) cls;+ }+ }++ return null;+ }+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/util/GitUtils.java b/gitop.web/src/main/java/com/pmease/gitop/web/util/GitUtils.javanew file mode 100644index 0000000000..ab4f1412a7--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/util/GitUtils.java@@ -0,0 +1,31 @@+package com.pmease.gitop.web.util;++import java.util.regex.Pattern;++import org.apache.commons.lang3.StringUtils;++import com.google.common.base.Preconditions;+import com.pmease.commons.git.Commit;++public class GitUtils {++ private GitUtils() {}++ public static final String NULL_SHA1 = StringUtils.repeat("0", 40);+ public static final Pattern PATTERN_HASH = Pattern.compile("[a-z0-9]{40}");++ public static final int SHORT_SHA_LENGTH = 10;++ public static boolean isHash(String sha) {+ return PATTERN_HASH.matcher(sha).matches();+ }++ public static String getShortSha(String sha) {+ Preconditions.checkArgument(isHash(sha));+ return sha.substring(0, SHORT_SHA_LENGTH);+ }++ public static String getCommitSummary(Commit commit) {+ return commit.getSummary();+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/util/Primitives.java b/gitop.web/src/main/java/com/pmease/gitop/web/util/Primitives.javanew file mode 100644index 0000000000..724686a626--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/util/Primitives.java@@ -0,0 +1,193 @@+package com.pmease.gitop.web.util;++import java.util.Map;+import java.util.Set;++import com.google.common.collect.BiMap;+import com.google.common.collect.ImmutableBiMap;+import com.google.common.collect.ImmutableMap;+import com.google.common.collect.ImmutableSet;++/**+ * Utilities for working with primitive types and reflection.+ * <p/>+ * <b>Terminology:</b>+ * <p/>+ * Non-reference primitive types (e.g. <code>int</code>, <code>double</code>, <code>void</code>) are+ * considered <i>native primitives</i>, or sometimes, <i>unboxed primitives</i>.+ * <p/>+ * Reference primitive types (e.g. {@link Integer}, {@link Double}, {@link Void}) are considered+ * <i>boxed primitives</i>.+ * <p/>+ * Conversion between native primitves and boxed primitives can be done with+ * {@link Primitives#box(Class)} and {@link Primitives#unbox(Class)}.+ * <p/>+ * Whenever possible, boxing/unboxing will be implicit and transparent, with a preference for native+ * primitive types.+ */+@SuppressWarnings("rawtypes")+public class Primitives {++ // a mapping of primitive types that are assignable to a wider primitive+ private static final Map<Class, Set<Class>> ASSIGNABLES;+ static {+ final ImmutableMap.Builder<Class, Set<Class>> builder = ImmutableMap.builder();+ builder.put(Short.TYPE, ImmutableSet.<Class>of(Byte.TYPE));+ builder.put(Integer.TYPE, ImmutableSet.<Class>of(Byte.TYPE, Short.TYPE));+ builder.put(Long.TYPE, ImmutableSet.<Class>of(Byte.TYPE, Short.TYPE, Integer.TYPE));+ builder.put(Float.TYPE,+ ImmutableSet.<Class>of(Byte.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE, Character.TYPE));+ builder.put(Double.TYPE, ImmutableSet.<Class>of(Byte.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE,+ Float.TYPE, Character.TYPE));+ ASSIGNABLES = builder.build();+ }++ // a mapping of primitive Class instances to their boxed counterparts+ private static final BiMap<Class, Class> BOXED_CLASSES;+ static {+ final ImmutableBiMap.Builder<Class, Class> builder = ImmutableBiMap.builder();+ builder.put(Byte.TYPE, Byte.class);+ builder.put(Short.TYPE, Short.class);+ builder.put(Integer.TYPE, Integer.class);+ builder.put(Long.TYPE, Long.class);+ builder.put(Float.TYPE, Float.class);+ builder.put(Double.TYPE, Double.class);+ builder.put(Boolean.TYPE, Boolean.class);+ builder.put(Character.TYPE, Character.class);+ builder.put(Void.TYPE, Void.class);+ BOXED_CLASSES = builder.build();+ }++ /**+ * Produces the {@link Class} for the boxed counterpart of the given primitive {@link Class}.+ *+ * @param clazz the {@link Class} of the primitive type to get the boxed counterpart for.+ * @return the {@link Class} of the boxed counterpart to the given primitive type {@link Class}+ * or; if the argument is already a boxed primitive, the argument itself.+ * @throws IllegalArgumentException if the given {@link Class} is not for a primitive type.+ */+ public static Class box(final Class clazz) {+ return isNativePrimitive(clazz) && BOXED_CLASSES.containsKey(clazz)+ ? BOXED_CLASSES.get(clazz)+ : requirePrimitiveClass(clazz);+ }++ /**+ * Produces the {@link Class} for the native primitive counterpart of the given boxed primitive+ * {@link Class}.+ *+ * @param clazz the {@link Class} of the boxed primitive type to unbox to a native primitive.+ * @return the {@link Class} of the native primitive counterpart to the given boxed primitive+ * {@link Class} or; if the argument is already a native primitive, the argument itself.+ * @throws IllegalArgumentException if the given {@link Class} is not for a primitive type.+ */+ public static Class unbox(final Class clazz) {+ return isBoxedPrimitive(clazz)+ ? BOXED_CLASSES.inverse().get(clazz)+ : requirePrimitiveClass(clazz);+ }++ /**+ * Determines whether the objects of the given source {@link Class} can be assigned to the+ * primitive type of the given target {@link Class}.+ * <p/>+ * If either type is a boxed-primitive, it will be unboxed automatically; all comparisons will be+ * of the native primitive types.+ *+ * @param target the {@link Class} of the type you wish to assign to.+ * @param source the {@link Class} of the type you wish to assign from.+ * @return true if objects of the source {@link Class} can be assigned to the type of the target+ * {@link Class}; otherwise, false.+ */+ public static boolean isAssignableFrom(final Class target, final Class source) {+ if (target.equals(Classes.Null.class)) {+ throw new NullPointerException("target for type assignment may not be the null type");+ }++ // permit null sources for boxed targets+ if (Primitives.isBoxedPrimitive(target) && source.equals(Classes.Null.class)) {+ return true;+ }++ // ensure source type is a primitive type+ if (!Primitives.isPrimitive(source)) {+ return false;+ }++ // unbox both types for comparison+ final Class unboxedTarget = unbox(target);+ final Class unboxedSource = unbox(source);++ return unboxedTarget.equals(unboxedSource)+ || (ASSIGNABLES.containsKey(unboxedTarget) && ASSIGNABLES.get(unboxedTarget).contains(+ unboxedSource));+ }++ /**+ * Determines whether the given {@link Class} is for a primitive type; either native or boxed.+ * <p/>+ * Both boxed and native primitive types are considered "primitives". Example: <code>+ * Primitives.isPrimitive(int.class) == true;+ * Primitives.isPrimitive(Integer.class) == true;+ * Primitives.isPrimitive(String.class) == false;+ * </code>+ *+ * @param clazz the {@link Class} of the type to determine whether or not it is for a primitive+ * type.+ * @return true if the given {@link Class} is for a primitive type, boxed or native; false if the+ * given {@link Class} is for any other type.+ */+ public static boolean isPrimitive(final Class clazz) {+ return clazz.isPrimitive() || BOXED_CLASSES.containsValue(clazz);+ }++ /**+ * Determines whether the given {@link Class} is for a boxed primitive type.+ * <p/>+ * Only boxed primitive types are accepted. Example: <code>+ * Primitives.isPrimitive(int.class) == false;+ * Primitives.isPrimitive(Integer.class) == true;+ * Primitives.isPrimitive(String.class) == false;+ * </code>+ *+ * @param clazz the {@link Class} of the type to determine whether or not it is for a boxed+ * primitive type.+ * @return true if the given {@link Class} is for a boxed primitive type; false if the given+ * {@link Class} is for any other type, including native primitive types.+ */+ public static boolean isBoxedPrimitive(final Class clazz) {+ return !clazz.isPrimitive() && BOXED_CLASSES.containsValue(clazz);+ }++ /**+ * Determines whether the given {@link Class} is for a native primitive type.+ * <p/>+ * Only native primitive types are accepted. Example: <code>+ * Primitives.isPrimitive(int.class) == true;+ * Primitives.isPrimitive(Integer.class) == false;+ * Primitives.isPrimitive(String.class) == false;+ * </code>+ *+ * @param clazz the {@link Class} of the type to determine whether or not it is for a native+ * primitive type.+ * @return true if the given {@link Class} is for a native primitive type; false if the given+ * {@link Class} is for any other type, including boxed primitive types.+ */+ public static boolean isNativePrimitive(final Class clazz) {+ return clazz.isPrimitive();+ }++ /**+ * Asserts that the given {@link Class} is for a primitive type, either native or boxed.+ *+ * @param clazz the {@link Class} to assert is for a primitive type.+ * @return the given {@link Class}, without modifications, to facilitate chaining.+ * @throws AssertionError if the given {@link Class} is for a non-primitive type.+ */+ public static Class requirePrimitiveClass(final Class clazz) {+ if (!isPrimitive(clazz)) {+ throw new AssertionError("Class must be for a primitive type; " + clazz + " given");+ }+ return clazz;+ }+}\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/util/UrlUtils.java b/gitop.web/src/main/java/com/pmease/gitop/web/util/UrlUtils.javanew file mode 100644index 0000000000..1a9732339f--- /dev/null+++ b/gitop.web/src/main/java/com/pmease/gitop/web/util/UrlUtils.java@@ -0,0 +1,69 @@+package com.pmease.gitop.web.util;++import java.io.IOException;+import java.io.InputStream;+import java.net.JarURLConnection;+import java.net.URL;+import java.net.URLConnection;+import java.util.Set;+import java.util.jar.JarEntry;++public class UrlUtils {++ private UrlUtils() {+ }++ public static long getLastModified(Set<URL> fileset) {+ long lastModified = 0;+ for (URL each : fileset) {+ lastModified = Math.max(lastModified, getLastModified(each));+ }++ return lastModified;+ }++ /**+ * Copied from dropwizard+ *+ * Returns the last modified time for file:// and jar:// URLs. This is slightly tricky for a couple of reasons:+ * 1) calling getConnection on a {@link URLConnection} to a file opens an {@link InputStream} to that file that must+ * then be closed ‚Äî though this is not true for {@code URLConnection}s to jar resources+ * 2) calling getLastModified on {@link JarURLConnection}s returns the last modified time of the jar file, rather+ * than the file within+ *+ * @param resourceURL the URL to return the last modified time for+ * @return the last modified time of the resource, expressed as the number of milliseconds since the epoch, or 0 if there was a problem+ */+ public static long getLastModified(URL resourceURL) {+ final String protocol = resourceURL.getProtocol();+ switch (protocol) {+ case "jar":+ try {+ final JarURLConnection jarConnection = (JarURLConnection) resourceURL.openConnection();+ final JarEntry entry = jarConnection.getJarEntry();+ return entry.getTime();+ } catch (IOException ignored) {+ return 0;+ }+ case "file":+ URLConnection connection = null;+ try {+ connection = resourceURL.openConnection();+ return connection.getLastModified();+ } catch (IOException ignored) {+ return 0;+ } finally {+ if (connection != null) {+ try {+ connection.getInputStream().close();+ } catch (IOException ignored) {+ // do nothing.+ }+ }+ }+ default:+ throw new IllegalArgumentException("Unsupported protocol " + resourceURL.getProtocol()+ + " for resource " + resourceURL);+ }+ }+}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/util/WicketUtils.java b/gitop.web/src/main/java/com/pmease/gitop/web/util/WicketUtils.javaindex b6093b6e5e..a1caeccf26 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/util/WicketUtils.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/util/WicketUtils.java@@ -45,6 +45,10 @@ public final class WicketUtils {return Optional.fromNullable(params);}+ public static CharSequence urlFor(Class<? extends Page> pageClass, PageParameters parameters) {+ return RequestCycle.get().urlFor(pageClass, parameters);+ }+public static boolean isCurrentRequestAjax() {return RequestCycle.get() != null? RequestCycle.get().find(AjaxRequestTarget.class) != null : false;