diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/chouette_controller.rb | 13 | ||||
| -rw-r--r-- | app/controllers/companies_controller.rb | 7 | ||||
| -rw-r--r-- | app/controllers/networks_controller.rb | 7 | ||||
| -rw-r--r-- | app/views/companies/_form.erb | 18 | ||||
| -rw-r--r-- | app/views/companies/_line.erb | 11 | ||||
| -rw-r--r-- | app/views/companies/edit.html.erb | 3 | ||||
| -rw-r--r-- | app/views/companies/index.html.erb | 17 | ||||
| -rw-r--r-- | app/views/companies/new.html.erb | 3 | ||||
| -rw-r--r-- | app/views/companies/show.html.erb | 47 | ||||
| -rw-r--r-- | app/views/layouts/application.html.erb | 9 | ||||
| -rw-r--r-- | app/views/networks/_form.erb | 17 | ||||
| -rw-r--r-- | app/views/networks/_form.erb~ | 18 | ||||
| -rw-r--r-- | app/views/networks/_line.erb~ | 11 | ||||
| -rw-r--r-- | app/views/networks/_network.erb | 6 | ||||
| -rw-r--r-- | app/views/networks/edit.html.erb | 3 | ||||
| -rw-r--r-- | app/views/networks/edit.html.erb~ | 3 | ||||
| -rw-r--r-- | app/views/networks/index.html.erb | 10 | ||||
| -rw-r--r-- | app/views/networks/index.html.erb~ | 17 | ||||
| -rw-r--r-- | app/views/networks/new.html.erb | 3 | ||||
| -rw-r--r-- | app/views/networks/new.html.erb~ | 3 | ||||
| -rw-r--r-- | app/views/networks/show.html.erb | 47 | ||||
| -rw-r--r-- | app/views/networks/show.html.erb~ | 47 |
22 files changed, 319 insertions, 1 deletions
diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb new file mode 100644 index 000000000..051e2fd77 --- /dev/null +++ b/app/controllers/chouette_controller.rb @@ -0,0 +1,13 @@ +class ChouetteController < InheritedResources::Base + + before_filter :switch_referential + + def switch_referential + Apartment::Database.switch(referential.slug) + end + + def referential + @referential = Referential.find params[:referential_id] + end + +end
\ No newline at end of file diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb new file mode 100644 index 000000000..3cb440ea2 --- /dev/null +++ b/app/controllers/companies_controller.rb @@ -0,0 +1,7 @@ +class CompaniesController < ChouetteController + defaults :resource_class => Chouette::Company + respond_to :html + respond_to :xml + respond_to :json + +end diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb new file mode 100644 index 000000000..eed00f365 --- /dev/null +++ b/app/controllers/networks_controller.rb @@ -0,0 +1,7 @@ +class NetworksController < ChouetteController + defaults :resource_class => Chouette::Network + respond_to :html + respond_to :xml + respond_to :json + +end diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb new file mode 100644 index 000000000..19a3b8b84 --- /dev/null +++ b/app/views/companies/_form.erb @@ -0,0 +1,18 @@ +<%= 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 %> + <%= 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 %> + <% end %> + + <%= form.buttons do %> + <%= form.commit_button true %> + <li><%= t('or') %></li> + <li><%= link_to t('back'), :back %></li> + <% end %> +<% end %> diff --git a/app/views/companies/_line.erb b/app/views/companies/_line.erb new file mode 100644 index 000000000..f594c7f9d --- /dev/null +++ b/app/views/companies/_line.erb @@ -0,0 +1,11 @@ +<%= 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 new file mode 100644 index 000000000..491a821fa --- /dev/null +++ b/app/views/companies/edit.html.erb @@ -0,0 +1,3 @@ +<%= title_tag "Modifier la Ligne #{@line.name}" %> + +<%= render "form" %> diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb new file mode 100644 index 000000000..03f5331e0 --- /dev/null +++ b/app/views/companies/index.html.erb @@ -0,0 +1,17 @@ +<div class="order"> + Trier par + <%= link_to_order "Code", "code" %> | + <%= link_to_order "Priorité", "priority" %> | + <%= link_to_order "Nom", "name" %> +</div> + +<%= title_tag Chouette::Line.model_name.human.pluralize %> + +<%= render :partial => "line", :collection => @lines %> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('lines.actions.new'), new_referential_line_path(@referential), :class => "add" %></li> + <br> +</ul> +<% end %> diff --git a/app/views/companies/new.html.erb b/app/views/companies/new.html.erb new file mode 100644 index 000000000..d580a2aae --- /dev/null +++ b/app/views/companies/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag "Créer la Ligne" %> + +<%= render "form" %> diff --git a/app/views/companies/show.html.erb b/app/views/companies/show.html.erb new file mode 100644 index 000000000..f0d987d3f --- /dev/null +++ b/app/views/companies/show.html.erb @@ -0,0 +1,47 @@ +<%= title_tag @line.name %> + +<div class="line_show"> + + <div class="summary"> + <p> + <label><%= Chouette::Line.human_attribute_name(:network) %>: </label> + <%= @line.network.name if @line.network.present? %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("company") %>: </label> + <%= @line.company.name if @line.company.present? %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("registrationnumber") %>: </label> + <%= @line.registrationnumber %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("name") %>: </label> + <%= @line.name %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("publishedname") %>: </label> + <%= @line.publishedname %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("number") %>: </label> + <%= @line.number %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("transportmodename") %>: </label> + <%= @line.transportmodename %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("comment") %>: </label> + <%= @line.comment %> + </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> + <br> +</ul> +<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 7e0460ebb..50633675d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,7 +16,14 @@ <div class="tabs"> <ul class="main"> - <li><%= tab_link_to t('activerecord.models.line'), lines_path %></li> + <% unless @referential %> + <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> + <li><%= tab_link_to t('activerecord.models.line'), referential_lines_path(@referential) %></li> + <li><%= tab_link_to t('activerecord.models.network'), referential_networks_path(@referential) %></li> + <li><%= tab_link_to t('activerecord.models.company'), referential_companies_path(@referential) %></li> + <% end %> </ul> </div> </div> diff --git a/app/views/networks/_form.erb b/app/views/networks/_form.erb new file mode 100644 index 000000000..877e238bf --- /dev/null +++ b/app/views/networks/_form.erb @@ -0,0 +1,17 @@ +<%= semantic_form_for [@referential, @network] do |form| %> + <%= form.inputs do %> + <%= form.input :name %> + <%= form.input :registration_number %> + <%= form.input :comment, :as => :text %> + <%= form.input :version_date %> + <%= form.input :description, :as => :text %> + <%= form.input :source_name, :as => :text %> + <%= form.input :source_identifier, :as => :text %> + <% end %> + + <%= form.buttons do %> + <%= form.commit_button %> + <li><%= t('or') %></li> + <li><%= link_to t('back'), :back %></li> + <% end %> +<% end %> diff --git a/app/views/networks/_form.erb~ b/app/views/networks/_form.erb~ new file mode 100644 index 000000000..19a3b8b84 --- /dev/null +++ b/app/views/networks/_form.erb~ @@ -0,0 +1,18 @@ +<%= 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 %> + <%= 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 %> + <% end %> + + <%= form.buttons do %> + <%= form.commit_button true %> + <li><%= t('or') %></li> + <li><%= link_to t('back'), :back %></li> + <% end %> +<% end %> diff --git a/app/views/networks/_line.erb~ b/app/views/networks/_line.erb~ new file mode 100644 index 000000000..f594c7f9d --- /dev/null +++ b/app/views/networks/_line.erb~ @@ -0,0 +1,11 @@ +<%= 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/networks/_network.erb b/app/views/networks/_network.erb new file mode 100644 index 000000000..4adf6896b --- /dev/null +++ b/app/views/networks/_network.erb @@ -0,0 +1,6 @@ +<%= div_for(network) do %> + <%= link_to network.name, [@referential, network] %> + <div class="info"> + + </div> +<% end %> diff --git a/app/views/networks/edit.html.erb b/app/views/networks/edit.html.erb new file mode 100644 index 000000000..90ffef291 --- /dev/null +++ b/app/views/networks/edit.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('networks.index.title'), {@line.name} %> + +<%= render "form" %> diff --git a/app/views/networks/edit.html.erb~ b/app/views/networks/edit.html.erb~ new file mode 100644 index 000000000..491a821fa --- /dev/null +++ b/app/views/networks/edit.html.erb~ @@ -0,0 +1,3 @@ +<%= title_tag "Modifier la Ligne #{@line.name}" %> + +<%= render "form" %> diff --git a/app/views/networks/index.html.erb b/app/views/networks/index.html.erb new file mode 100644 index 000000000..3743a1865 --- /dev/null +++ b/app/views/networks/index.html.erb @@ -0,0 +1,10 @@ +<%= title_tag t('networks.index.title') %> + +<%= render :partial => "network", :collection => @networks %> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('networks.actions.new'), new_referential_network_path(@referential), :class => "add" %></li> + <br> +</ul> +<% end %> diff --git a/app/views/networks/index.html.erb~ b/app/views/networks/index.html.erb~ new file mode 100644 index 000000000..03f5331e0 --- /dev/null +++ b/app/views/networks/index.html.erb~ @@ -0,0 +1,17 @@ +<div class="order"> + Trier par + <%= link_to_order "Code", "code" %> | + <%= link_to_order "Priorité", "priority" %> | + <%= link_to_order "Nom", "name" %> +</div> + +<%= title_tag Chouette::Line.model_name.human.pluralize %> + +<%= render :partial => "line", :collection => @lines %> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('lines.actions.new'), new_referential_line_path(@referential), :class => "add" %></li> + <br> +</ul> +<% end %> diff --git a/app/views/networks/new.html.erb b/app/views/networks/new.html.erb new file mode 100644 index 000000000..749beb197 --- /dev/null +++ b/app/views/networks/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('networks.new.title') %> + +<%= render "form" %> diff --git a/app/views/networks/new.html.erb~ b/app/views/networks/new.html.erb~ new file mode 100644 index 000000000..d580a2aae --- /dev/null +++ b/app/views/networks/new.html.erb~ @@ -0,0 +1,3 @@ +<%= title_tag "Créer la Ligne" %> + +<%= render "form" %> diff --git a/app/views/networks/show.html.erb b/app/views/networks/show.html.erb new file mode 100644 index 000000000..478d2f8aa --- /dev/null +++ b/app/views/networks/show.html.erb @@ -0,0 +1,47 @@ +<%= title_tag t('networks.show.title'), @line.name %> + +<div class="line_show"> + + <div class="summary"> + <p> + <label><%= Chouette::Line.human_attribute_name(:network) %>: </label> + <%= @line.network.name if @line.network.present? %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("company") %>: </label> + <%= @line.company.name if @line.company.present? %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("registrationnumber") %>: </label> + <%= @line.registrationnumber %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("name") %>: </label> + <%= @line.name %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("publishedname") %>: </label> + <%= @line.publishedname %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("number") %>: </label> + <%= @line.number %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("transportmodename") %>: </label> + <%= @line.transportmodename %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("comment") %>: </label> + <%= @line.comment %> + </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> + <br> +</ul> +<% end %> diff --git a/app/views/networks/show.html.erb~ b/app/views/networks/show.html.erb~ new file mode 100644 index 000000000..f0d987d3f --- /dev/null +++ b/app/views/networks/show.html.erb~ @@ -0,0 +1,47 @@ +<%= title_tag @line.name %> + +<div class="line_show"> + + <div class="summary"> + <p> + <label><%= Chouette::Line.human_attribute_name(:network) %>: </label> + <%= @line.network.name if @line.network.present? %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("company") %>: </label> + <%= @line.company.name if @line.company.present? %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("registrationnumber") %>: </label> + <%= @line.registrationnumber %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("name") %>: </label> + <%= @line.name %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("publishedname") %>: </label> + <%= @line.publishedname %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("number") %>: </label> + <%= @line.number %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("transportmodename") %>: </label> + <%= @line.transportmodename %> + </p> + <p> + <label><%= Chouette::Line.human_attribute_name("comment") %>: </label> + <%= @line.comment %> + </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> + <br> +</ul> +<% end %> |
