Skip to content

Commit fa172b6

Browse files
committed
configures document views for new document type schema
1 parent 26ae16c commit fa172b6

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

app/views/documents/_form.html.erb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
<%= simple_form_for [document] do |f| %>
2+
23
<%= f.association :service, collection: services, hint: "If your service isn't on the list, please contact the team" %>
3-
4-
<%= f.input :name, collection: document_names, hint: 'Name of the document', selected: 'Privacy Policy'%>
4+
5+
<% if document.name.present? %>
6+
<label class="sr-only" for="inputHelpBlock">Name</label>
7+
<input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock" placeholder="<%= document.name%>" readonly>
8+
<span id="helpBlock" class="help-block">To change the document name, please select a new document type.</span>
9+
<% end %>
10+
11+
<%= f.association :document_type, collection: document_names, hint: "Inspect the document types and their descriptions #{link_to 'here', document_types_path}".html_safe %>
512

613
<%= f.input :url, hint: "Where we should fetch this document", placeholder: "e.g. \"https://www.facebook.com/about/privacy\"" %>
714

8-
<%= f.input :xpath, input_html: { value: (f.object.xpath.present?) ? f.object.xpath : '//body' }, placeholder: "e.g. \"//*[@id='content']//div[@class='_5tkp _3m9']\"", hint: "The location of the terms on the page (Using <a href=\"https://en.wikipedia.org/wiki/XPath\" title=\"Wikipedia explanation of XPath\" target=\"_blank\">XPath</a>.)".html_safe %>
15+
<%= f.input :xpath, input_html: { value: (f.object.xpath.present?) ? f.object.xpath : '//body' }, placeholder: "e.g. \"//*[@id='content']//div[@class='_5tkp _3m9']\"", hint: "The location of the terms on the page using <a href=\"https://en.wikipedia.org/wiki/XPath\" title=\"Wikipedia explanation of XPath\" target=\"_blank\">XPath</a>".html_safe %>
916

1017
<%= f.input :crawler_server, collection: crawlers, label_method: :second, value_method: :first, hint: "<a href=\"https://to.tosdr.org/U98u1\">Select from which country the crawler should be used, or a specific crawler. Useful if blocked by EU. (Optional)</a>".html_safe, selected: document.crawler_server || "eu.crawler.api.tosdr.org" %>
1118

app/views/documents/_table_documents.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<% @documents.each do |d| %>
1414
<tr class="toSort">
1515
<td><%= link_to d.service.name, service_path(d.service), title: "View the service connected to this document" %></td>
16-
<td><%= link_to truncate(d.name, length: 30), document_path(d), title: "Inspect this document" %></td>
16+
<td><%= link_to truncate(d.document_type ? d.document_type.name : d.name, length: 30), document_path(d), title: "Inspect this document" %></td>
1717
<td><%= truncate(d.url, length: 30) %></td>
1818
<td></td>
1919
</tr>

app/views/documents/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<% content_for :title do %>
2-
<title>Editing Document <%= @document.service.name %> <%= @document.name %> (ToS;DR Phoenix)</title>
2+
<title>Editing <%= @document.service.name %> <%= @document.document_type ? @document.document_type.name : @document.name %></title>
33
<% end %>
44
<%= render 'form', document: @document, document_names: @document_names, crawlers: @crawlers, services: @services %>

app/views/documents/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% content_for :title do %>
2-
<title>New Document (ToS;DR Phoenix)</title>
2+
<title>New document</title>
33
<% end %>
44
<div class="container">
55
<div>

app/views/documents/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<% content_for :title do %>
2-
<title>Document <%= @document.service.name %> <%= @document.name %> (ToS;DR Phoenix)</title>
2+
<title><%= @document.service.name %> <%= @name %></title>
33
<% end %>
44

55
<div class="card-inline">
66
<div class="card-inline-item card-inline-service">
77
<div class="row">
88
<div class="col-lg-6">
99
<h1><%= link_to @document.service.name, annotate_service_path(@document.service) %></h1>
10-
<h5><%= @document.name %></h5>
10+
<h5><%= @name %></h5>
1111
</div>
1212
</div>
1313

0 commit comments

Comments
 (0)