Skip to content

Commit

Permalink
Fix a few broken links in the docs + add the grunt setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kjac committed Dec 13, 2015
1 parent 0bf026c commit 319bd76
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ _ReSharper*
bin/
obj/
**/node_modules/
**/Grunt/
Source/Solution/packages/
Dist/
Package/
Expand Down
2 changes: 1 addition & 1 deletion Docs/emails.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Email templates
Refer to the [setup guide](install.md) for instructions on how to configure email templates for Form Editor.

An email template is just a regular razor view that renders a `FormModel`. You'll need to place your email templates in the folder */Views/Partials/FormEditor/Email/* - Form Editor ships with a [sample email template](../Source/Umbraco/Views/Email/EmailTemplateSample.cshtml) to help you get started.
An email template is just a regular razor view that renders a `FormModel`. You'll need to place your email templates in the folder */Views/Partials/FormEditor/Email/* - Form Editor ships with a [sample email template](../Source/Umbraco/Views/Partial/FormEditor/Email/EmailTemplateSample.cshtml) to help you get started.

An email template is rendered in the Umbraco context. This means you'll be able to do all sorts of awesome stuff in your email template, because you have full access to your Umbraco data. In case you need the currently requested content item, Form Editor passes it (as `IPublishedContent`) to your view in `ViewData["currentContent"]`:

Expand Down
2 changes: 1 addition & 1 deletion Docs/extend_field_advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A complete implementation of a custom slider field (`input type="range"`) can be
## Project structure and field assets
The field assets (icon, editor and view) are included in the sample project. The directory structure in which they are placed mirrors the structure of your site (at least if you're using the [sample templates](../Source/Umbraco/Views/)). In other words you can copy the *App_Plugins* and *Views* folders directly to your site, and the assets will be placed correctly:
* The icon and editor goes into */App_Plugins/FormEditor/editor/fields/*.
* The partial view(s) goes into the folder where your form template looks for field partials. See the [rendering section](rendering.md) for details.
* The partial view(s) goes into the folder where your form template looks for field partials. See the [rendering section](render.md) for details.

## Project output
The sample project references the [Umbraco Cms Core Binaries](https://www.nuget.org/packages/UmbracoCms.Core/) NuGet package. That's why a bunch of Umbraco DLLs are found in the project output bin folder. Don't copy all of these to your site, or it will most likely explode. Please copy only the project output DLL (`My.Range.dll`).
Expand Down
2 changes: 1 addition & 1 deletion Docs/extend_field_simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The `name` given here is the field name presented to your editors when they're l
## Step 3: Render the field
The last step is to create the partial view that will render your slider field for the end users. Again, the partial view must be named after the field type name, so in this case it will be `my.range.cshtml`.

Create the partial view in the folder where your form template looks for field partials. See the [rendering section](rendering.md) for details.
Create the partial view in the folder where your form template looks for field partials. See the [rendering section](render.md) for details.

The following example illustrates of how the partial view could be implemented (of course the actual implementation is entirely up to you):
```xml
Expand Down
232 changes: 232 additions & 0 deletions Grunt/gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
module.exports = function (grunt) {
var isPackage = grunt.cli.tasks.indexOf("package") >= 0;
var packageDir = "temp/Package/";

// Project configuration.
grunt.initConfig({
// path to source
sourceDir: "../Source/",

// path to umbraco stuff
umbracoDir: "<%= sourceDir %>Umbraco/",
umbracoPluginDir: "<%= umbracoDir %>Plugin/",

// path to target (site)
targetDir: isPackage ? packageDir : grunt.option("target") || "../Dist/",
targetPluginDir: "<%= targetDir %>App_Plugins/FormEditor/",

// project build configuration
projectDir: "<%= sourceDir %>Solution/FormEditor/",
projectBuildConfig: isPackage ? "release" : grunt.option("buildConfig") || "debug",

pkg: grunt.file.readJSON("package.json"),

// tasks
// - less compilation
less: {
dist: {
files: {
"<%= targetPluginDir %>css/form.css": "<%= umbracoPluginDir %>css/form.less"
}
}
},
// - simple file copy (for files that need no transformation of any kind)
copy: {
// - static CSS and resources
css: {
files: [
{ expand: true, cwd: "<%= umbracoPluginDir %>css/", src: ["**", "!**/*.less"], dest: "<%= targetPluginDir %>css/", filter: "isFile" }
],
},
// - all static resources for the editor views (the actual views are handled by concat)
editorViews: {
files: [
{ expand: true, cwd: "<%= umbracoPluginDir %>editor/", src: ["*/**"], dest: "<%= targetPluginDir %>editor/", filter: "isFile" }
],
},
// - all configuration views
configViews: {
files: [
{ expand: true, cwd: "<%= umbracoPluginDir %>config/", src: ["**"], dest: "<%= targetPluginDir %>config/", filter: "isFile" }
],
},
// - project output dll
bin: {
files: [
{ expand: true, cwd: "<%= projectDir %>bin/<%= projectBuildConfig %>/", src: "FormEditor*.dll", dest: "<%= targetDir %>bin/", filter: "isFile" }
],
},
// - views for frontend rendering
frontendViews: {
files: [
{ expand: true, cwd: "<%= umbracoDir %>Views/", src: "**/*.cshtml", dest: "<%= targetDir %>Views/", filter: "isFile" }
],
},
// - JS for frontend rendering
frontendJS: {
files: [
{ expand: true, cwd: "<%= umbracoDir %>JS/", src: "**/*.js", dest: "<%= targetDir %>JS/", filter: "isFile" }
],
},
// - configuration files
config: {
files: [
{ expand: true, cwd: "<%= umbracoDir %>Config/", src: "*.config", dest: "<%= targetDir %>Config/", filter: "isFile" }
],
},
// - localization files
langs: {
files: [
{ expand: true, cwd: "<%= umbracoPluginDir %>js/langs/", src: "*.js", dest: "<%= targetPluginDir %>js/langs/", filter: "isFile" }
],
},
// - package manifest file
manifest: {
files: [
{ expand: true, cwd: "<%= umbracoPluginDir %>", src: "package.manifest", dest: "<%= targetPluginDir %>", filter: "isFile" }
],
}
},
// - concatination tasks
concat: {
// - create the form editor view
formEditorView: {
src: ["<%= umbracoPluginDir %>editor/form.html", "<%= umbracoPluginDir %>editor/directives.*.html"],
dest: "<%= targetPluginDir %>editor/form.html",
},
// - create the form data view
formDataView: {
src: ["<%= umbracoPluginDir %>editor/data.html", "<%= umbracoPluginDir %>editor/directives.common.html"],
dest: "<%= targetPluginDir %>editor/data.html",
},
// - create the JS
js: {
src: [
"<%= umbracoPluginDir %>js/controllers/*.js",
"<%= umbracoPluginDir %>js/directives/*.js",
"<%= umbracoPluginDir %>js/resources/*.js",
"<%= umbracoPluginDir %>js/services/*.js"
],
dest: "<%= targetPluginDir %>js/form.js",
options: {
sourceMap: true
}
}
},
// - watch tasks (watch everything in seperate tasks)
watch: {
options: {
atBegin: true
},
css: {
files: ["<%= umbracoPluginDir %>css/*.less"],
tasks: ["less"]
},
editorViews: {
files: ["<%= copy.editorViews.files[0].cwd %><%= copy.editorViews.files[0].src %>"],
tasks: ["copy:editorViews"]
},
configViews: {
files: ["<%= copy.configViews.files[0].cwd %><%= copy.configViews.files[0].src %>"],
tasks: ["copy:configViews"]
},
bin: {
files: ["<%= copy.bin.files[0].cwd %><%= copy.bin.files[0].src %>"],
tasks: ["copy:bin"]
},
frontendViews: {
files: ["<%= copy.frontendViews.files[0].cwd %><%= copy.frontendViews.files[0].src %>"],
tasks: ["copy:frontendViews"]
},
frontendJS: {
files: ["<%= copy.frontendJS.files[0].cwd %><%= copy.frontendJS.files[0].src %>"],
tasks: ["copy:frontendJS"]
},
config: {
files: ["<%= copy.config.files[0].cwd %><%= copy.config.files[0].src %>"],
tasks: ["copy:config"]
},
langs: {
files: ["<%= copy.langs.files[0].cwd %><%= copy.langs.files[0].src %>"],
tasks: ["copy:langs"]
},
manifest: {
files: ["<%= copy.manifest.files[0].cwd %><%= copy.manifest.files[0].src %>"],
tasks: ["copy:manifest"]
},
formEditorView: {
files: ["<%= concat.formEditorView.src %>"],
tasks: ["concat:formEditorView"]
},
formDataView: {
files: ["<%= concat.formDataView.src %>"],
tasks: ["concat:formDataView"]
},
js: {
files: ["<%= concat.js.src %>"],
tasks: ["concat:js"]
}
},
msbuild: {
options: {
stdout: true,
verbosity: "quiet",
maxCpuCount: 4,
version: 4.0,
buildParameters: {
WarningLevel: 2,
NoWarn: 1607
}
},
pkg: {
src: ["<%= projectDir %>FormEditor.csproj"],
options: {
projectConfiguration: "<%= projectBuildConfig %>",
targets: ["Clean", "Rebuild"]
}
}
},
assemblyinfo: {
options: {
files: ["<%= msbuild.pkg.src[0] %>"],
info: {
version: "<%= pkg.meta.version %>",
fileVersion: "<%= pkg.meta.version %>"
}
}
},
clean: {
pkg: [packageDir]
},
umbracoPackage: {
pkg: {
src: packageDir,
dest: "../Package",
options: { // Options for the package.xml manifest
name: "Form Editor",
version: "<%= pkg.meta.version %>",
url: "https://github.com/kjac/FormEditor",
license: "MIT",
licenseUrl: "https://opensource.org/licenses/MIT",
author: "Kenn Jacobsen",
authorUrl: "http://our.umbraco.org/member/25455",
readme: "See https://github.com/kjac/FormEditor for documentation."
}
}
}
});

// Load the plugins
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-msbuild");
grunt.loadNpmTasks("grunt-umbraco-package");
grunt.loadNpmTasks("grunt-dotnet-assembly-info");

// Tasks
grunt.registerTask("default", ["less", "copy", "concat"]);
grunt.registerTask("package", ["clean", "assemblyinfo", "msbuild", "less", "copy", "concat", "umbracoPackage"]);
};
20 changes: 20 additions & 0 deletions Grunt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "umbracian-form-grunt",
"version": "1.0.0",
"private": true,
"description": "Umbracian Form Grunt",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.7.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-msbuild": "^0.3.4",
"grunt-umbraco-package": "^1.0.0",
"grunt-dotnet-assembly-info": "^1.0.19"
},
"meta": {
"version": "0.9.0.2"
}
}

0 comments on commit 319bd76

Please sign in to comment.