aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Etienne2014-10-03 14:37:12 +0200
committerMichel Etienne2014-10-03 14:37:12 +0200
commitbf37e97d8a86814b1bc2f844cbcff86ab0a43266 (patch)
treeb009a3a77f22acb10c466835e14f7021055c9064
parent6a11b1c4057f828bbb98b53dde27a346b794bd3f (diff)
downloadchouette-core-bf37e97d8a86814b1bc2f844cbcff86ab0a43266.tar.bz2
duplicate calendar will open new form and not edit form , Mantis 29110
-rw-r--r--app/assets/stylesheets/main/time_tables.css.scss2
-rw-r--r--app/controllers/time_tables_controller.rb6
-rw-r--r--app/views/time_tables/_form.erb4
3 files changed, 6 insertions, 6 deletions
diff --git a/app/assets/stylesheets/main/time_tables.css.scss b/app/assets/stylesheets/main/time_tables.css.scss
index 9161f03ab..bc1f48810 100644
--- a/app/assets/stylesheets/main/time_tables.css.scss
+++ b/app/assets/stylesheets/main/time_tables.css.scss
@@ -79,7 +79,7 @@
}
}
-#workspace.time_tables.edit,#workspace.time_tables.new,#workspace.time_tables.create,#workspace.time_tables.update
+#workspace.time_tables.edit,#workspace.time_tables.new,#workspace.time_tables.create,#workspace.time_tables.update,#workspace.time_tables.duplicate
{
fieldset.inputs{
overflow: visible !important;
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index 54b0a3bac..be1738060 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -46,10 +46,10 @@ class TimeTablesController < ChouetteController
def duplicate
@time_table = Chouette::TimeTable.find params[:id]
+ # prepare breadcrumb before prepare data for new timetable
+ build_breadcrumb :edit
@time_table = @time_table.duplicate
- @time_table.save
- flash[:notice] = I18n.translate("time_tables.duplicate_success")
- redirect_to edit_referential_time_table_path(@referential, @time_table)
+ render :new
end
def tags
diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb
index 003bfb09f..7dceab747 100644
--- a/app/views/time_tables/_form.erb
+++ b/app/views/time_tables/_form.erb
@@ -33,7 +33,7 @@
<h3 class="time_table_dates"><%= @time_table.human_attribute_name("dates") %></h3>
<div id="dates_content">
<div id="dates">
- <%= form.semantic_fields_for :dates, @time_table.dates.where("in_out = true").to_a do |p| %>
+ <%= form.semantic_fields_for :dates, @time_table.dates.to_a.select {|d| d.in_out == true} do |p| %>
<%= render "date_fields", :f => p %>
<% end %>
</div>
@@ -46,7 +46,7 @@
<h3 class="time_table_dates"><%= @time_table.human_attribute_name("excluded_dates") %></h3>
<div id="excluded_dates_content">
<div id="excluded_dates">
- <%= form.semantic_fields_for :dates, @time_table.dates.where("in_out = false").to_a do |p| %>
+ <%= form.semantic_fields_for :dates, @time_table.dates.to_a.select {|d| d.in_out == false} do |p| %>
<%= render "excluded_date_fields", :f => p %>
<% end %>
</div>