lib/generators/templates/app/helpers/beautiful_helper.rb in beautiful_scaffold-0.3.0.rc1 vs lib/generators/templates/app/helpers/beautiful_helper.rb in beautiful_scaffold-0.3.0.rc2
- old
+ new
@@ -39,14 +39,13 @@
default_caption = attribute_name.capitalize
if is_belongs_to_column?(default_caption) then
default_caption = get_belongs_to_model(default_caption)
end
- cap = attribute_name
- cap = "number-attr" if attribute_name == "number"
+ cap = i18n_translate_path(model_name, attribute_name)
- caption = t(cap, :default => default_caption).capitalize
+ caption = t(cap, :default => default_caption).capitalize
strpath = model_name.pluralize + "_url"
strpath = namespace + '_' + strpath if not namespace.blank?
return link_to(
"#{csort} #{caption}".html_safe,
@@ -79,14 +78,12 @@
label_field = get_belongs_to_model(attribute_name)
end
name_field = model_name_for_ransack + "_" + name_field unless model_name_for_ransack.blank?
+ cap = i18n_translate_path(model_name, attribute_name)
- cap = label_field
- cap = "number-attr" if label_field == "number"
-
infostr = ''
response = '' # See at end
response += f.label name_field, t(cap, :default => default_caption).capitalize, :class => "control-label"
response += '<div class="controls">'
@@ -266,7 +263,19 @@
end
def clean_params
params.delete :q
params.delete :fields
+ end
+
+ def i18n_translate_path(model, attr)
+ "app.models.#{model}.bs_attributes.#{attr}"
+ end
+
+ def i18n_translate_path_model(model)
+ "app.models.#{model}.bs_caption"
+ end
+
+ def i18n_translate_path_model_plural(model)
+ "app.models.#{model}.bs_caption_plural"
end
end