Use ECMAScript 5 array and string methods
These methods were added in 2009 and are supported by 98.5% of the browsers, including Internet Explorer 9, 10 and 11. We were already using them in some places.
This commit is contained in:
@@ -17,7 +17,7 @@ App.ColumnsSelector =
|
||||
initChecks: () ->
|
||||
$(".column-selecteable th[data-field]").each ->
|
||||
field = $(this).data("field")
|
||||
text = $.trim($(this).text())
|
||||
text = $(this).text().trim()
|
||||
item = $("#column_selector_item_template").clone()
|
||||
item.prop("id", "column_selector_item_" + field)
|
||||
input = item.find("input")
|
||||
|
||||
@@ -44,15 +44,12 @@
|
||||
};
|
||||
|
||||
ProposalGraph.prototype.parseGoals = function(data) {
|
||||
var i, l;
|
||||
|
||||
this.goals = [];
|
||||
for (i = 0, l = data.length; i < l; i += 1) {
|
||||
this.goals.push({
|
||||
value: data[i].required_supports,
|
||||
text: data[i].title
|
||||
});
|
||||
}
|
||||
this.goals = data.map(function(item) {
|
||||
return {
|
||||
value: item.required_supports,
|
||||
text: item.title
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
ProposalGraph.prototype.refreshData = function () {
|
||||
|
||||
@@ -34,7 +34,7 @@ App.Documentable =
|
||||
data.submit()
|
||||
|
||||
change: (e, data) ->
|
||||
$.each data.files, (index, file) ->
|
||||
data.files.forEach (file) ->
|
||||
App.Documentable.setFilename(inputData, file.name)
|
||||
|
||||
fail: (e, data) ->
|
||||
|
||||
@@ -97,7 +97,5 @@ App.Globalize =
|
||||
App.Globalize.remove_language(locale)
|
||||
|
||||
$(".js-add-fields-container").on "cocoon:after-insert", ->
|
||||
$.each(
|
||||
App.Globalize.enabled_locales(),
|
||||
(index, locale) -> App.Globalize.enable_locale(locale)
|
||||
)
|
||||
App.Globalize.enabled_locales().forEach (locale) ->
|
||||
App.Globalize.enable_locale(locale)
|
||||
|
||||
@@ -36,7 +36,7 @@ App.Imageable =
|
||||
data.submit()
|
||||
|
||||
change: (e, data) ->
|
||||
$.each data.files, (index, file) ->
|
||||
data.files.forEach (file) ->
|
||||
App.Imageable.setFilename(inputData, file.name)
|
||||
|
||||
fail: (e, data) ->
|
||||
|
||||
@@ -11,8 +11,8 @@ App.Tags =
|
||||
name = "\"#{$(this).text()}\""
|
||||
current_tags = $tag_input.val().split(",").filter(Boolean)
|
||||
|
||||
if $.inArray(name, current_tags) >= 0
|
||||
current_tags.splice($.inArray(name, current_tags), 1)
|
||||
if current_tags.indexOf(name) >= 0
|
||||
current_tags.splice(current_tags.indexOf(name), 1)
|
||||
else
|
||||
current_tags.push name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user