aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/import_tasks_controller.rb2
-rw-r--r--app/controllers/stop_area_copies_controller.rb18
-rw-r--r--app/helpers/application_helper.rb42
-rw-r--r--app/helpers/remote_bootstrap_pagination_link_renderer.rb8
-rw-r--r--app/models/stop_area_copy.rb16
-rw-r--r--app/views/companies/_companies.erb2
-rw-r--r--app/views/compliance_check_tasks/_compliance_check_task.html.erb (renamed from app/views/compliance_check_tasks/_compliance_check_task.erb)0
-rw-r--r--app/views/compliance_check_tasks/_compliance_check_tasks.html.erb9
-rw-r--r--app/views/compliance_check_tasks/index.html.erb11
-rw-r--r--app/views/compliance_check_tasks/index.js.erb1
-rw-r--r--app/views/connection_links/_connection_links.erb2
-rw-r--r--app/views/exports/_exports.html.erb17
-rw-r--r--app/views/exports/index.html.erb19
-rw-r--r--app/views/exports/index.js.erb1
-rw-r--r--app/views/group_of_lines/_group_of_lines.erb2
-rw-r--r--app/views/import_tasks/_import_tasks.html.erb9
-rw-r--r--app/views/import_tasks/index.html.erb12
-rw-r--r--app/views/import_tasks/index.js.erb1
-rw-r--r--app/views/lines/_lines.html.erb2
-rw-r--r--app/views/networks/_networks.erb2
-rw-r--r--app/views/shared/_header.erb2
-rw-r--r--app/views/stop_area_copies/new.html.erb7
-rw-r--r--app/views/stop_areas/_stop_areas.html.erb2
-rw-r--r--app/views/time_tables/_time_tables.html.erb2
24 files changed, 125 insertions, 64 deletions
diff --git a/app/controllers/import_tasks_controller.rb b/app/controllers/import_tasks_controller.rb
index 37de83f4d..1d7e8c3aa 100644
--- a/app/controllers/import_tasks_controller.rb
+++ b/app/controllers/import_tasks_controller.rb
@@ -1,6 +1,6 @@
class ImportTasksController < ChouetteController
respond_to :html, :xml, :json
- respond_to :js, :only => :show
+ respond_to :js, :only => [:show, :index]
belongs_to :referential
def new
diff --git a/app/controllers/stop_area_copies_controller.rb b/app/controllers/stop_area_copies_controller.rb
index 01dfc5894..dbb66c2bd 100644
--- a/app/controllers/stop_area_copies_controller.rb
+++ b/app/controllers/stop_area_copies_controller.rb
@@ -7,25 +7,13 @@ class StopAreaCopiesController < ChouetteController
respond_to :html, :only => :new
def new
- @stop_area_copy = StopAreaCopy.new(:source_id => parent.id, :hierarchy => params[:hierarchy])
- if @stop_area_copy.hierarchy == "child"
- if parent.area_type.underscore == "stop_place"
- @stop_area_copy.area_type="commercial_stop_point"
- else
- @stop_area_copy.area_type="boarding_position"
- end
- else
- if parent.area_type.underscore == "stop_place" || parent.area_type.underscore == "commercial_stop_point"
- @stop_area_copy.area_type="stop_place"
- else
- @stop_area_copy.area_type="commercial_stop_point"
- end
- end
+ @stop_area_copy = StopAreaCopy.new(:hierarchy => params[:hierarchy], :source => parent)
new!
end
-# TODO
+
def create
@stop_area_copy = StopAreaCopy.new(params[:stop_area_copy])
+ @stop_area = parent
if @stop_area_copy.save
redirect_to referential_stop_area_path( @referential,parent ), notice: I18n.t("stop_area_copies.new.success")
else
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8e655c68d..a3808cfc1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -20,7 +20,47 @@ module ApplicationHelper
end
def help_path
- url_for(:controller => "/help", :action => "show") + '/'
+ path = request.env['PATH_INFO']
+ target = case
+ when path.include?("/help")
+ ""
+ when path.include?("/networks")
+ "networks"
+ when path.include?("/companies")
+ "companies"
+ when path.include?("/group_of_lines")
+ "group_of_lines"
+ when path.include?("/vehicle_journeys")
+ "vehicle_journeys"
+ when path.include?("/journey_patterns")
+ "journey_patterns"
+ when path.include?("/routes")
+ "routes"
+ when path.include?("/lines")
+ "lines"
+ when path.include?("/access_points")
+ "access_points"
+ when path.include?("/access_links")
+ "access_links"
+ when path.include?("/stop_areas")
+ "stop_areas"
+ when path.include?("/connection_links")
+ "connection_links"
+ when path.include?("/time_tables")
+ "time_tables"
+ when path.include?("/rule_parameter_set")
+ "parametersets"
+ when path.include?("/import_tasks")
+ "imports"
+ when path.include?("/exports")
+ "exports"
+ when path.include?("/compliance_check_tasks")
+ "validations"
+ else
+ ""
+ end
+
+ url_for(:controller => "/help", :action => "show") + '/' + target
end
diff --git a/app/helpers/remote_bootstrap_pagination_link_renderer.rb b/app/helpers/remote_bootstrap_pagination_link_renderer.rb
new file mode 100644
index 000000000..fe7f2d06b
--- /dev/null
+++ b/app/helpers/remote_bootstrap_pagination_link_renderer.rb
@@ -0,0 +1,8 @@
+# remote link for will paginate, using bootstrap as renderer
+class RemoteBootstrapPaginationLinkRenderer < BootstrapPagination::Rails
+ def link (text,target, attributes = {})
+ attributes["data-remote"] = true
+ super
+ end
+
+end
diff --git a/app/models/stop_area_copy.rb b/app/models/stop_area_copy.rb
index 2bd6447ab..39ae42c34 100644
--- a/app/models/stop_area_copy.rb
+++ b/app/models/stop_area_copy.rb
@@ -14,6 +14,22 @@ class StopAreaCopy
def initialize(attributes = {})
attributes.each { |name, value| send("#{name}=", value) } if attributes
+ if self.area_type.blank? && self.source != nil
+ self.source_id = self.source.id
+ if self.hierarchy == "child"
+ if self.source.area_type.underscore == "stop_place"
+ self.area_type="commercial_stop_point"
+ else
+ self.area_type="boarding_position"
+ end
+ else
+ if self.source.area_type.underscore == "stop_place" || self.source.area_type.underscore == "commercial_stop_point"
+ self.area_type="stop_place"
+ else
+ self.area_type="commercial_stop_point"
+ end
+ end
+ end
end
def persisted?
diff --git a/app/views/companies/_companies.erb b/app/views/companies/_companies.erb
index 29871b836..fb36a86af 100644
--- a/app/views/companies/_companies.erb
+++ b/app/views/companies/_companies.erb
@@ -5,5 +5,5 @@
<%= paginated_content(@companies) %>
</div>
<div class="pagination">
- <%= will_paginate @companies, :container => false, renderer: BootstrapPagination::Rails %>
+ <%= will_paginate @companies, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
diff --git a/app/views/compliance_check_tasks/_compliance_check_task.erb b/app/views/compliance_check_tasks/_compliance_check_task.html.erb
index 081b04b46..081b04b46 100644
--- a/app/views/compliance_check_tasks/_compliance_check_task.erb
+++ b/app/views/compliance_check_tasks/_compliance_check_task.html.erb
diff --git a/app/views/compliance_check_tasks/_compliance_check_tasks.html.erb b/app/views/compliance_check_tasks/_compliance_check_tasks.html.erb
new file mode 100644
index 000000000..9cb805b90
--- /dev/null
+++ b/app/views/compliance_check_tasks/_compliance_check_tasks.html.erb
@@ -0,0 +1,9 @@
+<div class="page_info">
+ <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @compliance_check_tasks %>
+</div>
+<div class="compliance_check_tasks paginated_content">
+ <%= paginated_content @compliance_check_tasks %>
+</div>
+<div class="pagination">
+ <%= will_paginate @compliance_check_tasks, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
+</div>
diff --git a/app/views/compliance_check_tasks/index.html.erb b/app/views/compliance_check_tasks/index.html.erb
index 8a659070c..fe05b3cdc 100644
--- a/app/views/compliance_check_tasks/index.html.erb
+++ b/app/views/compliance_check_tasks/index.html.erb
@@ -1,14 +1,7 @@
<%= title_tag t('.title') %>
<div class="warning"><%= t('.warning') %> </div>
-<div class="page_info">
- <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @compliance_check_tasks %>
-</div>
-<div class="compliance_check_tasks paginated_content">
- <%= paginated_content @compliance_check_tasks %>
-</div>
-<div class="pagination">
- <%= will_paginate @compliance_check_tasks, :container => false, renderer: BootstrapPagination::Rails %>
-</div>
+
+<div id="compliance_check_tasks"><%= render 'compliance_check_tasks' %></div>
<% content_for :sidebar do %>
<ul class="actions">
diff --git a/app/views/compliance_check_tasks/index.js.erb b/app/views/compliance_check_tasks/index.js.erb
new file mode 100644
index 000000000..08ddf1dc5
--- /dev/null
+++ b/app/views/compliance_check_tasks/index.js.erb
@@ -0,0 +1 @@
+$('#compliance_check_tasks').html('<%= escape_javascript(render("compliance_check_tasks")) %>'); \ No newline at end of file
diff --git a/app/views/connection_links/_connection_links.erb b/app/views/connection_links/_connection_links.erb
index 1f4704596..cfc1d45f4 100644
--- a/app/views/connection_links/_connection_links.erb
+++ b/app/views/connection_links/_connection_links.erb
@@ -5,5 +5,5 @@
<%= paginated_content(@connection_links) %>
</div>
<div class="pagination">
- <%= will_paginate @connection_links, :container => false, renderer: BootstrapPagination::Rails %>
+ <%= will_paginate @connection_links, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
diff --git a/app/views/exports/_exports.html.erb b/app/views/exports/_exports.html.erb
new file mode 100644
index 000000000..58d4d7e70
--- /dev/null
+++ b/app/views/exports/_exports.html.erb
@@ -0,0 +1,17 @@
+<div class="page_info">
+ <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @exports %>
+</div>
+<div class="exports paginated_content">
+ <% @exports.each_slice(3) do |row_exports| %>
+ <div class="row">
+ <% row_exports.each do |export| %>
+ <div class="col-md-4">
+ <%= render :partial => "export", locals: { export: export } %>
+ </div>
+ <% end %>
+ </div>
+ <% end %>
+</div>
+<div class="pagination">
+ <%= will_paginate @exports, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
+</div>
diff --git a/app/views/exports/index.html.erb b/app/views/exports/index.html.erb
index 2f89b9458..35b19be62 100644
--- a/app/views/exports/index.html.erb
+++ b/app/views/exports/index.html.erb
@@ -1,22 +1,7 @@
<%= title_tag t('.title') %>
<div class="warning"><%= t('.warning') %> </div>
-<div class="page_info">
- <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @exports %>
-</div>
-<div class="exports paginated_content">
- <% @exports.each_slice(3) do |row_exports| %>
- <div class="row">
- <% row_exports.each do |export| %>
- <div class="col-md-4">
- <%= render :partial => "export", locals: { export: export } %>
- </div>
- <% end %>
- </div>
- <% end %>
-</div>
-<div class="pagination">
- <%= will_paginate @exports, :container => false, renderer: BootstrapPagination::Rails %>
-</div>
+<div id="exports"><%= render 'exports' %></div>
+
<% content_for :sidebar do %>
<ul class="actions">
diff --git a/app/views/exports/index.js.erb b/app/views/exports/index.js.erb
new file mode 100644
index 000000000..08ddf1dc5
--- /dev/null
+++ b/app/views/exports/index.js.erb
@@ -0,0 +1 @@
+$('#compliance_check_tasks').html('<%= escape_javascript(render("compliance_check_tasks")) %>'); \ No newline at end of file
diff --git a/app/views/group_of_lines/_group_of_lines.erb b/app/views/group_of_lines/_group_of_lines.erb
index 4d2d06159..212507d01 100644
--- a/app/views/group_of_lines/_group_of_lines.erb
+++ b/app/views/group_of_lines/_group_of_lines.erb
@@ -5,5 +5,5 @@
<%= paginated_content(@group_of_lines) %>
</div>
<div class="pagination">
- <%= will_paginate @group_of_lines, :container => false, renderer: BootstrapPagination::Rails %>
+ <%= will_paginate @group_of_lines, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
diff --git a/app/views/import_tasks/_import_tasks.html.erb b/app/views/import_tasks/_import_tasks.html.erb
new file mode 100644
index 000000000..6e3825817
--- /dev/null
+++ b/app/views/import_tasks/_import_tasks.html.erb
@@ -0,0 +1,9 @@
+<div class="page_info">
+ <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @import_tasks %>
+</div>
+<div class="import_tasks paginated_content">
+ <%= paginated_content @import_tasks %>
+</div>
+<div class="pagination">
+ <%= will_paginate @import_tasks, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
+</div>
diff --git a/app/views/import_tasks/index.html.erb b/app/views/import_tasks/index.html.erb
index f19c84929..ce0149f72 100644
--- a/app/views/import_tasks/index.html.erb
+++ b/app/views/import_tasks/index.html.erb
@@ -1,14 +1,8 @@
<%= title_tag t('.title') %>
<div class="warning"><%= t('.warning') %> </div>
-<div class="page_info">
- <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @import_tasks %>
-</div>
-<div class="import_tasks paginated_content">
- <%= paginated_content @import_tasks %>
-</div>
-<div class="pagination">
- <%= will_paginate @import_tasks, :container => false, renderer: BootstrapPagination::Rails %>
-</div>
+
+<div id="import_tasks"><%= render 'import_tasks' %></div>
+
<% content_for :sidebar do %>
<ul class="actions">
diff --git a/app/views/import_tasks/index.js.erb b/app/views/import_tasks/index.js.erb
new file mode 100644
index 000000000..79679f8ac
--- /dev/null
+++ b/app/views/import_tasks/index.js.erb
@@ -0,0 +1 @@
+$('#import_tasks').html('<%= escape_javascript(render("import_tasks")) %>'); \ No newline at end of file
diff --git a/app/views/lines/_lines.html.erb b/app/views/lines/_lines.html.erb
index 3bb3cd37f..a4d9a3f0b 100644
--- a/app/views/lines/_lines.html.erb
+++ b/app/views/lines/_lines.html.erb
@@ -5,5 +5,5 @@
<%= paginated_content(@lines) %>
</div>
<div class="pagination">
- <%= will_paginate @lines, :container => false, renderer: BootstrapPagination::Rails %>
+ <%= will_paginate @lines, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
diff --git a/app/views/networks/_networks.erb b/app/views/networks/_networks.erb
index e395d4ebb..9d95d63b6 100644
--- a/app/views/networks/_networks.erb
+++ b/app/views/networks/_networks.erb
@@ -5,5 +5,5 @@
<%= paginated_content(@networks) %>
</div>
<div class="pagination">
- <%= will_paginate @networks, :container => false, renderer: BootstrapPagination::Rails %>
+ <%= will_paginate @networks, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
diff --git a/app/views/shared/_header.erb b/app/views/shared/_header.erb
index dc096f80b..53975556b 100644
--- a/app/views/shared/_header.erb
+++ b/app/views/shared/_header.erb
@@ -82,7 +82,7 @@
<li><%= link_to_language :en %></li>
</ul>
</li>
- <li><%= link_to t('layouts.help'), help_path, :class =>("current" if help_page?), :target => "_blank" %></li>
+ <li><%= link_to t('layouts.help'), help_path, :class =>("current" if help_page?), :target => "chouette_help" %></li>
<% if user_signed_in? %>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="gravatar"><%= user_gravatar_image_tag(current_user, 16) %></span><%= current_user.name %> <b class="caret"></b></a>
diff --git a/app/views/stop_area_copies/new.html.erb b/app/views/stop_area_copies/new.html.erb
index 28c201d2f..5edc005cc 100644
--- a/app/views/stop_area_copies/new.html.erb
+++ b/app/views/stop_area_copies/new.html.erb
@@ -3,8 +3,8 @@
<%= semantic_form_for [@referential, @stop_area, @stop_area_copy] do |form| %>
<br>
<%= form.inputs do %>
- <%= form.input :source_id , :as => :hidden%>
- <%= form.input :hierarchy , :as => :hidden%>
+ <%= form.input :source_id, :as => :hidden %>
+ <%= form.input :hierarchy, :as => :hidden %>
<% if @stop_area_copy.hierarchy == "child"%>
<% if @stop_area.area_type.underscore == "stop_place"%>
<%= form.input :area_type, :as => :select, :collection => ["stop_place","commercial_stop_point"], :include_blank => false, :member_label => Proc.new { |stop_area_type| t("area_types.label.#{stop_area_type}") } %>
@@ -12,8 +12,7 @@
<%= form.input :area_type, :as => :select, :collection => ["boarding_position","quay"], :include_blank => false, :member_label => Proc.new { |stop_area_type| t("area_types.label.#{stop_area_type}") } %>
<% end %>
<% else %>
- <%= form.input :area_type, :as => :select, :input_html => { :disabled => true }, :collection => [@stop_area_copy.area_type], :include_blank => false, :member_label => Proc.new { |stop_area_type| t("area_types.label.#{stop_area_type}") } %>
- <%= form.input :area_type , :as => :hidden%>
+ <%= form.input :area_type, :as => :select, :collection => [@stop_area_copy.area_type], :include_blank => false, :member_label => Proc.new { |stop_area_type| t("area_types.label.#{stop_area_type}") } %>
<% end %>
<% end %>
<%= form.actions do %>
diff --git a/app/views/stop_areas/_stop_areas.html.erb b/app/views/stop_areas/_stop_areas.html.erb
index 38423aedf..9c7a82d6d 100644
--- a/app/views/stop_areas/_stop_areas.html.erb
+++ b/app/views/stop_areas/_stop_areas.html.erb
@@ -5,5 +5,5 @@
<%= paginated_content(@stop_areas) %>
</div>
<div class="pagination">
- <%= will_paginate @stop_areas, :container => false, renderer: BootstrapPagination::Rails %>
+ <%= will_paginate @stop_areas, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
diff --git a/app/views/time_tables/_time_tables.html.erb b/app/views/time_tables/_time_tables.html.erb
index 72fbd9384..4458f653d 100644
--- a/app/views/time_tables/_time_tables.html.erb
+++ b/app/views/time_tables/_time_tables.html.erb
@@ -5,5 +5,5 @@
<%= paginated_content(@time_tables) %>
</div>
<div class="pagination">
- <%= will_paginate @time_tables, :container => false, renderer: BootstrapPagination::Rails %>
+ <%= will_paginate @time_tables, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>