diff options
| -rw-r--r-- | app/helpers/pagination_helper.rb | 7 | ||||
| -rw-r--r-- | app/views/group_of_lines/_group_of_line.erb | 4 | ||||
| -rw-r--r-- | app/views/lines/show.html.erb | 2 | ||||
| -rw-r--r-- | app/views/time_tables/_time_table.html.erb | 4 | ||||
| -rw-r--r-- | app/views/vehicle_journeys/show.html.erb | 2 |
5 files changed, 9 insertions, 10 deletions
diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb index b85137b85..68c3d462f 100644 --- a/app/helpers/pagination_helper.rb +++ b/app/helpers/pagination_helper.rb @@ -1,5 +1,8 @@ module PaginationHelper - def paginated_content(models, default_partial_name = nil) + def paginated_content(models, default_partial_name = nil, options = {}) + default_options = {:delete => true, :edit => true} + options = default_options.merge(options) + return "" if models.blank? html = "" @@ -7,7 +10,7 @@ module PaginationHelper html += '<div class="row">' row_models.each do |model| partial_name = default_partial_name || model.class.name.underscore.gsub("chouette/", "") - html += '<div class="col-md-4">' + (render :partial => partial_name, :object => model).to_s + '</div>' + html += '<div class="col-md-4">' + (render :partial => partial_name, :object => model, :locals => options).to_s + '</div>' end html += '</div>' end diff --git a/app/views/group_of_lines/_group_of_line.erb b/app/views/group_of_lines/_group_of_line.erb index dfbebdec6..d3a254ba9 100644 --- a/app/views/group_of_lines/_group_of_line.erb +++ b/app/views/group_of_lines/_group_of_line.erb @@ -5,9 +5,7 @@ <%= link_to edit_referential_group_of_line_path(@referential, group_of_line), :class => "btn btn-default btn-sm" do %> <span class="fa fa-pencil"></span> <% end %> - <%= link_to referential_group_of_line_path(@referential, group_of_line), :method => :delete, :data => {:confirm => t('group_of_lines.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %> - <span class="fa fa-trash-o"></span> - <% end %> + <%= link_to('<span class="fa fa-trash-o"></span>'.html_safe, referential_group_of_line_path(@referential, group_of_line), :method => :delete, :data => {:confirm => t('group_of_lines.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm") if delete %> </span> <h5> <%= link_to([@referential, group_of_line], :class => "preview", :title => "#{Chouette::GroupOfLine.model_name.human.capitalize} #{group_of_line.name}") do %> diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index cec5dc2f0..24eebd794 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -88,7 +88,7 @@ <% if @line.group_of_lines.any? %> <h3 class="line_group_of_lines"><%= t('.group_of_lines') %></h3> <div class="group_of_lines paginated_content"> - <%= paginated_content @group_of_lines, "group_of_lines/group_of_line" %> + <%= paginated_content @group_of_lines, "group_of_lines/group_of_line", :delete => false %> </div> <% end %> diff --git a/app/views/time_tables/_time_table.html.erb b/app/views/time_tables/_time_table.html.erb index 1eeb42541..0642f5a6c 100644 --- a/app/views/time_tables/_time_table.html.erb +++ b/app/views/time_tables/_time_table.html.erb @@ -5,9 +5,7 @@ <%= link_to edit_referential_time_table_path(@referential, time_table), :class => "btn btn-default btn-sm" do %> <span class="fa fa-pencil"></span> <% end %> - <%= link_to referential_time_table_path(@referential, time_table), :method => :delete, :data => {:confirm => t('time_tables.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %> - <span class="fa fa-trash-o"></span> - <% end %> + <%= link_to('<span class="fa fa-trash-o"></span>'.html_safe, referential_time_table_path(@referential, time_table), :method => :delete, :data => {:confirm => t('time_tables.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm") if delete %> </span> <h5> <%= link_to([@referential, time_table], :class => "preview", :title => "#{Chouette::TimeTable.model_name.human.capitalize} #{time_table.comment}") do %> diff --git a/app/views/vehicle_journeys/show.html.erb b/app/views/vehicle_journeys/show.html.erb index e90a74aa8..667ca570c 100644 --- a/app/views/vehicle_journeys/show.html.erb +++ b/app/views/vehicle_journeys/show.html.erb @@ -94,7 +94,7 @@ <h3><%= t('.time_tables') %></h3> <div class="time_tables paginated_content"> - <%= paginated_content @vehicle_journey.time_tables, "time_tables/time_table" %> + <%= paginated_content @vehicle_journey.time_tables, "time_tables/time_table", :delete => false %> </div> |
