From a6ce535b4eac3099b06eb004e7f5821b1797d505 Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Thu, 25 Oct 2018 23:48:49 +0200 Subject: [PATCH] Support line breaks in comments + CSS changes --- funding/orm/orm.py | 4 +++ funding/routes.py | 5 ++- funding/static/css/wow.css | 15 ++++++++- funding/static/reply.png | Bin 0 -> 3365 bytes .../templates/{devfund.html => donate.html} | 2 +- .../templates/proposal/macros/comment.html | 29 +++++++++++++----- funding/templates/proposal/proposal.html | 5 +-- 7 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 funding/static/reply.png rename funding/templates/{devfund.html => donate.html} (94%) diff --git a/funding/orm/orm.py b/funding/orm/orm.py index 66af310..7d7b5e1 100644 --- a/funding/orm/orm.py +++ b/funding/orm/orm.py @@ -379,6 +379,10 @@ class Comment(base): ix_comment_replied_to = sa.Index("ix_comment_replied_to", replied_to) ix_comment_proposal_id = sa.Index("ix_comment_proposal_id", proposal_id) + @property + def message_html(self): + return [line for line in self.message.strip().split('\r\n') if line] + @property def ago(self): from funding.bin.utils_time import TimeMagic diff --git a/funding/routes.py b/funding/routes.py index d96ca25..26e7a87 100644 --- a/funding/routes.py +++ b/funding/routes.py @@ -249,8 +249,7 @@ def donate(): if not data: daemon = Daemon(url=settings.RPC_LOCATION_DEVFUND, username=settings.RPC_USERNAME_DEVFUND, - password=settings.RPC_PASSWORD_DEVFUND - ) + password=settings.RPC_PASSWORD_DEVFUND) txs_in = daemon.get_transfers_in_simple() if not txs_in['txs']: @@ -263,7 +262,7 @@ def donate(): tx['datetime'] = dateutil_parse(tx['datetime']) txs_in = data - return make_response(render_template('devfund.html', txs_in=txs_in)) + return make_response(render_template('donate.html', txs_in=txs_in)) @app.route('/register', methods=['GET', 'POST']) diff --git a/funding/static/css/wow.css b/funding/static/css/wow.css index e6b5d74..69d4602 100644 --- a/funding/static/css/wow.css +++ b/funding/static/css/wow.css @@ -432,7 +432,7 @@ span.username a{ .comment-container a.reply{ margin-bottom:2px; - font-family: Verdana, Geneva, sans-serif; + font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif; font-size: 11pt; text-decoration: underline; color: black; @@ -652,4 +652,17 @@ ul.b { .container>.content h3, .container>.content h4{ margin-bottom:20px; +} + + +.comment-container .media-body span.body { + word-wrap: break-word; + display: block; + margin-top: 4px; + margin-bottom: 4px; +} + +.comment-container .media-body span.body img { + margin-top:10px; + margin-bottom:10px; } \ No newline at end of file diff --git a/funding/static/reply.png b/funding/static/reply.png new file mode 100644 index 0000000000000000000000000000000000000000..2447b6aeb8c84d37d89449b968264e5ebd614b00 GIT binary patch literal 3365 zcmd5<`8yPP7yr%}86u;S5pPB^WFH}0nFeD^A`vQ6V~-+xw!t7bWy-z`(-omq*D_hM z)kS1%W4XpM=8{1~mT+ya`@BEgKjFSVoadbLIp?Qyp67EuC-L$n6Cr`)0ssIZGgBiQ z03iDz1i%mMyX*Ih-S!>7uc?DS0D6c1Hb^J^c`N{eLuN)7Y(sJv#ufr4&K^tn(VVxV z5{#;YDvD;7pn`bQ^(czhieh?1jY?5AycSmxr7@=ec_>N{4pOzhUM9P88#@7A-=wA- ziJ}#Y@NaYfbalfe`9UX`?2U0qBOEkgpujf?07)4D+Ww7nOV4@t8xHQy)TqxY^89W6 zqj6UlXJ#<05w)|0X|3iEqZ}S$9M93`aPSghz8Rm@o*+q}ZAJMJVKQ}Sk z215`8E<};KQ?R}Fd($n>2L14Xq1io5YuMZTnmPcN{_ylr)OkxLA5Q}L=iQf{wHKoi z#PHSCh-!YIGoo6!;$PIZ?p>&GEi_9Hc^U@GRap(YJr&zd6yX!QU&}p z-|0SZh;Op`84Bt3(YN?9R+@a!;rsKIg3A6Pt-jWHj1e!&eMcj7WxR<)2oLsD4<&oi zwggaQUlsQVT?4OB)q$qa#r%->qNLZ{w+g9S?+>dbhdEge-}dSpPhT+83ao!RmfMyG zyX4O!R{vdUMjbr4zRWf?ab~u+p*Zg-dyzUHr3Mx#v^qdh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MNySYJLUKVvFCb8{&DgI)#BMOjywSpBn?%*4D%(^%B zbaI31_KXUwIto0&vFz@0_uNWW*%(dOA1^;RF4ern;M4i7ljfJVlvj4LZ!E0Kr1PMH zJ$<>Yx7*_yO!Y2WFdAJ>RA!=hx zv`PmyLS5+trCv@}H!@hFuU3HMxrn31K{jb!L~f5Gg6GxLw8J+2HRk^v1fat3l#`d1aHXpyse5^S=D(YIX3BHW?1# zQNZ$;c{gr1BHfSLFqn36BTy%4UJC@dEaSr@rirX`oIsh1_8cT}&Aq_^O$`ivQQ@cT zG`n%b3LPv3m_HI=g`*2X%A;MHN3SzHOGcjU)ks4LCWF2i@ukrj-m>ph&Ryj@+@Eu( zAwR?0l|MA|+r`d%us(|Fw9@3IPgT^)U97RwS61u3Im z`mLEAo%!pnlj+ost8S;^>9KqllGpE;`pj_qi}2wJ1HO=VDdu--0z*_UP`Z-#2w%#@ z>z*_sLo>C!!TdaLv)<{+`>IN%vb@drW+UO(+pmq;u|C)J>g{%2P9Y^w4u`!zGXKY& z-(_FuwF_E{Aa6pd(|kBX1d3Y^%()bcbv$-w#qtirp%uZR%J*EUUwid`|t5>J@Z#r3vH)yIr(1zQnA zeIc`Wo>_mTP1?{}MO20B79X4>L+Q~Td4)F5Ux?2V!#csRyy`>mazd0u57?KpA)oQU z7Cq2x{QMP?AJT~f8YizdmtzqK=zc*1ttk8|%a8{L9OBvh9@Kf;i=Seg-6iMTYaVOT zaJ&T5=$t$oerz02D{8`v;{YEKPDq+JcK-a6Eh)(7s|IaC;XoAv;6x_Ur=!yvzE|L*~2#+QuV;0Q7Q1zB&ruK)l5 literal 0 HcmV?d00001 diff --git a/funding/templates/devfund.html b/funding/templates/donate.html similarity index 94% rename from funding/templates/devfund.html rename to funding/templates/donate.html index bf590b9..c4f9efb 100644 --- a/funding/templates/devfund.html +++ b/funding/templates/donate.html @@ -6,7 +6,7 @@

Development Fund

- Ongoing development is supported by donations and sponsorships *cough*. + Ongoing development is supported by donations.

diff --git a/funding/templates/proposal/macros/comment.html b/funding/templates/proposal/macros/comment.html index 98e50cc..4b1714b 100644 --- a/funding/templates/proposal/macros/comment.html +++ b/funding/templates/proposal/macros/comment.html @@ -17,11 +17,21 @@ {{c.date_added.strftime('%Y-%m-%d %H:%M')}} -
- {{c.message}} -
+ + + + {% for line in c.message_html %} + {{line}} + {% if loop.index != c.message_html|length %} +
+ {% endif %} + {% endfor %} +
+ {% if not c.automated %} - reply + + reply + {% endif %} {% for _c in c.comments %} @@ -45,9 +55,14 @@ {{_c.date_added.strftime('%Y-%m-%d %H:%M')}} -
- - {{_c.message}} + + + {% for line in _c.message_html %} + {{line}} + {% if loop.index != _c.message_html|length %} +
+ {% endif %} + {% endfor %}
diff --git a/funding/templates/proposal/proposal.html b/funding/templates/proposal/proposal.html index bff2ed4..1fc1e5c 100644 --- a/funding/templates/proposal/proposal.html +++ b/funding/templates/proposal/proposal.html @@ -243,9 +243,6 @@ // convert images to let html = obj.html(); let uid = obj.attr('data-id'); - if(uid == 30){ - debugger; - } var matches = html.match(regexp_imgur) || []; matches = matches.concat(html.match(regexp_imgflip)); @@ -253,7 +250,7 @@ matches.filter(function (value, index, self) { return self.indexOf(value) === index && typeof value === 'string'; }).forEach(function (obj) { - html = html.replace(new RegExp(obj, 'g'), `

`) + html = html.replace(new RegExp(obj, 'g'), ``) }); } obj.html(html);