summaryrefslogtreecommitdiff
path: root/web/views/key.erb
blob: bbff9849be9b2545bb0e62e74feb1245e5072cca (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
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
<div class="pre">
    <form id="filter-form">
        <label for="filter"><%= h(t.pages.key.filter.label) %></label>
        <select id="filter" name="filter">
            <option value="all"<%=       @sel['all']       %>><%= h(t.pages.key.filter.none) %></option>
            <option value="nodes"<%=     @sel['nodes']     %>><%= h(t.pages.key.filter.nodes) %></option>
            <option value="ways"<%=      @sel['ways']      %>><%= h(t.pages.key.filter.ways) %></option>
            <option value="relations"<%= @sel['relations'] %>><%= h(t.pages.key.filter.relations) %></option>
        </select>
    </form>
    <div id="tools" class="no-print">
        <% if @count_all_values < TaginfoConfig.get('xapi.max_results', 1000) %>
            <%= xapi_link(@filter_xapi, @key) %> <%= josm_link(@filter_xapi, @key) %>
        <% else %>
            <span class="button disabled" title="Button disabled, because there are too many objects with this key">XAPI</span>
            <span class="button disabled" title="Button disabled, because there are too many objects with this key">JOSM</span>
        <% end %>
        <%= turbo_link(@filter_type, @key) %>
    </div>
    <h1></h1>
    <p><%= @desc %></p>
</div>
<div id="tabs">
    <ul class="no-print">
        <li><a href="#overview"><%= h(t.taginfo.overview) %></a></li>
        <li><a href="#values"><%= h(t.osm.values) %></a></li>
        <li><a href="#combinations"><%= h(t.taginfo.key_combinations) %></a></li>
        <li><a href="#map"><%= h(t.taginfo.map) %></a></li>
        <li><a href="#wiki"><%= h(t.sources.wiki.name) %></a></li>
        <li><a href="#josm"><%= h(t.sources.josm.name) %></a></li>
    </ul>
    <div id="overview">
        <div style="float: right; text-align: center; padding-left: 20px;">
            <p><%= h(t.pages.key.overview.distribution_of_values) %></p>
            <div class="canvas" id="canvas-values"></div>
        </div>
<% if @image_url %>
        <div class="wiki_image">
            <img src="<%= @image_url %>" alt=""/>
        </div>
<% end %>
        <h2><%= h(t.taginfo.overview) %></h2>
        <table id="grid-overview">
        </table>
        <p><span title="<%= h(t.pages.key.overview.no_endorsement) %>" tipsy="n"><%= t.pages.key.overview.objects_last_edited_by(@user_count.to_s_with_ts) %></span></p>
    </div>
    <div id="values">
        <h2><%= h(t.pages.key.values_used) %></h2>
        <div>
            <table id="grid-values">
            </table>
        </div>
    </div>
    <div id="combinations">
        <h2><%= h(t.pages.key.other_keys_used.title) %></h2>
        <table id="grid-keys">
        </table>
    </div>
    <div id="map">
        <h2><%= h(t.pages.key.geographic_distribution.title) %></h2>
        <% if @filter_type == 'all' %>
            <div style="background-image: url(<%= TaginfoConfig.get('geodistribution.background_image') %>); background-repeat: no-repeat; background-position: 1px 1px;"/>
                <img class="map" src="/api/4/key/distribution/nodes?key=<%= @key_uri %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>" style="position: absolute;"/>
                <img class="map" src="/api/4/key/distribution/ways?key=<%= @key_uri %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>"/>
            </div>
        <% elsif @filter_type == 'nodes' %>
            <div style="background-image: url(<%= TaginfoConfig.get('geodistribution.background_image') %>); background-repeat: no-repeat; background-position: 1px 1px;"/>
                <img class="map" src="/api/4/key/distribution/nodes?key=<%= @key_uri %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>"/>
            </div>
        <% elsif @filter_type == 'ways' %>
            <div style="background-image: url(<%= TaginfoConfig.get('geodistribution.background_image') %>); background-repeat: no-repeat; background-position: 1px 1px;"/>
                <img class="map" src="/api/4/key/distribution/ways?key=<%= @key_uri %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>"/>
            </div>
        <% elsif @filter_type == 'relations' %>
            <p class="empty"><%= h(t.pages.key.geographic_distribution.relations) %></p>
        <% end %>
    </div>
    <div id="wiki">
        <h2><%= h(t.pages.key.wiki_pages.title) %></h2>
        <% if @wiki_count > 0 %>
            <table id="grid-wiki">
            </table>
        <% else %>
            <p class="empty"><%= h(t.pages.key.wiki_pages.none_found) %></p>
            <p><a class="extlink" target="_blank" rel="nofollow" href="http://wiki.openstreetmap.org/w/index.php?action=edit&title=Key:<%= @key_uri %>"><%= h(t.pages.key.wiki_pages.create) %></a></p>
        <% end %>
    </div>
    <div id="josm">
        <h2><%= h(t.pages.key.josm.title) %></h2>
<!--        <form>
            <label for="josm-style"><%= h(t.pages.key.josm.choice) %></label>
            <select id="josm-style" name="josm-style">
                <option>Standard</option>
            </select>
        </form>-->
<% if @josm_count > 0 %>
        <table id="grid-josm">
        </table>
<% else %>
        <p class="empty"><%= h(t.pages.key.josm.no_styles) %></p>
<% end %>
    </div>
</div>
<iframe id="josmiframe" name="josmiframe"></iframe>
<% javascript do
    JS.raw(<<"JAVASCRIPT")
function page_init2() {
    var key = #{ @key.to_json };
    jQuery('h1').html(fmt_key(key));
    init_tabs([key, #{ @filter_type.to_json }, #{ r18n.locale.code.to_json }]);
    create_chart({
        key: key,
        width: 160,
        height: 440,
        max: #{ @count_all_values },
        data: #{ @prevalent_values.to_json() }
    });
}
JAVASCRIPT
end
%>