-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3168 from mroderick/decaffeinate
Fix #3111: Convert CoffeeScript to JavaScript
- Loading branch information
Showing
13 changed files
with
623 additions
and
553 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// override this file in your application to add custom behaviour |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(function() { | ||
var Locale; | ||
|
||
this.RailsAdmin || (this.RailsAdmin = {}); | ||
|
||
this.RailsAdmin.I18n = Locale = (function() { | ||
function Locale() {} | ||
|
||
Locale.init = function(locale, translations) { | ||
this.locale = locale; | ||
this.translations = translations; | ||
moment.locale(this.locale); | ||
if (typeof this.translations === "string") { | ||
this.translations = JSON.parse(this.translations); | ||
} | ||
}; | ||
|
||
Locale.t = function(key) { | ||
var humanize; | ||
humanize = key.charAt(0).toUpperCase() + key.replace(/_/g, " ").slice(1); | ||
return this.translations[key] || humanize; | ||
}; | ||
|
||
return Locale; | ||
|
||
})(); | ||
|
||
}).call(this); |
55 changes: 0 additions & 55 deletions
55
app/assets/javascripts/rails_admin/ra.nested-form-hooks.coffee
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
app/assets/javascripts/rails_admin/ra.nested-form-hooks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
(function($) { | ||
$(document).ready(function() { | ||
return window.nestedFormEvents.insertFields = function(content, assoc, link) { | ||
var tab_content; | ||
tab_content = $(link).closest(".controls").siblings(".tab-content"); | ||
tab_content.append(content); | ||
return tab_content.children().last(); | ||
}; | ||
}); | ||
|
||
$(document).on('nested:fieldAdded', 'form', function(content) { | ||
var controls, field, nav, new_tab, one_to_one, parent_group, toggler; | ||
field = content.field.addClass('tab-pane').attr('id', 'unique-id-' + (new Date().getTime())); | ||
new_tab = $('<li><a data-toggle="tab" href="#' + field.attr('id') + '">' + field.children('.object-infos').data('object-label') + '</a></li>'); | ||
parent_group = field.closest('.control-group'); | ||
controls = parent_group.children('.controls'); | ||
one_to_one = controls.data('nestedone') !== void 0; | ||
nav = controls.children('.nav'); | ||
content = parent_group.children('.tab-content'); | ||
toggler = controls.find('.toggler'); | ||
nav.append(new_tab); | ||
$(window.document).trigger('rails_admin.dom_ready', [field, parent_group]); | ||
new_tab.children('a').tab('show'); | ||
if (!one_to_one) { | ||
nav.select(':hidden').show('slow'); | ||
} | ||
content.select(':hidden').show('slow'); | ||
toggler.addClass('active').removeClass('disabled').children('i').addClass('icon-chevron-down').removeClass('icon-chevron-right'); | ||
if (one_to_one) { | ||
controls.find('.add_nested_fields').removeClass('add_nested_fields').html(field.children('.object-infos').data('object-label')); | ||
} | ||
}); | ||
|
||
$(document).on('nested:fieldRemoved', 'form', function(content) { | ||
var add_button, controls, current_li, field, nav, one_to_one, parent_group, toggler; | ||
field = content.field; | ||
nav = field.closest(".control-group").children('.controls').children('.nav'); | ||
current_li = nav.children('li').has('a[href="#' + field.attr('id') + '"]'); | ||
parent_group = field.closest(".control-group"); | ||
controls = parent_group.children('.controls'); | ||
one_to_one = controls.data('nestedone') !== void 0; | ||
toggler = controls.find('.toggler'); | ||
(current_li.next().length ? current_li.next() : current_li.prev()).children('a:first').tab('show'); | ||
current_li.remove(); | ||
if (nav.children().length === 0) { | ||
nav.select(':visible').hide('slow'); | ||
toggler.removeClass('active').addClass('disabled').children('i').removeClass('icon-chevron-down').addClass('icon-chevron-right'); | ||
} | ||
if (one_to_one) { | ||
add_button = toggler.next(); | ||
add_button.addClass('add_nested_fields').html(add_button.data('add-label')); | ||
} | ||
field.find('[required]').each(function() { | ||
$(this).removeAttr('required'); | ||
}); | ||
}); | ||
}(jQuery)); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(function($) { | ||
function setFrozenColPositions() { | ||
var $listForm, frozenColumns; | ||
|
||
$listForm = $('#bulk_form'); | ||
if (!$listForm.is('.ra-sidescroll')) { | ||
return; | ||
} | ||
frozenColumns = $listForm.data('ra-sidescroll'); | ||
|
||
$listForm.find('table tr').each(function(index, tr) { | ||
var firstPosition = 0; | ||
|
||
$(tr).children().slice(0, frozenColumns).each(function(idx, td) { | ||
var tdLeft; | ||
$(td).addClass('ra-sidescroll-frozen'); | ||
if (idx === frozenColumns - 1) { | ||
$(td).addClass('last-of-frozen'); | ||
} | ||
tdLeft = $(td).position().left; | ||
if (idx === 0) { | ||
firstPosition = tdLeft; | ||
} | ||
td.style.left = (tdLeft - firstPosition) + "px"; | ||
}); | ||
}); | ||
}; | ||
|
||
$(window).on('load', setFrozenColPositions); | ||
$(document).on('rails_admin.dom_ready', setFrozenColPositions); | ||
})(jQuery); |
Oops, something went wrong.