Skip to content

Commit dceb2a7

Browse files
committed
refactors document views
1 parent 1a01a97 commit dceb2a7

File tree

2 files changed

+50
-19
lines changed

2 files changed

+50
-19
lines changed

app/views/documents/_form.html.erb

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
<%= simple_form_for [document] do |f| %>
2+
<span class="lighter">
3+
<%= f.association :service, collection: services, hint: "If your service isn't on the list, please contact the team" %>
24

3-
<%= f.association :service, collection: services, hint: "If your service isn't on the list, please contact the team" %>
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 %>
410

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 %>
12-
13-
<%= f.input :url, hint: "Where we should fetch this document", placeholder: "e.g. \"https://www.facebook.com/about/privacy\"" %>
14-
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 %>
16-
17-
<%= 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" %>
11+
<%= f.association :document_type, collection: document_names, hint: "Inspect the document types and their descriptions #{link_to 'here', document_types_path}".html_safe %>
12+
13+
<%= f.input :url, hint: "The web location at which we can fetch the text of this document", placeholder: "e.g. \"https://www.facebook.com/about/privacy\"" %>
14+
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 web page using <a href=\"https://en.wikipedia.org/wiki/XPath\" title=\"Wikipedia explanation of XPath\" target=\"_blank\">XPath</a>".html_safe %>
16+
17+
<%= f.input :crawler_server, collection: crawlers, label_method: :second, value_method: :first, hint: "<a href=\"https://to.tosdr.org/U98u1\">Select which crawler should be used (optional, useful if blocked by EU)</a>".html_safe, selected: document.crawler_server || "eu.crawler.api.tosdr.org" %>
18+
</span>
1819

19-
<%= f.submit "Crawl Document", name: "only_create", class: 'btn btn-primary' %>
20+
<%= f.submit "Crawl Document", name: "only_create", class: 'btn btn-default lighter' %>
2021
<% end %>

app/views/documents/new.html.erb

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
11
<% content_for :title do %>
22
<title>New document</title>
33
<% end %>
4-
<div class="container">
4+
5+
<div>
56
<div>
6-
We now enforce the standardization of document names to prevent the addition of non-sensical texts and spam. Definitions of these standardized names can be found <a href="https://github.com/tosdr/terms-types?tab=readme-ov-file#terms-types-definitions"> here</a>. We are working on new features to ease this transition.
7+
<ul class="nav navbar-nav navbar-right">
8+
<li class="lighter small"><%= link_to 'Back', documents_path %></li>
9+
</ul>
710
</div>
8-
<div>
9-
<%= render 'form', document: @document, document_names: @document_names, crawlers: @crawlers, services: @services %>
11+
<br>
12+
<br>
13+
<div class="container">
14+
<div class="panel panel-default">
15+
<div class="panel-heading">
16+
<small>Documents describe a service's various <mark>legal policies</mark> and <mark>business practices</mark>.</small>
17+
</div>
18+
<div class="panel-body">
19+
<span class="lighter">
20+
<h4>
21+
New document
22+
<small>
23+
To generate the document, crawlers fetch the text from the given web location
24+
</small>
25+
</h4>
26+
</span>
27+
</div>
28+
</div>
29+
<div class="panel panel-default">
30+
<div class="panel-heading">
31+
<small>We use <%= link_to 'document types', document_types_path %> to enforce the <mark>standardization</mark> of document names to prevent the addition of non-sensical texts and spam. We are working on new features to ease this transition.</small>
32+
</div>
33+
<div class="panel-body">
34+
<br>
35+
<%= render 'form', document: @document, document_names: @document_names, crawlers: @crawlers, services: @services %>
36+
<br>
37+
</div>
38+
</div>
1039
</div>
1140
</div>
41+

0 commit comments

Comments
 (0)