From dfce3c461f3ef5ab97ff51b5456624b82059f7ac Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 8 Nov 2011 17:22:07 +0000 Subject: [PATCH] add special column to rights management column of site dialog tab --- static/js/pandora/siteDialog.js | 42 +++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/static/js/pandora/siteDialog.js b/static/js/pandora/siteDialog.js index ca393c63..951c3e3f 100644 --- a/static/js/pandora/siteDialog.js +++ b/static/js/pandora/siteDialog.js @@ -28,6 +28,7 @@ pandora.ui.siteDialog = function(section) { pandora.$ui.contactForm = pandora.ui.contactForm().appendTo($content); } else { pandora.api.getPage({name: id}, function(result) { + var $column, risk; Ox.Editable({ clickLink: pandora.clickLink, editable: pandora.site.capabilities.canEditSitePages[pandora.user.level], @@ -35,7 +36,13 @@ pandora.ui.siteDialog = function(section) { type: 'textarea', value: result.data.body }) - .css({width: '100%'/*, height: '100%'*/}) + .css(id == 'rights' ? { + // this will get applied twice, + // total is 144px + marginRight: '72px' + } : { + width: '100%' + }) .bindEvent({ submit: function(data) { Ox.Request.clearCache('getPage'); @@ -45,7 +52,38 @@ pandora.ui.siteDialog = function(section) { }); } }) - .appendTo($content) + .appendTo($content); + if (id == 'rights') { + $column = $('
') + .css({position: 'absolute', top: '16px', right: '16px', width: '128px'}) + .appendTo($content); + $('') + .attr({src: '/static/png/rights.png'}) + .css({width: '128px', height: '128px', marginBottom: '8px'}) + .appendTo($column); + risk = ['Unknown', 'Severe', 'High', 'Significant', 'General', 'Low']; + Ox.merge( + ['Unknown'], + pandora.site.rightsLevels.map(function(rightsLevel) { + return rightsLevel.name; + }).reverse() + ).forEach(function(name, i) { + Ox.Theme.formatColor(330 + 30 * i, 'gradient') + .css({ + padding: '4px', + marginTop: '8px', + }) + .html( + '' + name + '
' + + risk[i] + ' Risk' + + (i % 3 == 0 ? '
of ' : ' of
') + + 'Legal Action
' + ) + .appendTo($column); + }) + pandora.site.rightsLevels.forEach(function(rightsLevel) { + }); + } }); } return Ox.SplitPanel({