knowledge base cleanup
This commit is contained in:
parent
5fc06554ff
commit
edab76b274
@ -1735,7 +1735,6 @@ body {
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-weight: normal;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
@ -3571,7 +3570,6 @@ div.appframe-toolbar {
|
||||
*/
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
|
||||
font-weight: normal;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
|
@ -1215,7 +1215,6 @@ body {
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-weight: normal;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
@ -1888,7 +1887,6 @@ div.appframe-toolbar {
|
||||
*/
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
|
||||
font-weight: normal;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
|
@ -116,59 +116,68 @@ EditableText = function(args) {
|
||||
$.extend(this, args);
|
||||
var me = this;
|
||||
|
||||
this.wrapper = $a(me.parent, 'div');
|
||||
this.display = $a(me.wrapper, 'div', me.disp_class, '', me.text);
|
||||
this.input = $a(me.wrapper, 'textarea', me.inp_class, {display:'none'});
|
||||
me.$w = $(repl('<div class="ed-text">\
|
||||
<div class="ed-text-display %(disp_class)s"></div>\
|
||||
<a class="ed-text-edit" style="cursor: pointer; float: right;">[edit]</a>\
|
||||
<textarea class="ed-text-input %(inp_class)s hide"></textarea><br>\
|
||||
<div class="help hide">Formatted as <a href="http://en.wikipedia.org/wiki/Markdown#Syntax_examples"\
|
||||
target="_blank">markdown</div>\
|
||||
<button class="btn btn-small btn-info hide ed-text-save">Save</button>\
|
||||
<a class="ed-text-cancel hide" style="cursor: pointer;">Cancel</a>\
|
||||
</div>', args)).appendTo(me.parent);
|
||||
|
||||
var div = $a(me.wrapper, 'div', '', {marginTop:'5px', height:'23px'});
|
||||
|
||||
// edit text
|
||||
this.edit_btn = $a(div, 'a', '', {cursor:'pointer'}, '[edit]');
|
||||
|
||||
this.edit_btn.onclick = function() {
|
||||
me.input.value = me.display.innerHTML;
|
||||
me.show_as_input();
|
||||
this.set_display = function(txt) {
|
||||
me.$w.find('.ed-text-display').html(wn.markdown(txt));
|
||||
me.text = txt;
|
||||
}
|
||||
|
||||
this.set_display(me.text);
|
||||
|
||||
if(me.height) me.$w.find('.ed-text-input').css('height', me.height);
|
||||
|
||||
// edit
|
||||
me.$w.find('.ed-text-edit').click(function() {
|
||||
me.$w.find('.ed-text-input').val(me.text);
|
||||
me.show_as_input();
|
||||
})
|
||||
|
||||
// save button - save the new text
|
||||
// check if text is written
|
||||
this.save_btn = $btn(div, 'Save', function() {
|
||||
var v = me.rich_text ? wn.tinymce.get_value(me.input) : me.input.value;
|
||||
if(!v) {
|
||||
msgprint('Please write something!');
|
||||
return;
|
||||
me.$w.find('.ed-text-save').click(
|
||||
function() {
|
||||
var v = me.$w.find('.ed-text-input').val();
|
||||
// check if text is written
|
||||
if(!v) {
|
||||
msgprint('Please write something!');
|
||||
return;
|
||||
}
|
||||
var btn = this;
|
||||
$(btn).set_working();
|
||||
$c_page('knowledge_base', 'question_view', 'update_item', {
|
||||
dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
|
||||
},
|
||||
function(r) {
|
||||
$(btn).done_working();
|
||||
if(r.exc) {msgprint(r.exc); return; }
|
||||
me.set_display(v);
|
||||
me.show_as_text();
|
||||
});
|
||||
}
|
||||
me.save_btn.set_working();
|
||||
$c_page('knowledge_base', 'question_view', 'update_item', {
|
||||
dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
|
||||
},
|
||||
function(r, rt) {
|
||||
me.save_btn.done_working();
|
||||
if(r.exc) {msgprint(r.exc); return; }
|
||||
me.display.innerHTML = v;
|
||||
me.show_as_text();
|
||||
});
|
||||
}, {display: 'none'});
|
||||
)
|
||||
|
||||
|
||||
// cancel button
|
||||
this.cancel_btn = $a(div, 'span', 'link_type', {color: '#555', display:'none'}, 'Cancel', {marginLeft:'7px'});
|
||||
this.cancel_btn.onclick = function() {
|
||||
me.$w.find('.ed-text-cancel').click(function() {
|
||||
me.show_as_text();
|
||||
}
|
||||
})
|
||||
|
||||
this.show_as_text = function() {
|
||||
$ds(me.display); $ds(me.edit_btn);
|
||||
if(me.rich_text)
|
||||
wn.tinymce.remove(me.input);
|
||||
$dh(me.input); $dh(me.save_btn); $dh(me.cancel_btn);
|
||||
|
||||
me.$w.find('.ed-text-display, .ed-text-edit').toggle(true);
|
||||
me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(false);
|
||||
}
|
||||
|
||||
this.show_as_input = function() {
|
||||
$ds(me.input); $ds(me.save_btn); $ds(me.cancel_btn);
|
||||
$dh(me.edit_btn); $dh(me.display);
|
||||
if(me.rich_text)
|
||||
wn.tinymce.add_simple(me.input, '300px');
|
||||
}
|
||||
me.$w.find('.ed-text-display, .ed-text-edit').toggle(false);
|
||||
me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(true);
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
<div class="layout-wrapper">
|
||||
<a class="close" onclick="window.history.back();">×</a>
|
||||
<h1>Knowledge Base</h1>
|
||||
<hr>
|
||||
<p style="text-align: right"><a href="#!questions">← Back to Questions</a></p>
|
||||
<div class="qv-question-wrapper">
|
||||
<div class="layout-wrapper layout-wrapper-appframe">
|
||||
<div class="layout-appframe"></div>
|
||||
<div class="layout-main">
|
||||
<div class="qv-question-wrapper">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="qv-answer-wrapper">
|
||||
</div>
|
||||
<div class="add-answer-link"></div>
|
||||
<div class="add-answer-area"></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="qv-answer-wrapper">
|
||||
</div>
|
||||
<div class="add-answer-link"></div>
|
||||
<div class="add-answer-area"></div>
|
||||
</div>
|
@ -15,6 +15,9 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pscript['onload_question-view'] = function(wrapper) {
|
||||
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
|
||||
wrapper.appframe.title('<a href="#questions">Knowledge Base</a>');
|
||||
|
||||
wrapper.add_answer_area = $('.add-answer-area').get(0);
|
||||
}
|
||||
|
||||
@ -71,12 +74,10 @@ KBQuestionView = function(w, qid, qtext) {
|
||||
|
||||
// add a link to open add answer
|
||||
this.make_answer_box_link = function() {
|
||||
$('.add-answer-link').html('<button class="btn btn-small">\
|
||||
<i class="icon-plus"></i> Add you answer</button>').find('button').click(
|
||||
function() {
|
||||
$(this).toggle(false);
|
||||
me.make_answer_box();
|
||||
});
|
||||
wn.pages['question-view'].appframe.add_button('Add your answer', function() {
|
||||
$(this).toggle(false);
|
||||
me.make_answer_box();
|
||||
}, 'icon-plus');
|
||||
}
|
||||
|
||||
// answer box
|
||||
@ -130,9 +131,10 @@ KBAnswerList = function(args) {
|
||||
$.extend(this, args);
|
||||
|
||||
this.make_list = function() {
|
||||
|
||||
wn.pages['question-view'].appframe.clear_buttons();
|
||||
this.list = new wn.ui.Listing({
|
||||
parent: me.parent,
|
||||
appframe: wn.pages['question-view'].appframe,
|
||||
as_dict: 1,
|
||||
no_result_message: 'No answers yet, be the first one to answer!',
|
||||
render_row: function(body, data) {
|
||||
@ -143,8 +145,7 @@ KBAnswerList = function(args) {
|
||||
+"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
|
||||
+"where question='%(qid)s' and t1.owner = t2.name "
|
||||
+"order by t1.points desc, t1.modified desc", {qid: me.qid})
|
||||
},
|
||||
title: 'Answers'
|
||||
}
|
||||
});
|
||||
|
||||
this.list.run();
|
||||
@ -169,7 +170,7 @@ KBAnswer = function(body, data, ans_list) {
|
||||
text: data.answer,
|
||||
inp_class: 'qv-ans-input',
|
||||
disp_class: 'qv-ans-text',
|
||||
rich_text: 1
|
||||
height: '300px'
|
||||
});
|
||||
|
||||
$(edtxt.wrapper).addClass('well');
|
||||
|
@ -1,8 +1,6 @@
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="layout-appframe"></div>
|
||||
<div class="layout-main-section">
|
||||
<a class="close" onclick="window.history.back();">×</a>
|
||||
<h1>Knowledge Base</h1>
|
||||
<hr>
|
||||
<div class="well kb-search-wrapper">
|
||||
<textarea></textarea>
|
||||
<div>
|
||||
|
@ -17,6 +17,9 @@
|
||||
pscript.onload_questions = function(wrapper) {
|
||||
body = $(wrapper).find('.layout-main-section').get(0);
|
||||
|
||||
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
|
||||
wrapper.appframe.title('Knowledge Base');
|
||||
|
||||
// kb
|
||||
var kb = new KnowledgeBase(body);
|
||||
|
||||
@ -60,7 +63,7 @@ function KnowledgeBase(w) {
|
||||
if(this.search.value==$(this.search).attr('default_text')) {
|
||||
msgprint('Please enter some text'); return;
|
||||
}
|
||||
this.suggest();
|
||||
this.add_question([]);
|
||||
}
|
||||
|
||||
// suggest a few users who can answer
|
||||
|
@ -1,6 +1,5 @@
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
|
||||
font-weight: normal;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="web-content" id="content-about-us">
|
||||
{% if doc.headline %}
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
<div class="web-main-section">
|
||||
<div class="layout-main-section">
|
||||
{% if doc.headline %}
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
|
||||
{{ doc.main_section_html }}
|
||||
|
||||
{% if doc.about_team %}
|
||||
@ -28,7 +29,7 @@
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
<div class="layout-side-section">
|
||||
{{ doc.side_section_html }}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
|
@ -1,13 +1,13 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="web-content" id="blog-{{ doc.name }}">
|
||||
<h1>Blog</h1>
|
||||
<div class="web-main-section">
|
||||
<div class="layout-main-section">
|
||||
<h1>Blog</h1>
|
||||
<h3>{{ doc.title }}</h3>
|
||||
<div class="help">By {{ doc.full_name }} on {{ doc.updated }}</div>
|
||||
<br>
|
||||
{{ doc.content_html }}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
<div class="layout-side-section">
|
||||
<p><a href="#!blog">All Blogs</a></p>
|
||||
<h4>Subscribe</h4>
|
||||
<p>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="web-content" id="content-contact-us">
|
||||
{% if doc.headline %}
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
<div class="web-main-section">
|
||||
<div class="layout-main-section">
|
||||
{% if doc.headline %}
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
<label>Your Name*</label>
|
||||
<div><input name="contact-name" type="text"/></div>
|
||||
<br>
|
||||
@ -16,7 +16,7 @@
|
||||
<div><button class="btn primary">Send</button></div>
|
||||
{{ doc.main_section_html }}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
<div class="layout-side-section">
|
||||
{{ doc.side_section_html }}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
|
@ -1,26 +1,21 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="web-content" id="content-{{ doc.name }}"
|
||||
style="text-align: {{ doc.text_align }};">
|
||||
{% if doc.head_section and doc.layout=='Two column with header' %}
|
||||
<div class="web-head-section">
|
||||
{{ doc.head_section_html }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if doc.layout.startswith('Two column') %}
|
||||
<div class="web-main-section">
|
||||
<div class="layout-main-section">
|
||||
{% else %}
|
||||
<div class="layout-main">
|
||||
{% endif %}
|
||||
{{ doc.main_section_html }}
|
||||
{% if doc.next_page_html %}
|
||||
{{ doc.next_page_html }}
|
||||
{% endif %}
|
||||
|
||||
{% if doc.layout.startswith('Two column') %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if doc.layout.startswith('Two column') %}
|
||||
<div class="web-side-section">
|
||||
<div class="layout-side-section">
|
||||
{{ doc.side_section_html }}
|
||||
{% if doc.see_also %}
|
||||
<div class="info-box">
|
||||
|
@ -1,10 +1,10 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="web-content" id="content-blog">
|
||||
<h1>Blog</h1>
|
||||
<br>
|
||||
<div class="web-main-section">
|
||||
<div class="layout-main-section">
|
||||
<h1>Blog</h1>
|
||||
<br>
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
<div class="layout-side-section">
|
||||
<!-- for later
|
||||
<h4>Get Updates</h4>
|
||||
<p>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
pscript.onload_blog = function(wrapper) {
|
||||
wrapper.blog_list = new wn.ui.Listing({
|
||||
parent: $(wrapper).find('.web-main-section').get(0),
|
||||
parent: $(wrapper).find('.layout-main-section').get(0),
|
||||
query: 'select tabBlog.name, title, left(content, 300) as content, tabBlog.modified, \
|
||||
ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
|
||||
from tabProfile, tabBlog\
|
||||
|
@ -186,7 +186,7 @@ wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px
|
||||
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||
$(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')};(function($){$.fn.add_options=function(options_list){for(var i=0;i<options_list.length;i++){var v=options_list[i];value=v.value||v;label=v.label||v;$('<option>').html(label).attr('value',value).appendTo(this);}
|
||||
$(this).val(options_list[0].value||options_list[0]);}
|
||||
$.fn.set_working=function(){var ele=this.get(0);if(ele.loading_img){$di(ele.loading_img)}else{ele.disabled=1;ele.loading_img=$('<img src="lib/images/ui/button-load.gif" \
|
||||
$.fn.set_working=function(){var ele=this.get(0);if(ele.loading_img){$(ele.loading_img).toggle(true);}else{ele.disabled=1;ele.loading_img=$('<img src="lib/images/ui/button-load.gif" \
|
||||
style="margin-left: 4px; margin-bottom: -2px; display: inline;" />').insertAfter(ele);}}
|
||||
$.fn.done_working=function(){var ele=this.get(0);ele.disabled=0;if(ele.loading_img){$(ele.loading_img).toggle(false);};}})(jQuery);
|
||||
/*
|
||||
@ -433,7 +433,7 @@ if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';da
|
||||
*/
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){if(!name)name=wn.boot.home_page;wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
|
||||
wn.container.change_to(name);});}}
|
||||
wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
|
||||
wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style||'');this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
|
||||
wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html('<div class="layout-wrapper">\
|
||||
<h1>Not Found</h1><br>\
|
||||
<p>Sorry we were unable to find what you were looking for.</p>\
|
||||
@ -930,7 +930,7 @@ if(f.init)f.init();f.make_body();return f;}
|
||||
wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
||||
<span class="appframe-title"></span>\
|
||||
<span class="close">×</span>\
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').text(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
||||
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
||||
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}})
|
||||
|
@ -73,7 +73,7 @@ wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px
|
||||
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||
$(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')};(function($){$.fn.add_options=function(options_list){for(var i=0;i<options_list.length;i++){var v=options_list[i];value=v.value||v;label=v.label||v;$('<option>').html(label).attr('value',value).appendTo(this);}
|
||||
$(this).val(options_list[0].value||options_list[0]);}
|
||||
$.fn.set_working=function(){var ele=this.get(0);if(ele.loading_img){$di(ele.loading_img)}else{ele.disabled=1;ele.loading_img=$('<img src="lib/images/ui/button-load.gif" \
|
||||
$.fn.set_working=function(){var ele=this.get(0);if(ele.loading_img){$(ele.loading_img).toggle(true);}else{ele.disabled=1;ele.loading_img=$('<img src="lib/images/ui/button-load.gif" \
|
||||
style="margin-left: 4px; margin-bottom: -2px; display: inline;" />').insertAfter(ele);}}
|
||||
$.fn.done_working=function(){var ele=this.get(0);ele.disabled=0;if(ele.loading_img){$(ele.loading_img).toggle(false);};}})(jQuery);
|
||||
/*
|
||||
@ -320,7 +320,7 @@ if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';da
|
||||
*/
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){if(!name)name=wn.boot.home_page;wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
|
||||
wn.container.change_to(name);});}}
|
||||
wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
|
||||
wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style||'');this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
|
||||
wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html('<div class="layout-wrapper">\
|
||||
<h1>Not Found</h1><br>\
|
||||
<p>Sorry we were unable to find what you were looking for.</p>\
|
||||
@ -590,7 +590,7 @@ $(wrapper).hide().fadeIn(1000);}
|
||||
wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
||||
<span class="appframe-title"></span>\
|
||||
<span class="close">×</span>\
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').text(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
||||
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
||||
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}})
|
||||
|
Loading…
x
Reference in New Issue
Block a user