aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMarc Florisson2013-05-17 18:55:22 +0200
committerMarc Florisson2013-05-17 18:55:22 +0200
commitf3b470270bcfa7c1a8e0f29ba6dbe95c75605385 (patch)
tree4778f65237324cf89f753c5efc624932050b520c /app
parent74fa1a9551e1bd6eedabf88a40e5ebc6bed21645 (diff)
downloadchouette-core-f3b470270bcfa7c1a8e0f29ba6dbe95c75605385.tar.bz2
add geoportail maps. Refs #21, #122, #127
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/openlayers_style.css2
-rw-r--r--app/controllers/organisations_controller.rb6
-rw-r--r--app/maps/application_map.rb13
-rw-r--r--app/views/organisations/edit.html.erb14
-rw-r--r--app/views/organisations/show.html.erb10
5 files changed, 41 insertions, 4 deletions
diff --git a/app/assets/stylesheets/openlayers_style.css b/app/assets/stylesheets/openlayers_style.css
index aa088e537..0e3a67108 100644
--- a/app/assets/stylesheets/openlayers_style.css
+++ b/app/assets/stylesheets/openlayers_style.css
@@ -31,7 +31,7 @@ div.olLayerDiv {
.olControlAttribution {
font-size: smaller;
right: 3px;
- bottom: 4.5em;
+ bottom: 0.5em;
position: absolute;
display: block;
}
diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb
index daeb41837..7e2edb220 100644
--- a/app/controllers/organisations_controller.rb
+++ b/app/controllers/organisations_controller.rb
@@ -1,6 +1,12 @@
class OrganisationsController < InheritedResources::Base
respond_to :html
+ def update
+ update! do |success, failure|
+ success.html { redirect_to organisation_path }
+ end
+ end
+
private
def resource
diff --git a/app/maps/application_map.rb b/app/maps/application_map.rb
index 8e9ce4d57..e068a8950 100644
--- a/app/maps/application_map.rb
+++ b/app/maps/application_map.rb
@@ -19,6 +19,15 @@ class ApplicationMap
self
end
+ def geoportail_key
+ if ( self.helpers && self.helpers.current_user &&
+ self.helpers.current_user.organisation &&
+ self.helpers.current_user.organisation.geoportail_key)
+ return self.helpers.current_user.organisation.geoportail_key
+ end
+ return nil
+ end
+
class Helpers
include ActionDispatch::Routing::UrlFor
include Rails.application.routes.url_helpers
@@ -43,7 +52,7 @@ class ApplicationMap
def map
@map ||= MapLayers::Map.new(id, :projection => projection("EPSG:900913"), :controls => controls) do |map, page|
page << map.add_layer(MapLayers::OSM_MAPNIK)
- page << map.add_layer(geoportail_wmts)
+ page << map.add_layer(geoportail_wmts) if self.geoportail_key
page << map.add_layer(google_physical)
page << map.add_layer(google_streets)
page << map.add_layer(google_hybrid)
@@ -70,7 +79,7 @@ class ApplicationMap
def geoportail_wmts
OpenLayers::Layer::WMTS.new :name => I18n.t("maps.ign_map"),
- :url => "http://gpp3-wxs.ign.fr/#{self.class.ign_api_key}/wmts",
+ :url => "http://gpp3-wxs.ign.fr/#{self.geoportail_key}/wmts",
:layer => "GEOGRAPHICALGRIDSYSTEMS.MAPS",
:matrixSet => "PM",
:style => "normal",
diff --git a/app/views/organisations/edit.html.erb b/app/views/organisations/edit.html.erb
new file mode 100644
index 000000000..0e55a1562
--- /dev/null
+++ b/app/views/organisations/edit.html.erb
@@ -0,0 +1,14 @@
+<%= title_tag t(".title") %>
+
+<%= semantic_form_for @organisation, :url => organisation_path do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :name %>
+ <%= form.input :geoportail_key %>
+ <% end %>
+
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
+<% end %>
+
diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb
index c407f56f9..753efc2c3 100644
--- a/app/views/organisations/show.html.erb
+++ b/app/views/organisations/show.html.erb
@@ -1,5 +1,12 @@
<%= title_tag @organisation.name %>
+<div class="summary">
+ <p>
+ <label><%= Organisation.human_attribute_name(:geoportail_key) %>: </label>
+ <%= @organisation.geoportail_key ? t('.key_registered') : t('.key_not_registered') %>
+ </p>
+</div>
+
<div class="users">
<% @organisation.users.each do |user| %>
<%= div_for user do %>
@@ -12,7 +19,8 @@
<% content_for :sidebar do %>
<ul class="actions">
- <%= link_to t('users.actions.new'), new_organisation_user_path, :class => "add" %>
+ <li><%= link_to t('organisations.actions.edit'), edit_organisation_path, :class => "edit" %></li>
+ <li><%= link_to t('users.actions.new'), new_organisation_user_path, :class => "add" %></li>
</ul>
<% end %>