From 8fb886cc2df636fd42cb075254f986c500e3e50f Mon Sep 17 00:00:00 2001 From: Egil Moeller Date: Sat, 10 Apr 2010 02:17:24 +0200 Subject: Separated the padpage into a common part (page.ejs) and an inheriting part adding actual pad stuff. --- etherpad/src/etherpad/utils.js | 4 +- etherpad/src/templates/pad/pad_body2.ejs | 981 ++++++++++++++----------------- etherpad/src/templates/page.ejs | 139 +++++ 3 files changed, 594 insertions(+), 530 deletions(-) create mode 100644 etherpad/src/templates/page.ejs (limited to 'etherpad') diff --git a/etherpad/src/etherpad/utils.js b/etherpad/src/etherpad/utils.js index 83a1ec4..57ca5de 100644 --- a/etherpad/src/etherpad/utils.js +++ b/etherpad/src/etherpad/utils.js @@ -79,8 +79,10 @@ Template.prototype.define = function(name, fn) { Template.prototype.use = function (name, fn, arg) { if (this._defines[name] != undefined) return this._defines[name](arg); - else + else if (fn != undefined) return fn(arg); + else + return ''; } Template.prototype.inherit = function (template) { diff --git a/etherpad/src/templates/pad/pad_body2.ejs b/etherpad/src/templates/pad/pad_body2.ejs index 0eb9029..a19e685 100644 --- a/etherpad/src/templates/pad/pad_body2.ejs +++ b/etherpad/src/templates/pad/pad_body2.ejs @@ -13,564 +13,487 @@ distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ %> -<% helpers.setHtmlTitle("EtherPad: "+pageTitle); %> -<% helpers.setBodyId("padbody") %> -<% helpers.addBodyClass(bodyClass) %> -<% helpers.includeCss("pad2_ejs.css") %> -<% helpers.includeJs("undo-xpopup.js") %> -<% helpers.includeCometJs() %> -<% helpers.includeJQuery(); %> -<% helpers.includeJs("json2.js") %> -<% helpers.includeJs("colorutils.js") %> -<% helpers.includeJs("ace.js") %> -<% helpers.includeJs("collab_client.js") %> -<% helpers.includeJs("draggable.js") %> -<% helpers.includeJs("pad_utils.js") %> -<% helpers.includeJs("pad_cookie.js") %> -<% helpers.includeJs("pad_editor.js") %> -<% helpers.includeJs("pad_userlist.js") %> -<% helpers.includeJs("pad_editbar.js") %> -<% helpers.includeJs("pad_chat.js") %> -<% helpers.includeJs("pad_docbar.js") %> -<% helpers.includeJs("pad_impexp.js") %> -<% helpers.includeJs("pad_savedrevs.js") %> -<% helpers.includeJs("pad_connectionstatus.js") %> -<% helpers.includeJs("pad_modals.js") %> -<% helpers.includeJs("pad2.js") %> -<% helpers.suppressGA() %> -<% helpers.setRobotsPolicy({index: false, follow: false}) %> -<% - var padUrlAttrValue = request.url.split("?", 1)[0].replace(/\"/g, '"'); //" -%> + +<% template.inherit('page.ejs') %> <% - function exportLink(type, n, label, requiresOffice, url, title) { - url = url || '/ep/pad/export/'+localPadId+'/latest?format='+type; - var classes = ["exportlink", "exporthref"+type, "n"+n]; - if (requiresOffice && !hasOffice) { - classes.push("disabledexport"); - } - else { - classes.push("requiresoffice"); - } - var pieces = ['', label); - /* if (title) { - pieces.push('?'); - }*/ - pieces.push(''); - return pieces.join(''); - } + helpers.setHtmlTitle("EtherPad: "+pageTitle); + helpers.includeJs("ace.js"); + helpers.includeJs("collab_client.js"); + helpers.includeJs("pad_userlist.js"); + helpers.includeJs("pad_chat.js"); + helpers.includeJs("pad_impexp.js"); + helpers.includeJs("pad_savedrevs.js"); + helpers.includeJs("pad_connectionstatus.js"); + + var padUrlAttrValue = request.url.split("?", 1)[0].replace(/\"/g, '"'); + + function exportLink(type, n, label, requiresOffice, url, title) { + url = url || '/ep/pad/export/'+localPadId+'/latest?format='+type; + var classes = ["exportlink", "exporthref"+type, "n"+n]; + if (requiresOffice && !hasOffice) { + classes.push("disabledexport"); + } + else { + classes.push("requiresoffice"); + } + var pieces = ['', label); + /* if (title) { + pieces.push('?'); + }*/ + pieces.push(''); + return pieces.join(''); + } %> -
- -
-
- <% /* floated left */ %> -
- <% /* New Pad */ %> - <% /* floated right */ %> -
- <% /* Toggle Width */ %> - <% /* non-floated */ %> -
- EtherPad -
-<% if (isProAccountHolder) { %> - Return to pad list -
<%= toHTML(account.email) %> - (sign out) -
-<% } else if (isPro) { %> -
- sign in -
-<% } %> -
-
-
-
-

Server Notice:

- hide -

+ +<% template.define('docBarTitleEditor', function() { var ejs_data=''; %> + <% if (isProAccountHolder) { %> + + <% } /* isProAccountHolder */ %> + +
+ Save + Cancel
+<% return ejs_data; }); %> + -
- - - - - - <% - plugins.callHookStr('docbarItemsAll', {}, '', ''); - plugins.callHookStr('docbarItemsPad', {}, '', ''); - %> - <% if (isProAccountHolder) { %> - - <% } /* isProAccountHolder */ %> - - - - - - -
<%= initialTitle %> ', '', ' - - Security - - - - Pad Options - - - Import/Export - - - Saved revisions - - - Time Slider -
- <% if (isProAccountHolder) { %> -