lib/assets/javascripts/scrivito_editing.js in scrivito_sdk-0.16.0 vs lib/assets/javascripts/scrivito_editing.js in scrivito_sdk-0.17.0

- old
+ new

@@ -6745,11 +6745,11 @@ return _; }); } }).call(this); //! moment.js -//! version : 2.6.0 +//! version : 2.7.0 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com (function (undefined) { @@ -6757,11 +6757,11 @@ /************************************ Constants ************************************/ var moment, - VERSION = "2.6.0", + VERSION = "2.7.0", // the global-scope this is NOT the global object in Node.js globalScope = typeof global !== 'undefined' ? global : this, oldGlobalMoment, round = Math.round, i, @@ -6782,10 +6782,11 @@ _isAMomentObject: null, _i : null, _f : null, _l : null, _strict : null, + _tzm : null, _isUTC : null, _offset : null, // optional. Combine with _isUTC _pf : null, _lang : null // optional }, @@ -6890,10 +6891,20 @@ }, // format function strings formatFunctions = {}, + // default relative time thresholds + relativeTimeThresholds = { + s: 45, //seconds to minutes + m: 45, //minutes to hours + h: 22, //hours to days + dd: 25, //days to month (month == 1) + dm: 45, //days to months (months > 1) + dy: 345 //days to year + }, + // tokens to ordinalize and pad ordinalizeTokens = 'DDD w W M D d'.split(' '), paddedTokens = 'M D H h m s w W'.split(' '), formatTokenFunctions = { @@ -7029,10 +7040,20 @@ } }, lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin']; + // Pick the first defined of two or three arguments. dfl comes from + // default. + function dfl(a, b, c) { + switch (arguments.length) { + case 2: return a != null ? a : b; + case 3: return a != null ? a : b != null ? b : c; + default: throw new Error("Implement me"); + } + } + function defaultParsingFlags() { // We need to deep clone this object, and es5 standard is not very // helpful. return { empty : false, @@ -7897,85 +7918,113 @@ case 'Z' : // fall through to ZZ case 'ZZ' : config._useUTC = true; config._tzm = timezoneMinutesFromString(input); break; + // WEEKDAY - human + case 'dd': + case 'ddd': + case 'dddd': + a = getLangDefinition(config._l).weekdaysParse(input); + // if we didn't get a weekday name, mark the date as invalid + if (a != null) { + config._w = config._w || {}; + config._w['d'] = a; + } else { + config._pf.invalidWeekday = input; + } + break; + // WEEK, WEEK DAY - numeric case 'w': case 'ww': case 'W': case 'WW': case 'd': - case 'dd': - case 'ddd': - case 'dddd': case 'e': case 'E': token = token.substr(0, 1); /* falls through */ - case 'gg': case 'gggg': - case 'GG': case 'GGGG': case 'GGGGG': token = token.substr(0, 2); if (input) { config._w = config._w || {}; - config._w[token] = input; + config._w[token] = toInt(input); } break; + case 'gg': + case 'GG': + config._w = config._w || {}; + config._w[token] = moment.parseTwoDigitYear(input); } } + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, lang; + + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = dfl(w.GG, config._a[YEAR], weekOfYear(moment(), 1, 4).year); + week = dfl(w.W, 1); + weekday = dfl(w.E, 1); + } else { + lang = getLangDefinition(config._l); + dow = lang._week.dow; + doy = lang._week.doy; + + weekYear = dfl(w.gg, config._a[YEAR], weekOfYear(moment(), dow, doy).year); + week = dfl(w.w, 1); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < dow) { + ++week; + } + } else if (w.e != null) { + // local weekday -- counting starts from begining of week + weekday = w.e + dow; + } else { + // default to begining of week + weekday = dow; + } + } + temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow); + + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } + // convert an array to a date. // the array should mirror the parameters below // note: all values past the year are optional and will default to the lowest possible value. // [year, month, day , hour, minute, second, millisecond] function dateFromConfig(config) { - var i, date, input = [], currentDate, - yearToUse, fixYear, w, temp, lang, weekday, week; + var i, date, input = [], currentDate, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - fixYear = function (val) { - var intVal = parseInt(val, 10); - return val ? - (val.length < 3 ? (intVal > 68 ? 1900 + intVal : 2000 + intVal) : intVal) : - (config._a[YEAR] == null ? moment().weekYear() : config._a[YEAR]); - }; - - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - temp = dayOfYearFromWeeks(fixYear(w.GG), w.W || 1, w.E, 4, 1); - } - else { - lang = getLangDefinition(config._l); - weekday = w.d != null ? parseWeekday(w.d, lang) : - (w.e != null ? parseInt(w.e, 10) + lang._week.dow : 0); - - week = parseInt(w.w, 10) || 1; - - //if we're parsing 'd', then the low day numbers may be next week - if (w.d != null && weekday < lang._week.dow) { - week++; - } - - temp = dayOfYearFromWeeks(fixYear(w.gg), week, weekday, lang._week.doy, lang._week.dow); - } - - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; + dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear) { - yearToUse = config._a[YEAR] == null ? currentDate[YEAR] : config._a[YEAR]; + yearToUse = dfl(config._a[YEAR], currentDate[YEAR]); if (config._dayOfYear > daysInYear(yearToUse)) { config._pf._overflowDayOfYear = true; } @@ -7996,15 +8045,16 @@ // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; } - // add the offsets to the time to be parsed so that we can have a clean array for checking isValid - input[HOUR] += toInt((config._tzm || 0) / 60); - input[MINUTE] += toInt((config._tzm || 0) % 60); - config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input); + // Apply timezone offset from input. The actual zone can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm); + } } function dateFromObject(config) { var normalizedInput; @@ -8040,10 +8090,15 @@ } // date from string and format string function makeDateFromStringAndFormat(config) { + if (config._f === moment.ISO_8601) { + parseISO(config); + return; + } + config._a = []; config._pf.empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var lang = getLangDefinition(config._l), @@ -8152,11 +8207,11 @@ extend(config, bestMoment || tempConfig); } // date from iso format - function makeDateFromString(config) { + function parseISO(config) { var i, l, string = config._i, match = isoRegex.exec(string); if (match) { @@ -8176,12 +8231,20 @@ } if (string.match(parseTokenTimezone)) { config._f += "Z"; } makeDateFromStringAndFormat(config); + } else { + config._isValid = false; } - else { + } + + // date from iso format or fallback + function makeDateFromString(config) { + parseISO(config); + if (config._isValid === false) { + delete config._isValid; moment.createFromInputFallback(config); } } function makeDateFromInput(config) { @@ -8258,19 +8321,19 @@ var seconds = round(Math.abs(milliseconds) / 1000), minutes = round(seconds / 60), hours = round(minutes / 60), days = round(hours / 24), years = round(days / 365), - args = seconds < 45 && ['s', seconds] || + args = seconds < relativeTimeThresholds.s && ['s', seconds] || minutes === 1 && ['m'] || - minutes < 45 && ['mm', minutes] || + minutes < relativeTimeThresholds.m && ['mm', minutes] || hours === 1 && ['h'] || - hours < 22 && ['hh', hours] || + hours < relativeTimeThresholds.h && ['hh', hours] || days === 1 && ['d'] || - days <= 25 && ['dd', days] || - days <= 45 && ['M'] || - days < 345 && ['MM', round(days / 30)] || + days <= relativeTimeThresholds.dd && ['dd', days] || + days <= relativeTimeThresholds.dm && ['M'] || + days < relativeTimeThresholds.dy && ['MM', round(days / 30)] || years === 1 && ['y'] || ['yy', years]; args[2] = withoutSuffix; args[3] = milliseconds > 0; args[4] = lang; return substituteTimeAgo.apply({}, args); @@ -8312,10 +8375,11 @@ //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) { var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear; + d = d === 0 ? 7 : d; weekday = weekday != null ? weekday : firstDayOfWeek; daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0); dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1; return { @@ -8387,10 +8451,44 @@ "https://github.com/moment/moment/issues/1407 for more info.", function (config) { config._d = new Date(config._i); }); + // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return moment(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (moments[i][fn](res)) { + res = moments[i]; + } + } + return res; + } + + moment.min = function () { + var args = [].slice.call(arguments, 0); + + return pickBy('isBefore', args); + }; + + moment.max = function () { + var args = [].slice.call(arguments, 0); + + return pickBy('isAfter', args); + }; + // creating with utc moment.utc = function (input, format, lang, strict) { var c; if (typeof(lang) === "boolean") { @@ -8483,18 +8581,30 @@ moment.version = VERSION; // default format moment.defaultFormat = isoFormat; + // constant that refers to the ISO standard + moment.ISO_8601 = function () {}; + // Plugins that add properties should also add the key here (null value), // so we can properly clone ourselves. moment.momentProperties = momentProperties; // This function will be called whenever a moment is mutated. // It is intended to keep the offset in sync with the timezone. moment.updateOffset = function () {}; + // This function allows you to set a threshold for relative time strings + moment.relativeTimeThreshold = function(threshold, limit) { + if (relativeTimeThresholds[threshold] === undefined) { + return false; + } + relativeTimeThresholds[threshold] = limit; + return true; + }; + // This function will load languages and then set the global language. If // no arguments are passed in, it will simply return the current global // language key. moment.lang = function (key, values) { var r; @@ -8646,11 +8756,13 @@ }, add : function (input, val) { var dur; // switch args to support add('s', 1) and add(1, 's') - if (typeof input === 'string') { + if (typeof input === 'string' && typeof val === 'string') { + dur = moment.duration(isNaN(+val) ? +input : +val, isNaN(+val) ? val : input); + } else if (typeof input === 'string') { dur = moment.duration(+val, input); } else { dur = moment.duration(input, val); } addOrSubtractDurationFromMoment(this, dur, 1); @@ -8658,11 +8770,13 @@ }, subtract : function (input, val) { var dur; // switch args to support subtract('s', 1) and subtract(1, 's') - if (typeof input === 'string') { + if (typeof input === 'string' && typeof val === 'string') { + dur = moment.duration(isNaN(+val) ? +input : +val, isNaN(+val) ? val : input); + } else if (typeof input === 'string') { dur = moment.duration(+val, input); } else { dur = moment.duration(input, val); } addOrSubtractDurationFromMoment(this, dur, -1); @@ -8709,14 +8823,15 @@ fromNow : function (withoutSuffix) { return this.from(moment(), withoutSuffix); }, - calendar : function () { + calendar : function (time) { // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're zone'd or not. - var sod = makeAs(moment(), this).startOf('day'), + var now = time || moment(), + sod = makeAs(now, this).startOf('day'), diff = this.diff(sod, 'days', true), format = diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : @@ -8807,19 +8922,25 @@ isSame: function (input, units) { units = units || 'ms'; return +this.clone().startOf(units) === +makeAs(input, this).startOf(units); }, - min: function (other) { - other = moment.apply(null, arguments); - return other < this ? this : other; - }, + min: deprecate( + "moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548", + function (other) { + other = moment.apply(null, arguments); + return other < this ? this : other; + } + ), - max: function (other) { - other = moment.apply(null, arguments); - return other > this ? this : other; - }, + max: deprecate( + "moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548", + function (other) { + other = moment.apply(null, arguments); + return other > this ? this : other; + } + ), // keepTime = true means only change the timezone, without affecting // the local hour. So 5:31:26 +0300 --[zone(2, true)]--> 5:31:26 +0200 // It is possible that 5:31:26 doesn't exist int zone +0200, so we // adjust the time as needed, to be valid. @@ -9484,32 +9605,41 @@ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; function program1(depth0,data) { var buffer = "", stack1; + buffer += "scrivito_"; + if (stack1 = helpers.color) { stack1 = stack1.call(depth0, {hash:{},data:data}); } + else { stack1 = depth0.color; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } + buffer += escapeExpression(stack1); + return buffer; + } + +function program3(depth0,data) { + + var buffer = "", stack1; buffer += "\n <p class=\"scrivito_description\">"; if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "</p>\n "; return buffer; } - buffer += "<div class=\"scrivito_confirmation_dialog scrivito_modal_prompt scrivito_center_dialog scrivito_"; - if (stack1 = helpers.color) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.color; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\">\n <div class=\"scrivito_modal_header\">\n <i class=\"scrivito_icon\">"; + buffer += "<div class=\"scrivito_confirmation_dialog scrivito_modal_prompt scrivito_center_dialog\n "; + stack1 = helpers['if'].call(depth0, depth0.color, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\">\n <div class=\"scrivito_modal_header\">\n <i class=\"scrivito_icon\">"; if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</i>\n <h3 class=\"scrivito_title\">"; if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "</h3>\n "; - stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); + stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data}); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n </div>\n <div class=\"scrivito_modal_footer\">\n <a href=\"#\" class=\"scrivito_button scrivito_"; if (stack1 = helpers.cancel_button_color) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.cancel_button_color; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) @@ -9533,21 +9663,29 @@ (function() { this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {}); this.ScrivitoHandlebarsTemplates["details_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [3,'>= 1.0.0-rc.4']; helpers = helpers || Handlebars.helpers; data = data || {}; - var buffer = "", stack1, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + var buffer = "", stack1, stack2, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this; +function program1(depth0,data) { + + + return "\n <div class=\"scrivito_button_bar scrivito_obj_menu\"></div>\n "; + } buffer += "<div class=\"scrivito_details_dialog scrivito_modal_medium scrivito_adjust_dialog\">\n\n <div class=\"scrivito_modal_header\">\n <h3><i class=\"scrivito_icon\">"; if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</i>"; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "details_dialog.title", depth0.title, options) : helperMissing.call(depth0, "translate", "details_dialog.title", depth0.title, options))) - + "</h3>\n <div class=\"scrivito_details_dialog_saving_indicator\"></div>\n </div>\n\n <div class=\"scrivito_modal_body scrivito_auto_height\">\n <i class=\"scrivito_icon scrivito_spinning\">&#xf023;</i>\n <div class=\"scrivito_details_dialog_markup\"></div>\n </div>\n\n <div class=\"scrivito_modal_footer\">\n <a href=\"#\" class=\"scrivito_button scrivito_cancel scrivito_green\">"; + + "</h3>\n <div class=\"scrivito_details_dialog_saving_indicator\"></div>\n "; + stack2 = helpers['if'].call(depth0, depth0.obj, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); + if(stack2 || stack2 === 0) { buffer += stack2; } + buffer += "\n </div>\n\n <div class=\"scrivito_modal_body scrivito_auto_height\">\n <i class=\"scrivito_icon scrivito_spinning\">&#xf023;</i>\n <div class=\"scrivito_details_dialog_markup\"></div>\n </div>\n\n <div class=\"scrivito_modal_footer\">\n <a href=\"#\" class=\"scrivito_button scrivito_cancel scrivito_green\">"; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "done", options) : helperMissing.call(depth0, "translate", "done", options))) + "</a>\n </div>\n\n</div>\n"; return buffer; }); @@ -9721,33 +9859,49 @@ (function() { this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {}); this.ScrivitoHandlebarsTemplates["menu"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [3,'>= 1.0.0-rc.4']; helpers = helpers || Handlebars.helpers; data = data || {}; - var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this; + var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; function program1(depth0,data) { var buffer = "", stack1; + buffer += "scrivito_"; + if (stack1 = helpers.align) { stack1 = stack1.call(depth0, {hash:{},data:data}); } + else { stack1 = depth0.align; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } + buffer += escapeExpression(stack1); + return buffer; + } + +function program3(depth0,data) { + + + return "scrivito_right"; + } + +function program5(depth0,data) { + + var buffer = "", stack1; buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.is_present, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); + stack1 = helpers['if'].call(depth0, depth0.is_present, {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data}); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer; } -function program2(depth0,data) { +function program6(depth0,data) { var buffer = "", stack1; - buffer += "\n <li class=\"scrivito_menu_item "; + buffer += "\n <li class=\"scrivito_menu_item scrivito_"; if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + " "; - stack1 = helpers['if'].call(depth0, depth0.is_disabled, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data}); + stack1 = helpers['if'].call(depth0, depth0.is_disabled, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data}); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\">\n <span title=\""; - stack1 = helpers['if'].call(depth0, depth0.is_enabled, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data}); + stack1 = helpers['if'].call(depth0, depth0.is_enabled, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data}); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\">\n <i class=\"scrivito_icon\">"; if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } if(stack1 || stack1 === 0) { buffer += stack1; } @@ -9756,39 +9910,38 @@ else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "\n </span>\n </li>\n "; return buffer; } -function program3(depth0,data) { +function program7(depth0,data) { - return "disabled"; + return "scrivito_disabled"; } -function program5(depth0,data) { +function program9(depth0,data) { var stack1; if (stack1 = helpers.tooltip) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.tooltip; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } return escapeExpression(stack1); } -function program7(depth0,data) { +function program11(depth0,data) { var stack1; if (stack1 = helpers.reason_for_being_disabled) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.reason_for_being_disabled; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } return escapeExpression(stack1); } - buffer += "<div class=\"scrivito_editing_marker_menu\">\n <ul class=\"scrivito_menu_box scrivito_" - + escapeExpression(((stack1 = ((stack1 = depth0.options),stack1 == null || stack1 === false ? stack1 : stack1.align)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + " " - + escapeExpression(((stack1 = ((stack1 = depth0.options),stack1 == null || stack1 === false ? stack1 : stack1.css_class)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "\">\n "; - stack2 = helpers.each.call(depth0, depth0.commands, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); - if(stack2 || stack2 === 0) { buffer += stack2; } + buffer += "<div class=\"scrivito_editing_marker_menu\">\n <ul class=\"scrivito_menu_box "; + stack1 = helpers['if'].call(depth0, depth0.align, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\">\n "; + stack1 = helpers.each.call(depth0, depth0.commands, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data}); + if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n </ul>\n</div>\n"; return buffer; }); return this.ScrivitoHandlebarsTemplates["menu"]; }).call(this); @@ -9798,19 +9951,52 @@ this.compilerInfo = [3,'>= 1.0.0-rc.4']; helpers = helpers || Handlebars.helpers; data = data || {}; - return "<div class=\"scrivito_topbar\">\n <div class=\"scrivito_first_level\">\n <div id=\"scrivito_menu_bar_toggle\" class=\"scrivito_viewmodes_wrapper\"></div>\n <div class=\"scrivito_button_bar scrivito_app scrivito_no_hover\"><span class=\"scrivito_logo\"></span></div>\n <div id=\"scrivito_select_workspace\" class=\"scrivito_button_bar\"></div>\n <div id=\"scrivito_menu_bar_dropdown\" class=\"scrivito_button_bar scrivito_right\"></div>\n <div id=\"scrivito_menu_bar_saving_indicator\"></div>\n </div>\n</div>\n"; + return "<div class=\"scrivito_topbar\">\n <div class=\"scrivito_first_level\">\n <div id=\"scrivito_menu_bar_toggle\" class=\"scrivito_viewmodes_wrapper\"></div>\n <div class=\"scrivito_button_bar scrivito_app scrivito_no_hover\"><span class=\"scrivito_logo\"></span></div>\n <div id=\"scrivito_select_workspace\" class=\"scrivito_button_bar\"></div>\n <div id=\"scrivito_current_page_menu\" class=\"scrivito_button_bar scrivito_right\"></div>\n <div id=\"scrivito_menu_bar_saving_indicator\"></div>\n </div>\n</div>\n"; }); return this.ScrivitoHandlebarsTemplates["menu_bar"]; }).call(this); (function() { this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {}); - this.ScrivitoHandlebarsTemplates["menu_bar_dropdown"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { + this.ScrivitoHandlebarsTemplates["menu_bar_toggle"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [3,'>= 1.0.0-rc.4']; helpers = helpers || Handlebars.helpers; data = data || {}; + var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression; + + + buffer += "<div class=\"scrivito_viewmodes scrivito_viewmode_"; + if (stack1 = helpers.mode) { stack1 = stack1.call(depth0, {hash:{},data:data}); } + else { stack1 = depth0.mode; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } + buffer += escapeExpression(stack1) + + "_active\">\n <span class=\"scrivito_viewmode_pill\"></span>\n\n <div class=\"scrivito_viewmode_view\">\n <span class=\"scrivito_viewmode_icon " + + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_view_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "\"></span>\n <span class=\"scrivito_viewmode_label\">" + + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_view_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "</span>\n </div>\n\n <div class=\"scrivito_viewmode_editing\">\n <span class=\"scrivito_viewmode_icon " + + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_editing_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "\"></span>\n <span class=\"scrivito_viewmode_label\">" + + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_editing_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "</span>\n </div>\n\n <div class=\"scrivito_viewmode_"; + if (stack2 = helpers.comparing_mode) { stack2 = stack2.call(depth0, {hash:{},data:data}); } + else { stack2 = depth0.comparing_mode; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; } + buffer += escapeExpression(stack2) + + "\">\n <span class=\"scrivito_viewmode_icon " + + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_comparing_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "\"></span>\n <span class=\"scrivito_viewmode_label scrivito_comparing_mode_toggle\">\n " + + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_comparing_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + " <i class=\"scrivito_icon\">&#xf025;</i>\n </span>\n </div>\n</div>\n"; + return buffer; + }); + return this.ScrivitoHandlebarsTemplates["menu_bar_toggle"]; +}).call(this); +(function() { + this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {}); + this.ScrivitoHandlebarsTemplates["obj_menu"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { + this.compilerInfo = [3,'>= 1.0.0-rc.4']; +helpers = helpers || Handlebars.helpers; data = data || {}; var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this; function program1(depth0,data) { @@ -9833,105 +10019,31 @@ return "\n scrivito_conflict\n "; } -function program9(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.is_present, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program10(depth0,data) { - - var buffer = "", stack1; - buffer += "\n <li id=\"scrivito_"; - if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\" class=\"scrivito_menu_item "; - stack1 = helpers['if'].call(depth0, depth0.is_disabled, {hash:{},inverse:self.noop,fn:self.program(11, program11, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\"\n title=\""; - if (stack1 = helpers.reason_for_being_disabled) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.reason_for_being_disabled; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\">\n <span><i class=\"scrivito_icon\">"; - if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "</i>"; - if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "</span>\n </li>\n "; - return buffer; - } -function program11(depth0,data) { - - - return "disabled"; - } - - buffer += "<i class=\"scrivito_icon\n "; - stack2 = helpers['if'].call(depth0, ((stack1 = depth0.current_page),stack1 == null || stack1 === false ? stack1 : stack1.is_new), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); + buffer += "<i title=\"" + + escapeExpression(((stack1 = ((stack1 = depth0.obj),stack1 == null || stack1 === false ? stack1 : stack1.tooltip)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "\" class=\"scrivito_icon\n "; + stack2 = helpers['if'].call(depth0, ((stack1 = depth0.obj),stack1 == null || stack1 === false ? stack1 : stack1.is_new), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack2 || stack2 === 0) { buffer += stack2; } buffer += "\n\n "; - stack2 = helpers['if'].call(depth0, ((stack1 = depth0.current_page),stack1 == null || stack1 === false ? stack1 : stack1.is_edited), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data}); + stack2 = helpers['if'].call(depth0, ((stack1 = depth0.obj),stack1 == null || stack1 === false ? stack1 : stack1.is_edited), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data}); if(stack2 || stack2 === 0) { buffer += stack2; } buffer += "\n\n "; - stack2 = helpers['if'].call(depth0, ((stack1 = depth0.current_page),stack1 == null || stack1 === false ? stack1 : stack1.is_deleted), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data}); + stack2 = helpers['if'].call(depth0, ((stack1 = depth0.obj),stack1 == null || stack1 === false ? stack1 : stack1.is_deleted), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data}); if(stack2 || stack2 === 0) { buffer += stack2; } buffer += "\n\n "; - stack2 = helpers['if'].call(depth0, ((stack1 = depth0.current_page),stack1 == null || stack1 === false ? stack1 : stack1.has_conflict), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data}); + stack2 = helpers['if'].call(depth0, ((stack1 = depth0.obj),stack1 == null || stack1 === false ? stack1 : stack1.has_conflict), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data}); if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n\">&#xf087;</i>\n\n<ul class=\"scrivito_menu_box scrivito_right\" style=\"display: none;\">\n "; - stack2 = helpers.each.call(depth0, depth0.commands, {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data}); - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n</ul>\n"; + buffer += "\n\">&#xf087;</i>\n"; return buffer; }); - return this.ScrivitoHandlebarsTemplates["menu_bar_dropdown"]; + return this.ScrivitoHandlebarsTemplates["obj_menu"]; }).call(this); (function() { this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {}); - this.ScrivitoHandlebarsTemplates["menu_bar_toggle"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [3,'>= 1.0.0-rc.4']; -helpers = helpers || Handlebars.helpers; data = data || {}; - var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression; - - - buffer += "<div class=\"scrivito_viewmodes scrivito_viewmode_"; - if (stack1 = helpers.mode) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.mode; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "_active\">\n <span class=\"scrivito_viewmode_pill\"></span>\n\n <div class=\"scrivito_viewmode_view\">\n <span class=\"scrivito_viewmode_icon " - + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_view_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "\"></span>\n <span class=\"scrivito_viewmode_label\">" - + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_view_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "</span>\n </div>\n\n <div class=\"scrivito_viewmode_editing\">\n <span class=\"scrivito_viewmode_icon " - + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_editing_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "\"></span>\n <span class=\"scrivito_viewmode_label\">" - + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_editing_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "</span>\n </div>\n\n <div class=\"scrivito_viewmode_"; - if (stack2 = helpers.comparing_mode) { stack2 = stack2.call(depth0, {hash:{},data:data}); } - else { stack2 = depth0.comparing_mode; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; } - buffer += escapeExpression(stack2) - + "\">\n <span class=\"scrivito_viewmode_icon " - + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_comparing_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "\"></span>\n <span class=\"scrivito_viewmode_label scrivito_comparing_mode_toggle\">\n " - + escapeExpression(((stack1 = ((stack1 = depth0.switch_to_comparing_mode_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + " <i class=\"scrivito_icon\">&#xf025;</i>\n </span>\n </div>\n</div>\n"; - return buffer; - }); - return this.ScrivitoHandlebarsTemplates["menu_bar_toggle"]; -}).call(this); -(function() { - this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {}); this.ScrivitoHandlebarsTemplates["obj_sorting_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [3,'>= 1.0.0-rc.4']; helpers = helpers || Handlebars.helpers; data = data || {}; var buffer = "", stack1, stack2, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this; @@ -9954,11 +10066,11 @@ if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</i>"; options = {hash:{},data:data}; - buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "inplace_marker.sort_items", options) : helperMissing.call(depth0, "translate", "inplace_marker.sort_items", options))) + buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "obj_sorting_dialog.title", options) : helperMissing.call(depth0, "translate", "obj_sorting_dialog.title", options))) + "</h3>\n </div>\n\n <div class=\"scrivito_modal_body scrivito_auto_height\">\n <ul id=\"scrivito_obj_sorting_sortable\">\n "; stack2 = helpers.each.call(depth0, depth0.child_list, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack2 || stack2 === 0) { buffer += stack2; } buffer += "\n </ul>\n </div>\n\n <div class=\"scrivito_modal_footer\">\n <a href=\"#\" class=\"scrivito_button scrivito_cancel\">"; options = {hash:{},data:data}; @@ -9991,28 +10103,41 @@ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; function program1(depth0,data) { var buffer = "", stack1; + buffer += "scrivito_"; + if (stack1 = helpers.color) { stack1 = stack1.call(depth0, {hash:{},data:data}); } + else { stack1 = depth0.color; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } + buffer += escapeExpression(stack1); + return buffer; + } + +function program3(depth0,data) { + + var buffer = "", stack1; buffer += "\n <p class=\"scrivito_description\">"; if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "</p>\n "; return buffer; } - buffer += "<div class=\"scrivito_prompt_dialog scrivito_center_dialog scrivito_modal_prompt\">\n <div class=\"scrivito_modal_header\">\n <i class=\"scrivito_icon\">"; + buffer += "<div class=\"scrivito_prompt_dialog scrivito_center_dialog scrivito_modal_prompt\n "; + stack1 = helpers['if'].call(depth0, depth0.color, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\">\n <div class=\"scrivito_modal_header\">\n <i class=\"scrivito_icon\">"; if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "</i>\n <h3 class=\"scrivito_title\">"; if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "</h3>\n "; - stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); + stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data}); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n </div>\n <div class=\"scrivito_modal_body\">\n <input type=\"text\" value=\""; if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) @@ -10149,54 +10274,67 @@ (function() { this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {}); this.ScrivitoHandlebarsTemplates["workspace_select_menu_bar_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [3,'>= 1.0.0-rc.4']; helpers = helpers || Handlebars.helpers; data = data || {}; - var buffer = "", stack1, stack2, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", self=this; + var buffer = "", stack1, stack2, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this, functionType="function"; function program1(depth0,data) { - var buffer = "", stack1, options; - buffer += "\n <li id=\"scrivito_changes_list_toggle\" class=\"scrivito_menu_item\">\n <span>\n <i class=\"scrivito_icon\" title=\""; + var buffer = "", stack1, stack2, options; + buffer += "\n <li class=\"scrivito_menu_separator\"></li>\n <li id=\"scrivito_changes_list_toggle\" class=\"scrivito_menu_item\">\n <span>\n <i class=\"scrivito_icon\" title=\""; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "changes_list.menu_item", options) : helperMissing.call(depth0, "translate", "changes_list.menu_item", options))) + "\">&#xf080;</i>\n "; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "changes_list.menu_item", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "changes_list.menu_item", depth0.current_short_title, options))) - + "\n </span>\n </li>\n <li class=\"scrivito_menu_separator\"></li>\n <li class=\"scrivito_menu_item\">\n <span id='ip-publish-current-ws'>\n <i class=\"scrivito_icon\"\n title=\""; + + "\n </span>\n </li>\n <li class=\"scrivito_menu_item "; + stack2 = helpers['if'].call(depth0, ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.is_disabled), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); + if(stack2 || stack2 === 0) { buffer += stack2; } + buffer += "\">\n <span id='" + + escapeExpression(((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "' title='" + + escapeExpression(((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.reason_for_being_disabled)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "'>\n <i class=\"scrivito_icon\" title=\"" + + escapeExpression(((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.tooltip)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "\">\n "; + stack2 = ((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.icon)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1); + if(stack2 || stack2 === 0) { buffer += stack2; } + buffer += "\n </i>\n " + + escapeExpression(((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='scrivito_rename_current_ws'>\n <i class=\"scrivito_icon\"\n title=\""; options = {hash:{},data:data}; - buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.publish_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.publish_working_copy", depth0.current_short_title, options))) - + " \">\n &#xf064;\n </i>\n "; - options = {hash:{},data:data}; - buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.publish_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.publish_working_copy", depth0.current_short_title, options))) - + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='ip-rename-current-ws'>\n <i class=\"scrivito_icon\"\n title=\""; - options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rename_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rename_working_copy", depth0.current_short_title, options))) + " \">&#61519;</i>\n "; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rename_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rename_working_copy", depth0.current_short_title, options))) - + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='ip-rebase-current-ws'>\n <i class=\"scrivito_icon\"\n title=\""; + + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='scrivito_rebase_current_ws'>\n <i class=\"scrivito_icon\"\n title=\""; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rebase_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rebase_working_copy", depth0.current_short_title, options))) + " \">\n &#xf023;\n </i>\n "; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rebase_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rebase_working_copy", depth0.current_short_title, options))) - + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='ip-delete-current-ws'>\n <i class=\"scrivito_icon\"\n title=\""; + + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='scrivito_delete_current_ws'>\n <i class=\"scrivito_icon\"\n title=\""; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.delete_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.delete_working_copy", depth0.current_short_title, options))) + " \">&#61464;</i>\n "; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.delete_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.delete_working_copy", depth0.current_short_title, options))) + "\n </span>\n </li>\n "; return buffer; } +function program2(depth0,data) { + + + return "scrivito_disabled"; + } buffer += "<i class=\"scrivito_icon\">&#xf011;</i>\n<span class=\"scrivito_button_label\">"; if (stack1 = helpers.current_long_title) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.current_long_title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) - + "</span>\n\n<ul class=\"scrivito_menu_box\" style=\"display: none;\">\n <li class=\"scrivito_menu_item\">\n <span id='ip-create-new-ws'>\n <i class=\"scrivito_icon\" title=\""; + + "</span>\n\n<ul class=\"scrivito_menu_box\" style=\"display: none;\">\n <li class=\"scrivito_menu_item\">\n <span id='scrivito_create_new_ws'>\n <i class=\"scrivito_icon\" title=\""; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.create_new_working_copy", options) : helperMissing.call(depth0, "translate", "menu_bar.create_new_working_copy", options))) + "\">&#61474;</i>\n "; options = {hash:{},data:data}; buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.create_new_working_copy", options) : helperMissing.call(depth0, "translate", "menu_bar.create_new_working_copy", options))) @@ -10223,11 +10361,10 @@ 'accept': 'Übernehmen', 'close': 'Schließen', 'done': 'Fertig', 'loading': 'Lade...', 'current_page': 'Aktuelle Seite', - 'resource': 'Ressource', 'obj.tooltip.is_new': 'Diese Seite ist neu.', 'obj.tooltip.is_edited': 'Diese Seite wurde geändert.', 'obj.tooltip.has_conflict': 'Auf dieser Seite gab es parallele Änderungen, die mit den Änderungen in dieser Arbeitskopie zusammengeführt werden sollten.', 'obj.tooltip.is_deleted': 'Diese Seite wurde gelöscht.', @@ -10244,18 +10381,33 @@ 'editable_ws_dialog.create_new_playholder': 'Titel der neuen Arbeitskopie', 'editable_ws_dialog.select': 'Auswählen', 'details_dialog.title': '$1 bearbeiten', + 'resource_dialog.title': 'Ressource', + + 'resource_dialog.commands.revert_obj.title': 'Änderungen an Ressource verwerfen', + 'resource_dialog.commands.revert_obj.rtc_workspace': 'Diese Ressource ist Teil der "rtc"-Arbeitskopie, bei der Änderungen nicht verworfen werden können.', + 'resource_dialog.commands.revert_obj.new_obj': 'Dies ist eine neue Ressource. Um die Erstellung dieser Ressource rückgängig zu machen, löschen Sie sie bitte.', + 'resource_dialog.commands.revert_obj.not_modified_obj': 'Diese Ressource wurde nicht geändert. Daher gibt es nichts zu verwerfen.', + 'resource_dialog.commands.revert_obj.dialog.title': 'Wirklich Änderungen an dieser Ressource verwerfen?', + + 'resource_dialog.commands.restore_obj.title': 'Ressource wiederherstellen', + 'resource_dialog.commands.restore_obj.rtc_workspace': 'Diese Ressource ist Teil der "rtc"-Arbeitskopie, bei der gelöschte Seiten nicht wiederhergestellt werden können.', + + 'resource_dialog.commands.mark_resolved_obj.title': 'Parallele Änderungen an der Ressource überschreiben', + 'resource_dialog.commands.mark_resolved_obj.dialog.description': 'Diese Ressource wurde in einer anderen, inzwischen veröffentlichten Arbeitskopie geändert. Bitte bestätigen Sie, dass Ihre Änderungen erhalten und die parallel durchgeführten Änderungen verworfen werden.', + + 'resource_dialog.commands.delete_obj.title': 'Ressource löschen', + 'resource_dialog.commands.delete_obj.dialog.title': 'Wirklich diese Ressource löschen?', + 'resource_dialog.commands.delete_obj.dialog.description': 'Änderungen an einer gelöschten Ressource können nicht wiederhergestellt werden.', + 'menu_bar.working_copy': 'Arbeitskopie', 'menu_bar.empty_workspace_title': '<leerer Titel>', 'menu_bar.published_workspace_title': 'Veröffentlichte Inhalte', 'menu_bar.loading_workspaces': 'Lade Arbeitskopien', 'menu_bar.select_working_copy': '"$1" auswählen', - 'menu_bar.publish_working_copy': '"$1" veröffentlichen', - 'menu_bar.publish_ws_confirmation': '"$1" veröffentlichen?', - 'menu_bar.publish_ws_confirmation_desc': 'Eine Arbeitskopie zu veröffentlichen ist endgültig. Dieser Vorgang kann nicht rückgängig gemacht werden.', 'menu_bar.rebase_working_copy': '"$1" aktualisieren', 'menu_bar.rename_working_copy': '"$1" umbenennen', 'menu_bar.rename_working_copy_desc': 'Bitte geben Sie den neuen Titel der Arbeitskopie ein.', 'menu_bar.rename': 'Umbenennen', 'menu_bar.delete_working_copy': '"$1" löschen', @@ -10263,26 +10415,25 @@ 'menu_bar.delete_ws_confirmation_desc': 'Eine gelöschte Arbeitskopie kann nicht wiederhergestellt werden.', 'menu_bar.delete': 'Löschen', 'menu_bar.move': 'Verschieben', 'menu_bar.copy': 'Kopieren', 'menu_bar.create': 'Anlegen', - 'menu_bar.publish': 'Veröffentlichen', 'menu_bar.create_new_working_copy': 'Arbeitskopie anlegen', 'menu_bar.create_new_ws_confirmation': 'Arbeitskopie anlegen', 'menu_bar.create_new_ws_confirmation_desc': 'Bitte geben Sie den Titel der neuen Arbeitskopie ein.', 'menu_bar.create_new_ws_confirmation_placeholder': 'Neuer Titel', 'saving_indicator_item.saving': 'Wird gespeichert...', 'saving_indicator_item.saved': 'Änderungen gespeichert', - 'widget_menus.widget_is_new': 'Widget ist neu', - 'widget_menus.widget_is_edited': 'Widget wurde geändert', - 'widget_menus.widget_is_edited_and_dragged_here': 'Widget wurde geändert und hierher gezogen', - 'widget_menus.widget_is_edited_and_dragged_away': 'Widget wurde geändert und von hier weggezogen', - 'widget_menus.widget_is_deleted': 'Widget wurde gelöscht', - 'widget_menus.widget_is_dragged_here': 'Widget wurde hierher gezogen', - 'widget_menus.widget_is_dragged_away': 'Widget wurde von hier weggezogen', + 'widget_marker.widget_is_new': 'Widget ist neu', + 'widget_marker.widget_is_edited': 'Widget wurde geändert', + 'widget_marker.widget_is_edited_and_dragged_here': 'Widget wurde geändert und hierher gezogen', + 'widget_marker.widget_is_edited_and_dragged_away': 'Widget wurde geändert und von hier weggezogen', + 'widget_marker.widget_is_deleted': 'Widget wurde gelöscht', + 'widget_marker.widget_is_dragged_here': 'Widget wurde hierher gezogen', + 'widget_marker.widget_is_dragged_away': 'Widget wurde von hier weggezogen', 'child_list_menu.description': 'Elemente von $1', 'changes_list.menu_item': 'Änderungen von "$1"', 'changes_list.title': 'Änderungen von "$1"', @@ -10308,16 +10459,18 @@ 'commands.revert_obj.title': 'Änderungen an Seite verwerfen', 'commands.revert_obj.published_workspace': 'Die veröffentlichten Inhalte können nicht direkt geändert werden. Daher gibt es nichts zu verwerfen.', 'commands.revert_obj.rtc_workspace': 'Diese Seite ist Teil der "rtc"-Arbeitskopie, bei der Änderungen nicht verworfen werden können.', 'commands.revert_obj.new_obj': 'Dies ist eine neue Seite. Um die Erstellung dieser Seite rückgängig zu machen, löschen Sie sie bitte.', 'commands.revert_obj.not_modified_obj': 'Diese Seite wurde nicht geändert. Daher gibt es nichts zu verwerfen.', + 'commands.revert_obj.is_binary': 'Verwerfen von Änderungen ist nicht verfügbar für binäre Daten.', 'commands.revert_obj.dialog.title': 'Wirklich Änderungen an dieser Seite verwerfen?', 'commands.revert_obj.dialog.description': 'Verworfene Änderungen können nicht wiederhergestellt werden.', 'commands.revert_obj.dialog.confirm': 'Verwerfen', 'commands.restore_obj.title': 'Seite wiederherstellen', 'commands.restore_obj.rtc_workspace': 'Diese Seite ist Teil der "rtc"-Arbeitskopie, bei der gelöschte Seiten nicht wiederhergestellt werden können.', + 'commands.restore_obj.is_binary': 'Wiederherstellen ist nicht verfügbar für binäre Daten.', 'commands.mark_resolved_obj.title': 'Parallele Änderungen an der Seite überschreiben', 'commands.mark_resolved_obj.dialog.title': 'Wirklich parallele Änderungen an der Seite überschreiben?', 'commands.mark_resolved_obj.dialog.description': 'Diese Seite wurde in einer anderen, inzwischen veröffentlichten Arbeitskopie geändert. Bitte bestätigen Sie, dass Ihre Änderungen erhalten und die parallel durchgeführten Änderungen verworfen werden.', 'commands.mark_resolved_obj.dialog.confirm': 'Änderungen überschreiben', @@ -10340,10 +10493,12 @@ 'commands.sort_items.auto_sort': 'Diese Navigation wird automatisch sortiert.', 'commands.sort_items.too_less_children': 'Die Navigation kann nicht sortiert werden, weil sie weniger als zwei Elemente enthält.', 'commands.add_widget.title': 'Widget einfügen', + 'obj_sorting_dialog.title': 'Elemente sortieren', + 'commands.widget_details.title': 'Widget-Eigenschaften', 'commands.widget_details.no_details_view': 'Dieses Widget hat keine Eigenschaften', 'commands.save_widget_to_clipboard.title': 'Widget zum Kopieren markieren', @@ -10360,10 +10515,16 @@ 'commands.switch_mode.diff': 'Vergleichen', 'commands.switch_mode.added': 'Hinzugefügt', 'commands.switch_mode.deleted': 'Gelöscht', 'commands.switch_mode.disabled': 'Aktuell ausgewählter Anzeigemodus', + 'commands.publish_workspace.title': '"$1" veröffentlichen', + 'commands.publish_workspace.permission_denied': 'Die Arbeitskopie kann aufgrund fehlender Benutzerrechte nicht veröffentlicht werden.', + 'commands.publish_workspace.dialog.confirm': 'Veröffentlichen', + 'commands.publish_workspace.dialog.title': '"$1" veröffentlichen?', + 'commands.publish_workspace.dialog.description': 'Eine Arbeitskopie zu veröffentlichen ist endgültig. Dieser Vorgang kann nicht rückgängig gemacht werden.', + 'image_upload.too_many_files': 'Nur eine Datei erlaubt.', 'warn_before_unloading': 'Sie haben nicht gespeicherte Änderungen! Sind Sie sicher, dass sie schließen wollen?' }, 'de'); $.i18n().load({ @@ -10375,11 +10536,10 @@ 'accept': 'Accept', 'close': 'Close', 'done': 'Done', 'loading': 'Loading...', 'current_page': 'current page', - 'resource': 'resource', 'obj.tooltip.is_new': 'This page is new.', 'obj.tooltip.is_edited': 'This page has been modified.', 'obj.tooltip.has_conflict': 'To this page concurrent changes were made that should be merged with the changes in this working copy.', 'obj.tooltip.is_deleted': 'This page has been deleted.', @@ -10396,18 +10556,33 @@ 'editable_ws_dialog.create_new_playholder': 'new working copy title', 'editable_ws_dialog.select': 'Select', 'details_dialog.title': 'Edit $1', + 'resource_dialog.title': 'resource', + + 'resource_dialog.commands.revert_obj.title': 'Discard changes to resource', + 'resource_dialog.commands.revert_obj.rtc_workspace': 'This resource is part of the "rtc" working copy, for which discarding changes is not supported.', + 'resource_dialog.commands.revert_obj.new_obj': 'This is a new resource. To discard the creation of this resource, please delete it.', + 'resource_dialog.commands.revert_obj.not_modified_obj': 'This resource has not been modified. Therefore, nothing can be discarded.', + 'resource_dialog.commands.revert_obj.dialog.title': 'Really discard changes to this resource?', + + 'resource_dialog.commands.restore_obj.title': 'Restore resource', + 'resource_dialog.commands.restore_obj.rtc_workspace': 'This resource is part of the "rtc" working copy, for which restoring resources is not supported.', + + 'resource_dialog.commands.mark_resolved_obj.title': 'Override concurrent changes to resource', + 'resource_dialog.commands.mark_resolved_obj.dialog.description': 'This resource was altered in a different working copy that has been published. Please confirm that you want to keep your changes and discard the ones concurrently made by others.', + + 'resource_dialog.commands.delete_obj.title': 'Delete resource', + 'resource_dialog.commands.delete_obj.dialog.title': 'Really delete this resource?', + 'resource_dialog.commands.delete_obj.dialog.description': 'Changes to a deleted resource cannot be restored.', + 'menu_bar.working_copy': 'Working copy', 'menu_bar.empty_workspace_title': '<empty title>', 'menu_bar.published_workspace_title': 'Published content', 'menu_bar.loading_workspaces': 'Loading working copies', 'menu_bar.select_working_copy': 'Select "$1"', - 'menu_bar.publish_working_copy': 'Publish "$1"', - 'menu_bar.publish_ws_confirmation': 'Publish "$1"?', - 'menu_bar.publish_ws_confirmation_desc': 'Publishing a working copy is final. This action cannot be undone.', 'menu_bar.rebase_working_copy': 'Update "$1"', 'menu_bar.rename_working_copy': 'Rename "$1"', 'menu_bar.rename_working_copy_desc': 'Please enter the new title of the working copy.', 'menu_bar.rename': 'Rename', 'menu_bar.delete_working_copy': 'Delete "$1"', @@ -10415,26 +10590,25 @@ 'menu_bar.delete_ws_confirmation_desc': 'A deleted working copy cannot be restored.', 'menu_bar.delete': 'Delete', 'menu_bar.create': 'Create', 'menu_bar.move': 'Move', 'menu_bar.copy': 'Copy', - 'menu_bar.publish': 'Publish', 'menu_bar.create_new_working_copy': 'Create working copy', 'menu_bar.create_new_ws_confirmation': 'Create a working copy', 'menu_bar.create_new_ws_confirmation_desc': 'Please enter the title of the new working copy.', 'menu_bar.create_new_ws_confirmation_placeholder': 'new title', 'saving_indicator_item.saving': 'Saving...', 'saving_indicator_item.saved': 'Changes saved', - 'widget_menus.widget_is_new': 'Widget is new', - 'widget_menus.widget_is_edited': 'Widget has been modified', - 'widget_menus.widget_is_edited_and_dragged_here': 'Widget has been modified and dragged here', - 'widget_menus.widget_is_edited_and_dragged_away': 'Widget has been modified and dragged away from here', - 'widget_menus.widget_is_deleted': 'Widget has been deleted', - 'widget_menus.widget_is_dragged_here': 'Widget has been dragged here', - 'widget_menus.widget_is_dragged_away': 'Widget has been dragged away from here', + 'widget_marker.widget_is_new': 'Widget is new', + 'widget_marker.widget_is_edited': 'Widget has been modified', + 'widget_marker.widget_is_edited_and_dragged_here': 'Widget has been modified and dragged here', + 'widget_marker.widget_is_edited_and_dragged_away': 'Widget has been modified and dragged away from here', + 'widget_marker.widget_is_deleted': 'Widget has been deleted', + 'widget_marker.widget_is_dragged_here': 'Widget has been dragged here', + 'widget_marker.widget_is_dragged_away': 'Widget has been dragged away from here', 'child_list_menu.description': 'Items of $1', 'changes_list.menu_item': 'Changes to "$1"', 'changes_list.title': 'Changes to "$1"', @@ -10459,17 +10633,19 @@ 'commands.revert_obj.title': 'Discard changes to page', 'commands.revert_obj.published_workspace': 'Since this is the published content, nothing has been modified. Therefore, nothing can be discarded.', 'commands.revert_obj.rtc_workspace': 'This page is part of the "rtc" working copy, for which discarding changes is not supported.', 'commands.revert_obj.new_obj': 'This is a new page. To discard the creation of this page, please delete it.', + 'commands.revert_obj.is_binary': 'Discarding changes is not available for binary content.', 'commands.revert_obj.not_modified_obj': 'This page has not been modified. Therefore, nothing can be discarded.', 'commands.revert_obj.dialog.title': 'Really discard changes to this page?', 'commands.revert_obj.dialog.description': 'Discarded changes cannot be restored.', 'commands.revert_obj.dialog.confirm': 'Discard', 'commands.restore_obj.title': 'Restore page', 'commands.restore_obj.rtc_workspace': 'This page is part of the "rtc" working copy, for which restoring pages is not supported.', + 'commands.restore_obj.is_binary': 'Restoring ist not available for binary content.', 'commands.mark_resolved_obj.title': 'Override concurrent changes to page', 'commands.mark_resolved_obj.dialog.confirm': 'Override changes', 'commands.mark_resolved_obj.dialog.title': 'Really override changes made by others in the meantime?', 'commands.mark_resolved_obj.dialog.description': 'This page was altered in a different working copy that has been published. Please confirm that you want to keep your changes and discard the ones concurrently made by others.', @@ -10490,10 +10666,12 @@ 'commands.sort_items.title': 'Sort items', 'commands.sort_items.tooltip': 'Edit order of items underneath $1', 'commands.sort_items.auto_sort': 'This navigation is sorted automatically.', 'commands.sort_items.too_less_children': 'This navigation cannot be sorted because it consists of less than two items.', + 'obj_sorting_dialog.title': 'Sort items', + 'commands.add_widget.title': 'Insert widget', 'commands.widget_details.title': 'Widget properties', 'commands.widget_details.no_details_view': 'This widget has no properties', @@ -10512,10 +10690,16 @@ 'commands.switch_mode.diff': 'All changes', 'commands.switch_mode.added': 'Additions', 'commands.switch_mode.deleted': 'Deletions', 'commands.switch_mode.disabled': 'Currently selected display mode', + 'commands.publish_workspace.title': 'Publish "$1"', + 'commands.publish_workspace.permission_denied': 'The working copy can not be published due to missing user permissions.', + 'commands.publish_workspace.dialog.confirm': 'Publish', + 'commands.publish_workspace.dialog.title': 'Publish "$1"?', + 'commands.publish_workspace.dialog.description': 'Publishing a working copy is final. This action cannot be undone.', + 'image_upload.too_many_files': 'Only one file allowed.', 'warn_before_unloading': 'You have unsaved changes. Are you sure you want to quit?', 'test.two_arguments': '$1, $2', @@ -10548,10 +10732,16 @@ if (!scrivito.suppress_alerts) { window.alert(message); } }, + log_error: function(message, exception) { + if (window.console) { + window.console.error(message, exception); + } + }, + change_location: function(location) { // this is a proxy method, so we can stub it easier. window.location = location; }, @@ -10655,18 +10845,25 @@ hex = '0' + hex; } return hex; }, + // 16 chars hex string + random_id: function() { + return scrivito.random_hex() + scrivito.random_hex(); + }, + deprecation_warning: function(subject, alternative) { var message = 'DEPRECATION WARNING: "' + subject + '" is deprecated.'; if (alternative) { message += ' Please use "' + alternative + '" instead.'; } - window.console.warn(message); + if (window.console) { + window.console.warn(message); + } }, on: function(event, callback) { if (event === 'editing') { scrivito.deprecation_warning('scrivito.on("editing", ...)', @@ -10742,25 +10939,33 @@ init: function(config) { scrivito.config = config; scrivito.editing_context.init(config.editing_context); + scrivito.user_permissions.init(config.user_permissions); scrivito.i18n.init(config.i18n); scrivito.obj.init(config.obj); - scrivito.resource_dialog.init(config.open_resource_dialog); + scrivito.resource_dialog.init(config.resource_dialog); scrivito.inplace_marker.init(); scrivito.menu_bar_saving_indicator.init(); scrivito.menu_bar_toggle.init(); - scrivito.menu_bar_dropdown.init(); + scrivito.current_page_menu.init(); scrivito.workspace_select.init(); scrivito.menu_bar.init(); - scrivito.widget_menus.init(); + + scrivito.child_list_commands.init(); + scrivito.widget_commands.init(); + scrivito.widget_field_commands.init(); + + scrivito.child_list_marker.init(); + scrivito.widget_field_marker.init(); + scrivito.widget_marker.init(); + scrivito.widget_reloading.init(); scrivito.widget_sorting.init(); scrivito.image_upload.init(); - scrivito.child_list_menus.init(); scrivito.reloading.init(); window.onbeforeunload = scrivito.warn_before_unloading; } }); @@ -10818,99 +11023,128 @@ } }); }()); (function() { var assert_valid_dom_element = function(dom_element) { - if (dom_element.length > 0) { - if (dom_element.length === 1) { - return true; - } else { - $.error('Can not call "scrivito" method on more than one tag'); - } + if (dom_element.length < 1) { + $.error('Can not call "scrivito" method on an empty element'); } + if (dom_element.length > 1) { + $.error('Can not call "scrivito" method on more than one tag'); + } }; - var build_cms_field_element = function(dom_element) { - var cms_field_element = scrivito.cms_element.from_dom_element(dom_element); - if (cms_field_element) { - return cms_field_element; + var build_cms_element = function(dom_element) { + var cms_element = scrivito.cms_element.from_dom_element(dom_element); + if (cms_element) { + return cms_element; } else { $.error('Can not call "scrivito" method on a non-cms tag'); } }; var save_content = function(dom_element, content) { - if (assert_valid_dom_element(dom_element)) { - if (content === undefined) { - $.error('Can not call "save" with no content'); + if (dom_element.length > 0) { + if (dom_element.length === 1) { + if (content === undefined) { + $.error('Can not call "save" with no content'); + } else { + var cms_element = build_cms_element(dom_element); + return cms_element.save(content).then(function() { + cms_element.set_original_content(content); + }); + } } else { - var cms_field_element = build_cms_field_element(dom_element); - return cms_field_element.save(content).then(function() { - cms_field_element.set_original_content(content); - }); + $.error('Can not call "scrivito" method on more than one tag'); } } }; var get_original_content = function(dom_element) { - if (assert_valid_dom_element(dom_element)) { - return build_cms_field_element(dom_element).original_content(); - } else { - $.error('Can not call "scrivito" method on an empty element'); - } + assert_valid_dom_element(dom_element); + return build_cms_element(dom_element).original_content(); }; + var get_menu = function(dom_element) { + assert_valid_dom_element(dom_element); + var cms_element = build_cms_element(dom_element); + return { + add: function(command_options) { + var menu = cms_element.menu(); + menu.push(scrivito.command.create_instance(command_options)); + cms_element.set_menu(menu); + } + }; + }; + $.fn.scrivito = function(method, content) { - if (method === 'save') { - return save_content($(this), content); - } else if (method === 'content') { - return get_original_content($(this)); - } else { - $.error('Unknown method "' + method + '"'); + switch (method) { + case 'save': + return save_content($(this), content); + case 'content': + return get_original_content($(this)); + case 'menu': + return get_menu($(this)); + default: + $.error('Unknown method "' + method + '"'); } }; }()); (function() { var callbacks = {}; + // The callback has to be function that takes no arguments + var log_exception_in_callback = function(event_name, callback) { + try { + callback(); + } catch(exception) { + var text = "'"+event_name+"' callback threw exception: "; + scrivito.log_error(text, exception); + } + }; + var run_open_callbacks = function() { if (callbacks.open) { _.each(callbacks.open, function(callback) { - callback(); + log_exception_in_callback('open', callback); }); } if (scrivito.editing_context.is_editing_mode() && callbacks.editing) { _.each(callbacks.editing, function(callback) { - callback(); + log_exception_in_callback('editing', callback); }); } }; var run_new_content_callbacks = function(dom_element) { if (scrivito.editing_context.is_editing_mode() && callbacks.new_content) { _.each(callbacks.new_content, function(callback) { if (dom_element) { - callback(dom_element); + log_exception_in_callback('new_content', function() { + callback(dom_element); + }); } }); } if (callbacks.content) { _.each(callbacks.content, function(callback) { if (dom_element) { - callback(dom_element); + log_exception_in_callback('content', function() { + callback(dom_element); + }); } }); } }; $.extend(scrivito, { gui: { start: function() { $('body').attr('data-scrivito-display-mode', scrivito.editing_context.display_mode); - $('body').append('<div id="ip-editing"></div>'); + $('body').append('<div id="scrivito_editing"></div>'); run_open_callbacks(); }, new_content: function(dom_element) { run_new_content_callbacks(dom_element); @@ -11021,10 +11255,25 @@ workspace_id: scrivito.editing_context.selected_workspace.id() }); }; }()); (function() { + $.extend(scrivito, { + user_permissions: { + permissions_hash: {}, + + init: function(permissions_hash) { + scrivito.user_permissions.permissions_hash = permissions_hash; + }, + + can: function(permission_key) { + return !!scrivito.user_permissions.permissions_hash[permission_key]; + } + } + }); +}()); +(function() { var handle_task = function(task) { switch (task.status) { case 'success': return $.Deferred().resolve(task.result); case 'error': @@ -11334,62 +11583,53 @@ return false; }); }); menu_bar_toggle.find('.scrivito_comparing_mode_toggle').on('click', function() { - scrivito.menus.toggle($(this), [ + scrivito.inline_menus.toggle($(this), [ scrivito.switch_mode_command('diff'), scrivito.switch_mode_command('added'), scrivito.switch_mode_command('deleted') - ], {align: 'left', css_class: 'scrivito_switch_mode_menu'}); + ], 'left'); return false; }); }); } } }); }()); (function() { $.extend(scrivito, { - menu_bar_dropdown: { + obj_menu: { + create: function(dom_element, obj, commands, options) { + dom_element.append(scrivito.template.render('obj_menu', {obj: obj})); + dom_element.on('click', function() { + scrivito.inline_menus.toggle(dom_element, commands, options); + return false; + }); + } + } + }); +}()); +(function() { + $.extend(scrivito, { + current_page_menu: { init: function() { - scrivito.menu_bar.register_item_renderer(function(menu_bar) { - var current_page = scrivito.obj.current_page; - - var commands = [ - scrivito.obj_details_command(current_page), - scrivito.save_obj_to_clipboard_command(current_page), - scrivito.delete_obj_command(current_page), - scrivito.revert_obj_command(current_page), - scrivito.restore_obj_command(current_page), - scrivito.mark_resolved_obj_command(current_page), - scrivito.duplicate_obj_command(current_page) - ]; - - var view = scrivito.template.render('menu_bar_dropdown', { - current_page: current_page, - commands: commands + if (scrivito.obj.current_page) { + scrivito.menu_bar.register_item_renderer(function(menu_bar) { + var current_page = scrivito.obj.current_page; + scrivito.obj_menu.create(menu_bar.find('#scrivito_current_page_menu'), current_page, [ + scrivito.obj_details_command(current_page), + scrivito.save_obj_to_clipboard_command(current_page), + scrivito.delete_obj_command(current_page), + scrivito.revert_obj_command(current_page), + scrivito.restore_obj_command(current_page), + scrivito.mark_resolved_obj_command(current_page), + scrivito.duplicate_obj_command(current_page) + ]); }); - - var menu_bar_dropdown = menu_bar.find('#scrivito_menu_bar_dropdown').html(view); - - if (current_page) { - menu_bar_dropdown.attr('title', current_page.tooltip()); - } - - menu_bar_dropdown.click(function() { - menu_bar_dropdown.toggleClass('active'); - menu_bar_dropdown.find('.scrivito_menu_box').fadeToggle('50'); - return false; - }); - - _.each(commands, function(command) { - menu_bar_dropdown.find('#scrivito_' + command.id()).click(function() { - return command.execute(); - }); - }); - }); + } } } }); }()); (function() { @@ -11422,26 +11662,28 @@ return t('menu_bar.select_working_copy', title); }; var renderer = function(view) { var workspace = scrivito.editing_context.selected_workspace; + var select_menu_view = $(scrivito.template.render('workspace_select_menu_bar_item', { current_workspace: workspace, current_short_title: workspace_title_short(workspace), - current_long_title: workspace_title_long(workspace) + current_long_title: workspace_title_long(workspace), + publish_command: scrivito.publish_workspace_command(workspace) })); view.find('#scrivito_select_workspace').append(select_menu_view); }; var default_click_action = function(e) { e.preventDefault(); e.stopPropagation(); - $('#scrivito_select_workspace .scrivito_menu_box').fadeToggle('50'); + scrivito.workspace_select.close_menu(); }; - $(document).on("click.ip-toggle-ws-select", "#scrivito_select_workspace", function(e) { + $(document).on("click.scrivito_toggle_ws_select", "#scrivito_select_workspace", function(e) { default_click_action(e); var replace_with_real_ws = $('#scrivito_select_workspace #scrivito_replace_with_real_ws'); if(replace_with_real_ws.length > 0) { scrivito.workspace.all().done(function(workspaces) { @@ -11476,14 +11718,15 @@ replace_with_real_ws.replaceWith(ws_list_view); }); } }); - $(document).on("click.ip-create-ws", "#ip-create-new-ws", function(e) { + $(document).on("click.scrivito_create_ws", "#scrivito_create_new_ws", function(e) { default_click_action(e); scrivito.prompt_dialog({ icon: '&#xf022;', + color: 'green', title: t('menu_bar.create_new_ws_confirmation'), description: t('menu_bar.create_new_ws_confirmation_desc'), placeholder: t('menu_bar.create_new_ws_confirmation_placeholder'), accept_button_text: t('menu_bar.create'), accept_button_color: 'green' @@ -11498,32 +11741,22 @@ }) ); }); }); - $(document).on("click.ip-publish-ws", "#ip-publish-current-ws", function(e) { - default_click_action(e); - scrivito.confirmation_dialog({ - icon: '&#xf064;', - confirm_button_text: t('menu_bar.publish'), - confirm_button_color: 'green', - title: t('menu_bar.publish_ws_confirmation', workspace_title_short( - scrivito.editing_context.selected_workspace)), - description: t('menu_bar.publish_ws_confirmation_desc') - }).done(function() { - scrivito.with_saving_overlay( - scrivito.editing_context.selected_workspace.publish().then(function() { - return scrivito.redirect_to('?_scrivito_workspace_id=published'); - }) - ); - }); + $(document).on("click.scrivito_publish_ws", "#scrivito_publish_current_ws", function(e) { + scrivito.publish_workspace_command(scrivito.editing_context.selected_workspace). + execute(); + + return false; }); - $(document).on("click.ip-rename-ws", "#ip-rename-current-ws", function(e) { + $(document).on("click.scrivito_rename_ws", "#scrivito_rename_current_ws", function(e) { default_click_action(e); scrivito.prompt_dialog({ icon: '&#xf04f;', + color: 'green', title: t('menu_bar.rename_working_copy', scrivito.editing_context.selected_workspace.title()), description: t('menu_bar.rename_working_copy_desc'), value: scrivito.editing_context.selected_workspace.title(), accept_button_text: t('menu_bar.rename'), accept_button_color: 'green' @@ -11534,20 +11767,20 @@ }) ); }); }); - $(document).on("click.ip-rebase-ws", "#ip-rebase-current-ws", function(e) { + $(document).on("click.scrivito_rebase_ws", "#scrivito_rebase_current_ws", function(e) { default_click_action(e); scrivito.with_saving_overlay( scrivito.editing_context.selected_workspace.rebase().then(function() { return scrivito.reload(); }) ); }); - $(document).on("click.ip-delete-ws", "#ip-delete-current-ws", function(e) { + $(document).on("click.scrivito_delete_ws", "#scrivito_delete_current_ws", function(e) { default_click_action(e); scrivito.confirmation_dialog({ color: 'red', icon: '&#xf018;', confirm_button_color: 'red', @@ -11571,10 +11804,13 @@ $.extend(scrivito, { workspace_select: { init: function() { scrivito.menu_bar.register_item_renderer(renderer); + }, + close_menu: function() { + $('#scrivito_select_workspace .scrivito_menu_box').fadeToggle('50'); } } }); }()); (function() { @@ -11587,11 +11823,11 @@ view = $(scrivito.template.render('changes_list_dialog', { selected_workspace_title: scrivito.editing_context.selected_workspace.title() })); - $('#ip-editing').append(view); + $('#scrivito_editing').append(view); var next_loader = view.find('.scrivito_load_more'); target = view.find('#scrivito_changes_table_loaded'); var spinner = view.find('#scrivito_changes_table_loading'); var empty_result = view.find('#scrivito_changes_table_empty_result'); @@ -11635,11 +11871,20 @@ var obj_id = element.attr('data-scrivito-private-changes-list-obj-id'); var obj_modification = element.attr( 'data-scrivito-private-changes-list-obj-modification'); var obj_is_binary = element.attr('data-scrivito-private-changes-list-obj-is-binary'); - scrivito.changes_dialog.redirect_to_obj(obj_id, obj_modification, obj_is_binary); + if (can_use_resource_dialog_directly(obj_modification, obj_is_binary)) { + var loaded_obj = _.find(loaded_objs, function(obj) { + return obj.id === obj_id; + }); + + scrivito.resource_dialog.open(scrivito.obj.create_instance(loaded_obj)); + } else { + scrivito.changes_dialog.redirect_to_obj(obj_id, obj_modification, obj_is_binary); + } + return false; }); }); }; @@ -11661,11 +11906,11 @@ view.addClass('scrivito_show'); }).then(function() { scrivito.dialog.adjust(view); }); - return scrivito.with_dialog_behaviour(deferred, {escape: cancel}); + return scrivito.with_dialog_behaviour(view, deferred, {escape: cancel}); }, redirect_to_obj: function(obj_id, modification, is_binary) { var base_url = '/'; var query_params = {}; @@ -11696,17 +11941,24 @@ var total_obj_count; var target; var load_markup; var loading_in_progress; + var can_use_resource_dialog_directly = function(modification, is_binary) { + return is_binary && ( + modification === 'edited' || + modification === 'deleted' && scrivito.editing_context.is_deleted_mode() || + modification === 'new' && !scrivito.editing_context.is_deleted_mode()); + }; + var basic_batch = function() { return scrivito. obj_where('_modification', 'equals', ['new', 'edited', 'deleted']). batch_size(100). order('_last_changed'). reverse_order(). - format('_changes_list'). + format('_default'). include_deleted(); }; var render_objs = function(obj_specs) { target.html(_.map(obj_specs, function(obj_spec) { @@ -11818,15 +12070,10 @@ child_list_element: { create_instance: function(cms_element) { if (cms_element.dom_element().attr('data-scrivito-private-child-list-path')) { var that = cms_element; - var generate_path = function(){ - var name = scrivito.random_hex(); - return that.path() + '/' + name; - }; - $.extend(that, { path: function() { return that.dom_element().attr('data-scrivito-private-child-list-path'); }, @@ -11847,23 +12094,21 @@ return JSON.parse( that.dom_element().attr('data-scrivito-private-child-list-allowed-classes')); }, create_child: function(obj_class) { - var path = generate_path(); - + var id = scrivito.random_id(); return scrivito.obj.create({ - _path: path, + _id: id, + _path: that.path() + '/' + id, _obj_class: obj_class }); }, add_child: function(child) { - var path = generate_path(); - return child.save({ - _path: path + _path: that.path() + '/' + child.id() }); }, children: function() { return _.map(that.dom_element().find('>[data-scrivito-private-obj-id]'), @@ -11899,14 +12144,13 @@ }); return that; } }, - all: function() { - return _.map($('[data-scrivito-private-child-list-path]'), function(dom_element) { - return scrivito.cms_element.from_dom_element($(dom_element)); - }); + + all: function(root_element) { + return scrivito.cms_element.all('[data-scrivito-private-child-list-path]', root_element); } } }); }()); @@ -11953,11 +12197,18 @@ }); return instance; }, - definitions: [] + definitions: [], + + all: function(selector, root_element) { + var dom_elements = (root_element || $('body')).find(selector).addBack(selector); + return _.map(dom_elements, function(dom_element) { + return scrivito.cms_element.from_dom_element($(dom_element)); + }); + } } }); }()); (function() { var has_original_content = function(field_type) { @@ -12271,10 +12522,15 @@ destroy: function() { return scrivito.ajax('DELETE', 'objs/' + that.id()); }, + destroy_widget: function(widget_id) { + return scrivito.ajax('PUT', + 'objs/' + that.id() + '/destroy_widget?widget_id=' + widget_id); + }, + revert: function() { return scrivito.ajax('PUT', 'objs/' + that.id() + '/revert'); }, restore: function() { @@ -12511,10 +12767,11 @@ (function() { var field_types = [ 'binary', 'enum', + 'link', 'linklist', 'multienum', 'reference', 'referencelist', 'text' @@ -12600,11 +12857,11 @@ return obj_data._widget_pool[that.id()]; }); }, destroy: function() { - return that.obj().save(build_obj_attributes(null)); + return that.obj().destroy_widget(that.id()); }, fetch_details_markup: function() { return that.fetch_markup('widget_details'); }, @@ -12676,10 +12933,14 @@ } }); return that; } + }, + + all: function(root_element) { + return scrivito.cms_element.all('[data-scrivito-private-widget-id]', root_element); } } }); scrivito.cms_element.definitions.push(scrivito.widget_element); @@ -12705,10 +12966,14 @@ return scrivito.cms_element.from_dom_element($(widget_element_dom)); }); return widget_elements; }, + is_empty: function() { + return that.widget_elements().length === 0; + }, + create_widget: function(widget_class, widget_element) { var widget_spec = {create: {_obj_class: widget_class}}; return add_widget(widget_spec, widget_element); }, @@ -12774,14 +13039,12 @@ return that; } }, - all: function() { - return _.map($('[data-scrivito-field-type="widget"]'), function(dom_element) { - return scrivito.cms_element.from_dom_element($(dom_element)); - }); + all: function(root_element) { + return scrivito.cms_element.all('[data-scrivito-field-type="widget"]', root_element); } } }); scrivito.cms_element.definitions.push(scrivito.widget_field_element); @@ -12929,17 +13192,17 @@ }; var target_height_for = function(elem, dont_store_height) { var parent = elem.parent(); var heightOfParent = parent.innerHeight(); - if (!dont_store_height) { parent.data("ip-last_inner_height", heightOfParent); } + if (!dont_store_height) { parent.data("scrivito_last_inner_height", heightOfParent); } var heightOfAllSiblings = _(relevant_siblings_for(elem)) .chain() .map($) .reduce(function(sum, sibling) { var height = sibling.outerHeight(true); - if (!dont_store_height) { sibling.data("ip-last_outer_height", height); } + if (!dont_store_height) { sibling.data("scrivito_last_outer_height", height); } return sum + height; }, 0).value() ; return Math.max(0, heightOfParent - heightOfAllSiblings); }; @@ -12950,11 +13213,11 @@ }; var sibling_height_changes = function(elem) { return _(relevant_siblings_for(elem)).map(function(sibling) { sibling = $(sibling); - var last = sibling.data("ip-last_outer_height"); + var last = sibling.data("scrivito_last_outer_height"); var actual = sibling.outerHeight(true); if (last !== actual) { return scrivito.describe_element(sibling) + " unexpectantly changed it's height from " + (last === undefined ? "<invisible>" : last) + " to " + actual ; @@ -12962,11 +13225,11 @@ }); }; var parent_height_changes = function(elem) { var parent = elem.parent(); - var last = parent.data("ip-last_inner_height"); + var last = parent.data("scrivito_last_inner_height"); var actual = parent.innerHeight(); if (last !== actual) { return scrivito.describe_element(parent) + " unexpectantly changed it's height from " + (last || "<invisible>") + " to " + actual ; @@ -13053,47 +13316,47 @@ } } }); }()); (function() { - var view; - $.extend(scrivito, { - with_overlay: function(promise) { - scrivito.overlay.show(); + with_dialog_overlay: function(dom_element, promise) { + var overlay = scrivito.dialog_overlay.create(dom_element); return promise.always(function() { - scrivito.overlay.hide(); + scrivito.dialog_overlay.destroy(overlay); }); }, - overlay: { - show: function() { - if (!view) { - view = $(scrivito.template.render('overlay')); - $('#ip-editing').append(view); - } + dialog_overlay: { + create: function(dom_element) { + $('.scrivito_overlay').removeClass('scrivito_show'); - scrivito.transition(view, function() { - view.addClass('scrivito_show'); + var overlay = $(scrivito.template.render('overlay')); + dom_element.before(overlay); + + scrivito.transition(overlay, function() { + overlay.addClass('scrivito_show'); }); + + return overlay; }, - hide: function() { - if (view) { - scrivito.transition(view, function() { - view.removeClass('scrivito_show'); - }).then(function() { - view.remove(); - view = null; - }); - } + destroy: function(overlay) { + scrivito.transition(overlay, function() { + overlay.removeClass('scrivito_show'); + }).then(function() { + overlay.remove(); + var last_overlay = $('.scrivito_overlay').last(); + if (last_overlay.length) { + last_overlay.addClass('scrivito_show'); + } + }); }, // Test purpose only. remove_all: function() { $('.scrivito_overlay').remove(); - view = null; } } }); }()); (function() { @@ -13109,11 +13372,11 @@ saving_overlay: { show: function() { if (!view) { view = $(scrivito.template.render('saving_overlay')); - $('#ip-editing').append(view); + $('#scrivito_editing').append(view); } scrivito.transition(view, function() { view.addClass('scrivito_show'); }); @@ -13225,11 +13488,11 @@ icon: '&#xf01d;', cancel_button_text: scrivito.i18n.translate('cancel'), confirm_button_text: scrivito.i18n.translate('confirm') }, options || {}))); - $('#ip-editing').append(view); + $('#scrivito_editing').append(view); var deferred = $.Deferred(); var close = function() { scrivito.transition(view, function() { @@ -13259,11 +13522,11 @@ view.addClass('scrivito_show'); }).then(function() { scrivito.center(view); }); - return scrivito.with_dialog_behaviour(deferred, {enter: accept, escape: cancel}); + return scrivito.with_dialog_behaviour(view, deferred, {enter: accept, escape: cancel}); }, // Test purpose only. remove_all: function() { $('.scrivito_confirmation_dialog').remove(); @@ -13283,11 +13546,11 @@ icon: '&#61468;', accept_button_text: scrivito.i18n.translate('accept'), cancel_button_text: scrivito.i18n.translate('cancel') }, options || {}))); - $('#ip-editing').append(view); + $('#scrivito_editing').append(view); var deferred = $.Deferred(); var close = function() { scrivito.transition(view, function() { @@ -13321,11 +13584,11 @@ view.addClass('scrivito_show'); }).then(function() { scrivito.center(view); }); - return scrivito.with_dialog_behaviour(deferred, {enter: accept, escape: cancel}); + return scrivito.with_dialog_behaviour(view, deferred, {enter: accept, escape: cancel}); } }); }()); (function() { $.extend(scrivito, { @@ -13396,11 +13659,11 @@ scrivito.dialog.close(view); deferred.resolve($(this).attr('data-scrivito-private-obj-class-name')); }); }); - $('#ip-editing').append(view); + $('#scrivito_editing').append(view); var cancel_action = function(e) { e.preventDefault(); scrivito.dialog.close(view); deferred.reject(); @@ -13412,36 +13675,40 @@ view.addClass('scrivito_show'); }); scrivito.dialog.adjust(view); - return scrivito.with_dialog_behaviour(deferred, {escape: cancel_action}); + return scrivito.with_dialog_behaviour(view, deferred, {escape: cancel_action}); } }); }()); (function() { $.extend(scrivito, { details_dialog: { - open: function(title, fetch_markup, icon) { + open: function(options) { var deferred = $.Deferred(); var view = $(scrivito.template.render('details_dialog', - {icon: icon || '&#xf030;', title: title})); + $.extend({icon: '&#xf030;'}, options || {}))); - $('#ip-editing').append(view); + if (options.obj) { + scrivito.obj_menu.create(view.find('.scrivito_obj_menu'), options.obj, options.commands); + } + $('#scrivito_editing').append(view); + var saving_indicator = scrivito.saving_indicator.create( view.find('.scrivito_details_dialog_saving_indicator')); var load_markup = function() { var target = view.find('.scrivito_details_dialog_markup'); var spinner = view.find('.scrivito_modal_body .scrivito_spinning'); target.hide(); spinner.show(); - fetch_markup().then(function(markup) { + options.fetch_markup().then(function(markup) { target.html(markup); var size_attr = 'data-scrivito-modal-size'; var modal_size = $(markup).attr(size_attr) || $(markup).find('[' + size_attr + ']').attr(size_attr); @@ -13474,102 +13741,140 @@ scrivito.dialog.close(view); deferred.resolve(); }; var cancel = function(e) { - e.preventDefault(); saving_indicator.destroy(); close(); + return false; }; view.find('.scrivito_cancel').on('click', cancel); scrivito.transition(view, function() { view.addClass('scrivito_show'); }).then(function() { scrivito.dialog.adjust(view); }); - return scrivito.with_dialog_behaviour(deferred, {escape: cancel}); + return scrivito.with_dialog_behaviour(view, deferred, {escape: cancel}); } } }); }()); (function() { $.extend(scrivito, { menus: { - open: function(dom_element, commands, options) { - scrivito.menus.close_all(); + open: function(dom_element, commands) { + scrivito.close_all_menus(); - var menu = $(scrivito.template.render('menu', { - commands: commands, - options: $.extend({align: 'right'}, options || {}) - })); + var menu = $(scrivito.template.render('menu', {commands: commands})); + dom_element.data('scrivito-private-menu', menu); - menu.data('scrivito-private-menus-target', dom_element); - dom_element.data('scrivito-private-menus-menu', menu); + menu.data('scrivito-menu-close', function() { + dom_element.removeData('scrivito-private-menu'); + menu.fadeOut(500, function() { + menu.remove(); + }); + }); + menu.data('scrivito-menu-update-position', function() { + menu.offset(dom_element.offset()); + }); + _.each(commands, function(command) { - menu.find('.scrivito_menu_item.' + command.id()).on('click', function() { + menu.find('.scrivito_' + command.id()).on('click', function() { if (command.is_enabled()) { - close(menu); + menu.data('scrivito-menu-close')(); } command.execute(); return false; }); }); menu.appendTo($('body')); - menu.offset(dom_element.offset()); // Bugfix IE: offset can not be set before append. + menu.data('scrivito-menu-update-position')(); // Bugfix IE: can't set offset before append. menu.find('.scrivito_menu_box').fadeIn(500); }, - toggle: function(dom_element, commands, options) { - var menu = dom_element.data('scrivito-private-menus-menu'); + toggle: function(dom_element, commands) { + var menu = dom_element.data('scrivito-private-menu'); if (menu) { - close(menu); + menu.data('scrivito-menu-close')(); } else { - scrivito.menus.open(dom_element, commands, options); + scrivito.menus.open(dom_element, commands); } }, - close_all: function() { - each_menu(function(menu) { - close(menu); + update_positions: function() { + _.each($('.scrivito_editing_marker_menu'), function(menu) { + var update_position = $(menu).data('scrivito-menu-update-position'); + if (update_position) { + update_position(); + } }); - }, - - refresh_positions: function() { - each_menu(function(menu) { - menu.offset(menu.data('scrivito-private-menus-target').offset()); - }); } } }); - - var each_menu = function(callback) { - _.each($('.scrivito_editing_marker_menu'), function(menu) { - callback($(menu)); - }); - }; - - var close = function(menu) { - menu.data('scrivito-private-menus-target').removeData('scrivito-private-menus-menu'); - menu.fadeOut(500, function() { - menu.remove(); - }); - }; }()); $(window).on('resize', function() { - scrivito.menus.refresh_positions(); + scrivito.menus.update_positions(); }); $(window).on('load', function() { - scrivito.menus.refresh_positions(); + scrivito.menus.update_positions(); }); (function() { + $.extend(scrivito, { + inline_menus: { + toggle: function(dom_element, commands, align) { + var menu = dom_element.find('.scrivito_editing_marker_menu'); + if (menu.length) { + menu.data('scrivito-menu-close')(); + } else { + open(dom_element, commands, align); + } + } + } + }); + + var open = function(dom_element, commands, align) { + scrivito.close_all_menus(); + + var menu = $(scrivito.template.render('menu', {commands: commands, align: align})); + + menu.data('scrivito-menu-close', function() { + menu.find('.scrivito_menu_box').fadeOut(500, function() { + menu.remove(); + }); + }); + + _.each(commands, function(command) { + menu.find('.scrivito_menu_item.scrivito_' + command.id()).on('click', function() { + if (command.is_enabled()) { + menu.data('scrivito-menu-close')(); + } + command.execute(); + return false; + }); + }); + + menu.appendTo(dom_element); + menu.find('.scrivito_menu_box').fadeIn(500); + }; +}()); +(function() { + $.extend(scrivito, { + close_all_menus: function() { + _.each($('.scrivito_editing_marker_menu'), function(menu) { + $(menu).data('scrivito-menu-close')(); + }); + } + }); +}()); +(function() { var callbacks = []; $.extend(scrivito, { inplace_marker: { init: function() { @@ -13591,11 +13896,11 @@ _.each(callbacks, function(callback) { callback(builder); }); - scrivito.menus.refresh_positions(); + scrivito.menus.update_positions(); } }, // For test purpose only. reset_callbacks: function() { @@ -13632,34 +13937,35 @@ }()); (function() { $.extend(scrivito, { resource_dialog: { init: function(config) { - if (config) { + if (config.obj) { + var obj = scrivito.obj.create_instance(config.obj); scrivito.gui.on('open', function() { - scrivito.resource_dialog.open_and_redirect_on_close(config.obj_id, config.redirect_to); + scrivito.resource_dialog.open(obj).done(function() { + return scrivito.redirect_to(config.return_to); + }); }); } }, - open: function(obj_id) { - var title = scrivito.i18n.translate('resource'); - - var obj = scrivito.obj.create_instance({ - id: obj_id + open: function(obj) { + return scrivito.details_dialog.open({ + title: scrivito.i18n.translate('resource_dialog.title'), + icon: '&#xf03d;', + fetch_markup: function() { + return obj.fetch_details_markup(); + }, + obj: obj, + commands: [ + scrivito.revert_obj_command(obj, 'resource_dialog.commands.revert_obj'), + scrivito.restore_obj_command(obj, 'resource_dialog.commands.restore_obj'), + scrivito.mark_resolved_obj_command(obj, 'resource_dialog.commands.mark_resolved_obj'), + scrivito.delete_obj_command(obj, 'resource_dialog.commands.delete_obj') + ] }); - var fetch_markup = function() { - return obj.fetch_details_markup(); - }; - - return scrivito.details_dialog.open(title, fetch_markup, '&#xf03d;'); - }, - - open_and_redirect_on_close: function(obj_id, redirect_to) { - scrivito.resource_dialog.open(obj_id).done(function() { - return scrivito.redirect_to(redirect_to); - }); } } }); }()); (function() { @@ -13803,14 +14109,18 @@ } }); }()); (function() { $.extend(scrivito, { - delete_obj_command: function(obj) { + delete_obj_command: function(obj, translations_namespace) { + if (!translations_namespace) { + translations_namespace = 'commands.delete_obj'; + } + return scrivito.command.create_instance({ id: 'delete_obj', - title: scrivito.i18n.translate('commands.delete_obj.title'), + title: scrivito.i18n.translate(translations_namespace + '.title'), icon: '&#xf018;', present: function() { return obj && !scrivito.editing_context.is_deleted_mode(); }, @@ -13824,12 +14134,12 @@ } }, execute: function() { return scrivito.confirmation_dialog({ - title: scrivito.i18n.translate('commands.delete_obj.dialog.title'), - description: scrivito.i18n.translate('commands.delete_obj.dialog.description'), + title: scrivito.i18n.translate(translations_namespace + '.dialog.title'), + description: scrivito.i18n.translate(translations_namespace + '.dialog.description'), icon: '&#xf018;', color: 'red', confirm_button_text: scrivito.i18n.translate('commands.delete_obj.dialog.confirm'), confirm_button_color: 'red' }).then(function() { @@ -13874,17 +14184,15 @@ scrivito.inplace_marker.refresh(); } scrivito.widget_sorting.update_placeholder(widget_field_element); - return widget_field_element.save().then(function() { - return widget.destroy().then(function() { - if (scrivito.widget_clipboard.is_present() && - scrivito.widget_clipboard.widget().id() === widget.id()) { - scrivito.widget_clipboard.clear(); - } - }); + return widget.destroy().then(function() { + if (scrivito.widget_clipboard.is_present() && + scrivito.widget_clipboard.widget().id() === widget.id()) { + scrivito.widget_clipboard.clear(); + } }); }); } }); } @@ -13920,24 +14228,28 @@ } }); }()); (function() { $.extend(scrivito, { - mark_resolved_obj_command: function(obj) { + mark_resolved_obj_command: function(obj, translations_namespace) { + if (!translations_namespace) { + translations_namespace = 'commands.mark_resolved_obj'; + } + return scrivito.command.create_instance({ id: 'mark_resolved_obj', - title: scrivito.i18n.translate('commands.mark_resolved_obj.title'), + title: scrivito.i18n.translate(translations_namespace + '.title'), icon: '&#xf124;', present: function() { return obj && obj.has_conflict(); }, execute: function() { return scrivito.confirmation_dialog({ title: scrivito.i18n.translate('commands.mark_resolved_obj.dialog.title'), - description: scrivito.i18n.translate('commands.mark_resolved_obj.dialog.description'), + description: scrivito.i18n.translate(translations_namespace + '.dialog.description'), icon: '&#xf124;', color: 'red', confirm_button_text: scrivito.i18n.translate('commands.mark_resolved_obj.dialog.confirm'), confirm_button_color: 'red' }).then(function() { @@ -13992,41 +14304,91 @@ present: function() { return obj.has_details_view(); }, execute: function() { - var title = scrivito.i18n.translate('current_page'); - var fetch_markup = function() { - return obj.fetch_details_markup(); - }; - return scrivito.write_monitor.track_changes(function() { - return scrivito.details_dialog.open(title, fetch_markup, '&#xf03d;'); + return scrivito.details_dialog.open({ + title: scrivito.i18n.translate('current_page'), + icon: '&#xf03d;', + fetch_markup: function() { + return obj.fetch_details_markup(); + } + }); }, function() { return scrivito.with_saving_overlay(scrivito.reload()); }); } }); } }); }()); (function() { $.extend(scrivito, { - restore_obj_command: function(obj) { + publish_workspace_command: function(workspace) { + var t = scrivito.i18n.translate; + var workspace_title = workspace.title() || + t('menu_bar.empty_workspace_title'); + return scrivito.command.create_instance({ + id: 'scrivito_publish_current_ws', + title: t('commands.publish_workspace.title', workspace_title), + icon: '&#xf064;', + tooltip: t('commands.publish_workspace.title', workspace_title), + disabled: function() { + if (!scrivito.user_permissions.can("publish_workspace")) { + return t('commands.publish_workspace.permission_denied'); + } + }, + execute: function() { + if (scrivito.user_permissions.can("publish_workspace")) { + scrivito.workspace_select.close_menu(); + + scrivito.confirmation_dialog({ + icon: '&#xf064;', + color: 'green', + confirm_button_text: t('commands.publish_workspace.dialog.confirm'), + confirm_button_color: 'green', + title: t('commands.publish_workspace.dialog.title', workspace_title), + description: t('commands.publish_workspace.dialog.description') + }).done(function() { + scrivito.with_saving_overlay( + workspace.publish().then(function() { + return scrivito.redirect_to('?_scrivito_workspace_id=published'); + }) + ); + }); + } + return false; + } + }); + } + }); +}()); +(function() { + $.extend(scrivito, { + restore_obj_command: function(obj, translations_namespace) { + if (!translations_namespace) { + translations_namespace = 'commands.restore_obj'; + } + + return scrivito.command.create_instance({ id: 'restore_obj', - title: scrivito.i18n.translate('commands.restore_obj.title'), + title: scrivito.i18n.translate(translations_namespace + '.title'), icon: '&#xf032;', present: function() { return obj && obj.is_deleted(); }, disabled: function() { if (scrivito.editing_context.selected_workspace.is_rtc()) { - return scrivito.i18n.translate('commands.restore_obj.rtc_workspace'); + return scrivito.i18n.translate(translations_namespace + '.rtc_workspace'); } + if (obj.is_binary()) { + return scrivito.i18n.translate('commands.restore_obj.is_binary'); + } }, execute: function() { return scrivito.with_saving_overlay(obj.restore().then(function() { scrivito.reload(); @@ -14036,14 +14398,18 @@ } }); }()); (function() { $.extend(scrivito, { - revert_obj_command: function(obj) { + revert_obj_command: function(obj, translations_namespace) { + if (!translations_namespace) { + translations_namespace = 'commands.revert_obj'; + } + return scrivito.command.create_instance({ id: 'revert_obj', - title: scrivito.i18n.translate('commands.revert_obj.title'), + title: scrivito.i18n.translate(translations_namespace + '.title'), icon: '&#xf032;', present: function() { return obj && !obj.is_deleted(); }, @@ -14051,23 +14417,26 @@ disabled: function() { if (!scrivito.editing_context.selected_workspace.is_editable()) { return scrivito.i18n.translate('commands.revert_obj.published_workspace'); } if (scrivito.editing_context.selected_workspace.is_rtc()) { - return scrivito.i18n.translate('commands.revert_obj.rtc_workspace'); + return scrivito.i18n.translate(translations_namespace + '.rtc_workspace'); } if (!obj.modification()) { - return scrivito.i18n.translate('commands.revert_obj.not_modified_obj'); + return scrivito.i18n.translate(translations_namespace + '.not_modified_obj'); } if (obj.is_new()) { - return scrivito.i18n.translate('commands.revert_obj.new_obj'); + return scrivito.i18n.translate(translations_namespace + '.new_obj'); } + if (obj.is_binary()) { + return scrivito.i18n.translate('commands.revert_obj.is_binary'); + } }, execute: function() { return scrivito.confirmation_dialog({ - title: scrivito.i18n.translate('commands.revert_obj.dialog.title'), + title: scrivito.i18n.translate(translations_namespace + '.dialog.title'), description: scrivito.i18n.translate('commands.revert_obj.dialog.description'), icon: '&#xf032;', color: 'red', confirm_button_text: scrivito.i18n.translate('commands.revert_obj.dialog.confirm'), confirm_button_color: 'red' @@ -14226,55 +14595,131 @@ return scrivito.i18n.translate('commands.widget_details.no_details_view'); } }, execute: function() { - var dialog_title = widget_element.widget().widget_class_name(); - var fetch_markup = function() { - return widget_element.fetch_details_markup(); - }; - return scrivito.write_monitor.track_changes(function() { - return scrivito.details_dialog.open(dialog_title, fetch_markup); + return scrivito.details_dialog.open({ + title: widget_element.widget().widget_class_name(), + fetch_markup: function() { + return widget_element.fetch_details_markup(); + } + }); }, function() { widget_element.dom_element().trigger('scrivito_reload'); }); } }); } }); }()); (function() { $.extend(scrivito, { - widget_menus: { + child_list_commands: { init: function() { - scrivito.inplace_marker.define(function(inplace_marker) { - if (scrivito.editing_context.selected_workspace.is_editable()) { - _.each(scrivito.widget_field_element.all(), function(widget_field_element) { + if (scrivito.editing_context.is_editing_mode()) { + scrivito.on('content', function(content) { + _.each(scrivito.child_list_element.all($(content)), function(child_list_element) { + child_list_element.set_menu([ + scrivito.add_subpage_command(child_list_element), + scrivito.copy_page_from_clipboard_command(child_list_element), + scrivito.move_page_from_clipboard_command(child_list_element), + scrivito.sort_items_command(child_list_element) + ].concat(child_list_element.menu())); + }); + }); + } + } + } + }); +}()); +(function() { + $.extend(scrivito, { + widget_commands: { + init: function() { + if (!scrivito.editing_context.is_view_mode()) { + scrivito.on('content', function(content) { + _.each(scrivito.widget_element.all($(content)), function(widget_element) { + var widget_field_element = widget_element.widget_field(); + widget_element.set_menu([ + scrivito.add_widget_command(widget_field_element, widget_element), + scrivito.widget_details_command(widget_element), + scrivito.save_widget_to_clipboard_command(widget_element), + scrivito.copy_widget_from_clipboard_command(widget_field_element, widget_element), + scrivito.delete_widget_command(widget_field_element, widget_element) + ].concat(widget_element.menu())); + }); + }); + } + } + } + }); +}()); +(function() { + $.extend(scrivito, { + widget_field_commands: { + init: function() { + if (scrivito.editing_context.is_editing_mode()) { + scrivito.on('content', function(content) { + _.each(scrivito.widget_field_element.all($(content)), function(widget_field_element) { widget_field_element.set_menu([ scrivito.add_widget_command(widget_field_element), scrivito.copy_widget_from_clipboard_command(widget_field_element) - ]); - - if (scrivito.editing_context.is_editing_mode() && - widget_field_element.widget_elements().length === 0) { + ].concat(widget_field_element.menu())); + }); + }); + } + } + } + }); +}()); +(function() { + $.extend(scrivito, { + child_list_marker: { + init: function() { + scrivito.inplace_marker.define(function(inplace_marker) { + if (scrivito.editing_context.is_editing_mode()) { + _.each(scrivito.child_list_element.all(), function(child_list_element) { + var description = scrivito.i18n.translate('child_list_menu.description', + child_list_element.obj().description_for_editor()); + inplace_marker.activate_for(child_list_element, {description: description}); + }); + } + }); + } + } + }); +}()); +(function() { + $.extend(scrivito, { + widget_field_marker: { + init: function() { + scrivito.inplace_marker.define(function(inplace_marker) { + if (scrivito.editing_context.is_editing_mode()) { + _.each(scrivito.widget_field_element.all(), function(widget_field_element) { + if (widget_field_element.is_empty()) { inplace_marker.activate_for(widget_field_element); } - + }); + } + }); + } + } + }); +}()); +(function() { + $.extend(scrivito, { + widget_marker: { + init: function() { + scrivito.inplace_marker.define(function(inplace_marker) { + if (scrivito.editing_context.selected_workspace.is_editable()) { + _.each(scrivito.widget_field_element.all(), function(widget_field_element) { _.each(widget_field_element.widget_elements(), function(widget_element) { - widget_element.set_menu([ - scrivito.add_widget_command(widget_field_element, widget_element), - scrivito.widget_details_command(widget_element), - scrivito.save_widget_to_clipboard_command(widget_element), - scrivito.copy_widget_from_clipboard_command(widget_field_element, widget_element), - scrivito.delete_widget_command(widget_field_element, widget_element) - ]); - - var modification = widget_element.widget().modification() || + var is_modified = widget_element.widget().modification() || widget_element.widget().container_modification(); if (scrivito.editing_context.is_editing_mode() || - scrivito.editing_context.is_comparing_mode() && !!modification) { + scrivito.editing_context.is_comparing_mode() && is_modified) { inplace_marker.activate_for(widget_element, inplace_marker_options(widget_element)); } }); }); @@ -14327,11 +14772,11 @@ break; } } if (tooltip_translation_key) { - options.tooltip = scrivito.i18n.translate('widget_menus.' + tooltip_translation_key); + options.tooltip = scrivito.i18n.translate('widget_marker.' + tooltip_translation_key); } } options.description = widget_element.widget().description_for_editor(); @@ -14392,11 +14837,11 @@ }, start: function(event, ui) { $('body').addClass('scrivito_widget_dragging_active'); - scrivito.menus.close_all(); + scrivito.close_all_menus(); var widget_element = scrivito.cms_element.from_dom_element(ui.item); var widget_class_name = widget_element.widget().widget_class_name(); _.each(widget_field_elements, function(widget_field_element) { var dom_element = widget_field_element.dom_element(); @@ -14508,35 +14953,10 @@ } }; }()); (function() { $.extend(scrivito, { - child_list_menus: { - init: function() { - scrivito.inplace_marker.define(function(inplace_marker) { - if (scrivito.editing_context.visible_workspace.is_editable() && - scrivito.editing_context.is_editing_mode()) { - _.each(scrivito.child_list_element.all(), function(child_list_element) { - child_list_element.set_menu([ - scrivito.add_subpage_command(child_list_element), - scrivito.copy_page_from_clipboard_command(child_list_element), - scrivito.move_page_from_clipboard_command(child_list_element), - scrivito.sort_items_command(child_list_element) - ]); - - var description = scrivito.i18n.translate('child_list_menu.description', - child_list_element.obj().description_for_editor()); - inplace_marker.activate_for(child_list_element, {description: description}); - }); - } - }); - } - } - }); -}()); -(function() { - $.extend(scrivito, { hotkeys: { add_actions_while: function(promise, key_map) { var key_actions = { 13: key_map.enter, // enter key 27: key_map.escape // escape key @@ -14556,14 +14976,13 @@ } }); }()); (function() { $.extend(scrivito, { - with_dialog_behaviour: function(promise, key_map) { - return scrivito.with_overlay( - scrivito.hotkeys.add_actions_while(promise, key_map) - ); + with_dialog_behaviour: function(dom_element, promise, key_map) { + return scrivito.with_dialog_overlay(dom_element, + scrivito.hotkeys.add_actions_while(promise, key_map)); } }); }()); (function() { @@ -14572,10 +14991,11 @@ init: function() { scrivito.on('load', function() { if (scrivito.in_editable_view()) { activate_for_field_type('linklist'); activate_for_field_type('reference'); + activate_for_field_type('link'); } }); // Disable DnD for all elements by default to prevent the user // from accidentally opening an image in browser. @@ -14604,16 +15024,22 @@ return scrivito.create_obj({blob: file, _path: path, _obj_class: 'Image'}); }; scrivito.with_saving_overlay(create_image(file).then(function(obj) { var field_value; - if (field_type === 'reference') { - field_value = obj.id; - } else if (field_type === 'linklist') { - field_value = [{obj_id: obj.id}]; - } else { - $.error('Field type must be "reference" or "linklist".'); + switch(field_type) { + case 'reference': + field_value = obj.id; + break; + case 'linklist': + field_value = [{obj_id: obj.id}]; + break; + case 'link': + field_value = {obj_id: obj.id}; + break; + default: + $.error('Field type must be "reference", "linklist" or "link".'); } return dom_element.scrivito('save', field_value).then(function() { dom_element.trigger('scrivito_reload'); }); @@ -14654,11 +15080,11 @@ open: function(workspaces) { var view = $(scrivito.template.render('editable_workspace_dialog', { workspaces: workspaces })); - $('#ip-editing').append(view); + $('#scrivito_editing').append(view); var create_new_ws = false; view.on('focus click', '.scrivito_input_list_of_ws', function(e) { create_new_ws = false; @@ -14713,11 +15139,11 @@ } else { view.find('.scrivito_input_list_of_ws').click(); view.find('#scrivito_list_of_ws').focus(); } - return scrivito.with_dialog_behaviour(deferred, { + return scrivito.with_dialog_behaviour(view, deferred, { enter: confirm_action, escape: cancel_action }); } }); @@ -14731,11 +15157,11 @@ var view = $(scrivito.template.render('obj_sorting_dialog', { icon: '\uF03C', child_list: child_list })); - $('#ip-editing').append(view); + $('#scrivito_editing').append(view); $('#scrivito_obj_sorting_sortable').sortable({ placeholder: 'scrivito_obj_sorting_placeholder' }); var deferred = $.Deferred(); @@ -14769,11 +15195,11 @@ view.addClass('scrivito_show'); }).then(function() { scrivito.dialog.adjust(view); }); - return scrivito.with_dialog_behaviour(deferred, { + return scrivito.with_dialog_behaviour(view, deferred, { enter: confirm_action, escape: cancel_action }); } } @@ -14909,14 +15335,24 @@ + + + + // // + +// + + + +//