diff options
| author | Michel Etienne | 2014-07-11 16:35:14 +0200 |
|---|---|---|
| committer | Michel Etienne | 2014-07-11 16:35:14 +0200 |
| commit | 101b9c237485ea6ec26bb583735c5d26f0d2efb2 (patch) | |
| tree | 7852dbce1e6def3db0aab910ad790ba716db759b | |
| parent | a7939d2991770328163723951edca6cf23148570 (diff) | |
| download | chouette-core-101b9c237485ea6ec26bb583735c5d26f0d2efb2.tar.bz2 | |
duplicate timetable, Mantis 25466
| -rw-r--r-- | Gemfile.lock | 9 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 8 | ||||
| -rw-r--r-- | app/views/time_tables/show.html.erb | 1 | ||||
| -rw-r--r-- | config/locales/time_tables.yml | 4 | ||||
| -rw-r--r-- | config/routes.rb | 3 |
5 files changed, 22 insertions, 3 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 544adef22..f15389b0b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,13 @@ GIT remote: https://github.com/afimb/ninoxe.git - revision: cbb81eb9682d24b54c0971b4050b116d5a5275f4 + revision: 4678304bb9a6d550ce45feb6557fbe33d3d11312 branch: sismo specs: ninoxe (1.1.0) activerecord (~> 3.2) acts_as_list (>= 0.1.6) acts_as_tree (>= 1.1.0) + deep_cloneable (~> 2.0.0) foreigner (= 1.6.0) georuby-ext (= 0.0.5) @@ -98,6 +99,8 @@ GEM daemons (1.1.9) dbf (2.0.7) fastercsv (~> 1.5.4) + deep_cloneable (2.0.0) + activerecord (>= 3.1.0, < 5.0.0) delayed_job (3.0.3) activesupport (~> 3.0) delayed_job_active_record (0.3.2) @@ -161,7 +164,7 @@ GEM activesupport (>= 3.2, < 5) highline (1.6.15) hike (1.2.3) - i18n (0.6.9) + i18n (0.6.11) inherited_resources (1.4.1) has_scope (~> 0.6.0.rc) responders (~> 1.0.0.rc) @@ -330,7 +333,7 @@ GEM treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.39) + tzinfo (0.3.40) uglifier (1.2.7) execjs (>= 0.3.0) multi_json (~> 1.3) diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index b2fdf711b..20100ddd6 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -31,6 +31,14 @@ class TimeTablesController < ChouetteController end end + def duplicate + @time_table = Chouette::TimeTable.find params[:id] + @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) + end + protected diff --git a/app/views/time_tables/show.html.erb b/app/views/time_tables/show.html.erb index 4c541a0c2..6e61d722b 100644 --- a/app/views/time_tables/show.html.erb +++ b/app/views/time_tables/show.html.erb @@ -151,6 +151,7 @@ <li><%= link_to t('time_tables.actions.new'), new_referential_time_table_path(@referential), :class => "add" %></li> <li><%= link_to t('time_tables.actions.edit'), edit_referential_time_table_path(@referential, @time_table), :class => "edit" %></li> <li><%= link_to t('time_tables.actions.destroy'), referential_time_table_path(@referential, @time_table), :method => :delete, :data => {:confirm => t('time_tables.actions.destroy_confirm')}, :class => "remove" %></li> + <li><%= link_to t('time_tables.actions.duplicate'), duplicate_referential_time_table_path(@referential, @time_table), :class => "add" %></li> <br> </ul> diff --git a/config/locales/time_tables.yml b/config/locales/time_tables.yml index 3f7baa6ae..e19eaaf57 100644 --- a/config/locales/time_tables.yml +++ b/config/locales/time_tables.yml @@ -1,5 +1,6 @@ en: time_tables: + duplicate_success: "duplication succeded" time_table: empty: "empty" bounding: "from %{start} to %{end}" @@ -10,6 +11,7 @@ en: new: "Add a new timetable" edit: "Edit this timetable" destroy: "Remove this timetable" + duplicate: "Duplicate this timetable" destroy_confirm: "Are you sure you want destroy this timetable ?" destroy_date_confirm: "Are you sure you want destroy this date ?" destroy_period_confirm: "Are you sure you want destroy this period ?" @@ -78,6 +80,7 @@ en: fr: time_tables: + duplicate_success: "duplication terminée" time_table: empty: "vide" bounding: "du %{start} au %{end}" @@ -88,6 +91,7 @@ fr: new: "Ajouter un calendrier" edit: "Modifier ce calendrier" destroy: "Supprimer ce calendrier" + duplicate: "Dupliquer ce calendrier" destroy_confirm: "Etes vous sûr de supprimer ce calendrier ?" destroy_date_confirm: "Etes vous sûr de supprimer cette date ?" destroy_period_confirm: "Etes vous sûr de supprimer cette période ?" diff --git a/config/routes.rb b/config/routes.rb index 7f4a6193a..e4241a62d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -127,6 +127,9 @@ ChouetteIhm::Application.routes.draw do collection do get :comment_filter end + member do + get 'duplicate' + end resources :time_table_dates resources :time_table_periods resources :time_table_combinations |
