aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/companies.css.scss24
-rw-r--r--app/assets/stylesheets/layout.css.scss29
-rw-r--r--app/assets/stylesheets/lines.css.scss29
-rw-r--r--app/assets/stylesheets/networks.css.scss25
-rw-r--r--app/assets/stylesheets/stop_areas.css.scss119
-rw-r--r--app/controllers/lines_controller.rb9
-rw-r--r--app/controllers/stop_areas_controller.rb7
-rw-r--r--app/models/referential.rb4
-rw-r--r--app/views/companies/index.html.erb2
-rw-r--r--app/views/layouts/application.html.erb1
-rw-r--r--app/views/lines/index.html.erb2
-rw-r--r--app/views/networks/index.html.erb2
-rw-r--r--app/views/stop_areas/_form.html.erb21
-rw-r--r--app/views/stop_areas/_stop_area.html.erb22
-rw-r--r--app/views/stop_areas/edit.html.erb3
-rw-r--r--app/views/stop_areas/index.html.erb21
-rw-r--r--app/views/stop_areas/new.html.erb3
-rw-r--r--app/views/stop_areas/show.html.erb43
18 files changed, 273 insertions, 93 deletions
diff --git a/app/assets/stylesheets/companies.css.scss b/app/assets/stylesheets/companies.css.scss
index 4c45138ee..563a25798 100644
--- a/app/assets/stylesheets/companies.css.scss
+++ b/app/assets/stylesheets/companies.css.scss
@@ -112,28 +112,4 @@
}
}
-/* FIXME a déplacer dans layout */
-
-#sidebar ul {
- padding: 0 8px;
-
- li {
- margin: 4px 0;
- }
-}
-
-#sidebar ul.selection li {
- a {
- padding-left: 20px;
- }
- a.current {
- text-decoration: none;
- color: black !important;
- background: url(image-path('user_interface/ui/accept.png')) no-repeat;
- }
- a.all {
- background-image: none;
- }
-}
-
diff --git a/app/assets/stylesheets/layout.css.scss b/app/assets/stylesheets/layout.css.scss
index 14823294f..d65167cfa 100644
--- a/app/assets/stylesheets/layout.css.scss
+++ b/app/assets/stylesheets/layout.css.scss
@@ -6,3 +6,32 @@ $tabs_color: white;
$text_color: #222;
@import "user_interface/layout";
+
+#sidebar ul {
+ padding: 0 8px;
+
+ li {
+ margin: 4px 0;
+ }
+}
+
+#sidebar ul.selection li {
+ a {
+ padding-left: 20px;
+ }
+ a.current {
+ text-decoration: none;
+ color: black !important;
+ background: url(image-path('user_interface/ui/accept.png')) no-repeat;
+ }
+ a.all {
+ background-image: none;
+ }
+}
+
+
+#map {
+ float: right;
+ width: 600px;
+ height: 400px;
+}
diff --git a/app/assets/stylesheets/lines.css.scss b/app/assets/stylesheets/lines.css.scss
index 022ba4955..5562c4e4b 100644
--- a/app/assets/stylesheets/lines.css.scss
+++ b/app/assets/stylesheets/lines.css.scss
@@ -143,34 +143,5 @@
}
}
-/* FIXME a déplacer dans layout */
-
-#sidebar ul {
- padding: 0 8px;
-
- li {
- margin: 4px 0;
- }
-}
-
-#sidebar ul.selection li {
- a {
- padding-left: 20px;
- }
- a.current {
- text-decoration: none;
- color: black !important;
- background: url(image-path('user_interface/ui/accept.png')) no-repeat;
- }
- a.all {
- background-image: none;
- }
-}
-
-#map {
- float: right;
- width: 600px;
- height: 400px;
-}
diff --git a/app/assets/stylesheets/networks.css.scss b/app/assets/stylesheets/networks.css.scss
index 6a8f4bbc2..c05752623 100644
--- a/app/assets/stylesheets/networks.css.scss
+++ b/app/assets/stylesheets/networks.css.scss
@@ -111,28 +111,3 @@
}
}
-/* FIXME a déplacer dans layout */
-
-#sidebar ul {
- padding: 0 8px;
-
- li {
- margin: 4px 0;
- }
-}
-
-#sidebar ul.selection li {
- a {
- padding-left: 20px;
- }
- a.current {
- text-decoration: none;
- color: black !important;
- background: url(image-path('user_interface/ui/accept.png')) no-repeat;
- }
- a.all {
- background-image: none;
- }
-}
-
-
diff --git a/app/assets/stylesheets/stop_areas.css.scss b/app/assets/stylesheets/stop_areas.css.scss
new file mode 100644
index 000000000..046066b9f
--- /dev/null
+++ b/app/assets/stylesheets/stop_areas.css.scss
@@ -0,0 +1,119 @@
+// Place all the styles related to the lines controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+@mixin div_for_object {
+ margin-bottom: 20px;
+
+ .color {
+ width: 64px;
+ height: 64px;
+ float: left;
+ margin-right: 10px;
+ }
+
+ img {
+ float: left;
+ margin-right: 10px;
+ }
+
+ img.preview {
+ width: 90px;
+ height: 70px;
+ }
+
+ a {
+ display:block;
+ text-decoration: underline;
+ margin: 5px 0px 0px 0px;
+ }
+
+ .info {
+ font-size: 10px;
+ color: #777;
+ font-weight: normal;
+ line-height: 14px;
+ margin-top: 5px;
+
+ a {
+ display:inline;
+ color: #777;
+ }
+
+ .line{
+ border: 1px solid #999;
+ padding: 2px;
+ }
+
+ .actions {
+ margin-top: 14px;
+ a {
+ color: #666;
+ padding-left: 12px;
+ }
+
+ a.edit {
+ background: url(image-path('user_interface/ui/edit-small.png')) no-repeat 0% 50%;
+ }
+ a.remove {
+ background: url(image-path('user_interface/ui/remove-small.png')) no-repeat 0% 50%;
+ }
+ }
+
+ p {
+ margin:0;
+ }
+ }
+}
+
+@mixin content_to_clear {
+ content: " ";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+@mixin after_div_for_object {
+ @include content_to_clear;
+}
+
+#workspace.stop_areas.index
+{
+ .stop_area:after {
+ @include after_div_for_object;
+ }
+
+ .stop_areas {
+ margin-top: 20px;
+ }
+
+ .stop_areas:after {
+ @include content_to_clear;
+ }
+
+ .stop_area {
+ @include div_for_object;
+ /* to create multi-column index */
+ width: 350px;
+ float: left;
+ padding-right: 10px;
+
+ }
+}
+
+
+#workspace .order {
+ float: right;
+ padding: 15px 0;
+ font-size: 0.8em;
+
+ a { text-decoration: underline; }
+
+ a.current {
+ font-weight: bold;
+ text-decoration: none;
+ }
+}
+
+
+
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb
index c9cd99327..925fae86b 100644
--- a/app/controllers/lines_controller.rb
+++ b/app/controllers/lines_controller.rb
@@ -1,6 +1,5 @@
class LinesController < ChouetteController
defaults :resource_class => Chouette::Line
- helper_method :sort_column, :sort_direction
respond_to :html
respond_to :xml
respond_to :json
@@ -17,14 +16,6 @@ class LinesController < ChouetteController
@lines ||= @q.result(:distinct => true).order(:number).paginate(:page => params[:page], :per_page => 10).includes([:network, :company])
end
- def sort_column
- %w(name number).include?(params[:sort]) ? params[:sort] : "name"
- end
-
- def sort_direction
- %w(asc desc).include?(params[:direction]) ? params[:direction] : "asc"
- end
-
def resource_url(line = nil)
referential_line_path(referential, line || resource)
end
diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb
index 5e4b9b024..8bd2c29a4 100644
--- a/app/controllers/stop_areas_controller.rb
+++ b/app/controllers/stop_areas_controller.rb
@@ -2,7 +2,7 @@ class StopAreasController < ChouetteController
defaults :resource_class => Chouette::StopArea
# belongs_to :network, :parent_class => Potimart::Network do
- belongs_to :line, :parent_class => Chouette::Line#, :optional => true
+ belongs_to :line, :parent_class => Chouette::Line, :optional => true
# end
respond_to :html, :kml
@@ -38,11 +38,12 @@ class StopAreasController < ChouetteController
# end
def line
- @line ||= Chouette::Line.find(params[:line_id])
+ @line ||= Chouette::Line.find(params[:line_id]) if params[:line_id]
end
def collection
- @stop_areas ||= line.stop_areas
+ @q = line ? line.stop_areas.search(params[:q]) : referential.stop_areas.search(params[:q])
+ @stop_areas ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page], :per_page => 10)
end
end
diff --git a/app/models/referential.rb b/app/models/referential.rb
index d0fdbd676..919c92a2d 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -17,6 +17,10 @@ class Referential < ActiveRecord::Base
Chouette::Company.scoped
end
+ def stop_areas
+ Chouette::StopArea.scoped
+ end
+
def switch
raise "Referential not created" if new_record?
Apartment::Database.switch(slug)
diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb
index 6b047b0ce..b6ed91aff 100644
--- a/app/views/companies/index.html.erb
+++ b/app/views/companies/index.html.erb
@@ -8,7 +8,7 @@
<%= link_to t("cancel"), referential_companies_path(@referential) %>
<% end %>
-<%#= will_paginate @companies %>
+<%= will_paginate @companies %>
<div class="companies paginated_content">
<%= render :partial => "company", :collection => @companies %>
</div>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 79f5d0b77..e1d3be438 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -36,6 +36,7 @@
<li><%= tab_link_to Chouette::Line, referential_lines_path(@referential) %></li>
<li><%= tab_link_to Chouette::Network, referential_networks_path(@referential) %></li>
<li><%= tab_link_to t('activerecord.models.company'), referential_companies_path(@referential) %></li>
+ <li><%= tab_link_to Chouette::StopArea, referential_stop_areas_path(@referential) %></li>
<% end %>
</ul>
</div>
diff --git a/app/views/lines/index.html.erb b/app/views/lines/index.html.erb
index bd206ea4f..70d6daa6e 100644
--- a/app/views/lines/index.html.erb
+++ b/app/views/lines/index.html.erb
@@ -23,7 +23,7 @@
</p>
<% end %>
-<%#= will_paginate @lines %>
+<%= will_paginate @lines %>
<div class="lines paginated_content">
<%= render :partial => "line", :collection => @lines %>
</div>
diff --git a/app/views/networks/index.html.erb b/app/views/networks/index.html.erb
index 96e4f8b0b..4514939f1 100644
--- a/app/views/networks/index.html.erb
+++ b/app/views/networks/index.html.erb
@@ -8,7 +8,7 @@
<%= link_to t("cancel"), referential_networks_path(@referential) %>
<% end %>
-<%#= will_paginate @networks %>
+<%= will_paginate @networks %>
<div class="networks paginated_content">
<%= render :partial => "network", :collection => @networks %>
</div>
diff --git a/app/views/stop_areas/_form.html.erb b/app/views/stop_areas/_form.html.erb
new file mode 100644
index 000000000..926f4fb55
--- /dev/null
+++ b/app/views/stop_areas/_form.html.erb
@@ -0,0 +1,21 @@
+<%= semantic_form_for [@referential, @stop_area] do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :name %>
+ <% if @stop_area.new_record? %>
+ <%= form.input :objectid %>
+ <% else %>
+ <li>
+ <label><%= @stop_area.human_attribute_name("objectid") %>: </label>
+ <%= @stop_area.objectid %>
+ </li>
+ <% end %>
+ <%= form.input :registration_number %>
+ <%= form.input :type, :as => :select, :collection => Chouette::StopArea.types, :include_blank => false, :member_label => Proc.new { |mode| t("area_types.label.#{mode}") } %>
+ <%= form.input :comment %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button %>
+ ou <%= link_to "revenir", [@referential, @stop_area] %>
+ <% end %>
+<% end %>
diff --git a/app/views/stop_areas/_stop_area.html.erb b/app/views/stop_areas/_stop_area.html.erb
new file mode 100644
index 000000000..a0b681d48
--- /dev/null
+++ b/app/views/stop_areas/_stop_area.html.erb
@@ -0,0 +1,22 @@
+<%= div_for(stop_area) do %>
+ <%= link_to stop_area.name, [@referential, stop_area] %>
+ <div class="info">
+ <p>
+ <% unless stop_area.geometry %>
+ <span class="warning"><%= t('.no_position') %></span> -
+ <% end %>
+ </p>
+ <p>
+ <%= stop_area.street_name %> <%= stop_area.country_code %>
+ </p>
+ <p>
+ <%= t('.lines') %> <% stop_area.lines.each do |line| %>
+ <span class="line"><%= line.number %></span>
+ <% end %>
+ </p>
+ <div class="actions">
+ <%= link_to t("actions.edit"), edit_referential_stop_area_path(@referential, stop_area), :class => "edit" %> |
+ <%= link_to t("actions.destroy"), referential_stop_area_path(@referential, stop_area), :method => :delete, :confirm => t('networks.actions.destroy_confirm'), :class => "remove" %>
+ </div>
+ </div>
+<% end %>
diff --git a/app/views/stop_areas/edit.html.erb b/app/views/stop_areas/edit.html.erb
new file mode 100644
index 000000000..10d937050
--- /dev/null
+++ b/app/views/stop_areas/edit.html.erb
@@ -0,0 +1,3 @@
+<%= title_tag t('stop_areas.edit.title', :stop_area => @stop_area.name ) %>
+
+<%= render "form" %>
diff --git a/app/views/stop_areas/index.html.erb b/app/views/stop_areas/index.html.erb
new file mode 100644
index 000000000..66de0e8ac
--- /dev/null
+++ b/app/views/stop_areas/index.html.erb
@@ -0,0 +1,21 @@
+<%= title_tag t('stop_areas.index.title') %>
+
+<%= search_form_for @q, :url => referential_stop_areas_path(@referential), :html => {:method => :get} do |f| %>
+ <%= f.label :name_or_country_code_cont, "#{t('.name_or_country_code')} :" %>
+ <%= f.text_field :name_or_countrycode_cont %>
+
+ <%= f.submit t('actions.search') %> <%= t("or") %>
+ <%= link_to t("cancel"), referential_stop_areas_path(@referential) %>
+<% end %>
+
+<%= will_paginate @stop_areas %>
+<div class="stop_areas paginated_content">
+ <%= render :partial => "stop_area", :collection => @stop_areas %>
+</div>
+<%= will_paginate @stop_areas %>
+
+<% content_for :sidebar do %>
+<ul class="actions">
+ <li><%= link_to t('stop_areas.actions.new'), new_referential_stop_area_path(@referential), :class => "add" %></li>
+</ul>
+<% end %>
diff --git a/app/views/stop_areas/new.html.erb b/app/views/stop_areas/new.html.erb
new file mode 100644
index 000000000..aed167a84
--- /dev/null
+++ b/app/views/stop_areas/new.html.erb
@@ -0,0 +1,3 @@
+<%= title_tag t('stop_area.new.title') %>
+
+<%= render "form" %>
diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb
new file mode 100644
index 000000000..8868011d3
--- /dev/null
+++ b/app/views/stop_areas/show.html.erb
@@ -0,0 +1,43 @@
+<%= title_tag t('stop_areas.show.title', :stop_area => @stop_area.name ) %>
+
+<div class="stop_area_show">
+
+ <div class="summary">
+ <p>
+ <label><%= @stop_area.human_attribute_name("name") %>: </label>
+ <%= @stop_area.name %>
+ </p>
+ <p>
+ <label><%= @stop_area.human_attribute_name("objectid") %>: </label>
+ <%= @stop_area.objectid %>
+ </p>
+ <p>
+ <label><%= @stop_area.human_attribute_name("registration_number") %>: </label>
+ <%= @stop_area.registration_number %>
+ </p>
+ <p>
+ <label><%= @stop_area.human_attribute_name("type") %>: </label>
+ <%= t("area_types.label.#{@stop_area.type}") %>
+ </p>
+ <p>
+ <label><%= @stop_area.human_attribute_name("comment") %>: </label>
+ <%= @stop_area.comment %>
+ </p>
+ <p>
+ <label><%= @stop_area.human_attribute_name("creation_time") %>: </label>
+ <%= @stop_area.creation_time %>
+ </p>
+ <p>
+ <label><%= @stop_area.human_attribute_name("creator_id") %>: </label>
+ <%= @stop_area.creator_id %>
+ </p>
+ </div>
+</div>
+
+<% content_for :sidebar do %>
+<ul class="actions">
+ <li><%= link_to t('stop_areas.actions.edit'), edit_referential_stop_area_path(@referential, @stop_area), :class => "edit" %></li>
+ <li><%= link_to t('stop_areas.actions.destroy'), referential_stop_area_path(@referential, @stop_area), :method => :delete, :confirm => t('stop_areas.actions.destroy_confirm'), :class => "remove" %></li>
+ <br>
+</ul>
+<% end %>