aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/main/routes.css.scss8
-rw-r--r--app/assets/stylesheets/main/simple_form.css.scss7
-rw-r--r--app/controllers/routes_controller.rb17
-rw-r--r--app/helpers/stop_areas_helper.rb12
-rw-r--r--app/views/devise/invitations/edit.html.erb2
-rw-r--r--app/views/devise/invitations/new.html.erb2
-rw-r--r--app/views/devise/passwords/edit.html.erb2
-rw-r--r--app/views/devise/passwords/new.html.erb2
-rw-r--r--app/views/routes/edit_boarding_alighting.html.erb27
-rw-r--r--app/views/routes/show.html.erb12
10 files changed, 84 insertions, 7 deletions
diff --git a/app/assets/stylesheets/main/routes.css.scss b/app/assets/stylesheets/main/routes.css.scss
index 31891f39e..7714c13a3 100644
--- a/app/assets/stylesheets/main/routes.css.scss
+++ b/app/assets/stylesheets/main/routes.css.scss
@@ -34,6 +34,14 @@
}
}
+#workspace.routes.edit_boarding_alighting{
+
+ .stop_area{
+ padding-top: 7px;
+ }
+
+}
+
#workspace.routes.show
{
}
diff --git a/app/assets/stylesheets/main/simple_form.css.scss b/app/assets/stylesheets/main/simple_form.css.scss
new file mode 100644
index 000000000..9282d89e0
--- /dev/null
+++ b/app/assets/stylesheets/main/simple_form.css.scss
@@ -0,0 +1,7 @@
+#workspace{
+
+ .submit{
+ @extend .col-md-offset-3;
+ }
+
+} \ No newline at end of file
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb
index 391a14d88..6454ce068 100644
--- a/app/controllers/routes_controller.rb
+++ b/app/controllers/routes_controller.rb
@@ -15,6 +15,21 @@ class RoutesController < ChouetteController
end
end
+ def edit_boarding_alighting
+ @route = route
+ build_breadcrumb :edit
+ end
+
+ def save_boarding_alighting
+ @route = route
+
+ if @route.update_attributes(params[:route])
+ redirect_to referential_line_route_path(@referential, @line, @route)
+ else
+ render "edit_boarding_alighting"
+ end
+ end
+
def show
@map = RouteMap.new(route).with_helpers(self)
@stop_points = route.stop_points.paginate(:page => params[:page])
@@ -26,7 +41,7 @@ class RoutesController < ChouetteController
# overwrite inherited resources to use delete instead of destroy
# foreign keys will propagate deletion)
def destroy_resource(object)
- object.delete
+ object.delete
end
def destroy
diff --git a/app/helpers/stop_areas_helper.rb b/app/helpers/stop_areas_helper.rb
index e287af7f3..ce0dab85a 100644
--- a/app/helpers/stop_areas_helper.rb
+++ b/app/helpers/stop_areas_helper.rb
@@ -1,4 +1,16 @@
module StopAreasHelper
+ def explicit_name(stop_area)
+ name = localization = ""
+
+ name += truncate(stop_area.name, :length => 30) || ""
+ name += (" <small>["+ ( truncate(stop_area.registration_number, :length => 10) || "") + "]</small>") if stop_area.registration_number
+
+ localization += stop_area.zip_code || ""
+ localization += ( truncate(stop_area.city_name, :length => 15) ) if stop_area.city_name
+
+ ( "#{image_tag( stop_area_picture_url(stop_area)) }" + " <span style='height:25px; line-height:25px; margin-left: 5px; '>" + name + " <small style='height:25px; line-height:25px; margin-left: 10px; color: #555;'>" + localization + "</small></span>").html_safe
+ end
+
def genealogical_title
return t(".stop_areas.genealogical.genealogical_routing") if @stop_area.stop_area_type == 'itl'
t("stop_areas.genealogical.genealogical")
diff --git a/app/views/devise/invitations/edit.html.erb b/app/views/devise/invitations/edit.html.erb
index a03b1ee7e..8835c5773 100644
--- a/app/views/devise/invitations/edit.html.erb
+++ b/app/views/devise/invitations/edit.html.erb
@@ -9,7 +9,7 @@
<%= form.input :password, :as => :password %>
<%= form.input :password_confirmation, :as => :password %>
- <div class="col-md-offset-2">
+ <div class="submit">
<%= form.button :submit, :value => t("devise.invitations.edit.submit_button"), :class => "btn-info" %>
</div>
<% end %>
diff --git a/app/views/devise/invitations/new.html.erb b/app/views/devise/invitations/new.html.erb
index 2232020c9..5567463c8 100644
--- a/app/views/devise/invitations/new.html.erb
+++ b/app/views/devise/invitations/new.html.erb
@@ -9,7 +9,7 @@
<%= form.input field %>
<% end -%>
- <div class="col-md-offset-2">
+ <div class="submit">
<%= form.button :submit, :value => t("devise.invitations.new.submit_button"), :class => "btn-info" %>
</div>
<% end %>
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb
index 7b408a149..e0cad44a2 100644
--- a/app/views/devise/passwords/edit.html.erb
+++ b/app/views/devise/passwords/edit.html.erb
@@ -8,7 +8,7 @@
<%= f.input :password, :as => :password %>
<%= f.input :password_confirmation, :as => :password %>
- <div class="col-md-offset-2">
+ <div class="submit">
<%= link_to t("cancel"), root_path, :class => "btn btn-default" %>
<%= f.button :submit, :value => t("devise.passwords.edit.commit"), :class => "btn-info" %>
</div>
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb
index 865805319..8f5ec0f10 100644
--- a/app/views/devise/passwords/new.html.erb
+++ b/app/views/devise/passwords/new.html.erb
@@ -5,7 +5,7 @@
<%= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |form| %>
<%= form.input :email, :as => :email, placeholder: 'user@domain.com' %>
- <div class="col-md-offset-2">
+ <div class="submit">
<%= link_to t("cancel"), root_path, :class => "btn btn-default" %>
<%= form.button :submit, :value => t("devise.passwords.new.commit"), :class => "btn-info" %>
</div>
diff --git a/app/views/routes/edit_boarding_alighting.html.erb b/app/views/routes/edit_boarding_alighting.html.erb
new file mode 100644
index 000000000..fc3378425
--- /dev/null
+++ b/app/views/routes/edit_boarding_alighting.html.erb
@@ -0,0 +1,27 @@
+<%= title_tag t('routes.edit_boarding_alighting.title', :route => @route.name ) %>
+
+<%= simple_form_for ["save_boarding_alighting", @referential, @line, @route] do |form| %>
+<table class="table table-hover">
+ <thead>
+ <th><%= t(".stop_area_name") %></th>
+ <th><%= t(".for_boarding") %></th>
+ <th><%= t(".for_alighting") %></th>
+ </thead>
+ <tbody>
+ <%= form.simple_fields_for :stop_points do |stop_points_form| %>
+ <tr>
+ <td>
+ <%= explicit_name(stop_points_form.object.stop_area) %>
+ </td>
+ <td><%= stop_points_form.input :for_boarding, :label => false, include_blank: t("simple_form.include_blanks.defaults.for_boarding") %></td>
+ <td><%= stop_points_form.input :for_alighting, :label => false, include_blank: t("simple_form.include_blanks.defaults.for_alighting") %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+ <div class="submit">
+ <%= form.button :submit, :class => "" %>
+ <%= link_to t("cancel"), referential_line_route_path(@referential, @line, @route) %>
+ </div>
+<% end %>
diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb
index fe1a9c956..e1f59cde9 100644
--- a/app/views/routes/show.html.erb
+++ b/app/views/routes/show.html.erb
@@ -93,18 +93,26 @@
<li><%= link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), :class => "add" %></li>
<li><%= link_to t('routes.actions.edit'), edit_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li>
<li><%= link_to t('routes.actions.destroy'), referential_line_route_path(@referential, @line, @route), :method => :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, :class => "remove" %></li>
-<% if @route.stop_points.size >= 2 %>
+</ul>
+<ul class="actions">
+ <% if @route.stop_points.size >= 2 %>
<li><%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %></li>
<% end %>
+ <% if @route.stop_points.present? %>
+ <li><%= link_to t('routes.actions.edit_boarding_alighting'), edit_boarding_alighting_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li>
+ <% end %>
<% if @route.journey_patterns.size > 0 %>
<li>
<%= link_to t('vehicle_journeys.actions.index'), [@referential, @line, @route, :vehicle_journeys], :class => "clock" %>
</li>
<% end %>
+</ul>
+
+<ul class="actions">
<li><%= link_to t('vehicle_journey_imports.new.title'), new_referential_line_route_vehicle_journey_import_path( @referential, @line, @route ), :class => "import" %></li>
<li><%= link_to t('vehicle_journey_exports.new.title'), referential_line_route_vehicle_journey_exports_path(@referential, @line, @route, :format => :zip), :class => "export" %></li>
</ul>
- <%= creation_tag(@route) %>
+<%= creation_tag(@route) %>
<% end %>