-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
206 lines (184 loc) · 6.68 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AngularJS Schema Creator</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"/>
<style>
#main-container {
padding-top: 10px;
font-size: 12px;
}
.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
float: left;
}
h1 {
font-size: 1.2rem;
}
p {
margin-bottom: 0;
}
label {
display: inline-block;
}
p label {
width: 120px;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
ul li {
padding-left: 10px;
}
ul label {
width: 110px;
margin-bottom: 0;
font-style: italic;
}
input, select, textarea {
width: 200px;
margin-bottom: 5px;
-webkit-border-radius: 0 !important;
-moz-border-radius: 0 !important;
-ms-border-radius: 0 !important;
-o-border-radius: 0 !important;
border-radius: 0 !important;
overflow: hidden;
outline: none !important;
}
input, select {
height: 35px;
}
.result {
border: 2px inset grey;
}
sup.info-note {
background-color: gold;
padding: 0 2px;
border: 1px solid #000;
border-radius: 50%;
cursor: help;
}
.hidden {display: none;}
.visible {display: block;}
</style>
<script>
var app = angular.module('schemaBuilder', []);
app.controller('dateCtrl', function($scope) {
$scope.date = new Date();
});
app.controller('schemaTypes', function($scope) {
$scope.types = ["Entity", "Product", "Event", "Place", "Article"];
});
function switchTypes(){
var typeSelect = document.getElementById('schemaTypes').selectedIndex;
var typeValue = document.getElementsByTagName('option')[typeSelect].text;
switch(typeValue) {
case 'Entity':
document.getElementById('organizationTypes').setAttribute('class','visible');
document.getElementById('productTypes').setAttribute('class','hidden');
break;
case 'Product':
document.getElementById('productTypes').setAttribute('class','visible');
document.getElementById('organizationTypes').setAttribute('class','hidden');
break;
default:
document.getElementById('schemaTypes').setAttribute('data-ng-model','maintype');
}
}
</script>
</head>
<body>
<div data-ng-app="schemaBuilder" class="container" id="main-container">
<section class="col-6">
<h1>Input the required data</h1>
<fieldset id="typeSelector">
<p><label>Type:</label>
<select data-ng-controller="schemaTypes" id="schemaTypes" onchange="switchTypes()">
<option value="" disabled selected>Select Type</option>
<option value="{{type}}" data-ng-repeat="type in types">{{type}}</option>
</select>
<fieldset id="organizationTypes" class="hidden">
<label>Select Entity Type:</label>
<select data-ng-model="maintype">
<option value="" disabled selected>Entity Type</option>
<option value="Person">Person</option>
<option value="Organization">Organization</option>
<option value="Corporation">Corporation</option>
<option value="Consortium">Consortium</option>
<option value="Project">Project</option>
<option value="Airline">Airline</option>
<option value="LibrarySystem">Library System</option>
<option value="WorkersUnion">Workers Union</option>
<option value="LocalBusiness">Local Business</option>
<option value="EducationalOrganization">Educational Organization</option>
<option value="GovernmentOrganization">Government Organization</option>
<option value="SportsOrganization">Sports Organization</option>
<option value="MedicalOrganization">Medical Organization</option>
<option value="NewsMediaOrganization">News Media Organization</option>
<option value="NGO">Non-Governmental Organization (NGO)</option>
</select>
</fieldset>
<fieldset id="productTypes" class="hidden">
<label>Select Product Type:</label>
<select data-ng-model="maintype">
<option value="" disabled selected>Product Type</option>
<option value="Product">Product</option>
<option value="IndividualProduct">Individual Product</option>
<option value="ProductModel">Product Model</option>
<option value="SomeProducts">Some Products</option>
<option value="Vehicle">Vehicle</option>
</select>
</fieldset>
</p>
</fieldset>
<p><label>Name:</label> <input type="text" data-ng-model="name" required placeholder="Name"></p>
<p> <label for="start">Start date:</label>
<input type="date" id="start" name="startdate" data-ng-model="datecreated" min="1960-01-01" max="2020-01-01">
</p>
<ul class="subtype">
<label>Address:</label>
<li><label>Street Address:</label> <input type="text" data-ng-model="streetaddress" required placeholder="Street Address"> </li>
<li><label>Postal Code:</label> <input type="number" data-ng-model="postalcode" required placeholder="Postal Code"> </li>
<li><label>Address Locality:</label> <input type="text" data-ng-model="addresslocality" required placeholder="Address Locality"> </li>
<li><label>Address Region:</label> <input type="text" data-ng-model="addressregion" required placeholder="Address Region"> </li>
<li><label>Address Country:</label> <input type="text" data-ng-model="addresscountry" required placeholder="Address Country"> </li>
</ul>
<p><label>Phone:</label> <input type="tel" data-ng-model="phone" required placeholder="Telephone"></p>
<p><label>Price Range:</label> <input type="text" data-ng-model="pricerange" required placeholder="Price Range"></p>
<p><label>Image:</label> <input type="url" data-ng-model="imagelink" required placeholder="Image URL"></p>
<p><label>Description:</label> <textarea maxlength="156" data-ng-model="description" placeholder="Maximum 156 Characters"></textarea></p>
</section>
<!--
<sup class="info-note" id="country-note">?</sup>
-->
<section class="col-6 result">
<script type="application/ld+json"><br>
{<br>
"@context": "http://schema.org",<br>
"@type": "{{maintype}}",<br>
"name": "{{name}}",<br>
"dateCreated": "{{datecreated}}",<br>
"address": {<br>
"@type": "PostalAddress",<br>
"streetAddress": "{{streetaddress}}",<br>
"postalCode": "{{postalcode}}",<br>
"addressLocality": "{{addresslocality}}",<br>
"addressRegion": "{{addressregion}}",<br>
"addressCountry": "{{addresscountry}}"<br>
},<br>
"telephone": "{{phone}}",<br>
"priceRange": "{{pricerange}}",<br>
"image": "{{imagelink}}",<br>
"description": "{{description}}",<br>
"sdAuthor": "SD Master",<br>
"sdDatePublished": "<span data-ng-controller="dateCtrl" data-ng-model="sdDate">{{date | date:'yyyy-MM-dd'}}</span>"
<br>}<br>
</script>
</section>
</div>
</body>
</html>