aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/chouette_controller.rb4
-rw-r--r--app/controllers/companies_controller.rb15
-rw-r--r--app/controllers/referentials_controller.rb7
-rw-r--r--app/helpers/title_helper.rb2
-rw-r--r--app/models/referential.rb22
-rw-r--r--app/views/companies/_company.erb6
-rw-r--r--app/views/companies/_form.erb19
-rw-r--r--app/views/companies/_line.erb11
-rw-r--r--app/views/companies/edit.html.erb2
-rw-r--r--app/views/companies/index.html.erb13
-rw-r--r--app/views/companies/new.html.erb2
-rw-r--r--app/views/companies/show.html.erb38
-rw-r--r--app/views/layouts/application.html.erb5
-rw-r--r--app/views/lines/_form.erb6
-rw-r--r--app/views/lines/edit.html.erb2
-rw-r--r--app/views/lines/index.html.erb2
-rw-r--r--app/views/lines/index.html.erb~18
-rw-r--r--app/views/lines/new.html.erb2
-rw-r--r--app/views/lines/show.html.erb8
-rw-r--r--app/views/networks/edit.html.erb2
-rw-r--r--app/views/networks/show.html.erb40
-rw-r--r--app/views/referentials/show.html.erb9
22 files changed, 121 insertions, 114 deletions
diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb
index 051e2fd77..1b9f30a85 100644
--- a/app/controllers/chouette_controller.rb
+++ b/app/controllers/chouette_controller.rb
@@ -7,7 +7,7 @@ class ChouetteController < InheritedResources::Base
end
def referential
- @referential = Referential.find params[:referential_id]
+ @referential ||= Referential.find params[:referential_id]
end
-end \ No newline at end of file
+end
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb
index 3cb440ea2..4fb83d789 100644
--- a/app/controllers/companies_controller.rb
+++ b/app/controllers/companies_controller.rb
@@ -4,4 +4,19 @@ class CompaniesController < ChouetteController
respond_to :xml
respond_to :json
+ # def update
+ # update! do |success, failure|
+ # failure.html { redirect_to referential_companies_path(@resource, @referential) }
+ # end
+ # end
+
+ protected
+
+
+ # def resource_url(company = nil)
+ # puts "########################################"
+ # puts referential_company_path(referential, company || @resource).inspect
+ # referential_company_path(referential, company || @resource)
+ # end
+
end
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index 539c7ca5d..a5e3b7247 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -1,9 +1,4 @@
class ReferentialsController < InheritedResources::Base
-
- before_filter :switch_referential
-
- def switch_referential
- Apartment::Database.switch(referential.slug)
- end
+ respond_to :html
end
diff --git a/app/helpers/title_helper.rb b/app/helpers/title_helper.rb
index f5219276b..2203151a3 100644
--- a/app/helpers/title_helper.rb
+++ b/app/helpers/title_helper.rb
@@ -7,7 +7,7 @@ module TitleHelper
@title
end
end
-
+
def title_tag(title, options = nil)
content_tag :h2, title(title), options
end
diff --git a/app/models/referential.rb b/app/models/referential.rb
index 430785470..a329bf950 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -2,9 +2,29 @@ class Referential < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :slug
+ before_create :create_schema
+ before_destroy :destroy_schema
+
def lines
Chouette::Line.all
- end
+ end
+
+ def networks
+ Chouette::Network.all
+ end
+
+ def companies
+ Chouette::Company.all
+ end
+
+ private
+
+ def create_schema
+ Apartment::Database.create self.slug
+ end
+ def destroy_schema
+ Apartment::Database.drop self.slug
+ end
end
diff --git a/app/views/companies/_company.erb b/app/views/companies/_company.erb
new file mode 100644
index 000000000..9d4683414
--- /dev/null
+++ b/app/views/companies/_company.erb
@@ -0,0 +1,6 @@
+<%= div_for(company) do %>
+ <%= link_to company.name, [@referential, company] %>
+ <div class="info">
+
+ </div>
+<% end %>
diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb
index 19a3b8b84..7e90e7259 100644
--- a/app/views/companies/_form.erb
+++ b/app/views/companies/_form.erb
@@ -1,13 +1,14 @@
-<%= semantic_form_for [@referential, @line] do |form| %>
- <%= form.inputs do %>
- <%= form.input :network, :as => :select, :collection => Chouette::Network.all, :include_blank => false %>
- <%= form.input :company, :as => :select, :collection => Chouette::Company.all, :include_blank => false%>
- <%= form.input :registrationnumber %>
+<%= semantic_form_for [@referential, @company] do |form| %>
+ <%= form.inputs do %>
<%= form.input :name %>
- <%= form.input :publishedname %>
- <%= form.input :number %>
- <%= form.input :transportmodename, :as => :select, :collection => Chouette::TransportMode.definitions, :include_blank => false, :member_label => Proc.new { |a| t("#{a[0]}") } %>
- <%= form.input :comment, :as => :text %>
+ <%= form.input :registration_number %>
+ <%= form.input :short_name %>
+ <%= form.input :organizational_unit %>
+ <%= form.input :operating_department_name %>
+ <%= form.input :code %>
+ <%= form.input :phone, :as => :phone %>
+ <%= form.input :fax, :as => :phone %>
+ <%= form.input :email, :as => :email %>
<% end %>
<%= form.buttons do %>
diff --git a/app/views/companies/_line.erb b/app/views/companies/_line.erb
deleted file mode 100644
index f594c7f9d..000000000
--- a/app/views/companies/_line.erb
+++ /dev/null
@@ -1,11 +0,0 @@
-<%= div_for(line) do %>
- <%= link_to([@referential, line], :class => "preview") do %>
- <div class="color" style="background-color: grey ">
- <div class="number"><%= line.number %></div>
- </div>
- <% end %>
- <%= link_to line.name, [@referential, line] %>
- <div class="info">
-
- </div>
-<% end %>
diff --git a/app/views/companies/edit.html.erb b/app/views/companies/edit.html.erb
index 491a821fa..797509787 100644
--- a/app/views/companies/edit.html.erb
+++ b/app/views/companies/edit.html.erb
@@ -1,3 +1,3 @@
-<%= title_tag "Modifier la Ligne #{@line.name}" %>
+<%= title_tag t('companies.edit.title', :company => @company.name) %>
<%= render "form" %>
diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb
index 03f5331e0..b20804fa0 100644
--- a/app/views/companies/index.html.erb
+++ b/app/views/companies/index.html.erb
@@ -1,17 +1,10 @@
-<div class="order">
- Trier par
- <%= link_to_order "Code", "code" %> |
- <%= link_to_order "Priorité", "priority" %> |
- <%= link_to_order "Nom", "name" %>
-</div>
+<%= title_tag t('companies.title.index') %>
-<%= title_tag Chouette::Line.model_name.human.pluralize %>
-
-<%= render :partial => "line", :collection => @lines %>
+<%= render :partial => "company", :collection => @companies %>
<% content_for :sidebar do %>
<ul class="actions">
- <li><%= link_to t('lines.actions.new'), new_referential_line_path(@referential), :class => "add" %></li>
+ <li><%= link_to t('companies.actions.new'), new_referential_company_path(@referential), :class => "add" %></li>
<br>
</ul>
<% end %>
diff --git a/app/views/companies/new.html.erb b/app/views/companies/new.html.erb
index d580a2aae..a1332ff3a 100644
--- a/app/views/companies/new.html.erb
+++ b/app/views/companies/new.html.erb
@@ -1,3 +1,3 @@
-<%= title_tag "Créer la Ligne" %>
+<%= title_tag t('companies.new.title') %>
<%= render "form" %>
diff --git a/app/views/companies/show.html.erb b/app/views/companies/show.html.erb
index f0d987d3f..4dd9e0a21 100644
--- a/app/views/companies/show.html.erb
+++ b/app/views/companies/show.html.erb
@@ -1,47 +1,47 @@
-<%= title_tag @line.name %>
+<%= title_tag t('companies.show.title', :company => @company.name) %>
<div class="line_show">
<div class="summary">
<p>
- <label><%= Chouette::Line.human_attribute_name(:network) %>: </label>
- <%= @line.network.name if @line.network.present? %>
+ <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label>
+ <%= @company.registration_number %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("company") %>: </label>
- <%= @line.company.name if @line.company.present? %>
+ <label><%= Chouette::Company.human_attribute_name("name") %>: </label>
+ <%= @company.name %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("registrationnumber") %>: </label>
- <%= @line.registrationnumber %>
+ <label><%= Chouette::Company.human_attribute_name("short_name") %>: </label>
+ <%= @company.short_name %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("name") %>: </label>
- <%= @line.name %>
+ <label><%= Chouette::Company.human_attribute_name("organizational_unit") %>: </label>
+ <%= @company.organizational_unit %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("publishedname") %>: </label>
- <%= @line.publishedname %>
+ <label><%= Chouette::Company.human_attribute_name("operating_department_name") %>: </label>
+ <%= @company.operating_department_name %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("number") %>: </label>
- <%= @line.number %>
+ <label><%= Chouette::Company.human_attribute_name("phone") %>: </label>
+ <%= @company.phone %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("transportmodename") %>: </label>
- <%= @line.transportmodename %>
+ <label><%= Chouette::Company.human_attribute_name("fax") %>: </label>
+ <%= @company.fax %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("comment") %>: </label>
- <%= @line.comment %>
+ <label><%= Chouette::Company.human_attribute_name("email") %>: </label>
+ <%= @company.email %>
</p>
</div>
</div>
<% content_for :sidebar do %>
<ul class="actions">
- <li><%= link_to t('lines.actions.edit'), edit_referential_line_path(@referential, @line), :class => "edit" %></li>
- <li><%= link_to t('lines.actions.destroy'), referential_line_path(@referential, @line), :method => :delete, :confirm => t('lines.actions.destroy_confirm'), :class => "remove" %></li>
+ <li><%= link_to t('companies.actions.edit'), edit_referential_company_path(@referential, @company), :class => "edit" %></li>
+ <li><%= link_to t('companys.actions.destroy'), referential_company_path(@referential, @company), :method => :delete, :confirm => t('companies.actions.destroy_confirm'), :class => "remove" %></li>
<br>
</ul>
<% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 50633675d..6fd73ef0d 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -11,12 +11,15 @@
<body>
<div id="header">
<div class="infos">
+ <ul class="user">
+ <li><%= link_to(t('layouts.home'), referentials_path) %></li>
+ </ul>
<h1>Chouette</h1>
</div>
<div class="tabs">
<ul class="main">
- <% unless @referential %>
+ <% if !@referential.present? || @referential.new_record? %>
<li><%= tab_link_to t('activerecord.models.referential'), referentials_path %></li>
<% else %>
<li><%= link_to "Tableau de bord", referential_path(@referential), :class => ("current" if current_page?(referential_path(@referential))) %></li>
diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb
index 19a3b8b84..4a6285e6e 100644
--- a/app/views/lines/_form.erb
+++ b/app/views/lines/_form.erb
@@ -2,11 +2,11 @@
<%= form.inputs do %>
<%= form.input :network, :as => :select, :collection => Chouette::Network.all, :include_blank => false %>
<%= form.input :company, :as => :select, :collection => Chouette::Company.all, :include_blank => false%>
- <%= form.input :registrationnumber %>
+ <%= form.input :registration_number %>
<%= form.input :name %>
- <%= form.input :publishedname %>
+ <%= form.input :published_name %>
<%= form.input :number %>
- <%= form.input :transportmodename, :as => :select, :collection => Chouette::TransportMode.definitions, :include_blank => false, :member_label => Proc.new { |a| t("#{a[0]}") } %>
+ <%= form.input :transport_mode_name, :as => :select, :collection => Chouette::TransportMode.definitions, :include_blank => false, :member_label => Proc.new { |a| t("#{a[0]}") } %>
<%= form.input :comment, :as => :text %>
<% end %>
diff --git a/app/views/lines/edit.html.erb b/app/views/lines/edit.html.erb
index 491a821fa..7f1b4bd67 100644
--- a/app/views/lines/edit.html.erb
+++ b/app/views/lines/edit.html.erb
@@ -1,3 +1,3 @@
-<%= title_tag "Modifier la Ligne #{@line.name}" %>
+<%= title_tag t('lines.show.title', :line => @line.name ) %>
<%= render "form" %>
diff --git a/app/views/lines/index.html.erb b/app/views/lines/index.html.erb
index 03f5331e0..e8f795a98 100644
--- a/app/views/lines/index.html.erb
+++ b/app/views/lines/index.html.erb
@@ -5,7 +5,7 @@
<%= link_to_order "Nom", "name" %>
</div>
-<%= title_tag Chouette::Line.model_name.human.pluralize %>
+<%= title_tag t('lines.index.title') %>
<%= render :partial => "line", :collection => @lines %>
diff --git a/app/views/lines/index.html.erb~ b/app/views/lines/index.html.erb~
deleted file mode 100644
index f357772fa..000000000
--- a/app/views/lines/index.html.erb~
+++ /dev/null
@@ -1,18 +0,0 @@
-<div class="order">
- Trier par
- <%= link_to_order "Code", "code" %> |
- <%= link_to_order "Priorité", "priority" %> |
- <%= link_to_order "Nom", "name" %>
-</div>
-
-<%= title_tag "Lignes" %>
-
-<%= render :partial => "line", :collection => @lines %>
-
-<% content_for :sidebar do %>
-<ul class="actions">
- <li><%= link_to "Créer une Ligne", new_network_line_path(@network), :class => "add" %></li>
- <br>
- <li><%= link_to "Export KML", network_lines_path(@network, :format => :kml), :class => "kml" %></li>
-</ul>
-<% end %>
diff --git a/app/views/lines/new.html.erb b/app/views/lines/new.html.erb
index d580a2aae..452ec5df2 100644
--- a/app/views/lines/new.html.erb
+++ b/app/views/lines/new.html.erb
@@ -1,3 +1,3 @@
-<%= title_tag "Créer la Ligne" %>
+<%= title_tag t('lines.new.title') %>
<%= render "form" %>
diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb
index f0d987d3f..4db5cff99 100644
--- a/app/views/lines/show.html.erb
+++ b/app/views/lines/show.html.erb
@@ -1,4 +1,4 @@
-<%= title_tag @line.name %>
+<%= title_tag t('lines.show.title', :line => @line.name ) %>
<div class="line_show">
@@ -13,7 +13,7 @@
</p>
<p>
<label><%= Chouette::Line.human_attribute_name("registrationnumber") %>: </label>
- <%= @line.registrationnumber %>
+ <%= @line.registration_number %>
</p>
<p>
<label><%= Chouette::Line.human_attribute_name("name") %>: </label>
@@ -28,8 +28,8 @@
<%= @line.number %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("transportmodename") %>: </label>
- <%= @line.transportmodename %>
+ <label><%= Chouette::Line.human_attribute_name("transport_mode_name") %>: </label>
+ <%= @line.transport_mode_name %>
</p>
<p>
<label><%= Chouette::Line.human_attribute_name("comment") %>: </label>
diff --git a/app/views/networks/edit.html.erb b/app/views/networks/edit.html.erb
index 90ffef291..b551690d6 100644
--- a/app/views/networks/edit.html.erb
+++ b/app/views/networks/edit.html.erb
@@ -1,3 +1,3 @@
-<%= title_tag t('networks.index.title'), {@line.name} %>
+<%= title_tag t('networks.edit.title', :network => @network.name) %>
<%= render "form" %>
diff --git a/app/views/networks/show.html.erb b/app/views/networks/show.html.erb
index 478d2f8aa..4fb8c3201 100644
--- a/app/views/networks/show.html.erb
+++ b/app/views/networks/show.html.erb
@@ -1,47 +1,43 @@
-<%= title_tag t('networks.show.title'), @line.name %>
+<%= title_tag t('networks.show.title', :network => @network.name )%>
-<div class="line_show">
+<div class="network_show">
<div class="summary">
<p>
- <label><%= Chouette::Line.human_attribute_name(:network) %>: </label>
- <%= @line.network.name if @line.network.present? %>
+ <label><%= Chouette::Network.human_attribute_name("registrationnumber") %>: </label>
+ <%= @network.registrationnumber %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("company") %>: </label>
- <%= @line.company.name if @line.company.present? %>
+ <label><%= Chouette::Network.human_attribute_name("name") %>: </label>
+ <%= @network.name %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("registrationnumber") %>: </label>
- <%= @line.registrationnumber %>
+ <label><%= Chouette::Network.human_attribute_name("comment") %>: </label>
+ <%= @network.comment %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("name") %>: </label>
- <%= @line.name %>
+ <label><%= Chouette::Network.human_attribute_name("version_date") %>: </label>
+ <%= @network.version_date %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("publishedname") %>: </label>
- <%= @line.publishedname %>
+ <label><%= Chouette::Network.human_attribute_name("description") %>: </label>
+ <%= @network.description %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("number") %>: </label>
- <%= @line.number %>
+ <label><%= Chouette::Network.human_attribute_name("source_name") %>: </label>
+ <%= @network.source_name %>
</p>
<p>
- <label><%= Chouette::Line.human_attribute_name("transportmodename") %>: </label>
- <%= @line.transportmodename %>
- </p>
- <p>
- <label><%= Chouette::Line.human_attribute_name("comment") %>: </label>
- <%= @line.comment %>
+ <label><%= Chouette::Network.human_attribute_name("source_identifier") %>: </label>
+ <%= @network.source_identifier %>
</p>
</div>
</div>
<% content_for :sidebar do %>
<ul class="actions">
- <li><%= link_to t('lines.actions.edit'), edit_referential_line_path(@referential, @line), :class => "edit" %></li>
- <li><%= link_to t('lines.actions.destroy'), referential_line_path(@referential, @line), :method => :delete, :confirm => t('lines.actions.destroy_confirm'), :class => "remove" %></li>
+ <li><%= link_to t('networks.actions.edit'), edit_referential_network_path(@referential, @network), :class => "edit" %></li>
+ <li><%= link_to t('networks.actions.destroy'), referential_network_path(@referential, @network), :method => :delete, :confirm => t('networks.actions.destroy_confirm'), :class => "remove" %></li>
<br>
</ul>
<% end %>
diff --git a/app/views/referentials/show.html.erb b/app/views/referentials/show.html.erb
index ad48cade5..146e19a67 100644
--- a/app/views/referentials/show.html.erb
+++ b/app/views/referentials/show.html.erb
@@ -5,4 +5,11 @@
<label><%= Referential.human_attribute_name("slug") %>: </label>
<%= @referential.slug %>
</p>
-</div> \ No newline at end of file
+</div>
+
+<% content_for :sidebar do %>
+<ul class="actions">
+ <li><%= link_to t('referentials.actions.destroy'), referential_path(@referential), :method => :delete, :confirm => t('referentials.actions.destroy_confirm'), :class => "remove" %></li>
+ <br>
+</ul>
+<% end %>