From 9a7bf3693ce5c93313e5f46017bef45b2f8547a3 Mon Sep 17 00:00:00 2001 From: Tom Fulton Date: Sat, 11 Jan 2014 22:17:12 -0700 Subject: [PATCH 01/31] Add package:nuget task * Add grunt-nuget * Add nuspec file * Add build task --- .gitignore | 4 +++- Gruntfile.js | 9 +++++++++ build/nuget/package.nuspec | 18 ++++++++++++++++++ package.json | 3 ++- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 build/nuget/package.nuspec diff --git a/.gitignore b/.gitignore index a02f08f..5683196 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ Desktop.ini $RECYCLE.BIN/ dist/ -node_modules/ \ No newline at end of file +node_modules/ + +build/*.nupkg \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index b727420..4e0e726 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -64,6 +64,13 @@ module.exports = function(grunt) { } }, + nugetpack: { + dist: { + src: 'build/nuget/package.nuspec', + dest: 'build' + } + }, + clean: ['<%= dest %>'] }); @@ -75,8 +82,10 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-nuget'); + grunt.registerTask('package:nuget', ['default', ' nugetpack']); grunt.registerTask('css:build', ['less']); grunt.registerTask('js:build', ['concat']); grunt.registerTask('default', ['clean', 'css:build', 'js:build', 'copy']); diff --git a/build/nuget/package.nuspec b/build/nuget/package.nuspec new file mode 100644 index 0000000..e6a9720 --- /dev/null +++ b/build/nuget/package.nuspec @@ -0,0 +1,18 @@ + + + + Archetype + 0.0.0.0 + Archetype + imulus, tomfulton + imulus, tomfulton + http://github.com/imulus/archetype + + umbraco + http://github.com/imulus/archetype/raw/master/assets/logo.png + http://www.opensource.org/licenses/mit-license.php + + + + + \ No newline at end of file diff --git a/package.json b/package.json index 209ff87..ec424d9 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "grunt-contrib-watch": "~0.5.3", "grunt-contrib-jshint": "~0.7.2", "grunt-cli": "~0.1.11", - "grunt-contrib-clean": "~0.5.0" + "grunt-contrib-clean": "~0.5.0", + "grunt-nuget": "~0.1.1" } } From eafd2d454ce773ca16cf1ff0a58f257da8d0cfcb Mon Sep 17 00:00:00 2001 From: Tom Fulton Date: Sun, 12 Jan 2014 01:12:50 -0700 Subject: [PATCH 02/31] Inject package version, files into nuspec on build * Move /build/ -> /pkg/ * Add nuspec * Refactor package:nuget workflow to create a temporary directory to build the package from - so we can store the transformed file * Add grunt-template task to transform the nuspec --- .gitignore | 3 ++- Gruntfile.js | 34 +++++++++++++++++++++++++---- package.json | 3 ++- {build => pkg}/nuget/package.nuspec | 6 +++-- 4 files changed, 38 insertions(+), 8 deletions(-) rename {build => pkg}/nuget/package.nuspec (76%) diff --git a/.gitignore b/.gitignore index 5683196..0963175 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ $RECYCLE.BIN/ dist/ node_modules/ -build/*.nupkg \ No newline at end of file +pkg/tmp/ +pkg/*.nupkg \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 4e0e726..4410baf 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,6 +2,9 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), dest: 'dist', + version: '0.0.0', + package_dir: 'pkg', + package_temp_dir: '<%= package_dir %>/tmp/', watch: { less: { @@ -37,6 +40,11 @@ module.exports = function(grunt) { {expand: true, src: ['app/package.manifest'], dest: '<%= dest %>', flatten: true}, {expand: true, src: ['app/views/archetype.html'], dest: '<%= dest %>/views', flatten: true} ] + }, + nuget_prepare: { + files: [ + {expand: true, cwd: '<%= dest %>/', src: ['**'], dest: '<%= package_temp_dir %>/nuget/content/', flatten: false}, + ] } }, @@ -66,12 +74,29 @@ module.exports = function(grunt) { nugetpack: { dist: { - src: 'build/nuget/package.nuspec', - dest: 'build' + src: '<%= package_temp_dir %>/nuget/package.nuspec', + dest: '<%= package_dir %>' } }, - clean: ['<%= dest %>'] + template: { + 'nuget_manifest': { + 'options': { + 'data': { + version: '<%= version %>', + files: [{ path: '..\\..\\..\\<%= dest %>\\**', target: 'content\\App_Plugins\\Archetype'}] + } + }, + 'files': { + '<%= package_temp_dir %>/nuget/package.nuspec': ['<%= package_dir %>/nuget/package.nuspec'] + } + } + }, + + clean: { + build: ['<%= dest %>'], + package_temp: ['<%= package_temp_dir %>'] + } }); @@ -83,9 +108,10 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-nuget'); + grunt.loadNpmTasks('grunt-template'); - grunt.registerTask('package:nuget', ['default', ' nugetpack']); + grunt.registerTask('package:nuget', ['default', 'clean:package_temp', 'copy:nuget_prepare', 'template:nuget_manifest', 'nugetpack', 'clean:package_temp']); grunt.registerTask('css:build', ['less']); grunt.registerTask('js:build', ['concat']); grunt.registerTask('default', ['clean', 'css:build', 'js:build', 'copy']); diff --git a/package.json b/package.json index ec424d9..547e799 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "grunt-contrib-jshint": "~0.7.2", "grunt-cli": "~0.1.11", "grunt-contrib-clean": "~0.5.0", - "grunt-nuget": "~0.1.1" + "grunt-nuget": "~0.1.1", + "grunt-template": "~0.2.2" } } diff --git a/build/nuget/package.nuspec b/pkg/nuget/package.nuspec similarity index 76% rename from build/nuget/package.nuspec rename to pkg/nuget/package.nuspec index e6a9720..e5143cc 100644 --- a/build/nuget/package.nuspec +++ b/pkg/nuget/package.nuspec @@ -2,7 +2,7 @@ Archetype - 0.0.0.0 + <%= version %> Archetype imulus, tomfulton imulus, tomfulton @@ -13,6 +13,8 @@ http://www.opensource.org/licenses/mit-license.php - + <% for (var file in files) { %> + + <% } %> \ No newline at end of file From 475f9fc62c9b7fd92bfc03e9e47348288d9405f0 Mon Sep 17 00:00:00 2001 From: Kevin Giszewski Date: Tue, 14 Jan 2014 12:10:17 -0500 Subject: [PATCH 03/31] Include extra js --- Gruntfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 9f1c3d4..e9f6d4f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -56,6 +56,7 @@ module.exports = function(grunt) { application: { src: [ 'app/controllers/controller.js', + 'app/controllers/config.controller.js', 'app/directives/archetypeproperty.js' ], dest: '<%= dest %>/js/archetype.js' @@ -66,7 +67,7 @@ module.exports = function(grunt) { build: { files: [ {expand: true, cwd: 'app/', src: ['package.manifest'], dest: '<%= dest %>', flatten: true}, - {expand: true, cwd: 'app/views/', src: ['archetype.html'], dest: '<%= dest %>/views', flatten: true} + {expand: true, cwd: 'app/views/', src: ['archetype.html', 'archetype.config.html'], dest: '<%= dest %>/views', flatten: true} ] }, deploy: { From 908df13626f57064ece693518e24489f6ee18e8c Mon Sep 17 00:00:00 2001 From: Kevin Giszewski Date: Tue, 14 Jan 2014 12:10:26 -0500 Subject: [PATCH 04/31] Begin WIP on config GUI --- app/controllers/config.controller.js | 119 +++++++++++++++++++++++++++ app/controllers/controller.js | 6 +- app/package.manifest | 17 +++- app/views/archetype.config.html | 59 +++++++++++++ 4 files changed, 196 insertions(+), 5 deletions(-) create mode 100644 app/controllers/config.controller.js create mode 100644 app/views/archetype.config.html diff --git a/app/controllers/config.controller.js b/app/controllers/config.controller.js new file mode 100644 index 0000000..83736ea --- /dev/null +++ b/app/controllers/config.controller.js @@ -0,0 +1,119 @@ +angular.module("umbraco").controller("Imulus.ArchetypeConfigController", function ($scope, $http, assetsService) { + + //$scope.model.value = ""; + + var defaultFieldsetConfigModel = ""; + + $scope.model.value = $scope.model.value || defaultFieldsetConfigModel; + + initConfigRenderModel(); + + $scope.sortableOptions = { + axis: 'y', + cursor: "move", + handle: ".handle", + update: function (ev, ui) { + + }, + stop: function (ev, ui) { + + } + }; + + //helpers + $scope.archetypeConfigRenderModel.toString = stringify; + setConfigPropertyToString(); + + //encapsulate stringify (should be built into browsers, not sure of IE support) + function stringify() { + return JSON.stringify(this); + } + + function setConfigPropertyToString() + { + for(var i in $scope.archetypeConfigRenderModel.fieldsets) + { + for(var j in $scope.archetypeConfigRenderModel.fieldsets[i].properties) + { + $scope.archetypeConfigRenderModel.fieldsets[i].properties[j].config.toString = stringify; + } + } + } + + //watch for changes + $scope.$watch('archetypeConfigRenderModel', function (v) { + //console.log(v); + if (typeof v === 'string') { + $scope.archetypeConfigRenderModel = JSON.parse(v); + $scope.archetypeConfigRenderModel.toString = stringify; + } + + for(var i in $scope.archetypeConfigRenderModel.fieldsets) + { + for(var j in $scope.archetypeConfigRenderModel.fieldsets[i].properties) + { + if(typeof $scope.archetypeConfigRenderModel.fieldsets[i].properties[j].config === 'string') + { + $scope.archetypeConfigRenderModel.fieldsets[i].properties[j].config = JSON.parse($scope.archetypeConfigRenderModel.fieldsets[i].properties[j].config); + $scope.archetypeConfigRenderModel.fieldsets[i].properties[j].config.toString = stringify; + } + } + } + }, true); + + //helper that returns if an item can be removed + $scope.canRemove = function () + { + return countVisible() > 1; + } + + //helper that returns if an item can be sorted + $scope.canSort = function () + { + return countVisible() > 1; + } + + //helper to count what is visible + function countVisible() + { + var count = 0; + + for (var i in $scope.archetypeConfigRenderModel.fieldsets) { + if ($scope.archetypeConfigRenderModel.fieldsets[i].remove == false) { + count++; + } + } + + return count; + } + + //helper to ini the render model + function initConfigRenderModel() + { + $scope.archetypeConfigRenderModel = {}; + $scope.archetypeConfigRenderModel.fieldsets = []; + $scope.archetypeConfigRenderModel.fieldsets = $scope.model.value; + + for(var i in $scope.archetypeConfigRenderModel.fieldsets) + { + $scope.archetypeConfigRenderModel.fieldsets[i].remove = false; + } + } + + //sync things up on save + $scope.$on("formSubmitting", function (ev, args) { + syncModelToRenderModel(); + }); + + //helper to sync the model to the renderModel + function syncModelToRenderModel() + { + $scope.model.value = []; + + for (var i in $scope.archetypeConfigRenderModel.fieldsets) { + if (!$scope.archetypeConfigRenderModel.fieldsets[i].remove) { + $scope.model.value.push($scope.archetypeConfigRenderModel.fieldsets[i]); + } + } + } +}); diff --git a/app/controllers/controller.js b/app/controllers/controller.js index d475c57..b62cb21 100644 --- a/app/controllers/controller.js +++ b/app/controllers/controller.js @@ -7,7 +7,9 @@ //validate the user configs $scope.model.config.defaultModel = getValidJson("$scope.model.config.defaultModel", $scope.model.config.defaultModel); - $scope.model.config.fieldsetModels = getValidJson("$scope.model.config.fieldsetModels", $scope.model.config.fieldsetModels); + $scope.model.config.fieldsetModels = $scope.model.config.archetypeConfig; + + console.log($scope.model.config.archetypeConfig); $scope.model.value = $scope.model.value || ($scope.model.config.defaultModel || { fieldsets: [getEmptyRenderItem($scope.model.config.fieldsetModels[0])] }); @@ -126,7 +128,7 @@ //watch for changes $scope.$watch('archetypeRenderModel', function (v) { if ($scope.model.config.developerMode) { - //console.log(v); + console.log(v); if (typeof v === 'string') { $scope.archetypeRenderModel = JSON.parse(v); $scope.archetypeRenderModel.toString = stringify; diff --git a/app/package.manifest b/app/package.manifest index 2a6744d..ebb311e 100644 --- a/app/package.manifest +++ b/app/package.manifest @@ -1,14 +1,25 @@ { - propertyEditors: [ + propertyEditors: [ { alias: "Imulus.Archetype", name: "Imulus Archetype", editor: { view: "~/App_Plugins/Imulus.Archetype/views/archetype.html", valueType: "JSON" - }, + }, prevalues: { - fields: [ + fields: [ + { + label: "Config", + description: "(Required) Define the fieldset models.", + key: "archetypeConfig", + view: "/App_Plugins/Imulus.Archetype/views/archetype.config.html", + validation: [ + { + type: "Required" + } + ] + }, { label: "Empty Fieldset Models", description: "(Required) Define your fieldset models?", diff --git a/app/views/archetype.config.html b/app/views/archetype.config.html new file mode 100644 index 0000000..8e6f778 --- /dev/null +++ b/app/views/archetype.config.html @@ -0,0 +1,59 @@ +
+
    +
  • +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + +
    + + + +
    +
    +
      +
    • +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      + + +
    • +
    +
    +
    +
  • +
+ +
From af014fbf4326f17418c0bac8d9cb573e452f303f Mon Sep 17 00:00:00 2001 From: Kevin Giszewski Date: Tue, 14 Jan 2014 13:51:23 -0500 Subject: [PATCH 05/31] Ongoing WIP --- app/controllers/config.controller.js | 3 ++ app/less/archetype.less | 54 ++++++++++++++++++++++++++++ app/views/archetype.config.html | 21 ++++++----- 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/app/controllers/config.controller.js b/app/controllers/config.controller.js index 83736ea..cf9d3bd 100644 --- a/app/controllers/config.controller.js +++ b/app/controllers/config.controller.js @@ -116,4 +116,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio } } } + + //archetype css + assetsService.loadCss("/App_Plugins/Imulus.Archetype/css/archetype.css"); }); diff --git a/app/less/archetype.less b/app/less/archetype.less index 7329433..dc6ba12 100644 --- a/app/less/archetype.less +++ b/app/less/archetype.less @@ -76,4 +76,58 @@ clear:both; margin-bottom: 3px; font-size: 12px; +} + +.archetypeConfig { + +} + +.archetypeConfig ul{ + list-style: none; +} + +.archetypeConfig .archetypeEditorControls{ + float: right; +} + +.archetypeConfig li{ + background-color: #fff; +} + +.archetypeConfig label{ + width: 100px; +} + +.archetypeConfig .archetypeFieldsetWrapper{ + border: 1px solid #ccc; + padding: 10px 5px; + margin-bottom: 10px; +} + +.archetypeConfig .archetypeDeveloperModel { + width: 98%; + height: 100px; +} + +.archetypeConfig .archetypePropertiesWrapper{ + border: 1px solid #ddd; + padding: 10px; + margin: 10px; + margin-left: 50px; + width: 60%; +} + +.archetypeConfig .archetypePropertiesWrapper ul{ + padding: 0; + margin: 0; +} + +.archetypeConfig .archetypePropertiesWrapper li{ + padding: 10px; + margin-bottom: 10px; + background-color: #eee; +} + +.archetypeConfig .archetypePropertiesWrapper li:last-child{ + margin-bottom: 0; } \ No newline at end of file diff --git a/app/views/archetype.config.html b/app/views/archetype.config.html index 8e6f778..87e3e53 100644 --- a/app/views/archetype.config.html +++ b/app/views/archetype.config.html @@ -2,6 +2,11 @@