diff --git a/css/all-app.css b/css/all-app.css index d267c9b7890..c42f3706eb7 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -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; } diff --git a/css/all-web.css b/css/all-web.css index c16a8e8e9b3..416e9022e03 100644 --- a/css/all-web.css +++ b/css/all-web.css @@ -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; } diff --git a/erpnext/knowledge_base/page/kb_common/kb_common.js b/erpnext/knowledge_base/page/kb_common/kb_common.js index a734f65ed92..6fb4d387418 100644 --- a/erpnext/knowledge_base/page/kb_common/kb_common.js +++ b/erpnext/knowledge_base/page/kb_common/kb_common.js @@ -25,9 +25,9 @@ KBItemToolbar = function(args, kb) { this.wrapper = $a(this.parent, 'div', '', {}); this.line1 = $a(this.wrapper, 'div', '', {color: '#888', fontSize:'11px', margin:'7px 0px'}); this.make_timestamp(); - this.make_vote(); if(this.with_tags) this.make_tags(); + this.setup_del(); } this.make_timestamp = function() { @@ -38,24 +38,11 @@ KBItemToolbar = function(args, kb) { // allow system manager to delete questions / answers if(has_common(user_roles, ['Administrator', 'System Manager'])) { - this.line1.innerHTML += ' | ' - $ln(this.line1, 'delete', me.del); + this.line1.innerHTML += ' | delete'; } } - this.make_vote = function() { - this.line1.innerHTML += ' | ' - new KBPoints(this.line1, this.det.points, this.det._users_voted, this.doctype, this.det.name, this.det.owner); - } - - this.del = function() { - this.innerHTML = 'deleting...'; this.disabled = 1; - $c_page('knowledge_base', 'questions', 'delete', {dt:me.doctype, dn:me.det.name}, function(r,rt) { - // reload the list - kb.list.run() - }); - } - this.make_tags = function() { this.line1.innerHTML += ' | ' this.tags_area = $a(this.line1, 'span', 'kb-tags') @@ -64,50 +51,23 @@ KBItemToolbar = function(args, kb) { this.doctype, this.det.name, 0, kb.set_tag_filter) } + this.setup_del = function() { + $(this.line1).find('.del-link').click(function() { + console.log(1); + this.innerHTML = 'deleting...'; + this.disabled = 1; + $c_page('knowledge_base', 'questions', 'delete', { + dt: me.doctype, dn: me.det.name}, function(r,rt) { + // reload the list + kb.list.run() + }); + }); + } + this.make(); } -// kb points -// x points | Vote Up | Vote Down (if not voted and not guest) -KBPoints = function(parent, points, voted, dt, dn, owner) { - var me = this; - voted = voted ? voted.split(',') : []; - - this.wrapper = $a(parent, 'span', '', {fontSize: '11px', marginRight: '7px', marginLeft: '7px'}); - - this.render_points = function(p) { - if(!this.points_area) - this.points_area = $a(this.wrapper, 'span'); - this.points_area.innerHTML = cint(p) + ' point' + (p>1 ? 's' : ''); - } - - this.render_points(points); - - // vote up or down - // if user has not already voted - - if(user!='Guest' && !in_list(voted, user) && user!=owner) { - this.vote_up = $a(this.wrapper, 'img', 'lib/images/ui/vote_up.gif', {margin:'0px 0px -2px 7px', cursor: 'pointer'}); - this.vote_down = $a(this.wrapper, 'img', 'lib/images/ui/vote_down.gif', {margin:'0px 0px -3px 0px', cursor: 'pointer'}); - - this.vote_up.title = 'Vote Up'; this.vote_down.title = 'Vote Down'; - - var callback = function(r, rt) { - if(r.exc) { msgprint(r.exc); return; } - $dh(me.vote_up); $dh(me.vote_down); - me.render_points(r.message); - } - - this.vote_up.onclick = function() { - $c_page('knowledge_base', 'questions', 'vote', {vote:'up', dn:dn, dt:dt}, callback); - } - this.vote_down.onclick = function() { - $c_page('knowledge_base', 'questions', 'vote', {vote:'down', dn:dn, dt:dt}, callback); - } - } -} - // displays an editable text, // needs parent, text, disp_class, inp_class // dt, dn @@ -116,59 +76,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('
\ +
\ + [edit]\ +
\ +
Formatted as markdown
\ + \ + Cancel\ +
', 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); + } } \ No newline at end of file diff --git a/erpnext/knowledge_base/page/question_view/question_view.html b/erpnext/knowledge_base/page/question_view/question_view.html index 9939332e32f..521244599e4 100644 --- a/erpnext/knowledge_base/page/question_view/question_view.html +++ b/erpnext/knowledge_base/page/question_view/question_view.html @@ -1,13 +1,12 @@ -
- × -

Knowledge Base

-
-

← Back to Questions

-
+
+
+
+
+
+
+
+
+ +
-
-
-
- -
\ No newline at end of file diff --git a/erpnext/knowledge_base/page/question_view/question_view.js b/erpnext/knowledge_base/page/question_view/question_view.js index 879ee7912eb..86a2b981666 100644 --- a/erpnext/knowledge_base/page/question_view/question_view.js +++ b/erpnext/knowledge_base/page/question_view/question_view.js @@ -15,6 +15,9 @@ // along with this program. If not, see . pscript['onload_question-view'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe')); + wrapper.appframe.title('Knowledge Base'); + 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('').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,21 +131,21 @@ 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) { new KBAnswer(body, data, me) }, get_query: function() { - return repl("SELECT t1.name, t1.owner, t1.answer, t1.points, t1._users_voted, t2.first_name, " + return repl("SELECT t1.name, t1.owner, t1.answer, t1._users_voted, t2.first_name, " +"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' + +"order by t1.modified desc", {qid: me.qid}) + } }); this.list.run(); @@ -158,7 +159,6 @@ KBAnswerList = function(args) { // kb answer // answer // by xxx | on xxx -// points yyy KBAnswer = function(body, data, ans_list) { body.className = 'qv-answer'; var edtxt = new EditableText({ @@ -169,7 +169,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'); diff --git a/erpnext/knowledge_base/page/questions/questions.html b/erpnext/knowledge_base/page/questions/questions.html index c76f4902bb1..1085b7555ad 100644 --- a/erpnext/knowledge_base/page/questions/questions.html +++ b/erpnext/knowledge_base/page/questions/questions.html @@ -1,8 +1,6 @@
+
- × -

Knowledge Base

-
diff --git a/erpnext/knowledge_base/page/questions/questions.js b/erpnext/knowledge_base/page/questions/questions.js index 6b0ca25079d..edb8063cbcb 100644 --- a/erpnext/knowledge_base/page/questions/questions.js +++ b/erpnext/knowledge_base/page/questions/questions.js @@ -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 @@ -123,7 +126,7 @@ function KnowledgeBase(w) { cond += ' and t1.`_user_tags` like "%' + f + '%"' } } - return repl('select t1.name, t1.owner, t1.question, t1.points, t1.modified, t1._user_tags, ' + return repl('select t1.name, t1.owner, t1.question, t1.modified, t1._user_tags, ' +'t1._users_voted, t2.first_name, t2.last_name ' +'from tabQuestion t1, tabProfile t2 ' +'where t1.docstatus!=2 ' diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css index 79ce027e37f..bd21144ec6d 100644 --- a/erpnext/startup/startup.css +++ b/erpnext/startup/startup.css @@ -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; } diff --git a/erpnext/website/doctype/about_us_settings/template.html b/erpnext/website/doctype/about_us_settings/template.html index 864fb655063..404ebe922b1 100644 --- a/erpnext/website/doctype/about_us_settings/template.html +++ b/erpnext/website/doctype/about_us_settings/template.html @@ -1,9 +1,10 @@ -
+
- {% if doc.headline %} -

{{ doc.headline }}

- {% endif %} -
+
+ {% if doc.headline %} +

{{ doc.headline }}

+ {% endif %} + {{ doc.main_section_html }} {% if doc.about_team %} @@ -28,7 +29,7 @@ {% endif %}
-
+
{{ doc.side_section_html }}
diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html index 1b81fe2d905..467f30169fd 100644 --- a/erpnext/website/doctype/blog/template.html +++ b/erpnext/website/doctype/blog/template.html @@ -1,13 +1,13 @@ -
+
-

Blog

-
+
+

Blog

{{ doc.title }}

By {{ doc.full_name }} on {{ doc.updated }}

{{ doc.content_html }}
-
+

All Blogs

Subscribe

diff --git a/erpnext/website/doctype/contact_us_settings/template.html b/erpnext/website/doctype/contact_us_settings/template.html index 6453784b7f4..508b534a892 100644 --- a/erpnext/website/doctype/contact_us_settings/template.html +++ b/erpnext/website/doctype/contact_us_settings/template.html @@ -1,9 +1,9 @@ -

+
- {% if doc.headline %} -

{{ doc.headline }}

- {% endif %} -
+
+ {% if doc.headline %} +

{{ doc.headline }}

+ {% endif %}

@@ -16,7 +16,7 @@
{{ doc.main_section_html }}
-
+
{{ doc.side_section_html }}
diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html index e6f071d0a7a..2c92a25e99f 100644 --- a/erpnext/website/doctype/web_page/template.html +++ b/erpnext/website/doctype/web_page/template.html @@ -1,26 +1,21 @@ -
+
- {% if doc.head_section and doc.layout=='Two column with header' %} -
- {{ doc.head_section_html }} -
- {% endif %} {% if doc.layout.startswith('Two column') %} -
+
+ {% else %} +
{% endif %} {{ doc.main_section_html }} {% if doc.next_page_html %} {{ doc.next_page_html }} {% endif %} - {% if doc.layout.startswith('Two column') %}
- {% endif %} {% if doc.layout.startswith('Two column') %} -
+
{{ doc.side_section_html }} {% if doc.see_also %}
diff --git a/erpnext/website/page/blog/blog.html b/erpnext/website/page/blog/blog.html index 79ea7f0f1f3..ffb81280a48 100644 --- a/erpnext/website/page/blog/blog.html +++ b/erpnext/website/page/blog/blog.html @@ -1,10 +1,10 @@ -
+
-

Blog

-
-
+
+

Blog

+
-
+