Skip to content
Snippets Groups Projects
Commit cef78f16 authored by Mark M. Florida's avatar Mark M. Florida
Browse files

Cleanup and tweaks.

parent 759199b2
No related branches found
No related tags found
No related merge requests found
......@@ -30,55 +30,7 @@
</div>
<script>
(function(){
function fixSlashes(str){
var HTTP = /^http:\/+/i;
var HTTPS = /^https:\/+/i;
var FTP = /^ftp:\/+/i;
// initially remove multiple slashes
str = str.replace(/\/+/g, '/');
// if there's a protocol specified,
// restore '//' to that
if (HTTP.test(str)) {
str = str.replace(HTTP, 'http://')
}
else if (HTTPS.test(str)) {
str = str.replace(HTTPS, 'https://')
}
else if (FTP.test(str)) {
str = str.replace(FTP, 'ftp://')
}
return str;
}
function setUrl(url){
return XNAT.url.rootUrl(url);
//return fixSlashes(PAGE.siteRoot + url);
}
function dataUrl(url){
return setUrl('/page/admin/data' + url);
}
var getTabs = $.getJSON({
url: dataUrl('/config/site-admin-sample-new.json'),
success: function(obj){
var adminTabs = XNAT.spawner.spawn(obj);
adminTabs.render('#admin-config-tabs', true);
}
});
})();
</script>
<script src="${sessionScope.siteRoot}/page/admin/tabs.js"></script>
</div>
......@@ -86,24 +38,6 @@
</div>
<!-- /#page-body -->
<div id="page-footer">
<div class="pad">
<div id="mylogger"></div>
</div>
</div>
<!-- /#page-footer -->
<div id="sticky-footer">
<div>
<div class="pad">
<a class="xnat-version" target="_blank" href="http://www.xnat.org/" style="">XNAT v1.7</a>
<a id="xnat_power" class="pull-right" target="_blank" href="http://www.xnat.org/" style="">
<img src="${sessionScope.siteRoot}/images/xnat_power_small.jpg">
</a>
</div>
</div>
</div>
<div id="xnat-scripts">
<script>
// $(window).load(function(){
......
......@@ -11,24 +11,19 @@ root:
projectCustomization: Project Customization
advanced: Advanced XNAT Settings
contains: tabs
tabs: # this property name is the same as 'contains', so it will be treated like 'contents'
siteSetup:
kind: tab
name: siteSetup
label: Site Setup
group: xnatSetup
contains: panels # the value for 'contains' can be a custom name for 'contents'
panels:
siteInfo:
kind: panel.form
name: siteInfo
label: Site Information
contents:
siteId:
kind: input.text
name: siteId
......@@ -38,12 +33,10 @@ root:
id: site-id
style:
display: block
adminEmail:
kind: input.email
name: adminEmail
label: Administrator Email Address
someInfo:
#kind: element
tag: div.message
......@@ -52,3 +45,35 @@ root:
style:
padding: 20px
color: red
security:
kind: tab
name: security
label: Security
contents:
generalSecuritySettings:
kind: panel.form
name: generalSecuritySettings
label: General Site Security Settings
contents:
securityChannel:
kind: element
tag: select
name: securityChannel
label: Security Channel
contains: options
options:
http:
tag: option
name: http
value: http
https:
tag: option
name: https
value: https
config:
id: security-channel
title: Security Channel
......@@ -26,7 +26,8 @@
success: function(data){
var json = YAML.parse(data);
var adminTabs = XNAT.spawner.spawn(json);
console.log(adminTabs);
adminTabs.render('#admin-config-tabs > .xnat-tab-content');
XNAT.app.adminTabs = adminTabs;
}
});
......
......@@ -331,6 +331,10 @@
// alias for convenience
el.html = el.outerHTML;
el.get = function(){
return el;
};
return el;
}
......
......@@ -101,7 +101,9 @@ var XNAT = getObject(XNAT);
// only spawn elements with defined methods
if (isFunction(method)) {
// 'spawnedElement' item will be an HTML element
// 'spawnedElement' item will be an
// object with a .get() method that
// will retrieve the spawned item
spawnedElement = method(prop);
// add spawnedElement to the master frag
......@@ -121,6 +123,7 @@ var XNAT = getObject(XNAT);
// a property matching the value of either 'contains' or 'kind'
if (prop.contains || prop.contents || prop.content || prop.children || prop[prop.kind]) {
prop.contents = prop[prop.contains] || prop.contents || prop.content || prop.children || prop[prop.kind];
// if there's a 'target' property, put contents in there
if (spawnedElement.target) {
$spawnedElement = $(spawnedElement.target);
}
......@@ -133,13 +136,18 @@ var XNAT = getObject(XNAT);
});
_spawn.spawned = frag;
_spawn.element = frag;
_spawn.children = $frag.contents();
_spawn.children = frag.children;
_spawn.get = function(){
return frag;
};
_spawn.getContents = function(){
return $frag.contents();
};
_spawn.render = function(element, empty){
var $el = $$(element);
......@@ -153,13 +161,6 @@ var XNAT = getObject(XNAT);
_spawn.foo = '(spawn.foo)';
// console.log('spawned:')
// console.log(frag);
console.log('children:');
console.log(_spawn.children);
// console.log('get():')
// console.log(_spawn.get());
return _spawn;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment