blob: b63a60640d59707d4b92ed21b9fa3cd9841a469a (
plain)
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
|
<h1>Create new node</h1>
<% if @node.errors.any? %>
<div class="error_messages">
<ul><% @node.errors.full_messages.each do |msg| %><li><%= msg.to_s.gsub("Slug", "Title") %></li><% end %></ul>
</div>
<% end %>
<%= form_tag nodes_path do %>
<div id="new_node">
<div class="node_description">Type</div>
<div class="node_content">
<% CccConventions::NODE_KINDS.each do |kind, config| %>
<p>
<%= radio_button_tag :kind, kind, kind == @selected_kind,
data: { path_prefix: resolve_kind_text(config[:path_prefix]) } %>
<%= resolve_kind_text(config[:label]) %>
<% if config[:hint] %>
<span class="field_hint"><%= resolve_kind_text(config[:hint]) %></span>
<% end %>
</p>
<% end %>
</div>
<div class="node_description">Title</div>
<div class="node_content">
<%= text_field_tag :title, nil, required: true %>
<span class="field_hint">A URL slug will be generated from this automatically. You can review or adjust it afterward under the "metadata" section's Slug field.</span>
</div>
<div id="parent_search_field" style="<%= @selected_kind == "generic" ? "" : "display: none;" %>">
<div class="node_description">Parent</div>
<div class="node_content">
<%= text_field_tag :parent_search_term, @parent_name %>
<%= hidden_field_tag :parent_id, @parent_id %>
<div id="parent_search_results" class="search_results"></div>
</div>
</div>
<div class="node_description">Resulting path</div>
<div class="node_content">
<span id="resulting_path">—</span>
<button type="button" id="copy_resulting_path" class="unselected">copy</button>
<span class="field_hint">This preview updates as you type. The final path can still be changed afterward by editing the title (for the last segment) or moving the node to a different parent (for everything before it).</span>
</div>
<div class="node_description"></div>
<div class="node_content"><%= submit_tag "Create" %></div>
</div>
<% end %>
|