Created
December 19, 2012 03:23
-
-
Save jasonrhodes/4334140 to your computer and use it in GitHub Desktop.
Drupal fix for the Hub: Remove "issue" options that don't correspond to the content type of the current article, and rename the remaining ones to remove the publication name.
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
jQuery(document).ready(function ($) { | |
var options = $("#edit-field-issue-und").find("option"); | |
var body = $("body"); | |
var type; | |
if (body.hasClass("node-type-magazine-article")) { | |
type = "magazine"; | |
} else if (body.hasClass("node-type-gazette-article")) { | |
type = "gazette"; | |
} | |
options.each(function (i, option) { | |
var $o = $(option); | |
var text = $o.text(); | |
var parts = text.split("-").map(function (part) { return $.trim(part); }); | |
if (parts[0].toLowerCase() === type) { | |
$o.html(parts[1]); | |
} else { | |
$o.remove(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment