2012-11-10 15:25:19 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Defines Javascript behaviors for the node module.
|
|
|
|
*/
|
|
|
|
|
2013-09-21 23:39:42 +00:00
|
|
|
(function ($, Drupal, drupalSettings) {
|
2009-04-11 22:19:46 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
"use strict";
|
2012-05-08 02:57:33 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
Drupal.behaviors.nodeDetailsSummaries = {
|
|
|
|
attach: function (context) {
|
2012-04-07 07:19:30 +00:00
|
|
|
var $context = $(context);
|
2014-01-27 21:41:32 +00:00
|
|
|
$context.find('.node-form-revision-information').drupalSetSummary(function (context) {
|
2015-01-10 01:36:01 +00:00
|
|
|
var $revisionContext = $(context);
|
|
|
|
var revisionCheckbox = $revisionContext.find('.form-item-revision input');
|
2010-12-15 03:42:25 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
// Return 'New revision' if the 'Create new revision' checkbox is checked,
|
|
|
|
// or if the checkbox doesn't exist, but the revision log does. For users
|
|
|
|
// without the "Administer content" permission the checkbox won't appear,
|
|
|
|
// but the revision log will if the content type is set to auto-revision.
|
2015-01-10 01:36:01 +00:00
|
|
|
if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.form-item-revision-log textarea').length)) {
|
2014-01-27 21:41:32 +00:00
|
|
|
return Drupal.t('New revision');
|
|
|
|
}
|
2010-12-15 03:42:25 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
return Drupal.t('No revision');
|
|
|
|
});
|
2009-04-11 22:19:46 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
$context.find('.node-form-author').drupalSetSummary(function (context) {
|
2015-01-10 01:36:01 +00:00
|
|
|
var $authorContext = $(context);
|
|
|
|
var name = $authorContext.find('.field-name-uid input').val(),
|
|
|
|
date = $authorContext.find('.field-name-created input').val();
|
2014-01-27 21:41:32 +00:00
|
|
|
return date ?
|
2015-01-10 01:36:01 +00:00
|
|
|
Drupal.t('By @name on @date', {'@name': name, '@date': date}) :
|
|
|
|
Drupal.t('By @name', {'@name': name});
|
2014-01-27 21:41:32 +00:00
|
|
|
});
|
2009-04-11 22:19:46 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
$context.find('.node-form-options').drupalSetSummary(function (context) {
|
2015-01-10 01:36:01 +00:00
|
|
|
var $optionsContext = $(context);
|
2014-01-27 21:41:32 +00:00
|
|
|
var vals = [];
|
2009-04-11 22:19:46 +00:00
|
|
|
|
2015-01-10 01:36:01 +00:00
|
|
|
if ($optionsContext.find('input').is(':checked')) {
|
|
|
|
$optionsContext.find('input:checked').next('label').each(function () {
|
2014-01-27 21:41:32 +00:00
|
|
|
vals.push(Drupal.checkPlain($.trim($(this).text())));
|
|
|
|
});
|
|
|
|
return vals.join(', ');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return Drupal.t('Not promoted');
|
|
|
|
}
|
|
|
|
});
|
Issue #1188388 by plach, peximo, YesCT | Gábor Hojtsy, fago, webchick, Bojhan, podarok, cosmicdreams, Berdir, aspilicious, bforchhammer, penyaskito: Added Entity translation UI in core.
2012-11-04 02:38:49 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
$context.find('fieldset.node-translation-options').drupalSetSummary(function (context) {
|
2015-01-10 01:36:01 +00:00
|
|
|
var $translationContext = $(context);
|
2014-01-27 21:41:32 +00:00
|
|
|
var translate;
|
2015-01-10 01:36:01 +00:00
|
|
|
var $checkbox = $translationContext.find('.form-item-translation-translate input');
|
Issue #1188388 by plach, peximo, YesCT | Gábor Hojtsy, fago, webchick, Bojhan, podarok, cosmicdreams, Berdir, aspilicious, bforchhammer, penyaskito: Added Entity translation UI in core.
2012-11-04 02:38:49 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
if ($checkbox.size()) {
|
|
|
|
translate = $checkbox.is(':checked') ? Drupal.t('Needs to be updated') : Drupal.t('Does not need to be updated');
|
|
|
|
}
|
|
|
|
else {
|
2015-01-10 01:36:01 +00:00
|
|
|
$checkbox = $translationContext.find('.form-item-translation-retranslate input');
|
2014-01-27 21:41:32 +00:00
|
|
|
translate = $checkbox.is(':checked') ? Drupal.t('Flag other translations as outdated') : Drupal.t('Do not flag other translations as outdated');
|
|
|
|
}
|
Issue #1188388 by plach, peximo, YesCT | Gábor Hojtsy, fago, webchick, Bojhan, podarok, cosmicdreams, Berdir, aspilicious, bforchhammer, penyaskito: Added Entity translation UI in core.
2012-11-04 02:38:49 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
return translate;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2009-04-11 22:19:46 +00:00
|
|
|
|
2013-09-21 23:39:42 +00:00
|
|
|
})(jQuery, Drupal, drupalSettings);
|