mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-08-04 12:53:58 +08:00
allow user-specified buttonText to override buttonIcons
This commit is contained in:
+7
-3
@@ -72,17 +72,21 @@ function Header(calendar, options) {
|
||||
// smartProperty allows different text per view button (ex: "Agenda Week" vs "Basic Week")
|
||||
var themeIcon = smartProperty(options.themeButtonIcons, buttonName);
|
||||
var normalIcon = smartProperty(options.buttonIcons, buttonName);
|
||||
var text = smartProperty(options.buttonText, buttonName);
|
||||
var defaultText = smartProperty(options.defaultButtonText, buttonName);
|
||||
var customText = smartProperty(options.buttonText, buttonName);
|
||||
var html;
|
||||
|
||||
if (themeIcon && options.theme) {
|
||||
if (customText) {
|
||||
html = htmlEscape(customText);
|
||||
}
|
||||
else if (themeIcon && options.theme) {
|
||||
html = "<span class='ui-icon ui-icon-" + themeIcon + "'></span>";
|
||||
}
|
||||
else if (normalIcon && !options.theme) {
|
||||
html = "<span class='fc-icon fc-icon-" + normalIcon + "'></span>";
|
||||
}
|
||||
else {
|
||||
html = htmlEscape(text || buttonName);
|
||||
html = htmlEscape(defaultText || buttonName);
|
||||
}
|
||||
|
||||
var button = $(
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ var defaults = {
|
||||
|
||||
// locale
|
||||
isRTL: false,
|
||||
buttonText: {
|
||||
defaultButtonText: {
|
||||
prev: "prev",
|
||||
next: "next",
|
||||
prevYear: "prev year",
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ fc.datepickerLang = function(langCode, datepickerLangCode, options) {
|
||||
'YYYY[' + options.yearSuffix + '] MMMM' :
|
||||
'MMMM YYYY[' + options.yearSuffix + ']'
|
||||
},
|
||||
buttonText: {
|
||||
defaultButtonText: {
|
||||
// the translations sometimes wrongly contain HTML entities
|
||||
prev: stripHTMLEntities(options.prevText),
|
||||
next: stripHTMLEntities(options.nextText),
|
||||
|
||||
@@ -159,6 +159,7 @@ function arrayMax(a) {
|
||||
|
||||
|
||||
function smartProperty(obj, name) { // get a camel-cased/namespaced property of an object
|
||||
obj = obj || {};
|
||||
if (obj[name] !== undefined) {
|
||||
return obj[name];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user