Implemented first basic version of layout option for switching display of skin edit controls, ie. a button that appears next to every editable skin and directly leads to the skin editor when clicked.
This commit is contained in:
parent
99b771f8af
commit
b21d98211e
9 changed files with 154 additions and 15 deletions
|
@ -25,9 +25,14 @@ $(function() {
|
|||
...
|
||||
<% layout.link images <% gettext Images %> %>
|
||||
<% layout.link skins <% gettext Skins %> prefix=" | " %>
|
||||
<% //layout.link sandbox <% gettext Sandbox %> prefix=" | " %>
|
||||
<br /><br />
|
||||
<form id="prefs" method="post" action="<% response.action %>">
|
||||
<table border="0" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td class='small'>Show Controls:</td>
|
||||
<td><input name='sandbox' type='checkbox' <% if <% layout.sandbox %> is true then checked %>></td>
|
||||
</tr>
|
||||
<% layout.values %>
|
||||
<tr id="addValueFields">
|
||||
<td id="newKey" class="small"></td>
|
||||
|
|
|
@ -93,6 +93,22 @@ Layout.remove = function(options) {
|
|||
return;
|
||||
}
|
||||
|
||||
Layout.sandbox = function(value) {
|
||||
var cookie = User.COOKIE + 'LayoutSandbox';
|
||||
var id = res.handlers.site._id;
|
||||
if (typeof value === 'undefined') {
|
||||
return req.cookies[cookie] === id;
|
||||
}
|
||||
if (value === true) {
|
||||
res.setCookie(cookie, id);
|
||||
//session.data.layout = new Layout;
|
||||
} else if (value === false) {
|
||||
res.unsetCookie(cookie);
|
||||
//delete session.data.layout;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
|
@ -140,6 +156,7 @@ Layout.prototype.getPermission = function(action) {
|
|||
case "import":
|
||||
case "reset":
|
||||
case "skins":
|
||||
case "sandbox":
|
||||
return res.handlers.site.getPermission("main") &&
|
||||
Membership.require(Membership.OWNER) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
|
@ -216,6 +233,9 @@ Layout.prototype.update = function(data) {
|
|||
}
|
||||
res.write("\n");
|
||||
skin.setSource(res.pop());
|
||||
|
||||
Layout.sandbox(!!data.sandbox);
|
||||
|
||||
this.description = data.description;
|
||||
this.mode = data.mode;
|
||||
this.touch();
|
||||
|
@ -297,6 +317,17 @@ Layout.prototype.import_action = function() {
|
|||
return;
|
||||
}
|
||||
|
||||
Layout.prototype.sandbox_action = function() {
|
||||
Layout.sandbox(!Layout.sandbox());
|
||||
res.redirect(req.data.http_referer);
|
||||
return;
|
||||
}
|
||||
|
||||
Layout.prototype.sandbox_macro = function() {
|
||||
res.write(Layout.sandbox());
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue