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
|
|
|
|
2015-10-13 22:37:56 +00:00
|
|
|
'use strict';
|
2012-05-08 02:57:33 +00:00
|
|
|
|
2015-06-05 20:17:55 +00:00
|
|
|
/**
|
2015-08-29 06:27:44 +00:00
|
|
|
* Behaviors for tabs in the node edit form.
|
2015-06-05 20:17:55 +00:00
|
|
|
*
|
|
|
|
* @type {Drupal~behavior}
|
2015-08-29 06:27:44 +00:00
|
|
|
*
|
|
|
|
* @prop {Drupal~behaviorAttach} attach
|
|
|
|
* Attaches summary behavior for tabs in the node edit form.
|
2015-06-05 20:17:55 +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);
|
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);
|
Issue #2214241 by mortendk, mdrummond, lauriii, galooph, ShaunDychko, jjcarrion, b0unty, joelpittet, scor, amitgoyal, aboros, Manuel Garcia, hkirsman, BLadwin, hussainweb, sushilkr, emma.maria, nlisgo, yched, LewisNyman, davidhernandez, mikl, camoa, dman, dodorama: Field default markup - removing the divitis
2015-08-26 08:36:43 +00:00
|
|
|
var name = $authorContext.find('.field--name-uid input').val();
|
|
|
|
var date = $authorContext.find('.field--name-created input').val();
|
2015-12-10 14:56:01 +00:00
|
|
|
|
|
|
|
if (name && date) {
|
|
|
|
return Drupal.t('By @name on @date', {'@name': name, '@date': date});
|
|
|
|
}
|
|
|
|
else if (name) {
|
|
|
|
return Drupal.t('By @name', {'@name': name});
|
|
|
|
}
|
|
|
|
else if (date) {
|
|
|
|
return Drupal.t('Authored on @date', {'@date': date});
|
|
|
|
}
|
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');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2009-04-11 22:19:46 +00:00
|
|
|
|
2013-09-21 23:39:42 +00:00
|
|
|
})(jQuery, Drupal, drupalSettings);
|