diff --git a/.gitignore b/.gitignore index 1bb174e..aab6533 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,9 @@ tmp/ pkg/*.nupkg pkg/*.zip +*_versioned* + + [Dd]ebug/ [Bb]uild/ [Rr]elease/ diff --git a/Gruntfile.js b/Gruntfile.js index 679fc20..5c10764 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,13 +1,41 @@ module.exports = function(grunt) { require('load-grunt-tasks')(grunt); - var path = require('path') - + var path = require('path'); + + grunt.loadNpmTasks('grunt-string-replace'); + grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), pkgMeta: grunt.file.readJSON('config/meta.json'), dest: grunt.option('target') || 'dist', basePath: path.join('<%= dest %>', 'App_Plugins', '<%= pkgMeta.name %>'), + 'string-replace': { + version: { + files: { + "app/controllers/controller_versioned.js": "app/controllers/controller.js", + "app/less/archetype_versioned.less": "app/less/archetype.less", + "app/views/archetype.config.developer.dialog_versioned.html": "app/views/archetype.config.developer.dialog.html", + "app/views/archetype.config.stylescript.dialog_versioned.html": "app/views/archetype.config.stylescript.dialog.html", + "app/views/archetype.config.fieldset.dialog_versioned.html": "app/views/archetype.config.fieldset.dialog.html", + "app/views/archetype.config_versioned.html": "app/views/archetype.config.html", + "app/views/archetype_versioned.html": "app/views/archetype.html", + "app/views/archetype.default_versioned.html": "app/views/archetype.default.html", + + }, + options: { + replacements: [{ + pattern: /{{VERSION}}/g, + replacement: '/* Version <%= pkgMeta.version %> */' + }, + { + pattern: /{{VERSION_HTML}}/g, + replacement: '' + }] + } + } + }, + watch: { options: { spawn: false, @@ -16,7 +44,7 @@ module.exports = function(grunt) { less: { files: ['app/**/*.less'], - tasks: ['less:dist'] + tasks: ['string-replace', 'less:dist'] }, js: { @@ -41,7 +69,7 @@ module.exports = function(grunt) { paths: ["app/less", "lib/less", "vendor"], }, files: { - '<%= basePath %>/css/archetype.css': 'app/less/archetype.less', + '<%= basePath %>/css/archetype.css': 'app/less/archetype_versioned.less', } } }, @@ -52,8 +80,9 @@ module.exports = function(grunt) { }, dist: { src: [ - 'app/controllers/controller.js', + 'app/controllers/controller_versioned.js', 'app/controllers/config.controller.js', + 'app/controllers/config.dialog.controller.js', 'app/directives/archetypeproperty.js', 'app/directives/archetypesubmitwatcher.js', 'app/directives/archetypecustomview.js', @@ -73,8 +102,24 @@ module.exports = function(grunt) { copy: { html: { cwd: 'app/views/', - src: ['archetype.html', 'archetype.default.html', 'archetype.config.html'], - dest: '<%= basePath %>/views', + src: [ + 'archetype_versioned.html', + 'archetype.default_versioned.html', + 'archetype.config_versioned.html', + 'archetype.config.fieldset.dialog_versioned.html', + 'archetype.config.stylescript.dialog_versioned.html', + 'archetype.config.developer.dialog_versioned.html' + ], + dest: '<%= basePath %>/views/', + expand: true, + rename: function(dest, src) { + return dest + src.replace('_versioned',''); + } + }, + assets: { + cwd: 'assets/', + src: ['logo_50.png'], + dest: '<%= basePath %>/assets', expand: true }, dll: { @@ -214,7 +259,7 @@ module.exports = function(grunt) { }); - grunt.registerTask('default', ['clean', 'less', 'concat', 'assemblyinfo', 'msbuild:dist', 'copy:dll', 'copy:config', 'copy:html']); + grunt.registerTask('default', ['clean', 'string-replace', 'less', 'concat', 'assemblyinfo', 'msbuild:dist', 'copy:dll', 'copy:assets', 'copy:config', 'copy:html']); grunt.registerTask('nuget', ['clean:tmp', 'default', 'copy:nuget', 'template:nuspec', 'nugetpack', 'clean:tmp']); grunt.registerTask('umbraco', ['clean:tmp', 'default', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']); diff --git a/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs b/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs index 75d3003..ba2816a 100644 --- a/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs +++ b/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs @@ -1,16 +1,16 @@ using System.Collections.Generic; using System; +using System.Diagnostics; using System.Linq; using System.Net; +using System.Reflection; using System.Web.Http; using AutoMapper; using Umbraco.Core.Models; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Web.Editors; -using Umbraco.Core.PropertyEditors; using Archetype.Extensions; -using Newtonsoft.Json; namespace Archetype.Api { @@ -53,5 +53,18 @@ namespace Archetype.Api var dataTypeDisplay = Mapper.Map(dataType); return new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues, contentTypeAlias = contentTypeAlias, propertyTypeAlias = propertyTypeAlias, archetypeAlias = archetypeAlias, nodeId = nodeId }; } + + public object GetDllVersion() + { + return new {dllVersion = _version()}; + } + + private string _version() + { + var asm = Assembly.GetExecutingAssembly(); + var fvi = FileVersionInfo.GetVersionInfo(asm.Location); + + return fvi.FileVersion; + } } } diff --git a/app/Umbraco/Umbraco.Archetype/Properties/VersionInfo.cs b/app/Umbraco/Umbraco.Archetype/Properties/VersionInfo.cs index c3f9401..34b1003 100644 --- a/app/Umbraco/Umbraco.Archetype/Properties/VersionInfo.cs +++ b/app/Umbraco/Umbraco.Archetype/Properties/VersionInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.11")] +[assembly: AssemblyFileVersion("1.11")] diff --git a/app/controllers/config.controller.js b/app/controllers/config.controller.js index 00d5826..615d45e 100644 --- a/app/controllers/config.controller.js +++ b/app/controllers/config.controller.js @@ -11,6 +11,12 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio //ini the model $scope.model.value = $scope.model.value || defaultFieldsetConfigModel; + $scope.dllVersion = ""; + + archetypePropertyEditorResource.getDllVersion().then(function(data){ + $scope.dllVersion = data.dllVersion; + }); + //ini the render model initConfigRenderModel(); @@ -234,16 +240,6 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio } } - //handles a fieldset group add - $scope.addFieldsetGroup = function () { - $scope.archetypeConfigRenderModel.fieldsetGroups.push({ name: "" }); - } - - //handles a fieldset group removal - $scope.removeFieldsetGroup = function ($index) { - $scope.archetypeConfigRenderModel.fieldsetGroups.splice($index, 1); - } - //helper to ini the render model function initConfigRenderModel() { @@ -309,6 +305,21 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio $scope.model.value.fieldsets = fieldsets; } + $scope.showOptions = function ($event, template) { + $event.preventDefault(); + + dialogService.closeAll(); + + dialogService.open({ + template: template, + show: true, + callback: function(data) { + $scope.archetypeConfigRenderModel = data; + }, + dialogData: $scope.archetypeConfigRenderModel + }); + } + //archetype css assetsService.loadCss("../App_Plugins/Archetype/css/archetype.css"); }); diff --git a/app/controllers/config.dialog.controller.js b/app/controllers/config.dialog.controller.js new file mode 100644 index 0000000..c057730 --- /dev/null +++ b/app/controllers/config.dialog.controller.js @@ -0,0 +1,17 @@ +angular.module('umbraco').controller('ArchetypeConfigOptionsController', function ($scope) { + $scope.model = angular.copy($scope.dialogData); + + //handles a fieldset group add + $scope.addFieldsetGroup = function () { + $scope.model.fieldsetGroups.push({ name: "" }); + } + + //handles a fieldset group removal + $scope.removeFieldsetGroup = function ($index) { + $scope.model.fieldsetGroups.splice($index, 1); + } + + $scope.apply = function(index) { + $scope.submit($scope.model); + } +}); \ No newline at end of file diff --git a/app/controllers/controller.js b/app/controllers/controller.js index b48ee09..264ea27 100644 --- a/app/controllers/controller.js +++ b/app/controllers/controller.js @@ -1,3 +1,4 @@ +{{VERSION}} angular.module("umbraco").controller("Imulus.ArchetypeController", function ($scope, $http, $filter, assetsService, angularHelper, notificationsService, $timeout, fileManager, entityResource, archetypeService, archetypeLabelService, archetypeCacheService, archetypePropertyEditorResource) { //$scope.model.value = ""; diff --git a/app/less/archetype.less b/app/less/archetype.less index 0835a78..bd73f8d 100644 --- a/app/less/archetype.less +++ b/app/less/archetype.less @@ -1,4 +1,4 @@ -/* TODO: clean this up */ +{{VERSION}} .archetypeEditor { width: 98%; @@ -306,6 +306,21 @@ .archetypeConfig { margin-bottom: 20px; + .archetype-headline { + + img { + margin-right: 5px; + } + + small { + margin-left: 5px; + } + } + + .manual-link { + color: blue; + } + ul { list-style: none; } @@ -387,22 +402,30 @@ } .archetypeAdvancedOptions { - margin-top: 15px; - div { - margin-bottom: 10px; - } label { - width: 400px; + width: 100%; } + + input[type=checkbox] { + margin-top: 0; + margin-right: 2px; + } + + small { + color: #b3b3b3; + } + .archetypeFieldsetGroups { padding: 0 10px; margin-bottom: 20px; + ul { padding: 0; margin: 0; + margin-top: 15px; li { - margin-bottom: 10px; + label { width: 120px; } @@ -447,3 +470,7 @@ visibility: visible !important; background-color: #d0e7f1 !important; } + +.archetype-dialog { + margin: 10px; +} \ No newline at end of file diff --git a/app/resources/archetypePropertyEditorResource.js b/app/resources/archetypePropertyEditorResource.js index a335fe2..463a028 100644 --- a/app/resources/archetypePropertyEditorResource.js +++ b/app/resources/archetypePropertyEditorResource.js @@ -31,6 +31,11 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f return ""; }); + }, + getDllVersion: function() { + return umbRequestHelper.resourcePromise( + $http.get("backoffice/ArchetypeApi/ArchetypeDataType/GetDllVersion", { cache: true }), 'Failed to retrieve dll version' + ); } } }); diff --git a/app/views/archetype.config.developer.dialog.html b/app/views/archetype.config.developer.dialog.html new file mode 100644 index 0000000..9803230 --- /dev/null +++ b/app/views/archetype.config.developer.dialog.html @@ -0,0 +1,30 @@ +{{VERSION_HTML}} +
+
+

Developer Options

+
+ +
+
+ +
+
+ +
+ +
+ + +
+ +
+ + Cancel + + + +
+
+
\ No newline at end of file diff --git a/app/views/archetype.config.fieldset.dialog.html b/app/views/archetype.config.fieldset.dialog.html new file mode 100644 index 0000000..c58eee2 --- /dev/null +++ b/app/views/archetype.config.fieldset.dialog.html @@ -0,0 +1,61 @@ +{{VERSION_HTML}} +
+
+

Global Fieldset Options

+
+ +
+ +
+ +
+
+ +
+
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+

Fieldset groups

+ If you have a lot of fieldsets to choose from, you may want to consider grouping them in the fieldset picker. Once you have created your groups here, a group picker will be displayed in the fieldset editor and you can assign your fieldsets to their respective groups. +
    +
  • +
    + + + +
    +
  • +
+ +
+
+
+ + Cancel + + + +
+
+
\ No newline at end of file diff --git a/app/views/archetype.config.html b/app/views/archetype.config.html index fb5f05b..4e078d6 100644 --- a/app/views/archetype.config.html +++ b/app/views/archetype.config.html @@ -1,4 +1,8 @@ +{{VERSION_HTML}}
+

Archetype{{dllVersion}}

+

At a minimum your Archetype needs at least one fieldset with at least one property. You can configure it to allow for multiple types of fieldsets within a single Archetype and you can even add another Archetype as a property. Please use the link below for the full manual:

+

Archetype Manual