aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/_form.html.erb
blob: 648834d407f27d8811ba7e47a125ff14dc598086 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<% if resource.errors.any? %>
    <div id="error_explanation">
        <h2><%= pluralize(resource.errors.count, "error") %> prohibited this resource from being saved:</h2>

        <ul>
            <% resource.errors.each do |error| %>
                <li><%= error.full_message %></li>
            <% end %>
        </ul>
    </div>
<% end %>

    <fieldset>
    <%= tag.legend "Propriétés de la ressource" %>

    <dl class="field">
        <dt><%= f.label :name %></dt>
        <dd><%= f.text_field :name, maxlength: 64, placeholder: 'La ferme des animaux' %></dd>

        <dt><%= f.label :summary %></dt>
        <dd><%= f.text_field :summary, maxlength: 136, placeholder: 'Une ferme locale' %></dd>

        <dt><%= f.label :description %></dt>
        <dd><%= f.text_area :description, cols: 72, rows: 10, placeholder: '## Un choix pertinent

La description _peut_ comporter du [Markdown].

[Markdown]: https://www.markdownguide.org/getting-started/' %></dd>

        <dt><%= f.label :email %></dt>
        <dd><%= f.email_field :email, placeholder: 'bonjour@la-ferme-des-animaux.example' %></dd>

        <dt><%= f.label :website %></dt>
        <dd><%= f.url_field :website, placeholder: 'https://la-ferme-des-animaux.example' %></dd>

        <dt><%= f.label :phone_number %></dt>
        <dd><%= f.telephone_field :phone_number, placeholder: '+32 489 000 0000' %></dd>
    </dl>
</fieldset>

<fieldset>
    <%= tag.legend "Classification" %>
    <%# TODO Add a taxonomy selector %>
    <%= section_select(current_agent.taxonomies&.first || Taxonomy.first, resource.section_ids, name: 'resource_form[section_ids]') %>
</fieldset>

<fieldset>
    <%= tag.legend "Coordonées géographiques" %>
    <%# TODO Add a graphical geo selector %>

    <dl class="field">
        <dt><%= f.label :address %></dt>
        <dd><%= f.text_field :address, placeholder: 'Rue aux herbes, 123' %></dd>

        <dt><%= f.label :postal_code %></dt>
        <dd><%= f.text_field :postal_code, placeholder: '1000' %></dd>

        <dt><%= f.label :city %></dt>
        <dd><%= f.text_field :city, placeholder: 'Bruxelles' %></dd>
    </dl>

    <dl class="field">
        <dt><%= f.label :longitude %></dt>
        <dd><%= f.text_field :longitude, placeholder: '0.56789012', pattern: '[\d]+.[\d]+' %></dd>

        <dt><%= f.label :latitude %></dt>
        <dd><%= f.text_field :latitude, placeholder: '50.12345678', pattern: '[\d]+.[\d]+' %></dd>
    </dl>
</fieldset>

<%= f.hidden_field :agent_id, value: current_agent.id %>
<%= f.hidden_field :source, value: current_agent.name %>

<p><%= f.submit 'Save' %></p>