aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorTeddy Wing2017-06-15 16:50:37 +0200
committerTeddy Wing2017-06-15 16:50:37 +0200
commit97c8cd58c1d3fd684f41135ac1774fac4cc46ea1 (patch)
tree2cfd7ea66749001c8ae3cc588c19087c1be98062 /app
parent3aea68a27af7a96db470fba2ad9c1f6000a681b9 (diff)
downloadchouette-core-97c8cd58c1d3fd684f41135ac1774fac4cc46ea1.tar.bz2
NewapplicationHelper: Remove my investigation comments
I added these comments when I was reading the code and trying to understand it. Now I basically understand all of it, and we've ported the code to `TableBuilderHelper`. These comments can be removed to revert the file back to how it looked before I messed with it. Refs #3479
Diffstat (limited to 'app')
-rw-r--r--app/helpers/newapplication_helper.rb12
1 files changed, 0 insertions, 12 deletions
diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb
index 27b9cb0a4..3d43e9fc7 100644
--- a/app/helpers/newapplication_helper.rb
+++ b/app/helpers/newapplication_helper.rb
@@ -1,7 +1,6 @@
module NewapplicationHelper
# Table Builder
- # selectable means actions-for-selection
def table_builder collection, columns, actions, selectable = [], cls = nil
return unless collection.present?
@@ -9,7 +8,6 @@ module NewapplicationHelper
content_tag :tr do
hcont = []
- # Adds checkbox to table header
unless selectable.empty?
cbx = content_tag :div, '', class: 'checkbox' do
check_box_tag('0', 'all').concat(content_tag(:label, '', for: '0'))
@@ -18,14 +16,12 @@ module NewapplicationHelper
end
columns.map do |k, v|
- # These columns are hard-coded to not be sortable
if ["ID Codif", "Oid", "OiD", "ID Reflex", "Arrêt de départ", "Arrêt d'arrivée", "Période de validité englobante", "Période englobante", "Nombre de courses associées", "Journées d'application", "Arrêts de l'itinéraire", "Arrêts inclus dans l'ITL"].include? k
hcont << content_tag(:th, k)
else
hcont << content_tag(:th, sortable_columns(collection, k))
end
end
- # Inserts a blank column for the gear menu
hcont << content_tag(:th, '') if actions.any?
hcont.join.html_safe
@@ -38,8 +34,6 @@ module NewapplicationHelper
content_tag :tr do
bcont = []
- # Adds item checkboxes whose value = the row object's id
- # Apparently the object id is also used in the HTML id attribute without any prefix
unless selectable.empty?
cbx = content_tag :div, '', class: 'checkbox' do
check_box_tag(item.try(:id), item.try(:id)).concat(content_tag(:label, '', for: item.try(:id)))
@@ -54,14 +48,9 @@ module NewapplicationHelper
else
item.try(attribute)
end
- # if so this column's contents get transformed into a link to the object
if attribute == 'name' or attribute == 'comment'
lnk = []
- # #is_a? ? ; or ?
- # TODO: Ask Jean-Paul: on which pages do we create multiple links?
- # Do we actually create multiple links with this code?
- # Answer: this is a polymorphic URL
unless item.class == Calendar or item.class == Referential
if current_referential
lnk << current_referential
@@ -183,7 +172,6 @@ module NewapplicationHelper
pic2 = content_tag :span, '', class: "fa fa-sort-desc #{(direction == 'asc') ? 'active' : ''}"
pics = content_tag :span, pic1 + pic2, class: 'orderers'
- # This snake cases and downcases the class name. Should use the ActiveSupport method to do this
obj = collection.model.to_s.gsub('Chouette::', '').scan(/[A-Z][a-z]+/).join('_').downcase
(I18n.t("activerecord.attributes.#{obj}.#{key}") + pics).html_safe