diff --git a/index.py b/index.py index 49cdfca..5ab66d6 100644 --- a/index.py +++ b/index.py @@ -146,8 +146,19 @@ def cms_page(): _html = e.render(**_args) return _html,200 - - +@_app.route('/page') +def _cms_page (): + global _config + _uri = request.args['uri'] + _uri = os.sep.join([_config['layout']['root'],_uri]) + _title = request.args['title'] if 'title' in request.args else '' + _args = {'system':_config['system']} + if 'plugins' in _config: + _args['routes'] = _config['plugins'] + + _html = cms.components.html(_uri,_title,_args) + e = Environment(loader=BaseLoader()).from_string(_html) + return e.render(**_args),200 # # Let us bootup the application SYS_ARGS = {} diff --git a/static/js/menu.js b/static/js/menu.js index 0a55384..fd8c553 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -57,7 +57,7 @@ menu.apply_link =function(_args){ // redirect open new window // dialog open in a dialog // - console.log(_args) + var url = _args['url'] _args.type = (_args.type == null)? 'redirect' :_args.type diff --git a/static/js/search.js b/static/js/search.js index f3b27fc..2baac41 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -1,5 +1,36 @@ var search = {} -search.find = function(id,_domid){ +search.find = function(id,_domid,_attr){ + var nodes = jx.dom.get.children(id) + jx.dom.set.focus(_domid) + var term = jx.dom.get.value(_domid).trim() + term = term == ''?'*':term + if (term.length < 2){ + $(nodes).show() + jx.dom.set.value('found',nodes.length) + return ;} + $(nodes).hide() + term = RegExp(term.replace(/ /,'|'),'ig') + _count = 0 + jx.utils.patterns.visitor (nodes,function(_node){ + + var _data = _node.getAttribute('data') ; + if (_data[0] == '{' || _data[0] == '['){ + _data = JSON.parse(_data) + _found = 0 + _attr.forEach(function(_name){ + _found += _data[_name].match(term) !=null?1:0 + }) + }else{ + _found = _data.match(term)!=null?1:0 + } + _count += _found + if (_found > 0){ + $(_node).show() + } + }) + jx.dom.set.value('found',_count) +} +search._find = function(id,_domid){ var nodes = jx.dom.get.children(id) $(nodes).hide() jx.dom.set.focus(_domid) @@ -50,4 +81,5 @@ search.find = function(id,_domid){ }) -} \ No newline at end of file +} +