Compare commits

..

68 Commits

Author SHA1 Message Date
Kevin Giszewski eb2cbf7a8f Update README.md 2014-01-17 12:16:35 -05:00
Kevin Giszewski 8a42c6fdbd Update README.md 2014-01-17 12:04:03 -05:00
Kevin Giszewski 8a4f3de023 Update README.md 2014-01-17 10:49:43 -05:00
Tom Fulton 5a092daca9 Mark package versions as prelease 2014-01-17 03:22:03 -07:00
Tom Fulton e9f710ea9e Include C# solution in build/package outputs 2014-01-17 02:54:59 -07:00
Tom Fulton 9d3f4e76db Quick cleanup of packaging tasks 2014-01-17 02:20:54 -07:00
Tom Fulton 489628451b Merge branch 'develop' into feature/packaging
Conflicts:
	.gitignore
	Gruntfile.js
	package.json
2014-01-16 23:33:53 -07:00
Tom Fulton 0c4c04f84e Merge branch 'develop' into feature/nuget
Conflicts:
	.gitignore
	Gruntfile.js
	package.json
2014-01-16 23:30:38 -07:00
Kevin Giszewski d46ae5b993 Fix validation bug, rename labelExpression, change error style 2014-01-16 19:43:15 -05:00
Kevin Giszewski b73b728780 Merge pull request #13 from imulus/feature/default-value
Feature/default value
2014-01-16 12:05:03 -08:00
Kevin Giszewski deb771e456 Alter config and defaultValue
- Turn into strings and try to eval on render
2014-01-16 15:03:41 -05:00
Kevin Giszewski d80f828b29 Fix validation.requiredAliases ini error 2014-01-16 14:43:46 -05:00
Kevin Giszewski c0e867b547 Merge pull request #10 from imulus/feature/configUI
Feature/config ui
2014-01-16 11:27:01 -08:00
Kevin Giszewski bd3cb98fe3 Rename the DLL Assembly (remove Imulus) 2014-01-16 14:26:10 -05:00
Kevin Giszewski 847c42238b Remove Imulus References from Archetype except for C# and Property Alias
- Default to only one fieldset
- Move all other options to 'advanced'
2014-01-16 14:23:02 -05:00
Kevin Giszewski 77084d5ce3 Rename views.js to config.views.js 2014-01-16 14:03:39 -05:00
Kevin Giszewski 758b479f2e Merge branch 'feature/fieldset-label-expressions' into feature/configUI 2014-01-16 13:47:19 -05:00
Kevin Giszewski a8cb0613cf Rename renderItem to renderFieldset 2014-01-16 13:42:08 -05:00
Kevin Giszewski 9424230452 Convert config to underscore 2014-01-16 13:41:51 -05:00
Kevin Giszewski ab6361f4ab Complete Feature Required
- Also switch to underscore.js for controller.js
2014-01-16 12:37:01 -05:00
Tom Fulton 963447ba38 Replace fieldset label expressions with basic templates
The Label Expr. field can now be defined like this:  Person: {{firstName}} {{lastName}}

Where firstName and lastName are the property alias of a property on the current fieldset
2014-01-15 23:27:33 -07:00
Kevin Giszewski e44a448f62 Removed the hasValue propotype, caused issues on save 2014-01-15 20:23:59 -05:00
Kevin Giszewski 5b0cb2c4ba Merge branch 'feature/configUI' of github.com:imulus/Archetype into feature/configUI 2014-01-15 19:44:53 -05:00
Kevin Giszewski b07d2c03ec Add Fieldset Highlight when !isValid 2014-01-15 19:44:27 -05:00
Kevin Giszewski 22bd3429df Update README.md 2014-01-15 19:21:24 -05:00
Kevin Giszewski 8fb49fab56 Merge branch 'develop' into feature/configUI 2014-01-15 19:19:14 -05:00
Kevin Giszewski d6dcf217e6 Merge pull request #11 from imulus/feature/template-helper
Template Helpers
2014-01-15 16:18:44 -08:00
Kevin Giszewski c540f90e4a Remove Sample Model 2014-01-15 19:17:22 -05:00
Tom Fulton e5f8dc5634 Add methods to access specific properties from a Fieldset
* GetValue("alias") - gets the value as a string
* GetValue<T>("alias") - attempts to convert to the specified types using some of Umbraco's built in TypeConverter logic.  If conversion fails, returns default(T).  Note this doesn't utilize PropertyValueConverters (yet?)
* GetProperty("alias") - gets a reference to the entire property object.  Leaving this private for now, but there may be a reason to publicize someday if we add more properties to the Property object.
2014-01-15 16:17:32 -07:00
Kevin Giszewski 4548c185d9 WIP on 'Required' 2014-01-15 17:31:31 -05:00
Tom Fulton eea861bb28 Pull in Kevin's PropertyValueConverter project 2014-01-15 15:00:47 -07:00
Tom Fulton 2e0a84852b Add grunt task for creating umbraco package 2014-01-15 14:16:17 -07:00
Kevin Giszewski 67d727647a Persist (don't collapse) a config FS if it's the only one. 2014-01-15 15:42:35 -05:00
Kevin Giszewski e42d86d594 Add Collapser to Property Configs 2014-01-15 15:31:52 -05:00
Kevin Giszewski 14455ad9a2 Add propertyEditorService
- using a static json file for now (could not find any way to get a list)
2014-01-15 14:36:06 -05:00
Kevin Giszewski 2210c07358 Keep a fieldset open if it's the only one onLoad; handle toggle after insert 2014-01-14 20:09:45 -05:00
Kevin Giszewski 7b5457d51b Add Label Expression 2014-01-14 19:48:01 -05:00
Kevin Giszewski 7ba4cd8e17 Remove Old Configs, fix bugs and wire-up collapser 2014-01-14 17:30:10 -05:00
Kevin Giszewski b9c9e499e2 Fix Default Config Model Issues 2014-01-14 16:08:38 -05:00
Kevin Giszewski 410a27fb89 Add Collapser 2014-01-14 15:41:40 -05:00
Kevin Giszewski 381efc0089 Basic fieldset/property CRUD working 2014-01-14 15:12:38 -05:00
Kevin Giszewski af014fbf43 Ongoing WIP 2014-01-14 14:15:16 -05:00
Kevin Giszewski 908df13626 Begin WIP on config GUI 2014-01-14 14:15:00 -05:00
Kevin Giszewski 475f9fc62c Include extra js 2014-01-14 14:14:42 -05:00
Kevin Giszewski e670a074a2 Update README.md 2014-01-13 13:01:21 -05:00
Kevin Giszewski e3a9a7c09a Update README.md 2014-01-13 12:58:42 -05:00
Kevin Giszewski bf60a3e9ee Merge pull request #9 from imulus/feature/remove-property
Remove the 'remove' property from the model
2014-01-13 09:51:09 -08:00
Kevin Giszewski 045fe2ee5c Remove the 'remove' property from the model 2014-01-13 12:47:21 -05:00
Kevin Giszewski 6d093c9642 Updated Readme.md with Documentation 2014-01-13 12:10:33 -05:00
Tom Fulton 5d6581e988 Fix README formatting 2014-01-12 23:55:10 -07:00
Tom Fulton 831ac0ca6f Tweak build tasks
* Disable spawn for watch:dev
* Reorder tasks
* Fix hardcoded path
2014-01-12 23:51:37 -07:00
Kevin Giszewski 9fb0a995ac Merge pull request #4 from imulus/develop
Bring Master up to date
2014-01-12 11:44:50 -08:00
Kevin Giszewski 67ebc20930 Merge pull request #2 from imulus/feature/dev-tasks
Grunt Tasks for Development
2014-01-12 11:43:59 -08:00
Kevin Giszewski e8a2d81009 Get Running with the Latest Reorg of stuff 2014-01-12 14:33:09 -05:00
Kevin Giszewski e44be56fb1 Ini new changes 2014-01-12 14:05:39 -05:00
Tom Fulton 4fb4c23c7d Fix build paths 2014-01-12 04:40:41 -07:00
Tom Fulton bffdc7f644 Add build option to touch web.config automatically on deploy 2014-01-12 04:40:27 -07:00
Tom Fulton 628fa750ba Update README with new dev tasks 2014-01-12 03:36:02 -07:00
Tom Fulton 75ed6f11c9 Merge branch 'develop' into feature/dev-tasks
Conflicts:
	README.md
2014-01-12 03:33:24 -07:00
Tom Fulton dcc869a3cc Merge branch 'develop'
Conflicts:
	README.md
2014-01-12 03:32:49 -07:00
Tom Fulton 5a3a38cc68 Add deploy, watch:dev tasks to ease local development. Usage:
`grunt deploy --target D:\\Dev\\Projects\\MyUmbracoSiteRoot` copies the build to /App_Plugins/Archetype/
`grunt watch:dev --target D:\\Dev\\Projects\\MyUmbracoSiteRoot` runs a deploy automatically when a file change is detected in /app/*
2014-01-12 03:26:08 -07:00
Tom Fulton eafd2d454c 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
2014-01-12 02:13:05 -07:00
Tom Fulton 9a7bf3693c Add package:nuget task
* Add grunt-nuget
* Add nuspec file
* Add build task
2014-01-11 22:17:12 -07:00
Tom Fulton c2e936364e Update readme with rough build details 2014-01-10 17:55:21 -07:00
Tom Fulton 5f3fb68ca7 Update readme with rough build details 2014-01-10 17:51:54 -07:00
Tom Fulton fe1218b028 Merge branch 'master' of github.com:imulus/Archetype 2014-01-10 17:38:43 -07:00
tomfulton c4f4995c65 Initial commit 2014-01-10 16:22:14 -08:00
Tom Fulton b524121f8a Initial commit 2014-01-10 17:20:35 -07:00
42 changed files with 2152 additions and 649 deletions
-1
View File
@@ -10,7 +10,6 @@ ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
app/less/*.css
dist/
node_modules/
pkg/tmp/
+201
View File
@@ -0,0 +1,201 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pkgMeta: grunt.file.readJSON('pkg/meta.json'),
dest: 'dist',
package_dir: 'pkg',
package_temp_dir: '<%= package_dir %>/tmp/',
watch: {
less: {
files: ['app/less/*.less', 'lib/**/*.less'],
tasks: ['less:build'],
options: {
spawn: false
}
},
js: {
files: ['app/**/*.js', 'lib/**/*.js'],
tasks: ['concat', 'jshint'],
options: {
spawn: false
}
},
dev: {
files: ['app/**'],
tasks: ['deploy'],
options: {
spawn: false
}
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
src: {
src: ['app/**/*.js', 'lib/**/*.js']
}
},
less: {
build: {
options: {
paths: ["app/less", "lib/less", "vendor"],
},
files: {
'<%= dest %>/css/archetype.css': 'app/less/archetype.less',
}
}
},
concat: {
options: {
stripBanners: false
},
application: {
src: [
'app/controllers/controller.js',
'app/controllers/config.controller.js',
'app/directives/archetypeproperty.js',
'app/services/propertyeditor.js'
],
dest: '<%= dest %>/js/archetype.js'
}
},
nugetpack: {
dist: {
src: '<%= package_temp_dir %>/nuget/package.nuspec',
dest: '<%= package_dir %>'
}
},
template: {
'nuget_manifest': {
'options': {
'data': {
name: '<%= pkgMeta.name %>',
version: '<%= pkgMeta.version %>',
url: '<%= pkgMeta.url %>',
license: '<%= pkgMeta.license %>',
licenseUrl: '<%= pkgMeta.licenseUrl %>',
author: '<%= pkgMeta.author %>',
authorUrl: '<%= pkgMeta.authorUrl %>',
files: [{ path: '..\\..\\..\\<%= dest %>\\**', target: 'content\\App_Plugins\\Archetype'}]
}
},
'files': {
'<%= package_temp_dir %>/nuget/package.nuspec': ['<%= package_dir %>/nuget/package.nuspec']
}
}
},
clean: {
build: ['<%= dest %>']
},
copy: {
build: {
files: [
{expand: true, cwd: 'app/', src: ['package.manifest'], dest: '<%= dest %>', flatten: true},
{expand: true, cwd: 'app/config/', src: ['config.views.js'], dest: '<%= dest %>/js', flatten: true},
{expand: true, cwd: 'app/views/', src: ['archetype.html', 'archetype.config.html'], dest: '<%= dest %>/views', flatten: true},
{expand: true, cwd: 'app/Umbraco/Umbraco.Archetype/bin/Debug/', src: ['Archetype.dll'], dest: '<%= dest %>/bin', flatten: true}
]
},
deploy: {
files: [
{expand: true, cwd: '<%= dest %>/', src: ['**/*', '!bin/*'], dest: '<%= grunt.option("target") %>\\App_Plugins\\Archetype', flatten: false},
{expand: true, cwd: '<%= dest %>/', src: ['bin/*'], dest: '<%= grunt.option("target") %>\\bin', flatten: false},
]
},
nuget_prepare: {
files: [
{expand: true, cwd: '<%= dest %>/', src: ['**/*', '!bin/*'], dest: '<%= package_temp_dir %>/nuget/content/', flatten: false},
{expand: true, cwd: '<%= dest %>/', src: ['bin/*'], dest: '<%= package_temp_dir %>/nuget/lib/net40/', flatten: false}
]
},
umbracopackage: {
files: [
{expand: true, cwd: '<%= dest %>/', src: ['**/*', "!bin/*"], dest: 'pkg/tmp/umbraco/App_Plugins/Archetype', flatten: false},
{expand: true, cwd: '<%= dest %>/', src: ['bin/*'], dest: 'pkg/tmp/umbraco', flatten: false}
]
}
},
touch: {
options: {},
webconfig: {
src: ['<%= grunt.option("target") %>\\Web.config']
}
},
umbracoPackage: {
options: {
name: "<%= pkgMeta.name %>",
version: '<%= pkgMeta.version %>',
url: '<%= pkgMeta.url %>',
license: '<%= pkgMeta.license %>',
licenseUrl: '<%= pkgMeta.licenseUrl %>',
author: '<%= pkgMeta.author %>',
authorUrl: '<%= pkgMeta.authorUrl %>',
manifest: 'pkg/umbraco/package.xml',
readme: 'pkg/umbraco/readme.txt',
sourceDir: 'pkg/tmp/umbraco',
outputDir: 'pkg',
}
},
clean: {
build: ['<%= dest %>'],
package_temp: ['pkg/tmp'],
},
msbuild: {
dev: {
src: ['app/Umbraco/Umbraco.Archetype/Archetype.Umbraco.csproj'],
options: {
projectConfiguration: 'Debug',
targets: ['Clean', 'Rebuild'],
stdout: true,
maxCpuCount: 4,
buildParameters: {
WarningLevel: 2
},
verbosity: 'quiet'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-nuget');
grunt.loadNpmTasks('grunt-template');
grunt.loadNpmTasks('grunt-touch');
grunt.loadNpmTasks('grunt-msbuild');
grunt.loadTasks('tasks');
grunt.registerTask('package', ['package:nuget', 'package:umbraco']);
grunt.registerTask('package:nuget', ['copy:nuget_prepare', 'template:nuget_manifest', 'nugetpack', 'clean:package_temp']);
grunt.registerTask('package:umbraco', ['copy:umbracopackage', 'umbracoPackage', 'clean:package_temp']);
grunt.registerTask('touchwebconfigifenabled', function() { if (grunt.option("touch")) grunt.task.run("touch:webconfig") });
grunt.registerTask('deploy', ['default', 'copy:deploy', 'touchwebconfigifenabled']);
grunt.registerTask('css:build', ['less']);
grunt.registerTask('js:build', ['concat']);
grunt.registerTask('default', ['clean', 'css:build', 'js:build', 'copy:build', 'msbuild:dev']);
};
+20
View File
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 Imulus
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.
+66
View File
@@ -0,0 +1,66 @@
Archetype
=========
## Install Dependencies ##
*Requires Node.js to be installed and in your system path*
npm install -g grunt-cli && npm install -g grunt
npm install
## Build ##
grunt
## Deploy ##
grunt deploy --target=C:\\path\\to\\umbraco\\site
grunt watch:dev --target=C:\\path\to\\umbraco\\site
Add `--touch` to either command to automatically touch the web.config on a deploy
## Installation
1) Install the <a href='http://bit.ly/1gUYKW8'>package</a> through the Umbraco package installer. Recommended if you want to just see the packaged version.
OR
2) Deploy with Grunt (see above). Recommended if you wish to extend this repo as this will inject this project into an existing v7 Umbraco install.
OR
3) Not recommended but a down and dirty way is to manually download and copy the files into the appropriate spot:
Your /App_Plugins and /bin should contain this structure:
/App_Plugins
- package.manifest
- /css
-- archetype.css
- /js
-- archetype.js (our Grunt script concats the controller.js/config.controller.js, services and all directives into one file, you will have to do so manually)
-- config.views.js
- /views
-- archetype.html
-- archetype.config.html
/bin
-- archetype.dll (you'll have to build it)
## Prevalue Configs ##
Most of the fields are self evident, the following fields will be discussed further:
###Developer Mode###
By turning this on, you will get a textarea visible with the data model (not prevalue model). You can change the contents of the textarea for real-time editing. Additionally when in developer mode, the console will reflect the scope object of each property.
##View Compatibility##
The basis of compatibility is based on the following:
- The model of the view must use `$scope.model.value` and the config must use `$scope.model.config`.
All core properties have not been tested yet :)
##Developer Notes##
If you decide to extend this project locally, you'll want to set the `<compilation>` `debug` property in your `web.config` to `true`:
<compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.5">
This is in order to circumvent the minification and caching of the JavaScript files.
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Binary file not shown.
+136
View File
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages>
<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">false</RequireRestoreConsent>
<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
</PropertyGroup>
<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>
<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>
<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>
<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />
<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
+27
View File
@@ -0,0 +1,27 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Archetype.Umbraco", "Umbraco.Archetype\Archetype.Umbraco.csproj", "{7D185D41-4228-4978-ACB8-83F9A48AD94F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D84AA4ED-85A6-484F-9E72-BE7AC9835821}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7D185D41-4228-4978-ACB8-83F9A48AD94F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D185D41-4228-4978-ACB8-83F9A48AD94F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D185D41-4228-4978-ACB8-83F9A48AD94F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D185D41-4228-4978-ACB8-83F9A48AD94F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7D185D41-4228-4978-ACB8-83F9A48AD94F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Archetype.Umbraco</RootNamespace>
<AssemblyName>Archetype</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper">
<HintPath>..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="AutoMapper.Net4">
<HintPath>..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.Net4.dll</HintPath>
</Reference>
<Reference Include="businesslogic">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\businesslogic.dll</HintPath>
</Reference>
<Reference Include="ClientDependency.Core">
<HintPath>..\packages\ClientDependency.1.7.0.4\lib\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="ClientDependency.Core.Mvc">
<HintPath>..\packages\ClientDependency-Mvc.1.7.0.4\lib\ClientDependency.Core.Mvc.dll</HintPath>
</Reference>
<Reference Include="cms">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\cms.dll</HintPath>
</Reference>
<Reference Include="controls">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\controls.dll</HintPath>
</Reference>
<Reference Include="CookComputing.XmlRpcV2">
<HintPath>..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll</HintPath>
</Reference>
<Reference Include="Examine">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\Examine.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack">
<HintPath>..\packages\HtmlAgilityPack.1.4.6\lib\Net45\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="interfaces">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\interfaces.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\log4net.dll</HintPath>
</Reference>
<Reference Include="Lucene.Net">
<HintPath>..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ApplicationBlocks.Data">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\Microsoft.ApplicationBlocks.Data.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Helpers">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\Microsoft.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Mvc.FixedDisplayModes">
<HintPath>..\packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.1\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll</HintPath>
</Reference>
<Reference Include="MiniProfiler">
<HintPath>..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll</HintPath>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SQLCE4Umbraco">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\SQLCE4Umbraco.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\System.Data.SqlServerCe.dll</HintPath>
</Reference>
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\System.Data.SqlServerCe.Entity.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="TidyNet">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\TidyNet.dll</HintPath>
</Reference>
<Reference Include="umbraco">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\umbraco.dll</HintPath>
</Reference>
<Reference Include="Umbraco.Core">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\Umbraco.Core.dll</HintPath>
</Reference>
<Reference Include="umbraco.DataLayer">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\umbraco.DataLayer.dll</HintPath>
</Reference>
<Reference Include="umbraco.editorControls">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\umbraco.editorControls.dll</HintPath>
</Reference>
<Reference Include="umbraco.MacroEngines">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\umbraco.MacroEngines.dll</HintPath>
</Reference>
<Reference Include="umbraco.providers">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\umbraco.providers.dll</HintPath>
</Reference>
<Reference Include="Umbraco.Web.UI">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\Umbraco.Web.UI.dll</HintPath>
</Reference>
<Reference Include="umbraco.XmlSerializers">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\umbraco.XmlSerializers.dll</HintPath>
</Reference>
<Reference Include="UmbracoExamine">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\UmbracoExamine.dll</HintPath>
</Reference>
<Reference Include="UrlRewritingNet.UrlRewriter">
<HintPath>..\packages\UmbracoCms.Core.7.0.1\lib\UrlRewritingNet.UrlRewriter.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Extensions\Extensions.cs" />
<Compile Include="Models\Archetype.cs" />
<Compile Include="Models\Fieldset.cs" />
<Compile Include="Models\Property.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PropertyConverters\ArchetypeValueConverter.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Archetype.Umbraco.Extensions
{
public static class Extensions
{
//lifted from the core as it is marked 'internal'
public static bool DetectIsJson(this string input)
{
input = input.Trim();
return input.StartsWith("{") && input.EndsWith("}")
|| input.StartsWith("[") && input.EndsWith("]");
}
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Archetype.Umbraco.Models
{
public class Archetype
{
public IEnumerable<Fieldset> Fieldsets { get; set; }
public Archetype()
{
Fieldsets = new List<Fieldset>();
}
}
}
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core;
namespace Archetype.Umbraco.Models
{
public class Fieldset
{
public string Alias { get; set; }
public IEnumerable<Property> Properties;
public Fieldset()
{
Properties = new List<Property>();
}
public string GetValue(string propertyAlias)
{
return GetValue<string>(propertyAlias);
}
public T GetValue<T>(string propertyAlias)
{
var property = GetProperty(propertyAlias);
if (property == null || string.IsNullOrEmpty(property.Value))
return default(T);
var convertAttempt = property.Value.TryConvertTo<T>();
if (convertAttempt.Success)
return convertAttempt.Result;
return default(T);
}
private Property GetProperty(string propertyAlias)
{
return Properties.FirstOrDefault(p => p.Alias.InvariantEquals(propertyAlias));
}
}
}
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Archetype.Umbraco.Models
{
public class Property
{
public string Alias { get; set; }
public string Value { get; set; }
}
}
@@ -0,0 +1,37 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Archetype")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Archetype")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e37e94f9-c7ba-4b54-b7e1-64419b3dba0b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0-alpha")]
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Models.PublishedContent;
using Archetype.Umbraco.Models;
using Archetype.Umbraco.Extensions;
namespace Archetype.Umbraco.PropertyConverters
{
/* based on the Tim Geyssens sample at: https://github.com/TimGeyssens/MatrixPropEditor/blob/master/SamplePropertyValueConverter/SamplePropertyValueConverter/MatrixValueConverter.cs */
[PropertyValueType(typeof(Archetype.Umbraco.Models.Archetype))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class ArchetypeValueConverter : PropertyValueConverterBase
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.Equals("Imulus.Archetype");
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
if (source == null) return null;
var sourceString = source.ToString();
if (sourceString.DetectIsJson())
{
try
{
var archetype = JsonConvert.DeserializeObject <Archetype.Umbraco.Models.Archetype> (sourceString);
return archetype;
}
catch (Exception ex)
{
return null;
}
}
return sourceString;
}
}
}
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.0.0" targetFramework="net45" />
<package id="ClientDependency" version="1.7.0.4" targetFramework="net45" />
<package id="ClientDependency-Mvc" version="1.7.0.4" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.6" targetFramework="net45" />
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.1" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
<package id="MySql.Data" version="6.6.5" targetFramework="net45" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="UmbracoCms.Core" version="7.0.1" targetFramework="net45" />
<package id="xmlrpcnet" version="2.5.0" targetFramework="net45" />
</packages>
+22
View File
@@ -0,0 +1,22 @@
[
{
"name": "Textstring",
"path": "/umbraco/views/propertyeditors/textbox/textbox.html"
},
{
"name": "Content Picker",
"path": "/umbraco/views/propertyeditors/contentpicker/contentpicker.html"
},
{
"name": "Boolean",
"path": "/umbraco/views/propertyeditors/boolean/boolean.html"
},
{
"name": "Checkbox List",
"path": "/umbraco/views/propertyeditors/checkboxlist/checkboxlist.html"
},
{
"name": "Radio Buttons",
"path": "/umbraco/views/propertyeditors/radiobuttons/radiobuttons.html"
}
]
+239
View File
@@ -0,0 +1,239 @@
angular.module("umbraco").controller("Imulus.ArchetypeConfigController", function ($scope, $http, assetsService, propertyEditorService) {
//$scope.model.value = "";
//console.log($scope.model.value);
var newPropertyModel = '{alias: "", remove: false, collapse: false, label: "", helpText: "", view: "", value: "", config: ""}';
var newFieldsetModel = '{alias: "", remove: false, collapse: false, labelTemplate: "", tooltip: "", icon: "", label: "", headerText: "", footerText: "", properties:[' + newPropertyModel + ']}';
var defaultFieldsetConfigModel = eval("({showAdvancedOptions: false, hideFieldsetToolbar: false, enableMultipleFieldsets: false, hideFieldsetControls: false, hideFieldsetLabels: false, hidePropertyLabel: false, maxFieldsets: null, fieldsets: [" + newFieldsetModel + "]})");
$scope.model.value = $scope.model.value || defaultFieldsetConfigModel;
initConfigRenderModel();
//get the available views
propertyEditorService.getViews().then(function(data){
$scope.availableViews = data;
});
$scope.sortableOptions = {
axis: 'y',
cursor: "move",
handle: ".handle",
update: function (ev, ui) {
},
stop: function (ev, ui) {
}
};
$scope.focusFieldset = function(fieldset){
var iniState;
if(fieldset)
{
iniState = fieldset.collapse;
}
_.each($scope.archetypeConfigRenderModel.fieldsets, function(fieldset){
if($scope.archetypeConfigRenderModel.fieldsets.length == 1 && fieldset.remove == false)
{
fieldset.collapse = false;
return;
}
if(fieldset.label)
{
fieldset.collapse = true;
}
else
{
fieldset.collapse = false;
}
});
if(iniState)
{
fieldset.collapse = !iniState;
}
}
//ini
$scope.focusFieldset();
$scope.focusProperty = function(properties, property){
var iniState;
if(property)
{
iniState = property.collapse;
}
_.each(properties, function(property){
if(property.label)
{
property.collapse = true;
}
else
{
property.collapse = false;
}
});
if(iniState)
{
property.collapse = !iniState;
}
}
//setup JSON.stringify helpers
$scope.archetypeConfigRenderModel.toString = stringify;
//encapsulate stringify (should be built into browsers, not sure of IE support)
function stringify() {
return JSON.stringify(this);
}
//watch for changes
$scope.$watch('archetypeConfigRenderModel', function (v) {
//console.log(v);
if (typeof v === 'string') {
$scope.archetypeConfigRenderModel = JSON.parse(v);
$scope.archetypeConfigRenderModel.toString = stringify;
}
}, true);
//helper that returns if an item can be removed
$scope.canRemoveFieldset = function ()
{
return countVisibleFieldset() > 1;
}
//helper that returns if an item can be sorted
$scope.canSortFieldset = function ()
{
return countVisibleFieldset() > 1;
}
//helper that returns if an item can be removed
$scope.canRemoveProperty = function (fieldset)
{
return countVisibleProperty(fieldset) > 1;
}
//helper that returns if an item can be sorted
$scope.canSortProperty = function (fieldset)
{
return countVisibleProperty(fieldset) > 1;
}
//helper to count what is visible
function countVisibleFieldset()
{
var count = 0;
_.each($scope.archetypeConfigRenderModel.fieldsets, function(fieldset){
if (fieldset.remove == false) {
count++;
}
});
return count;
}
function countVisibleProperty(fieldset)
{
var count = 0;
for (var i in fieldset.properties) {
if (fieldset.properties[i].remove == false) {
count++;
}
}
return count;
}
//handles a fieldset add
$scope.addFieldsetRow = function ($index, $event) {
$scope.archetypeConfigRenderModel.fieldsets.splice($index + 1, 0, eval("(" + newFieldsetModel + ")"));
$scope.focusFieldset();
}
//rather than splice the archetypeConfigRenderModel, we're hiding this and cleaning onFormSubmitting
$scope.removeFieldsetRow = function ($index) {
if ($scope.canRemoveFieldset()) {
if (confirm('Are you sure you want to remove this?')) {
$scope.archetypeConfigRenderModel.fieldsets[$index].remove = true;
}
}
}
//handles a property add
$scope.addPropertyRow = function (fieldset, $index) {
fieldset.properties.splice($index + 1, 0, eval("(" + newPropertyModel + ")"));
}
//rather than splice the archetypeConfigRenderModel, we're hiding this and cleaning onFormSubmitting
$scope.removePropertyRow = function (fieldset, $index) {
if ($scope.canRemoveProperty(fieldset)) {
if (confirm('Are you sure you want to remove this?')) {
fieldset.properties[$index].remove = true;
}
}
}
//helper to ini the render model
function initConfigRenderModel()
{
$scope.archetypeConfigRenderModel = $scope.model.value;
_.each($scope.archetypeConfigRenderModel.fieldsets, function(fieldset){
fieldset.remove = false;
if(fieldset.label)
{
fieldset.collapse = true;
}
_.each(fieldset.properties, function(fieldset){
fieldset.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 = $scope.archetypeConfigRenderModel;
var fieldsets = [];
_.each($scope.archetypeConfigRenderModel.fieldsets, function(fieldset){
//check fieldsets
if (!fieldset.remove) {
fieldsets.push(fieldset);
var properties = [];
_.each(fieldset.properties, function(property){
if (!property.remove) {
properties.push(property);
}
});
fieldset.properties = properties;
}
});
$scope.model.value.fieldsets = fieldsets;
}
//archetype css
assetsService.loadCss("/App_Plugins/Archetype/css/archetype.css");
});
+333
View File
@@ -0,0 +1,333 @@
angular.module("umbraco").controller("Imulus.ArchetypeController", function ($scope, $http, $interpolate, assetsService, angularHelper, notificationsService) {
//$scope.model.value = "";
//set default value of the model
//this works by checking to see if there is a model; then cascades to the default model then to an empty fieldset
var form = angularHelper.getCurrentForm($scope);
$scope.model.config = $scope.model.config.archetypeConfig;
$scope.model.value = $scope.model.value || { fieldsets: [getEmptyRenderFieldset($scope.model.config.fieldsets[0])] };
//ini
$scope.archetypeRenderModel = {};
initArchetypeRenderModel();
//helper to get $eval the labelTemplate
$scope.getFieldsetTitle = function(fieldsetConfigModel, fieldsetIndex) {
var fieldset = $scope.archetypeRenderModel.fieldsets[fieldsetIndex];
var template = fieldsetConfigModel.labelTemplate;
var rgx = /{{(.*?)}}*/g;
var results;
var parsedTemplate = template;
while ((results = rgx.exec(template)) !== null) {
var propertyAlias = results[1];
var propertyValue = $scope.getPropertyValueByAlias(fieldset, propertyAlias);
parsedTemplate = parsedTemplate.replace(results[0], propertyValue);
}
return parsedTemplate;
};
/* add/remove/sort */
//defines the options for the jquery sortable
//i used an ng-model="archetypeRenderModel" so the sort updates the right model
$scope.sortableOptions = {
axis: 'y',
cursor: "move",
handle: ".handle",
update: function (ev, ui) {
},
stop: function (ev, ui) {
}
};
//handles a fieldset add
$scope.addRow = function (fieldsetAlias, $index) {
if ($scope.canAdd())
{
if ($scope.model.config.fieldsets)
{
var newFieldset = getEmptyRenderFieldset($scope.getConfigFieldsetByAlias(fieldsetAlias));
if (typeof $index != 'undefined')
{
$scope.archetypeRenderModel.fieldsets.splice($index + 1, 0, newFieldset);
}
else
{
$scope.archetypeRenderModel.fieldsets.push(newFieldset);
}
}
newFieldset.collapse = true;
$scope.focusFieldset(newFieldset);
}
}
//rather than splice the archetypeRenderModel, we're hiding this and cleaning onFormSubmitting
$scope.removeRow = function ($index) {
if ($scope.canRemove()) {
if (confirm('Are you sure you want to remove this?')) {
$scope.archetypeRenderModel.fieldsets[$index].remove = true;
}
}
}
//helpers for determining if a user can do something
$scope.canAdd = function ()
{
if ($scope.model.config.maxFieldsets)
{
return countVisible() < $scope.model.config.maxFieldsets;
}
return 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, ini the render model from the server (model.value)
function initArchetypeRenderModel() {
$scope.archetypeRenderModel = $scope.model.value;
_.each($scope.archetypeRenderModel.fieldsets, function (fieldset)
{
fieldset.remove = false;
fieldset.collapse = false;
fieldset.isValid = true;
});
}
//helper to get the correct fieldset from config
$scope.getConfigFieldsetByAlias = function(alias) {
return _.find($scope.model.config.fieldsets, function(fieldset){
return fieldset.alias == alias;
});
}
//helper to get a property by alias from a fieldset
$scope.getPropertyValueByAlias = function(fieldset, propertyAlias) {
var property = _.find(fieldset.properties, function(p) {
return p.alias == propertyAlias;
});
return (typeof property !== 'undefined') ? property.value : '';
};
//helper for collapsing
$scope.focusFieldset = function(fieldset){
var iniState;
if(fieldset)
{
iniState = fieldset.collapse;
}
_.each($scope.archetypeRenderModel.fieldsets, function(fieldset){
if($scope.archetypeRenderModel.fieldsets.length == 1 && fieldset.remove == false)
{
fieldset.collapse = false;
return;
}
fieldset.collapse = true;
});
if(iniState)
{
fieldset.collapse = !iniState;
}
}
//ini
$scope.focusFieldset();
//helper returns valid JS or null
function getValidJson(variable, json)
{
if(!json) return null;
try {
return eval("(" + json + ")");
}
catch (e) {
console.log("There was an error while using 'eval' on " + variable);
console.log(json);
return null;
}
}
//developerMode helpers
$scope.archetypeRenderModel.toString = stringify;
//encapsulate stringify (should be built into browsers, not sure of IE support)
function stringify() {
return JSON.stringify(this);
}
//watch for changes
$scope.$watch('archetypeRenderModel', function (v) {
if ($scope.model.config.developerMode) {
console.log(v);
if (typeof v === 'string') {
$scope.archetypeRenderModel = JSON.parse(v);
$scope.archetypeRenderModel.toString = stringify;
}
}
});
//helper to count what is visible
function countVisible()
{
var count = 0;
_.each($scope.archetypeRenderModel.fieldsets, function(fieldset){
if (fieldset.remove == false) {
count++;
}
});
return count;
}
//helper to sync the model to the renderModel
function syncModelToRenderModel()
{
$scope.model.value = { fieldsets: [] };
_.each($scope.archetypeRenderModel.fieldsets, function(fieldset){
if (typeof fieldset != 'function' && !fieldset.remove){
//clone and clean
var tempFieldset = JSON.parse(JSON.stringify(fieldset));
delete tempFieldset.remove;
delete tempFieldset.isValid;
delete tempFieldset.collapse;
_.each(tempFieldset.properties, function(property){
delete property.isValid;
});
$scope.model.value.fieldsets.push(tempFieldset);
}
});
}
//helper to add an empty fieldset
function getEmptyRenderFieldset (fieldsetModel)
{
return eval("({ alias: '" + fieldsetModel.alias + "', remove: false, properties: []})");
}
//helper for validation
function getValidation()
{
var validation = {}
validation.isValid = true;
validation.requiredAliases = [];
validation.invalidProperties = [];
//determine which fields are required
_.each($scope.model.config.fieldsets, function(fieldset){
_.each(fieldset.properties, function(property){
if(property.required)
{
validation.requiredAliases.push(property.alias);
}
});
});
//if nothing required; let's go
if(validation.requiredAliases.length == 0)
{
return validation;
}
//otherwise we need to check the required aliases
_.each($scope.archetypeRenderModel.fieldsets, function(fieldset){
fieldset.isValid = true;
_.each(fieldset.properties, function(property){
property.isValid = true;
//if a required field
if(_.find(validation.requiredAliases, function(alias){ return alias == property.alias }))
{
//TODO: do a better validation test
if(property.value == ""){
fieldset.isValid = false;
property.isValid = false;
validation.isValid = false;
validation.invalidProperties.push(property);
}
}
});
});
if($scope.model.config.developerMode == '1')
{
console.log(validation);
}
return validation;
}
$scope.getPropertyValidity = function(fieldsetIndex, alias)
{
if($scope.archetypeRenderModel.fieldsets[fieldsetIndex])
{
var property = _.find($scope.archetypeRenderModel.fieldsets[fieldsetIndex].properties, function(property){
return property.alias == alias;
});
}
return (typeof property == 'undefined') ? true : property.isValid;
}
//sync things up on save
$scope.$on("formSubmitting", function (ev, args) {
var validation = getValidation();
if(!validation.isValid)
{
notificationsService.warning("Cannot Save Document", "The document could not be saved because of missing required fields.")
form.$setValidity("archetypeError", false);
}
else
{
syncModelToRenderModel();
form.$setValidity("archetypeError", true);
}
});
//custom js
if ($scope.model.config.customJsPath) {
assetsService.loadJs($scope.model.config.customJsPath);
}
//archetype css
assetsService.loadCss("/App_Plugins/Archetype/css/archetype.css");
//custom css
if($scope.model.config.customCssPath)
{
assetsService.loadCss($scope.model.config.customCssPath);
}
});
+130
View File
@@ -0,0 +1,130 @@
angular.module("umbraco").directive('archetypeProperty', function ($compile, $http) {
function getFieldsetByAlias(fieldsets, alias)
{
for (var i in fieldsets)
{
if (fieldsets[i].alias == alias)
{
return fieldsets[i];
}
}
}
function getPropertyIdByAlias(properties, alias)
{
for (var i in properties)
{
if (properties[i].alias == alias) {
return i;
}
}
}
var linker = function (scope, element, attrs) {
var configFieldsetModel = getFieldsetByAlias(scope.archetypeConfig.fieldsets, scope.fieldset.alias);
var view = configFieldsetModel.properties[scope.propertyConfigIndex].view;
var label = configFieldsetModel.properties[scope.propertyConfigIndex].label;
var config = configFieldsetModel.properties[scope.propertyConfigIndex].config;
var alias = configFieldsetModel.properties[scope.propertyConfigIndex].alias;
var defaultValue = configFieldsetModel.properties[scope.propertyConfigIndex].value;
//try to convert the config to a JS object
if(config && typeof config == 'string'){
try{
if(scope.archetypeConfig.developerMode == '1'){
console.log("Trying to eval config: " + config);
}
config = eval("(" + config + ")");
}
catch(exception)
{
if(scope.archetypeConfig.developerMode == '1'){
console.log("Failed to eval config.");
}
}
}
if(config && scope.archetypeConfig.developerMode == '1'){
console.log("Config post-eval: " + config);
}
//try to convert the defaultValue to a JS object
if(defaultValue && typeof defaultValue == 'string'){
try{
if(scope.archetypeConfig.developerMode == '1'){
console.log("Trying to eval default value: " + defaultValue);
}
defaultValue = eval("(" + defaultValue + ")");
}
catch(exception)
{
if(scope.archetypeConfig.developerMode == '1'){
console.log("Failed to eval defaultValue.");
}
}
}
if(defaultValue && scope.archetypeConfig.developerMode == '1'){
console.log("Default value post-eval: " + defaultValue);
}
if (view)
{
$http.get(view).success(function (data) {
if (data) {
if (scope.archetypeConfig.developerMode == '1')
{
console.log(scope);
}
var rawTemplate = data;
//define the initial model and config
scope.model = {};
scope.model.config = {};
//ini the property value after test to make sure a prop exists in the renderModel
var renderModelPropertyIndex = getPropertyIdByAlias(scope.archetypeRenderModel.fieldsets[scope.fieldsetIndex].properties, alias);
if (!renderModelPropertyIndex)
{
scope.archetypeRenderModel.fieldsets[scope.fieldsetIndex].properties.push(eval("({alias: '" + alias + "', value:'" + defaultValue + "'})"));
renderModelPropertyIndex = getPropertyIdByAlias(scope.archetypeRenderModel.fieldsets[scope.fieldsetIndex].properties, alias);
}
scope.model.value = scope.archetypeRenderModel.fieldsets[scope.fieldsetIndex].properties[renderModelPropertyIndex].value;
//set the config from the prevalues
scope.model.config = config;
//some items need an alias
scope.model.alias = "scope-" + scope.$id;
//watch for changes since there is no two-way binding with the local model.value
scope.$watch('model.value', function (newValue, oldValue) {
scope.archetypeRenderModel.fieldsets[scope.fieldsetIndex].properties[renderModelPropertyIndex].value = newValue;
});
element.html(rawTemplate).show();
$compile(element.contents())(scope);
}
});
}
}
return {
restrict: "E",
rep1ace: true,
link: linker,
scope: {
property: '=',
propertyConfigIndex: '=',
archetypeConfig: '=',
fieldset: '=',
fieldsetIndex: '=',
archetypeRenderModel: '='
}
}
});
+190
View File
@@ -0,0 +1,190 @@
.archetypeEditor fieldset{
border: 1px solid #666;
padding: 5px;
margin-bottom: 5px;
background-color: #fff;
clear: both;
}
.archetypeEditor label{
width: 75px;
float: left;
}
.archetypeEditor fieldset>label{
float: left;
width: 200px;
padding-left: 0;
}
.archetypeEditor .multiPropertyTextbox{
margin-bottom: 3px;
}
.archetypeEditor ul{
list-style: none;
}
.archetypeEditor .archetypeEditorControls{
float: right;
}
.archetypeEditor .archetypeProperty{
clear: both;
overflow: hidden;
margin-top: 3px;
}
.archetypeEditor .umb-contentpicker{
margin-left: 60px;
padding-left: 25px;
}
.archetypeEditor .archetypeDeveloperModel
{
width: 98%;
min-height: 100px;
margin-bottom: 10px;
border: 1px solid red;
}
.archetypeEditor .archetypeFieldsetToolbar {
margin-bottom: 10px;
overflow: hidden;
}
.archetypeEditor .archetypeFieldsetToolbar li {
float: left;
padding: 2px 4px;
margin-right: 10px;
border: 1px solid #ddd;
cursor: pointer;
}
.archetypeEditor .archetypeFieldsetHeaderText{
clear:both;
margin-bottom: 3px;
font-size: 12px;
}
.archetypeEditor .archetypeFieldsetFooterText{
clear:both;
margin-bottom: 3px;
font-size: 12px;
}
.archetypeEditor .archetypeFieldsetHelpText{
clear:both;
margin-bottom: 3px;
font-size: 12px;
}
.archetypeConfig {
margin-bottom: 20px;
}
.archetypeConfig ul{
list-style: none;
}
.archetypeConfig .archetypeEditorControls{
float: right;
}
.archetypeConfig li{
background-color: #fff;
}
.archetypeConfig label{
width: 120px;
}
.archetypeConfig .archetypeFieldsetWrapper{
border: 1px solid #ccc;
padding: 10px 5px;
margin-bottom: 10px;
}
.archetypeConfig .archetypeFieldsetOption input[type=text]{
width: 600px;
}
.archetypeConfig .archetypeDeveloperModel {
width: 88%;
margin-left: 30px;
height: 100px;
}
.archetypeConfig .archetypePropertiesWrapper{
border: 1px solid #ddd;
padding: 10px;
margin: 10px;
margin-left: 50px;
width: 665px;
}
.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;
}
.archetypeConfig .archetypeFieldsets {
margin-left: 0;
}
.archetypeConfig .archetypeFieldsetTitle {
overflow: hidden;
}
.archetypeConfig .archetypeFieldsetCollapser{
margin-top: 10px;
}
.archetypeConfig .archetypeOptions label{
width: 200px;
}
.archetypeConfig .archetypeAdvancedOptions label{
width: 400px;
}
.archetypeConfig .archetypeDeveloperModel {
margin-bottom: 10px;
}
.archetypeConfig .archetypeMaxFieldsets{
border: 1px solid #ddd;
width: 25px;
text-align: right;
}
.archetypeConfig .archetypePropertyTitle{
overflow: hidden;
}
.archetypeConfig .archetypePropertyCollapser{
margin-top: 10px;
}
.archetypeEditor .archetypeFieldsetError{
border: 1px solid red;
}
.archetypeEditor .archetypePropertyError{
border: 1px solid red;
background-color: #8b0000;
color: #fff;
margin-bottom: 5px;
padding-top: 3px;
padding-bottom: 3px;
}
+30
View File
@@ -0,0 +1,30 @@
{
propertyEditors: [
{
alias: "Imulus.Archetype",
name: "Archetype",
editor: {
view: "~/App_Plugins/Archetype/views/archetype.html",
valueType: "JSON"
},
prevalues: {
fields: [
{
label: "Config",
description: "(Required) Describe your Archetype.",
key: "archetypeConfig",
view: "/App_Plugins/Archetype/views/archetype.config.html",
validation: [
{
type: "Required"
}
]
}
]
}
}
],
javascript: [
'~/App_Plugins/Archetype/js/archetype.js'
]
}
+9
View File
@@ -0,0 +1,9 @@
angular.module('umbraco').factory('propertyEditorService', function($q, $http, umbRequestHelper){
return {
getViews: function() {
return umbRequestHelper.resourcePromise(
$http.get("/App_Plugins/Archetype/js/config.views.js"), 'Failed to retreive config for views.'
);
}
};
});
+119
View File
@@ -0,0 +1,119 @@
<div class="archetypeConfig" ng-controller="Imulus.ArchetypeConfigController">
<ul class="archetypeFieldsets" ui-sortable="sortableOptions" ng-model="archetypeConfigRenderModel.fieldsets">
<li ng-repeat="fieldset in archetypeConfigRenderModel.fieldsets" ng-hide="fieldset.remove">
<div class="archetypeFieldsetWrapper" >
<div class="archetypeEditorControls" ng-show="archetypeConfigRenderModel.enableMultipleFieldsets">
<i class="icon icon-add" ng-click="addFieldsetRow($index, $event)"></i>
<i class="icon icon-delete" ng-click="removeFieldsetRow($index)" ng-show="canRemoveFieldset()"></i>
<i class="icon icon-navigation handle" ng-show="canSortFieldset()"></i>
</div>
<div class="archetypeFieldsetTitle" ng-click="focusFieldset(fieldset)">{{fieldset.label}}</div>
<div class="archetypeFieldsetCollapser" ng-hide="fieldset.collapse && fieldset.label">
<div class="archetypeFieldsetOption">
<label>Label</label><input type="text" ng-model="fieldset.label" />
</div>
<div class="archetypeFieldsetOption">
<label>Alias</label><input type="text" ng-model="fieldset.alias" />
</div>
<div class="archetypeFieldsetOption">
<label>Label Template</label><input type="text" ng-model="fieldset.labelTemplate" />
</div>
<div class="archetypeFieldsetOption">
<label>Tooltip</label><input type="text" ng-model="fieldset.tooltip" />
</div>
<div class="archetypeFieldsetOption">
<label>Icon</label><input type="text" ng-model="fieldset.icon" />
</div>
<div class="archetypeFieldsetOption">
<label>Header Text</label><input type="text" ng-model="fieldset.headerText" />
</div>
<div class="archetypeFieldsetOption">
<label>Footer Text</label><input type="text" ng-model="fieldset.footerText" />
</div>
<div class="archetypeFieldsetOption">
<label>Properties</label>
</div>
<div class="archetypePropertiesWrapper">
<ul ui-sortable="sortableOptions" ng-model="fieldset.properties">
<li ng-repeat="property in fieldset.properties" ng-hide="property.remove">
<div class="archetypeEditorControls">
<i class="icon icon-add" ng-click="addPropertyRow(fieldset, $index)"></i>
<i class="icon icon-delete" ng-click="removePropertyRow(fieldset, $index)" ng-show="canRemoveProperty(fieldset)"></i>
<i class="icon icon-navigation handle" ng-show="canSortProperty(fieldset)"></i>
</div>
<div class="archetypePropertyTitle" ng-click="focusProperty(fieldset.properties, property)">{{property.label}}</div>
<div class="archetypePropertyCollapser" ng-hide="property.collapse && property.label">
<div>
<label>Label</label><input type="text" ng-model="property.label" />
</div>
<div>
<label>Alias</label><input type="text" ng-model="property.alias" />
</div>
<div>
<label>Help Text</label><input type="text" ng-model="property.helpText" />
</div>
<div>
<label>View</label><select ng-model="property.view" ng-options="view.path as view.name for view in availableViews"></select>
</div>
<div>
<label>Default Value</label><input type="text" ng-model="property.value" />
</div>
<div>
<label>Config</label><textarea ng-model="property.config" /></textarea>
</div>
<div>
<label>Required</label><input type="checkbox" ng-model="property.required" />
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</li>
</ul>
<div class="archetypeOptions">
<div>
<label>Toggle Advanced Options<small>Show advanced options.</small></label><input type="checkbox" ng-model="archetypeConfigRenderModel.showAdvancedOptions"/>
</div>
</div>
<div class="archetypeAdvancedOptions" ng-show="archetypeConfigRenderModel.showAdvancedOptions">
<div>
<label>Hide fieldset editor controls?<small>Hides the fieldset add/remove/sort controls.</small></label><input type="checkbox" ng-model="archetypeConfigRenderModel.hideFieldsetControls"/>
</div>
<div>
<label>Hide fieldset labels?<small>Hides the fieldset labels.</small></label><input type="checkbox" ng-model="archetypeConfigRenderModel.hideFieldsetLabels"/>
</div>
<div>
<label>Hide property labels?<small>Hides the property labels.</small></label><input type="checkbox" ng-model="archetypeConfigRenderModel.hidePropertyLabels"/>
</div>
<div>
<label>Max fieldsets<small>How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.</small></label><input type="text" class="archetypeMaxFieldsets" ng-model="archetypeConfigRenderModel.maxFieldsets"/>
</div>
<div>
<label>Enable multiple fieldsets?<small>Allows multiple types of fieldsets within this archetype.</small></label><input type="checkbox" ng-model="archetypeConfigRenderModel.enableMultipleFieldsets"/>
</div>
<div>
<label>Hide fieldset toolbar?<small>Hides the fieldset toolbar that appears when more than one fieldset model appears.</small></label><input type="checkbox" ng-model="archetypeConfigRenderModel.hideFieldsetToolbar"/>
</div>
<div>
<label>Custom Wrapper Class<small>(Optional) Enter a custom CSS class that will be applied to the wrapper div.</small></label><input type="text" ng-model="archetypeConfigRenderModel.customCssClass"/>
</div>
<div>
<label>CSS File<small>(Optional) Enter a path for a custom CSS file to be included on the page.</small></label><input type="text" ng-model="archetypeConfigRenderModel.customCssPath"/>
</div>
<div>
<label>JS File<small>(Optional) Enter a path for a custom JS file to be included on the page.</small></label><input type="text" ng-model="archetypeConfigRenderModel.customJsPath"/>
</div>
<div>
<label>Toggle Developer Mode<small>Turn on for developer options.</small></label><input type="checkbox" ng-model="archetypeConfigRenderModel.developerMode"/>
</div>
<div>
<label>Config Model<small>Be careful editing the text below, it controls the schema for this archetype.</small></label>
<textarea class="archetypeDeveloperModel" ng-model="archetypeConfigRenderModel"></textarea>
</div>
</div>
</div>
+44
View File
@@ -0,0 +1,44 @@
<div class="archetypeEditor ng-class:model.config.customCssClass" ng-controller="Imulus.ArchetypeController">
<textarea class="archetypeDeveloperModel" ng-show="model.config.developerMode" ng-model="archetypeRenderModel"></textarea>
<div class="archetypeFieldsetToolbar" ng-show="model.config.fieldsets.length > 1 && model.config.hideFieldsetToolbar != '1'">
<ul>
<li ng-repeat="fieldsetModel in model.config.fieldsets" ng-click="addRow(fieldsetModel.alias)">
<img ng-src='{{fieldsetModel.icon}}' title="{{fieldsetModel.tooltip}}" />
<span>{{fieldsetModel.label}}</span>
</li>
</ul>
</div>
<ul ui-sortable="sortableOptions" ng-model="archetypeRenderModel.fieldsets">
<li ng-repeat="fieldset in archetypeRenderModel.fieldsets" ng-hide="fieldset.remove">
<fieldset ng-class="{archetypeFieldsetError: !fieldset.isValid}" ng-init="fieldsetConfigModel = getConfigFieldsetByAlias(fieldset.alias)">
<label ng-hide="model.config.hideFieldsetLabels == '1'" ng-click="focusFieldset(fieldset)">
<img ng-src='{{fieldsetConfigModel.icon}}' title="{{fieldsetConfigModel.tooltip}}"/>
<span ng-bind="getFieldsetTitle(fieldsetConfigModel, $index)"></span>
</label>
<div class="archetypeEditorControls" ng-hide="model.config.hideFieldsetControls || model.config.maxFieldsets == '1'">
<i class="icon icon-add" ng-click="addRow(fieldset.alias, $index)" ng-show="canAdd()"></i>
<i class="icon icon-delete" ng-click="removeRow($index)" ng-show="canRemove()"></i>
<i class="icon icon-navigation handle" ng-show="canSort()"></i>
</div>
<div class="arechetypeCollapser" ng-hide="fieldset.collapse">
<div class="archetypeFieldsetHeaderText" ng-show="fieldsetConfigModel.headerText">
<em>{{fieldsetConfigModel.headerText}}</em>
</div>
<div ng-class="{archetypePropertyError: getPropertyValidity($parent.$index, property.alias) === false}" class="archetypeProperty" ng-repeat="property in fieldsetConfigModel.properties">
<label ng-hide="archetypeConfig.hidePropertyLabels == '1'">
<span>{{property.label}}</span>
<div class="archetypeFieldsetHelpText" ng-show="property.helpText">
<em>{{property.helpText}}</em>
</div>
</label>
<archetype-property class="archetypeEditor ng-class:property.alias" property="property" fieldset-index="$parent.$index" fieldset="fieldset" archetype-config="model.config" property-config-index="$index" archetype-render-model="archetypeRenderModel"></archetype-property>
</div>
<div class="archetypeFieldsetFooterText" ng-show="fieldsetConfigModel.footerText">
<em>{{fieldsetConfigModel.footerText}}</em>
</div>
</div>
</fieldset>
</li>
</ul>
</div>
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

-143
View File
@@ -1,143 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="description" content="Archetype : An Umbraco 7 Property Editor Wrapper" />
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<title>Archetype</title>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
<img class="logo" src="images/logo.png" alt="logo"/>
<a id="forkme_banner" href="https://github.com/imulus/Archetype">View on GitHub</a>
<h1 id="project_title">Archetype</h1>
<h2 id="project_tagline">An Umbraco 7 Property Editor Wrapper</h2>
<section id="downloads">
<a class="zip_download_link" href="https://github.com/imulus/Archetype/zipball/master">Download this project as a .zip file</a>
<a class="tar_download_link" href="https://github.com/imulus/Archetype/tarball/master">Download this project as a tar.gz file</a>
</section>
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<p>Archetype is an Umbraco 7 property editor that wraps other installed property editors. By wrapping the other properties, Archetype allows for custom and repeatable fieldset mashups.</p>
<p>Checkout some videos of Archetype in action here: <a href="http://blog.imulus.com/kevin-giszewski/umbraco-7-package-preview-archetype">http://blog.imulus.com/kevin-giszewski/umbraco-7-package-preview-archetype</a></p>
<img class="logo" style="border: 1px solid #ccc;" src="images/example1.png"/>
<h2>
<a name="installation" class="anchor" href="#installation"><span class="octicon octicon-link"></span></a>Installation</h2>
<p>Install the latest <a href="https://github.com/imulus/Archetype/releases">package</a> through the Umbraco package installer or via <a href="http://www.nuget.org/packages/Archetype/">NuGet</a>.</p>
<h2>
<a name="basic-configuration" class="anchor" href="#basic-configuration"><span class="octicon octicon-link"></span></a>Basic Configuration</h2>
<p>After installation, visit the developer section and create a new data type with Archetype as the selected property editor.</p>
<p>At this point you should now see several input boxes to set up your Archetype fieldset:</p>
<p><strong>Label</strong> - A label for your fieldset (i.e. person, car, etc)</p>
<p><strong>Alias (required)</strong> - Pick a machine safe (A-Z 0-9 _- no spaces) name for your archetype that will be used for tracking this fieldset.</p>
<p><strong>Label Template</strong></p>
<p>This template will be used in the data editor and will display when the fieldset is collapsed. Ideally you can select static text or a property alias. If you choose to use a property value, you must use the following syntax:</p>
<p><code>{{firstName}}</code> - Where firstName is the alias of a property.</p>
<p><strong>Tooltip</strong> - Appears when hovering overing over a fieldset in the data editor. This is only applicable when multiple fieldsets are enabled.</p>
<p><strong>Properties</strong> - Properties represent the actual input controls that your Archetype will encapsulate.</p>
<ul>
<li><p><em>Label</em> - A label for your property.</p></li>
<li><p><em>Alias</em> (required) - Pick a machine safe (A-Z 0-9 _- no spaces) name for your archetype that will be used for tracking this property.</p></li>
<li><p><em>Help Text</em> - Text that appears under the label to guide the user on what the input is for.</p></li>
<li><p><em>Datatype</em> - Select the preconfigured Umbraco data type.</p></li>
<li><p><em>Default Value</em> - Input either a JSON or plain text value. This value varies and is determined by the chosen view.</p></li>
<li><p><em>Required</em> - Simple required validation can be achieved by ticking this box.</p></li>
</ul><h2>
<a name="advanced-configuration" class="anchor" href="#advanced-configuration"><span class="octicon octicon-link"></span></a>Advanced Configuration</h2>
<p>Advanced options can be exposed by ticking the Toggle Advanced Options box.</p>
<p><strong>Max Fieldsets</strong> - When blank, the Archetype will allow an infinite number of repeated fieldsets. Placing an integer in this box will limit the number to the amount entered.</p>
<p><strong>Enable Multiple Fieldsets</strong> - By ticking this box, a developer may add more than one type of fieldset to the Archetype. When there are multiple fieldsets configured, a toolbar will display on the data editor to allow the editor to select the different fieldsets.</p>
<p><strong>Custom Wrapper Class</strong> - If you need to inject a custom class to your Archetype wrapper, this is the place to do it.</p>
<p><strong>CSS File</strong> - If you would like to alter the appearance of the default Archetype styles, simply include a file path to your CSS file here.</p>
<p><strong>JS File</strong> - If you would like to inject some JavaScript on the page, simply include a file path to your JS file here.</p>
<p><strong>Toggle Developer Mode</strong> - Tick this box to enable verbose debugging to the console. This also expose the data model on the data editor page which can be live edited.</p>
<p><strong>Config Model</strong> - Import/Export your Archetype between installs by copy/pasting this code. You can also live edit your Archetype config by alter these values. Caution should be used when doing so.</p>
<h2>
<a name="usage" class="anchor" href="#usage"><span class="octicon octicon-link"></span></a>Usage</h2>
<p>To use your new Archetype, simply add it to any document type.</p>
<p>To integrate your own property editor:</p>
<ol>
<li>Ensure your property editor is installed into Umbraco.</li>
<li>Edit the <code>/App_Plugins/Archetype/js/propertyEditors.views.js</code> file.</li>
<li>Add a JSON object that defines your custom property editor.</li>
</ol>
<p>How to use it on a template you ask?: <a href="https://gist.github.com/kgiszewski/8863822">Get the gist here.</a></p>
<h2>
<a name="known-issues" class="anchor" href="#known-issues"><span class="octicon octicon-link"></span></a>Known Issues</h2>
<h3>
<a name="umbraco-caching" class="anchor" href="#umbraco-caching"><span class="octicon octicon-link"></span></a>Umbraco Caching</h3>
<p>If you decide to extend this project locally, you'll want to set the <code>&lt;compilation&gt;</code> debug property in your web.config to <code>true</code>:</p>
<p><code>&lt;compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.5"&gt;</code></p>
<p>This is in order to circumvent the minification and caching of the JavaScript files.</p>
<h3>
<a name="prevalue-character-limit" class="anchor" href="#prevalue-character-limit"><span class="octicon octicon-link"></span></a>Prevalue Character Limit</h3>
<p>If you get an error during saving that says the value will be truncated in the database, it is because you config has exceeded the 2500 character limit imposed by Umbraco. You can get around this by upping the limit in your DB. Please backup your DB first.</p>
<p><a href="http://issues.umbraco.org/issue/U4-2120">http://issues.umbraco.org/issue/U4-2120</a></p>
<h3>
<a name="other-issues" class="anchor" href="#other-issues"><span class="octicon octicon-link"></span></a>Other Issues</h3>
<p>There is also a list <a href='https://github.com/imulus/Archetype/issues'>here</a>.</p>
</section>
</div>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner">
<p class="copyright">Archetype maintained by <a href="https://github.com/imulus">imulus</a></p>
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
</footer>
</div>
</body>
</html>
-1
View File
@@ -1 +0,0 @@
console.log('This would be the main JS file.');
+25
View File
@@ -0,0 +1,25 @@
{
"name": "archetype",
"version": "0.0.0",
"devDependencies": {
"grunt": "~0.4.2",
"bower": "~1.2.8",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-less": "~0.8.3",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.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-touch": "~0.1.0",
"guid": "0.0.12",
"adm-zip": "~0.4.3",
"rimraf": "~2.2.5",
"grunt-nuget": "~0.1.1",
"grunt-template": "~0.2.2",
"grunt-touch": "~0.1.0",
"fs-extra": "~0.8.1",
"grunt-msbuild": "~0.1.9"
}
}
-1
View File
@@ -1 +0,0 @@
{"name":"Archetype","tagline":"An Umbraco 7 Property Editor Wrapper","body":"Archetype is an Umbraco 7 property editor that wraps other installed property editors. By wrapping the other properties, Archetype allows for custom and repeatable fieldset mashups.\r\n\r\nCheckout some videos of Archetype in action here: http://blog.imulus.com/kevin-giszewski/umbraco-7-package-preview-archetype\r\n\r\n##Installation\r\n\r\nInstall the [package](https://github.com/imulus/Archetype/releases) through the Umbraco package installer or via [NuGet](http://www.nuget.org/packages/Archetype/).\r\n\r\n##Basic Configuration##\r\n\r\nAfter installation, visit the developer section and create a new data type with Archetype as the selected property editor.\r\n\r\nAt this point you should now see several input boxes to set up your Archetype fieldset:\r\n\r\n**Label** - A label for your fieldset (i.e. person, car, etc)\r\n\r\n**Alias (required)** - Pick a machine safe (A-Z 0-9 _- no spaces) name for your archetype that will be used for tracking this fieldset.\r\n\r\n**Label Template**\r\n\r\nThis template will be used in the data editor and will display when the fieldset is collapsed. Ideally you can select static text or a property alias. If you choose to use a property value, you must use the following syntax:\r\n\r\n`{{firstName}}` - Where firstName is the alias of a property.\r\n\r\n**Tooltip** - Appears when hovering overing over a fieldset in the data editor. This is only applicable when multiple fieldsets are enabled.\r\n\r\n**Properties** - Properties represent the actual input controls that your Archetype will encapsulate.\r\n\t\r\n* _Label_ - A label for your property.\r\n\t\r\n* _Alias_ (required) - Pick a machine safe (A-Z 0-9 _- no spaces) name for your archetype that will be used for tracking this property.\r\n\r\n* _Help Text_ - Text that appears under the label to guide the user on what the input is for.\r\n\r\n* _Datatype_ - Select the preconfigured Umbraco data type.\r\n\r\n* _Default Value_ - Input either a JSON or plain text value. This value varies and is determined by the chosen view.\r\n\r\n* _Required_ - Simple required validation can be achieved by ticking this box.\r\n\r\n## Advanced Configuration\r\n\r\nAdvanced options can be exposed by ticking the Toggle Advanced Options box.\r\n\r\n**Max Fieldsets** - When blank, the Archetype will allow an infinite number of repeated fieldsets. Placing an integer in this box will limit the number to the amount entered.\r\n\r\n**Enable Multiple Fieldsets** - By ticking this box, a developer may add more than one type of fieldset to the Archetype. When there are multiple fieldsets configured, a toolbar will display on the data editor to allow the editor to select the different fieldsets.\r\n\r\n**Custom Wrapper Class** - If you need to inject a custom class to your Archetype wrapper, this is the place to do it.\r\n\r\n**CSS File** - If you would like to alter the appearance of the default Archetype styles, simply include a file path to your CSS file here.\r\n\r\n**JS File** - If you would like to inject some JavaScript on the page, simply include a file path to your JS file here.\r\n\r\n**Toggle Developer Mode** - Tick this box to enable verbose debugging to the console. This also expose the data model on the data editor page which can be live edited.\r\n\r\n**Config Model** - Import/Export your Archetype between installs by copy/pasting this code. You can also live edit your Archetype config by alter these values. Caution should be used when doing so.\r\n\r\n## Usage\r\n\r\nTo use your new Archetype, simply add it to any document type.\r\n\r\nTo integrate your own property editor:\r\n\r\n1. Ensure your property editor is installed into Umbraco.\r\n2. Edit the `/App_Plugins/Archetype/js/propertyEditors.views.js` file.\r\n3. Add a JSON object that defines your custom property editor.\r\n\r\n## Known Issues\r\n\r\n### Umbraco Caching\r\n\r\nIf you decide to extend this project locally, you'll want to set the `<compilation>` debug property in your web.config to `true`:\r\n\r\n`<compilation defaultLanguage=\"c#\" debug=\"true\" batch=\"false\" targetFramework=\"4.5\">`\r\n\r\nThis is in order to circumvent the minification and caching of the JavaScript files.\r\n\r\n### Prevalue Character Limit\r\n\r\nIf you get an error during saving that says the value will be truncated in the database, it is because you config has exceeded the 2500 character limit imposed by Umbraco. You can get around this by upping the limit in your DB. Please backup your DB first.\r\n\r\nhttp://issues.umbraco.org/issue/U4-2120\r\n\r\n### Core Property Editors\r\nRTE - The RTE doesnt like to render on a repeatable fieldset. It also goes bonkers when you try to sort a field.","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
+9
View File
@@ -0,0 +1,9 @@
{
"name": "Archetype",
"version": "0.1.0-alpha",
"url": "http://github.com/imulus/archetype/",
"author": "Imulus",
"authorUrl": "http://imulus.com/",
"license": "MIT",
"licenseUrl": "http://opensource.org/licenses/MIT"
}
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Archetype</id>
<version><%= version %></version>
<title><%= name %></title>
<authors>imulus, kgiszewski, tomfulton</authors>
<owners>imulus, kgiszewski, tomfulton</owners>
<projectUrl>http://github.com/imulus/archetype</projectUrl>
<description><![CDATA[Archetype for Umbraco]]></description>
<tags>umbraco</tags>
<iconUrl>http://github.com/imulus/archetype/raw/master/assets/logo.png</iconUrl>
<licenseUrl><%= licenseUrl %></licenseUrl>
</metadata>
<files>
<% files.forEach(function(file) { %>
<file src="<%- file.path %>" target="<%= file.target %>" />
<% }); %>
</files>
</package>
+39
View File
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<umbPackage>
<info>
<package>
<name><%= name %></name>
<version><%= version %></version>
<license url="<%= licenseUrl %>"><%= license %></license>
<url><%= url %></url>
<requirements>
<major>0</major>
<minor>0</minor>
<patch>0</patch>
</requirements>
</package>
<author>
<name><%= author %></name>
<website><%= authorUrl %></website>
</author>
<readme><![CDATA[<%= readmeContents %>]]></readme>
</info>
<DocumentTypes />
<Templates />
<Stylesheets />
<Macros />
<DictionaryItems />
<Languages />
<DataTypes />
<control />
<Actions />
<files>
<% files.forEach(function(file) { %>
<file>
<guid><%= file.guid %>.<%= file.ext %></guid>
<orgPath><%= file.dir %></orgPath>
<orgName><%= file.name %></orgName>
</file>
<% }); %>
</files>
</umbPackage>
View File
-70
View File
@@ -1,70 +0,0 @@
.highlight .hll { background-color: #ffffcc }
.highlight { background: #f0f3f3; }
.highlight .c { color: #0099FF; font-style: italic } /* Comment */
.highlight .err { color: #AA0000; background-color: #FFAAAA } /* Error */
.highlight .k { color: #006699; font-weight: bold } /* Keyword */
.highlight .o { color: #555555 } /* Operator */
.highlight .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #009999 } /* Comment.Preproc */
.highlight .c1 { color: #0099FF; font-style: italic } /* Comment.Single */
.highlight .cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #003300; font-weight: bold } /* Generic.Heading */
.highlight .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
.highlight .go { color: #AAAAAA } /* Generic.Output */
.highlight .gp { color: #000099; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #003300; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #99CC66 } /* Generic.Traceback */
.highlight .kc { color: #006699; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #006699; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #006699; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #006699 } /* Keyword.Pseudo */
.highlight .kr { color: #006699; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #007788; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #FF6600 } /* Literal.Number */
.highlight .s { color: #CC3300 } /* Literal.String */
.highlight .na { color: #330099 } /* Name.Attribute */
.highlight .nb { color: #336666 } /* Name.Builtin */
.highlight .nc { color: #00AA88; font-weight: bold } /* Name.Class */
.highlight .no { color: #336600 } /* Name.Constant */
.highlight .nd { color: #9999FF } /* Name.Decorator */
.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #CC0000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #CC00FF } /* Name.Function */
.highlight .nl { color: #9999FF } /* Name.Label */
.highlight .nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #330099; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #003333 } /* Name.Variable */
.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #FF6600 } /* Literal.Number.Float */
.highlight .mh { color: #FF6600 } /* Literal.Number.Hex */
.highlight .mi { color: #FF6600 } /* Literal.Number.Integer */
.highlight .mo { color: #FF6600 } /* Literal.Number.Oct */
.highlight .sb { color: #CC3300 } /* Literal.String.Backtick */
.highlight .sc { color: #CC3300 } /* Literal.String.Char */
.highlight .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #CC3300 } /* Literal.String.Double */
.highlight .se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #CC3300 } /* Literal.String.Heredoc */
.highlight .si { color: #AA0000 } /* Literal.String.Interpol */
.highlight .sx { color: #CC3300 } /* Literal.String.Other */
.highlight .sr { color: #33AAAA } /* Literal.String.Regex */
.highlight .s1 { color: #CC3300 } /* Literal.String.Single */
.highlight .ss { color: #FFCC33 } /* Literal.String.Symbol */
.highlight .bp { color: #336666 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #003333 } /* Name.Variable.Class */
.highlight .vg { color: #003333 } /* Name.Variable.Global */
.highlight .vi { color: #003333 } /* Name.Variable.Instance */
.highlight .il { color: #FF6600 } /* Literal.Number.Integer.Long */
.type-csharp .highlight .k { color: #0000FF }
.type-csharp .highlight .kt { color: #0000FF }
.type-csharp .highlight .nf { color: #000000; font-weight: normal }
.type-csharp .highlight .nc { color: #2B91AF }
.type-csharp .highlight .nn { color: #000000 }
.type-csharp .highlight .s { color: #A31515 }
.type-csharp .highlight .sc { color: #A31515 }
-433
View File
@@ -1,433 +0,0 @@
/*******************************************************************************
Slate Theme for GitHub Pages
by Jason Costello, @jsncostello
*******************************************************************************/
@import url(pygment_trac.css);
/*******************************************************************************
MeyerWeb Reset
*******************************************************************************/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
ol, ul {
list-style: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/*******************************************************************************
Theme Styles
*******************************************************************************/
body {
box-sizing: border-box;
color:#373737;
background: #212121;
font-size: 16px;
font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 {
margin: 10px 0;
font-weight: 700;
color:#222222;
font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif;
letter-spacing: -1px;
}
h1 {
font-size: 36px;
font-weight: 700;
}
h2 {
padding-bottom: 10px;
font-size: 32px;
background: url('../images/bg_hr.png') repeat-x bottom;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 21px;
}
h5 {
font-size: 18px;
}
h6 {
font-size: 16px;
}
p {
margin: 10px 0 15px 0;
}
footer p {
color: #f2f2f2;
}
a {
text-decoration: none;
color: #007edf;
text-shadow: none;
transition: color 0.5s ease;
transition: text-shadow 0.5s ease;
-webkit-transition: color 0.5s ease;
-webkit-transition: text-shadow 0.5s ease;
-moz-transition: color 0.5s ease;
-moz-transition: text-shadow 0.5s ease;
-o-transition: color 0.5s ease;
-o-transition: text-shadow 0.5s ease;
-ms-transition: color 0.5s ease;
-ms-transition: text-shadow 0.5s ease;
}
a:hover, a:focus {text-decoration: underline;}
footer a {
color: #F2F2F2;
text-decoration: underline;
}
em {
font-style: italic;
}
strong {
font-weight: bold;
}
img {
position: relative;
margin: 0 auto;
max-width: 739px;
padding: 5px;
margin: 10px 0 10px 0;
border: 1px solid #ebebeb;
box-shadow: 0 0 5px #ebebeb;
-webkit-box-shadow: 0 0 5px #ebebeb;
-moz-box-shadow: 0 0 5px #ebebeb;
-o-box-shadow: 0 0 5px #ebebeb;
-ms-box-shadow: 0 0 5px #ebebeb;
}
p img {
display: inline;
margin: 0;
padding: 0;
vertical-align: middle;
text-align: center;
border: none;
}
pre, code {
width: 100%;
color: #222;
background-color: #fff;
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
font-size: 14px;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
}
pre {
width: 100%;
padding: 10px;
box-shadow: 0 0 10px rgba(0,0,0,.1);
overflow: auto;
}
code {
padding: 3px;
margin: 0 3px;
box-shadow: 0 0 10px rgba(0,0,0,.1);
}
pre code {
display: block;
box-shadow: none;
}
blockquote {
color: #666;
margin-bottom: 20px;
padding: 0 0 0 20px;
border-left: 3px solid #bbb;
}
ul, ol, dl {
margin-bottom: 15px
}
ul {
list-style: inside;
padding-left: 20px;
}
ol {
list-style: decimal inside;
padding-left: 20px;
}
dl dt {
font-weight: bold;
}
dl dd {
padding-left: 20px;
font-style: italic;
}
dl p {
padding-left: 20px;
font-style: italic;
}
hr {
height: 1px;
margin-bottom: 5px;
border: none;
background: url('../images/bg_hr.png') repeat-x center;
}
table {
border: 1px solid #373737;
margin-bottom: 20px;
text-align: left;
}
th {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 10px;
background: #373737;
color: #fff;
}
td {
padding: 10px;
border: 1px solid #373737;
}
form {
background: #f2f2f2;
padding: 20px;
}
/*******************************************************************************
Full-Width Styles
*******************************************************************************/
.outer {
width: 100%;
}
.inner {
position: relative;
max-width: 640px;
padding: 20px 10px;
margin: 0 auto;
}
#forkme_banner {
display: block;
position: absolute;
top:0;
right: 10px;
z-index: 10;
padding: 10px 50px 10px 10px;
color: #fff;
background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%;
font-weight: 700;
box-shadow: 0 0 10px rgba(0,0,0,.5);
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}
#header_wrap {
background: #212121;
background: -moz-linear-gradient(top, #373737, #212121);
background: -webkit-linear-gradient(top, #373737, #212121);
background: -ms-linear-gradient(top, #373737, #212121);
background: -o-linear-gradient(top, #373737, #212121);
background: linear-gradient(top, #373737, #212121);
height: 170px;
}
#header_wrap .inner {
padding: 50px 10px 30px 10px;
}
#project_title {
margin: 0;
color: #fff;
font-size: 42px;
font-weight: 700;
text-shadow: #111 0px 0px 10px;
}
#project_tagline {
color: #fff;
font-size: 24px;
font-weight: 300;
background: none;
text-shadow: #111 0px 0px 10px;
}
#downloads {
position: absolute;
width: 210px;
z-index: 10;
bottom: -40px;
right: 0;
height: 70px;
background: url('../images/icon_download.png') no-repeat 0% 90%;
}
.zip_download_link {
display: block;
float: right;
width: 90px;
height:70px;
text-indent: -5000px;
overflow: hidden;
background: url(../images/sprite_download.png) no-repeat bottom left;
}
.tar_download_link {
display: block;
float: right;
width: 90px;
height:70px;
text-indent: -5000px;
overflow: hidden;
background: url(../images/sprite_download.png) no-repeat bottom right;
margin-left: 10px;
}
.zip_download_link:hover {
background: url(../images/sprite_download.png) no-repeat top left;
}
.tar_download_link:hover {
background: url(../images/sprite_download.png) no-repeat top right;
}
#main_content_wrap {
background: #f2f2f2;
border-top: 1px solid #111;
border-bottom: 1px solid #111;
}
#main_content {
padding-top: 40px;
clear:both;
}
#footer_wrap {
background: #212121;
}
.logo{
float: left;
border: none;
box-shadow: none;
-webkit-box-shadow: none;
margin-right: 10px;
}
/*******************************************************************************
Small Device Styles
*******************************************************************************/
@media screen and (max-width: 480px) {
body {
font-size:14px;
}
#downloads {
display: none;
}
.inner {
min-width: 320px;
max-width: 480px;
}
#project_title {
font-size: 32px;
}
h1 {
font-size: 28px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 21px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 14px;
}
h6 {
font-size: 12px;
}
code, pre {
min-width: 320px;
max-width: 480px;
font-size: 11px;
}
}
+76
View File
@@ -0,0 +1,76 @@
module.exports = function(grunt) {
grunt.registerTask('umbracoPackage', 'Create Umbraco Package', function() {
grunt.config.requires('umbracoPackage.options.name');
grunt.config.requires('umbracoPackage.options.version');
grunt.config.requires('umbracoPackage.options.license');
grunt.config.requires('umbracoPackage.options.licenseUrl');
grunt.config.requires('umbracoPackage.options.url');
grunt.config.requires('umbracoPackage.options.author');
grunt.config.requires('umbracoPackage.options.authorUrl');
grunt.config.requires('umbracoPackage.options.manifest');
grunt.config.requires('umbracoPackage.options.readme');
grunt.config.requires('umbracoPackage.options.outputDir');
grunt.config.requires('umbracoPackage.options.sourceDir');
var Guid = require('guid');
var path = require('path');
var rimraf = require('rimraf');
var AdmZip = require('adm-zip');
var fs = require('fs-extra');
var options = this.options({
minimumUmbracoVersion: '',
files: [],
cwd: '/'
});
var packageFileName = options.name + "_" + options.version + ".zip"
// Gather files
var filesToPackage = [];
getFilesRecursive(options.sourceDir);
filesToPackage = filesToPackage.map(function(f) {
return { guid: Guid.create(), dir: f.dir.replace(options.sourceDir, ''), name: f.name, ext: f.name.split('.').pop() };
});
// Create temp folder for package zip source
var guidFolder = Guid.create().toString();
var newDirName = path.join(options.sourceDir, "..\\" + guidFolder);
fs.mkdirSync(newDirName);
newDirName = path.join(newDirName, guidFolder);
fs.mkdirSync(newDirName);
// Copy flatten structure, with files renamed as <guid>.<ext>
filesToPackage.forEach(function(f) {
var newFileName = f.name == "package.xml" ? f.name : f.guid.toString() + '.' + f.ext;
fs.copySync(path.join(options.sourceDir, f.dir, f.name), path.join(newDirName, newFileName));
});
// Load / transform XML Manifest
options.files = filesToPackage;
options.readmeContents = grunt.file.read(options.readme);
var manifest = grunt.file.read(options.manifest);
manifest = grunt.template.process(manifest, {data: options});
grunt.file.write(path.join(options.sourceDir, "..\\", guidFolder, guidFolder, "package.xml"), manifest); // TODO: Probably shouldn't use sourceDir - what if under source control
// Zip
var zip = new AdmZip();
zip.addLocalFolder(path.join(options.sourceDir, "..\\", guidFolder));
zip.writeZip(path.join(options.outputDir, packageFileName))
function getFilesRecursive(dir) {
var files = fs.readdirSync(dir);
for (var i in files) {
if (!files.hasOwnProperty(i)) continue;
var name = dir+'/'+files[i];
if (fs.statSync(name).isDirectory()) {
getFilesRecursive(name);
} else {
filesToPackage.push({ dir: dir, name: files[i]});
}
}
}
});
};