diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/lib/api/v4/project.rb | 8 | ||||
-rw-r--r-- | web/public/img/generic_project_icon.png | bin | 0 -> 285 bytes | |||
-rw-r--r-- | web/public/js/taginfo.js | 2 | ||||
-rw-r--r-- | web/views/project.erb | 6 | ||||
-rw-r--r-- | web/viewsjs/key.js.erb | 2 | ||||
-rw-r--r-- | web/viewsjs/tag.js.erb | 2 |
6 files changed, 14 insertions, 6 deletions
diff --git a/web/lib/api/v4/project.rb b/web/lib/api/v4/project.rb index 94eeadc..b461b72 100644 --- a/web/lib/api/v4/project.rb +++ b/web/lib/api/v4/project.rb @@ -57,10 +57,14 @@ class Taginfo < Sinatra::Base :ui => '/projects' }) do project_id = params[:project] - content_type :png - @db.select('SELECT icon FROM projects.projects'). + url = @db.select('SELECT icon_url FROM projects.projects'). condition('id = ?', project_id). get_first_value() + if url.nil? || url == '' + redirect '/img/generic_project_icon.png' + else + redirect url + end end end diff --git a/web/public/img/generic_project_icon.png b/web/public/img/generic_project_icon.png Binary files differnew file mode 100644 index 0000000..38ea79f --- /dev/null +++ b/web/public/img/generic_project_icon.png diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index 165b2b0..4fa0ed0 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -198,7 +198,7 @@ function link_to_rtype(rtype, attr) { } function link_to_project(id, name, attr) { - return /*img({ src: '/api/v4/project/icon?project=' + id, alt: '' }) + ' ' +*/ link( + return img({ src: '/api/4/project/icon?project=' + id, width: 16, height: 16, alt: '' }) + ' ' + link( url_for_project(id), html_escape(name), attr diff --git a/web/views/project.erb b/web/views/project.erb index 16637c1..faab181 100644 --- a/web/views/project.erb +++ b/web/views/project.erb @@ -9,7 +9,7 @@ </ul> <div id="overview"> <table class="desc"> - <tr><th><%= h(t.pages.project.overview.project_name) %>:</th><td><%= h(@project.name) %></td></tr> + <tr><th><%= h(t.pages.project.overview.project_name) %>:</th><td><span id="icon_url"></span> <%= h(@project.name) %></td></tr> <tr><th><%= h(t.pages.project.overview.project_url) %>:</th><td id="project_url"></td></tr> <tr><th><%= h(t.pages.project.overview.description) %>:</th><td><%= h(@project.description) %></td></tr> <% if @project.doc_url %> @@ -33,11 +33,15 @@ function page_init2() { var project = #{ @project_id.to_json }, project_url = #{ @project.project_url.to_json }, json_url = #{ @project.json_url.to_json }, + icon_url = #{ @project.icon_url.to_json }, doc_url = #{ @project.doc_url.to_json }; if (project_url) { jQuery('#project_url').html(link_to_url(project_url)); } + if (icon_url) { + jQuery('#icon_url').html(img({ src: icon_url, width: 16, height: 16, alt: ''})); + } if (json_url) { jQuery('#json_url').html(link_to_url(json_url)); } diff --git a/web/viewsjs/key.js.erb b/web/viewsjs/key.js.erb index ad9937d..6035850 100644 --- a/web/viewsjs/key.js.erb +++ b/web/viewsjs/key.js.erb @@ -149,7 +149,7 @@ var create_flexigrid_for = { create_flexigrid('grid-projects', { url: '/api/4/tag/projects?key=' + encodeURIComponent(key), colModel: [ - { display: '<%= h(taginfo.project) %>', name: 'project_name', width: 200, sortable: true }, + { display: '<%= h(taginfo.project) %>', name: 'project_name', width: 280, sortable: true }, { display: '<%= h(osm.tag) %>', name: 'key', width: 220, sortable: true }, { display: '<%= h(misc.description) %>', name: 'description', width: 600, sortable: false, align: 'left' } ], diff --git a/web/viewsjs/tag.js.erb b/web/viewsjs/tag.js.erb index d47906e..bc24f5f 100644 --- a/web/viewsjs/tag.js.erb +++ b/web/viewsjs/tag.js.erb @@ -129,7 +129,7 @@ var create_flexigrid_for = { create_flexigrid('grid-projects', { url: '/api/4/tag/projects?key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value), colModel: [ - { display: '<%= h(taginfo.project) %>', name: 'project_name', width: 200, sortable: true }, + { display: '<%= h(taginfo.project) %>', name: 'project_name', width: 280, sortable: true }, { display: '<%= h(osm.tag) %>', name: 'key', width: 220, sortable: true }, { display: '<%= h(misc.description) %>', name: 'description', width: 600, sortable: false, align: 'left' } ], |