1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!DOCTYPE html>



<html>

<head>

	<meta charset="utf-8" />

	<meta http-equiv="X-UA-Compatible" content="IE=9" />

	<title>Edit Aspect</title>

	<link href="/content/css/admin.css" rel="Stylesheet" media="all" />

	<link href="/content/css/jquery/common.css" rel="Stylesheet" media="all" />

	<link href="/content/css/controls/markdown.css" rel="Stylesheet" media="all" />



	

	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>

	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js"></script>



	<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8/jquery.validate.min.js"></script>

	<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js"></script>

	<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusive-ajax.min.js"></script>



	<script type="text/javascript" src="https://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.min.js"></script>

	<script type="text/javascript" src="http://cloud.github.com/downloads/SteveSanderson/knockout/knockout-1.2.1.debug.js"></script>

    <script type="text/javascript" src="https://github.com/SteveSanderson/knockout.mapping/raw/master/build/output/knockout.mapping-latest.debug.js"></script>

	<script type="text/javascript" src="/content/scripts/modernizr.js"></script>

	<script type="text/javascript" src="/content/scripts/markdown.js"></script>

	<script type="text/javascript" src="/content/scripts/jsonview.js"></script>

	<script type="text/javascript" src="/content/scripts/lightcast.js"></script>



	<script type="text/javascript">
		$(document).ready(function () {
			$("textarea.mdd_editor").MarkdownDeep({
				help_location: "/content/resources/mdd_help.htm",
				disableTabHandling: false
			});
		});

	</script>

</head>

<body>

	<br class="space" />

	<div class="container">

		<nav id="menu">

			<ul>

				<li>

					<a href="/Administrator/Home/Aspects">Aspects</a>

				</li>

				<li>

					<a href="/Administrator/Home/Templates">Templates</a>

				</li>

				<li>

					<a href="#">Members</a>

				</li>

			</ul>

		</nav>

		<div id="main">

			

	

<form action="/Administrator/Aspects/Edit" id="__frmAspect" method="post"><div class="validation-summary-valid" data-valmsg-summary="true"><ul><li style="display:none"></li>

</ul></div>

<input name="__RequestVerificationToken" type="hidden" value="WFAkecHcRzBYa6airaUBj8orKWQNE2wxgOmkRzGkgJgzb+RyMZnHg5C4ETh/dFq4m83lmJAB9L58XDCzTZODWMkjxL6p6sLQZNHmgr7M9HbihIyPMeClFWNnimj2X2wmzzkt1n1ERkq6qgWbRKpkQ7MivxU=" />

<br class="space" />

<ul class="clearfix">

	<li>

		<label for="Classification">Classification</label>

		<span class="input-validation-rules">The classification of the aspect being created. <strong>All aspects must have a classification</strong>.</span>

		<select data-bind="value:Classification" data-val="true" data-val-required="The Classification field is required." id="Classification" name="Classification"><option value=""></option><option value="One">One</option><option value="Two">Two</option><option value="Three">Three</option><option value="Four">Four</option><option value="Five">Five</option><option value="Six">Six</option><option value="Seven">Seven</option><option value="Eight">Eight</option></select>

	</li>

	<li>

		<label for="Archetype">Archetype</label>

		<span class="input-validation-rules">The primary archetype that the aspect belongs to. Select <em>None</em> if this does not apply.</span>

		<select data-bind="value:Archetype" data-val="true" data-val-required="The Archetype field is required." id="Archetype" name="Archetype"><option value=""></option><option value="None">None</option><option value="Physical">Physical</option><option value="Mental">Mental</option><option value="Spirit">Spirit</option></select>

	</li>

</ul>

<br class="space" />

<ul class="clearfix">

	<li>

		<label for="Name">Name</label>

		<span class="input-validation-rules">The name of the aspect, you can't use: <em>[ ] | ; , $ \ < > "</em></span>

		<input data-bind="value:Name,uniqueName:true" data-val="true" data-val-regex="Invalid name. Names must be between 3 and 64 characters in length, may contain any alphanumeric character and the symbols -&amp;#39;, and whitespace only." data-val-regex-pattern="^(?!.*[ ]{2})(?!.*[&#39;]{2})(?!.*[-]{2})(?:[a-zA-Z0-9 \p{L}&#39;-]{3,64}$)$" data-val-required="The Name field is required." id="Name" name="Name" size="45" type="text" />

	</li>

</ul>

<br class="space" />
<br class="space" />

<div>

	<label for="Description">Description</label>

	<span class="input-validation-rules">A brief description of the aspect.</span>

	<div class="mdd_toolbar"></div><textarea cols="50" data-bind="value:Description" data-mdd-preview="#aspectPreview" data-val="true" data-val-required="The Description field is required." id="Description" name="Description" rows="10" class="mdd_editor"></textarea><div id="aspectPreview"></div>

</div>

<h2>Properties</h2>

<hr />

<br class="space" />

<div class="clearfix right">

	<button type="submit">Submit</button>

</div>

</form>

<script type="text/javascript">

	// Construct knockout view models for persisting the aspect
	var viewModel = {
		// a GUID that the user will never be able to edit. This
		// is assigned, maintained, and persisted by the server.
		Id
			: ko.observable(),
		Name
			: ko.observable(),
		Description
			: ko.observable(),
		Archetype
			: ko.observable(),
		Classification
			: ko.observable(),
		Properties
			: ko.observableArray([]),

		Save: function () {
			alert('we reached the save function.');

			// we will try to send the model to the server.
			ko.utils.postJson(
				$("#__frmAspect").attr('action'),
				{ model: ko.toJS(this) }
			);
		}
	};

	// ----------------------------------------------------------------------- //
	// **************************** MODEL BINDING **************************** //
	// ----------------------------------------------------------------------- //

	// apply the knockout binding to the viewModel
	ko.applyBindings(viewModel, $("#__frmAspect")[0]);

	// attach the jquery unobtrusive validator
	$.validator.unobtrusive.parse("#__frmAspect");

	// bind the submit handler to unobtrusive validation.
	$("#__frmAspect").validate({
		submitHandler: function (form) {
			viewModel.Save();
		}
	});

</script>

		</div>	

	</div>

</body>

</html>