aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2010-12-13 21:36:39 +0100
committerJochen Topf <jochen@topf.org>2010-12-13 21:36:39 +0100
commit1debdfe42cf0830388839d0a5fa2fa99de043e6d (patch)
tree9ddb88489bbc67d264b46fa024f0d73f0546bcf1 /web
parent4e1689b4ff8a401d3326f94e91654ebc46bd89b2 (diff)
downloadtaginfo-1debdfe42cf0830388839d0a5fa2fa99de043e6d.tar
taginfo-1debdfe42cf0830388839d0a5fa2fa99de043e6d.tar.gz
more javascript new style stuff, more josm scale stuff removed
Diffstat (limited to 'web')
-rw-r--r--web/public/js/taginfo.js30
-rw-r--r--web/views/sources/josm/style.erb48
2 files changed, 37 insertions, 41 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js
index 53ca1d3..4fa86bb 100644
--- a/web/public/js/taginfo.js
+++ b/web/public/js/taginfo.js
@@ -536,6 +536,36 @@ var create_flexigrid_for = {
// TODO
}
},
+ sources: {
+ josm: {
+ style: function(stylename) {
+ create_flexigrid('grid-rules', {
+ url: '/api/2/josm/styles/' + stylename,
+ colModel: [
+ { display: 'Key', name: 'k', width: 200, sortable: true, align: 'left' },
+ { display: 'Value', name: 'v', width: 200, sortable: true, align: 'left' },
+ { display: 'Rule XML', name: 'rule', width: 100, sortable: false, align: 'left' }
+ ],
+ searchitems: [
+ { display: 'Key/Value', name: 'k' }
+ ],
+ sortname: 'k',
+ sortorder: 'asc',
+ height: 400,
+ preProcess: function(data) {
+ data.rows = jQuery.map(data.data, function(row, i) {
+ return { 'cell': [
+ link_to_key(row.k),
+ row.v ? link_to_value(row.k, row.v) : row.b ? (row.b + ' (Boolean)') : '*',
+ '<span title="' + row.rule + '">XML</span>'
+ ] };
+ });
+ return data;
+ }
+ });
+ }
+ }
+ },
reports: {
characters_in_keys: {
statistics: function() {
diff --git a/web/views/sources/josm/style.erb b/web/views/sources/josm/style.erb
index d5a16e4..256dc55 100644
--- a/web/views/sources/josm/style.erb
+++ b/web/views/sources/josm/style.erb
@@ -1,45 +1,11 @@
-
<h1><img src="/img/josm.32.png" alt="" title="JOSM"/> JOSM Style: <%= @stylename %></h1>
-<table id="rules">
+<table id="grid-rules">
</table>
-<script type="text/javascript">
- jQuery(document).ready(function() {
- jQuery('#rules').flexigrid({
- url: '/api/2/josm/styles/<%= @stylename %>',
- method: 'GET',
- dataType: 'json',
- colModel: [
- { display: 'Key', name: 'k', width: 200, sortable: true, align: 'left' },
- { display: 'Value', name: 'v', width: 200, sortable: true, align: 'left' },
- { display: 'Scale min', name: 'scale_min', width: 80, sortable: true, align: 'right' },
- { display: 'Scale max', name: 'scale_max', width: 80, sortable: true, align: 'right' },
- { display: 'Rule XML', name: 'rule', width: 100, sortable: false, align: 'left' }
- ],
- searchitems: [
- { display: 'Key/Value', name: 'k' }
- ],
- sortname: 'k',
- sortorder: 'asc',
- showToggleBtn: false,
- showTableToggleBtn: true,
- usepager: true,
- useRp: true,
- rp: 15,
- height: 400,
- preProcess: function(data) {
- data.rows = jQuery.map(data.data, function(row, i) {
- return { 'cell': [
- link_to_key(row.k),
- row.v ? link_to_value(row.k, row.v) : row.b ? (row.b + ' (Boolean)') : '*',
- print_with_ts(row.scale_min),
- print_with_ts(row.scale_max),
- '<span title="' + row.rule + '">XML</span>'
- ] };
- });
- return data;
- }
- });
- });
-</script>
+<% javascript do
+ JQuery.ready do
+ JS.raw(%Q{ create_flexigrid_for.sources.josm.style('#{ @stylename }'); })
+ end
+end
+%>