-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathshow.html.erb
186 lines (172 loc) · 8.1 KB
/
show.html.erb
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
<!--
# Alaska Data Integration working group - ADIwg
# REST endpoint controller for description of api
# History:
# Stan Smith 2019-05-16 added iso19115-1 writer
# Stan Smith 2017-12-27 moved input textarea to top of page
# Stan Smith 2017-12-27 reworded page text to support other than mdJson input
# Stan Smith 2017-05-19 refactored v1 demo for v3
# Stan Smith 2017-06-30 add buttons to insert mdJson or sbJson into JSON textarea
-->
<h2 id="mainHeader">
<%= image_tag "logo150.png", alt: "mdTranslator", class: "logo" %>
<span>API</span>
<span class="version">Demo v3</span>
</h2>
<div id="form_container">
<%= form_tag((ENV['RAILS_RELATIVE_URL_ROOT'] ? ENV['RAILS_RELATIVE_URL_ROOT'] : "") + "/api/v3/translator", id: "submitJSON") do %>
<div class="form_description">
<h2>Submit metadata to mdTranslator <%=Gem::Specification.find_by_name('adiwg-mdtranslator').version.to_s%></h2>
</h2>
<ol type="1">
<li>Load a sample input metadata file. Modify if you like; or paste in your own file. </li>
<li>Select 'reader' and 'writer'. </li>
<li>Select desired options. </li>
<li>Click 'Submit' and translated metadata will be returned. </li>
<li>For more info visit the
<a href="http://www.adiwg.org/mdTranslator">mdTranslator website</a>. </li>
</ol>
</div>
<ul>
<li id="li_1">
<p class="guidelines" id="guide_1">
<label class="description" for="element_1">Input Metadata File Area</label><br>
<small>CLICK</small>
<input type="button" class="buttons" value="mdJson example" id="loadMdJson">
<input type="button" class="buttons" value="fgdc example" id="loadFgdc">
<input type="button" class="buttons" value="sbJson example" id="loadSbJson">
<small>OR INSERT your metadata below ...</small>
</p>
<div>
<textarea id="codeTextarea" name="file"></textarea>
</div>
</li>
<textarea id="mdJsonExample" hidden><%= @mdJsonDemo %></textarea>
<textarea id="fgdcExample" hidden><%= @fgdcDemo %></textarea>
<textarea id="sbJsonExample" hidden><%= @sbJsonDemo %></textarea>
<p></p>
<li>
<label class="description">Select a Reader and Writer (Required)</label>
<div class="container">
<div class="fixed">
<label class="description" for="element_2">Reader</label>
<div>
<select class="element select medium" id="element_2" name="reader">
<option value="mdJson" selected="selected">mdJson</option>
<option value="fgdc">fgdc</option>
<option value="sbJson">sbJson</option>
</select>
</div>
<p class="guidelines" id="guide_2">
<small>Select a Reader</small>
</p>
</div>
<div class="flex-item">
<label class="description" for="element_3">Writer</label>
<div>
<select class="element select medium" id="element_3" name="writer">
<option value="simple_html">Simple HTML</option>
<option value="html" selected="selected">html</option>
<option value="fgdc">fgdc</option>
<option value="dcat_us">dcat_us</option>
<option value="iso19110">iso19110</option>
<option value="iso19115_3">iso19115_1 (alias of iso19115_3)</option>
<option value="iso19115_2">iso19115_2/19139 (deprecated)</option>
<option value="iso19115_3">iso19115_3</option>
<option value="mdJson">mdJson</option>
<option value="sbJson">sbJson</option>
<option value="">-none-</option>
</select>
</div>
<p class="guidelines" id="guide_2">
<small>Select a Writer</small>
</p>
</div>
</div>
</li>
<p></p>
<li>
<label class="description">Options</label>
<div class="container">
<div class="fixed">
<label class="description" for="element_4">mdJson Validation</label>
<div>
<select class="element select medium" id="element_4" name="validate">
<option value="none">None</option>
<option value="normal" selected="selected">Normal</option>
<option value="strict">Strict</option>
</select>
</div>
<p class="guidelines" id="guide_2">
<small>Set validation level</small>
</p>
</div>
<div class="flex-item">
<label class="description" for="element_5">Include Empty Tags</label>
<div>
<select class="element select medium" id="element_5" name="showAllTags">
<option value="false" selected="selected">False</option>
<option value="true">True</option>
</select>
</div>
<p class="guidelines" id="guide_2">
<small>Show empty tags for missing values</small>
</p>
</div>
<div class="flex-item">
<label class="description" for="element_6">Force Valid Output</label>
<div>
<select class="element select medium" id="element_6" name="forceValid">
<option value="true"selected="selected">true</option>
<option value="false">false</option>
</select>
</div>
<p class="guidelines" id="guide_2">
<small>Make output valid or fail</small>
</p>
</div>
<div class="flex-item">
<label class="description" for="element_7">Response Format</label>
<div>
<select class="element select medium" id="element_7" name="format">
<option value="auto" selected="selected">Auto</option>
<option value="plain">Plain</option>
<option value="json">JSON</option>
<option value="xml">XML</option>
</select>
</div>
<p class="guidelines" id="guide_2">
<small>Select response format</small>
</p>
</div>
</div>
</li>
</ul>
<p></p>
<div class="buttons">
<input type="hidden" name="form_id" value="759352"/>
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit"/>
</div>
<% end %>
<%= javascript_tag nonce: true do -%>
function insertText(exampleCode) {
if (exampleCode == 'mdJson') {
var elem = document.getElementById('codeTextarea');
var elemSource = document.getElementById('mdJsonExample');
}
if (exampleCode == 'fgdc') {
var elem = document.getElementById('codeTextarea');
var elemSource = document.getElementById('fgdcExample');
}
if (exampleCode == 'sbJson') {
var elem = document.getElementById('codeTextarea');
var elemSource = document.getElementById('sbJsonExample');
}
elem.value = elemSource.value;
document.getElementById('element_2').value = exampleCode;
}
document.getElementById('loadMdJson').addEventListener('click', () => insertText('mdJson'));
document.getElementById('loadFgdc').addEventListener('click', () => insertText('fgdc'));
document.getElementById('loadSbJson').addEventListener('click', () => insertText('sbJson'));
<% end -%>
</div>