You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2018/08/20 20:47:21 UTC

[sling-org-apache-sling-app-cms] branch master updated: Significantly improving the UI for the content tables and fixing issues with the FED code build

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git


The following commit(s) were added to refs/heads/master by this push:
     new c223217  Significantly improving the UI for the content tables and fixing issues with the FED code build
c223217 is described below

commit c22321751265bd5833292e49415da20917fa61a7
Author: Dan Klco <dk...@apache.org>
AuthorDate: Mon Aug 20 16:47:14 2018 -0400

    Significantly improving the UI for the content tables and fixing issues
    with the FED code build
---
 .../components/general/search/pagination.jsp       |  3 +-
 ui/src/main/frontend/gulpfile.js                   | 69 ++++++++++------------
 ui/src/main/frontend/package.json                  |  5 +-
 ui/src/main/frontend/src/js/scripts.js             | 32 ++++++----
 ui/src/main/frontend/src/scss/styles.scss          | 40 +++++++++++--
 .../components/cms/columns/actions/actions.jsp     |  2 +-
 .../cms/columns/lastmodified/lastmodified.jsp      |  3 +-
 .../cms/contentactions/contentactions.jsp          | 10 +++-
 .../cms/contentbreadcrumb/contentbreadcrumb.jsp    |  2 +-
 .../components/cms/contenttable/contenttable.jsp   | 11 +++-
 .../libs/sling-cms/components/pages/base/body.jsp  |  2 +-
 .../sling-cms/components/pages/base/scripts.jsp    |  2 +-
 .../jcr_root/libs/sling-cms/content/start.json     |  1 +
 13 files changed, 115 insertions(+), 67 deletions(-)

diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/pagination.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/pagination.jsp
index e3164ad..f7bf5fb 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/pagination.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/pagination.jsp
@@ -17,6 +17,7 @@
  * under the License.
  */ --%>
 <%@include file="/libs/sling-cms/global.jsp"%>
+<c:set var="pageParam" value="${not empty param.q ? param.q : '1'}" />
 <nav>
 	<ul class="${searchConfig.valueMap.paginationClass}">
 		<c:choose>
@@ -34,7 +35,7 @@
 			</c:otherwise>
 		</c:choose>
 		<c:forEach var="page" items="${search.pages}">
-			<li class="${searchConfig.valueMap.pageItemClass}${page == param.page ? ' active' : ''}">
+			<li class="${searchConfig.valueMap.pageItemClass}${page == pageParam ? ' active' : ''}">
 				<a href="?q=${sling:encode(search.term,'HTML_ATTR')}&page=${page}" class="${searchConfig.valueMap.pageLinkClass}${page == param.page ? ' active' : ''}">
 					${page}
 				</a>
diff --git a/ui/src/main/frontend/gulpfile.js b/ui/src/main/frontend/gulpfile.js
index 9131361..d91f431 100755
--- a/ui/src/main/frontend/gulpfile.js
+++ b/ui/src/main/frontend/gulpfile.js
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-const gulp        = require('gulp');
-const sass        = require('gulp-sass');
-const header      = require('gulp-header');
-const cleanCSS   = require('gulp-clean-css');
-var concatCss = require('gulp-concat-css');
+var gulp        = require('gulp');
+var sass        = require('gulp-sass');
+var header      = require('gulp-header');
+var cleanCSS   = require('gulp-clean-css');
 var concat = require('gulp-concat');
 var rename = require('gulp-rename');
 var uglify = require('gulp-uglify');
-let sourcemaps = require('gulp-sourcemaps');
-var merge = require('merge-stream');
-var order = require("gulp-order");
+var sourcemaps = require('gulp-sourcemaps');
+var streamqueue = require('streamqueue');
+var saveLicense = require('uglify-save-license');
+
 
 const apache2License = [
 '/*',
@@ -46,44 +46,37 @@ const apache2License = [
 ''
 ].join('\n');
 
-var scssStream = gulp.src('./src/scss/*.scss')
-	.pipe(sass().on('error', sass.logError))
-	.pipe(concat('scss-files.scss'))
-    .pipe(sourcemaps.init())
-    .pipe(cleanCSS())
-    .pipe(header(apache2License));
-
-var cssStream = gulp.src('./node_modules/summernote/dist/summernote-lite.css');
-
 gulp.task('styles', function() {
-	 var mergedStream = merge(cssStream, scssStream)
+	 return streamqueue ({objectMode: true},
+			 gulp.src('./src/scss/*.scss')
+				.pipe(sass().on('error', sass.logError))
+				.pipe(concat('scss-files.scss'))
+			    .pipe(sourcemaps.init())
+			    .pipe(cleanCSS())
+			    .pipe(header(apache2License)),
+			 gulp.src('./node_modules/summernote/dist/summernote-lite.css')
+			    .pipe(cleanCSS())
+	 	)
      	.pipe(concat('styles.min.css'))
         .pipe(gulp.dest('./dist/jcr_root/static/clientlibs/sling-cms/css'))
 	 	.pipe(rename('bundle.css'))
 	 	.pipe(gulp.dest('./dist/jcr_root/content/starter/css'));
-	 return mergedStream;
 });
 
-var vendorJSStream = gulp.src([
-	'./node_modules/jquery/dist/jquery.min.js',
-	'./node_modules/handlebars/dist/handlebars.min.js',
-	'./node_modules/summernote/dist/summernote-lite.js']);
-
-var jsStream = gulp.src([
-		'./src/js/scripts.js'
-	])
-	.pipe(uglify())
-    .pipe(header(apache2License));
-
 gulp.task('js', function() {
-	var mergedStream = merge(jsStream, vendorJSStream)
-		.pipe(order([
-			'node_modules/jquery/**/*.js',
-			'node_modules/handlebars/**/*.js',
-			'node_modules/summernote/**/*.js',
-			'src/js/*.js',
-		]))
-		.pipe(concat('scripts.min.js'))
+	return gulp.src([
+			'./node_modules/jquery/dist/jquery.js',
+			'./node_modules/handlebars/dist/handlebars.js',
+			'./node_modules/summernote/dist/summernote-lite.js',
+			'./src/js/scripts.js'
+		])
+		.pipe(uglify({
+            output: {
+                comments: saveLicense
+            }
+        }))
+ 		.pipe(concat('scripts-all.min.js'))
+	    .pipe(header(apache2License))
 		.pipe(gulp.dest('./dist/jcr_root/static/clientlibs/sling-cms/js'));
 });
 
diff --git a/ui/src/main/frontend/package.json b/ui/src/main/frontend/package.json
index 5f51579..10a85f8 100644
--- a/ui/src/main/frontend/package.json
+++ b/ui/src/main/frontend/package.json
@@ -16,13 +16,12 @@
     "gulp-concat": "^2.6.1",
     "gulp-rename": "^1.2.2",
     "gulp-uglify": "^3.0.0",
-    "gulp-concat-css": "^3.0.0",
     "gulp-header": "^1.8.9",
     "gulp-clean-css": "^3.9.2",
     "gulp-sass": "^3.1.0",
     "gulp-sourcemaps": "^2.6.4",
-    "merge-stream": "^1.0.1",
-    "gulp-order": "^1.1.1"
+    "streamqueue": "^1.1.2",
+    "uglify-save-license": "^0.4.1"
   },
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1"
diff --git a/ui/src/main/frontend/src/js/scripts.js b/ui/src/main/frontend/src/js/scripts.js
index 13c65ed..df8ba02 100644
--- a/ui/src/main/frontend/src/js/scripts.js
+++ b/ui/src/main/frontend/src/js/scripts.js
@@ -81,7 +81,7 @@ Sling.CMS = {
 			    return data;
 			}
 		}
-	}
+	};
 
 	//support links which fetch HTML and display a modal
 	Sling.CMS.ext['fetch-modal'] = {
@@ -95,7 +95,7 @@ Sling.CMS = {
 				return false;
 			});
 		}
-	}
+	};
 
 	Sling.CMS.ext['ajaxform'] = {
 		decorate: function($ctx){
@@ -208,7 +208,9 @@ Sling.CMS = {
 				    			valb = $.trim($elb.text()).toLowerCase();
 				    		}
 				    		$h.data('sort-status', sortStatus * -1);
-				        return vala.localeCompare(valb) * sortStatus;
+				        return vala.localeCompare(valb, {
+				        	numeric: true
+				        }) * sortStatus;
 				    });
 				    for (var i = 0; i < list.length; i++) {
 				        list[i].parentNode.appendChild(list[i]);
@@ -216,7 +218,7 @@ Sling.CMS = {
 				});
 			});
 		}
-	}
+	};
 
 	Sling.CMS.ext['fetch-json'] = {
 		decorate: function($ctx) {
@@ -230,7 +232,7 @@ Sling.CMS = {
 				});
 			});
 		}
-	}
+	};
 
 	Sling.CMS.ext['includeconfig'] = {
 		decorate: function($ctx){
@@ -283,7 +285,7 @@ Sling.CMS = {
 				});
 			});
 		}
-	}
+	};
 
 	Sling.CMS.ext['repeating'] = {
 		decorate: function($ctx){
@@ -329,9 +331,19 @@ Sling.CMS = {
 			}).on('summernote.keydown', function(we, e) {
 				  console.log('Key is downed:', e.keyCode);
 			});
-;
 		}
-	}
+	};
+	
+	Sling.CMS.ext['table'] = {
+		decorate: function($ctx) {
+			$ctx.find('table tr').click(function(el){
+				$('#Actions-Target *').appendTo('tr.active .Cell-Actions')
+				$('tr').removeClass('active');
+				$(this).addClass('active');
+				$(this).find('.Cell-Actions *').appendTo('#Actions-Target')
+			});
+		}
+	};
 
 	Sling.CMS.ext['taxonomy'] = {
 		decorate: function($ctx){
@@ -374,7 +386,7 @@ Sling.CMS = {
 				$($(this).data('target')).toggleClass('Hide');
 			});
 		}
-	}
+	};
 	
 	Sling.CMS.ext['toggle-value'] = {
 		decorate: function($ctx) {
@@ -389,7 +401,7 @@ Sling.CMS = {
 				});
 			})
 		}
-	}
+	};
 
 	$(document).ready(function() {
 		Sling.CMS.init();
diff --git a/ui/src/main/frontend/src/scss/styles.scss b/ui/src/main/frontend/src/scss/styles.scss
index 07cdca7..516cf16 100644
--- a/ui/src/main/frontend/src/scss/styles.scss
+++ b/ui/src/main/frontend/src/scss/styles.scss
@@ -45,15 +45,20 @@ ul.Breadcrumb  {
 	content: "";
 }
 
- .Checkbox-Label {
- 	width:100%;
- 	display:block;
- }
+.Checkbox-Label {
+	width:100%;
+	display:block;
+}
 
 .Cell-Pad {
-	padding: 1em;
+	padding: 4em 1em 1em 1em;
 }
 
+.Col-id {
+	width: 2em;
+}
+
+
 .Editor-Page  {
 	background-color: white;
 }
@@ -166,6 +171,29 @@ thead {
 	color: white;
 }
 
-tbody tr:hover {
+tbody tr:hover, tbody tr.active {
 	background-color: lightgray;
+}
+
+@media (min-width: 62em) { 
+
+	.Col-lastModified {
+		width: 13em;
+	}
+
+	.Col-published {
+		width: 6em;
+	}
+
+	.Col-type {
+		width: 4em;
+	}
+		
+	.Content-Actions {
+		background-color: #ccc;
+		padding: .5em;
+		position: fixed;
+		top: 0px;
+		width: 100%;
+	}
 }
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/actions/actions.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/actions/actions.jsp
index edc394a..4504a31 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/actions/actions.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/actions/actions.jsp
@@ -17,7 +17,7 @@
  * under the License.
  */ --%>
 <%@include file="/libs/sling-cms/global.jsp"%>
-<td class="Cell-Actions">
+<td class="Cell-Actions Hide">
 	<c:forEach var="actionConfig" items="${sling:listChildren(colConfig)}">
 		<c:choose>
 			<c:when test="${actionConfig.valueMap.modal}">
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/lastmodified/lastmodified.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/lastmodified/lastmodified.jsp
index cea0ce6..7237015 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/lastmodified/lastmodified.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/lastmodified/lastmodified.jsp
@@ -20,7 +20,8 @@
 <c:set var="modifiedProperty" value="${colConfig.valueMap.subPath}jcr:lastModified" />
 <c:set var="modifiedByProperty" value="${colConfig.valueMap.subPath}jcr:lastModifiedBy" />
 <fmt:formatDate var="lastModified" type = "both"  dateStyle = "medium" timeStyle = "medium" value="${resource.valueMap[modifiedProperty].time}" />
-<td class="Cell-Static" title="${sling:encode(colValue,'HTML_ATTR')}" data-value="${resource.valueMap[modifiedProperty].time.time}">
+<c:set var="colValue" value="${lastModified} - ${resource.valueMap[modifiedByProperty]}" />
+<td class="Cell-Static" title="${sling:encode(colValue,'HTML_ATTR')}">
 	<sling:encode value="${lastModified}" mode="HTML" /><br/>
 	<sling:encode value="${resource.valueMap[modifiedByProperty]}" mode="HTML" />
 </td>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentactions/contentactions.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentactions/contentactions.jsp
index bf384ce..7558810 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentactions/contentactions.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentactions/contentactions.jsp
@@ -17,6 +17,10 @@
  * under the License.
  */ --%>
  <%@include file="/libs/sling-cms/global.jsp"%>
- <c:forEach var="action" items="${sling:listChildren(sling:getRelativeResource(resource,'actions'))}" varStatus="status">
- 	<c:if test="${!status.first}"> | </c:if><a class="Button Fetch-Modal" data-title="Add ${action.valueMap.label}" data-path=".Main-Content form" href="${action.valueMap.prefix}${slingRequest.requestPathInfo.suffix}">+ ${action.valueMap.label}</a>
- </c:forEach>
\ No newline at end of file
+ <div class="Content-Actions">
+	 <c:forEach var="action" items="${sling:listChildren(sling:getRelativeResource(resource,'actions'))}" varStatus="status">
+	 	<c:if test="${!status.first}"> | </c:if><a class="Button Fetch-Modal" data-title="Add ${action.valueMap.label}" data-path=".Main-Content form" href="${action.valueMap.prefix}${slingRequest.requestPathInfo.suffix}">+ ${action.valueMap.label}</a>
+	 </c:forEach>
+	 <span id="Actions-Target">
+	 </span>
+ </div>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp
index 5bc7d95..6f483fe 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp
@@ -40,7 +40,7 @@
 	</c:if>
 	<li class="Pull-Right">
 		<form method="get" class="content-filter">
-			<label for="filter" class="hide">Filter</label>
+			<label for="filter" class="Hide">Filter</label>
 			<input type="text" placeholder="Filter..." />
 		</form>
 	</li>
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp
index bef9eb8..9b4d233 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp
@@ -20,8 +20,12 @@
 <table class="sortable">
 	<thead>
 		<tr>
+			<th class="sortable__header Col-id" data-attribute="id">
+				#
+				<span class="sortable__indicator"></span>
+			</th>
 			<c:forEach var="column" items="${sling:listChildren(sling:getRelativeResource(resource,'columns'))}">
-				<th class="sortable__header" data-attribute="${column.name}">
+				<th class="${column.name == 'actions' ? 'Hide' : '' } sortable__header Col-${column.name}" data-attribute="${column.name}">
 					<sling:encode value="${column.valueMap.title}" mode="HTML" />
 					<span class="sortable__indicator"></span>
 				</th>
@@ -30,10 +34,14 @@
 	</thead>
 	<tbody>
 		<c:set var="parentPath" value="${slingRequest.requestPathInfo.suffix}${not empty properties.appendSuffix ? properties.appendSuffix : ''}" />
+		<c:set var="count" value="1" />
 		<c:forEach var="child" items="${sling:listChildren(sling:getResource(resourceResolver, parentPath))}">
 			<sling:getResource var="typeConfig" base="${resource}" path="types/${child.valueMap['jcr:primaryType']}" />
 			<c:if test="${typeConfig != null && !fn:contains(child.name,':')}">
 				<tr class="sortable__row" data-resource="${child.path}" data-type="${typeConfig.path}">
+					<td class="Cell-Static" title="# ${status.index + 1}}" data-sort-value="<fmt:formatNumber pattern="0000" value="${count}" />">
+						${count}
+					</td>
 					<c:forEach var="column" items="${sling:listChildren(sling:getRelativeResource(typeConfig,'columns'))}">
 						<c:set var="configPath" value="columns/${column.name}"/>
 						<c:set var="colConfig" value="${sling:getRelativeResource(typeConfig,configPath)}" scope="request" />
@@ -42,6 +50,7 @@
 						</c:if>
 					</c:forEach>
 				</tr>
+				<c:set var="count" value="${count + 1}" />
 			</c:if>
 		</c:forEach> 
 	</tbody>
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/body.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/body.jsp
index 7908412..e3e0d19 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/body.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/body.jsp
@@ -24,7 +24,7 @@
 			<sling:call script="nav.jsp" />
 		</nav>
 		<div class="Cell Small-5"></div>
-		<div class="Cell Main-Content Align-Center">
+		<div class="Cell Main-Content ${properties.center ? 'Align-Center' : '' }">
 			<div class="Grid">
 				<main class="Cell Cell-Pad Small-100">
 					<sling:call script="content.jsp" />
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp
index 93ec702..fe2c77c 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp
@@ -17,4 +17,4 @@
  * under the License.
  */ --%>
  <%@include file="/libs/sling-cms/global.jsp"%>
-<script src="/static/clientlibs/sling-cms/js/scripts.min.js"></script>
\ No newline at end of file
+<script src="/static/clientlibs/sling-cms/js/scripts-all.min.js"></script>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
index aac49ac..06f0d40 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
@@ -6,6 +6,7 @@
 		"jcr:primaryType": "nt:unstructured",
 		"sling:vanityPath": "/cms",
 		"sling:redirect": true,
+		"center": true,
 		"container": {
 			"jcr:primaryType": "nt:unstructured",
 			"sling:resourceType": "sling-cms/components/general/container",