Commit 71282ef451612a8a72d033fc6d5b730b6c965a6c
- Diff rendering mode:
- inline
- side by side
app/app.py
(21 / 1)
  | |||
49 | 49 | reply=['guid', 'title', 'content', 'context', 'author', 'tags']) | |
50 | 50 | Ideas = client.Idea.cursor( | |
51 | 51 | reply=['guid', 'title', 'content', 'context', 'author', 'tags']) | |
52 | Solutions= client.Solution.cursor( | ||
52 | Solutions = client.Solution.cursor( | ||
53 | 53 | reply=['guid', 'content', 'parent', 'author', 'tags']) | |
54 | Comments = client.Comment.cursor( | ||
55 | reply=['guid', 'message', 'tags', 'author']) | ||
54 | 56 | ||
55 | 57 | def get_colors(): | |
56 | 58 | client = gconf.client_get_default() | |
… | … | ||
307 | 307 | return render_template('users-grid.html',query=query, | |
308 | 308 | result=result, type='user') | |
309 | 309 | ||
310 | @app.route('/_comments/<resource_guid>') | ||
311 | def comments_browser(resource_guid=None): | ||
312 | result = Comments | ||
313 | return render_template('_context-comment-list.html', | ||
314 | result=result, resource_guid=resource_guid) | ||
315 | |||
310 | 316 | @app.route('/question/<resource_guid>') | |
311 | 317 | @app.route('/idea/<resource_guid>') | |
312 | 318 | @app.route('/problem/<resource_guid>') | |
… | … | ||
437 | 437 | solution.post() | |
438 | 438 | Solutions._reset() | |
439 | 439 | return redirect('/%s/%s' % (solution['parent_resource'], solution['parent'])) | |
440 | |||
441 | @app.route('/submit_comment', methods=['POST']) | ||
442 | def new_comment(): | ||
443 | comment=client.Comment() | ||
444 | comment['message'] = request.form['comment'] | ||
445 | #comment['parent'] = request.form['resource_guid'] | ||
446 | #comment['parent_resource'] = request.form['resource_type'] | ||
447 | if comment['message']: | ||
448 | comment.post() | ||
449 | Comments._reset() | ||
450 | return redirect('_comments/test') | ||
451 | #return redirect('_comments/%s' % comment['parent']) | ||
440 | 452 | ||
441 | 453 | @app.route('/_shutdown') | |
442 | 454 | def shutdown_server(): |
app/static/css/browser.css
(59 / 9)
  | |||
99 | 99 | vertical-align: middle; | |
100 | 100 | line-height: 40px; | |
101 | 101 | z-index: 100; | |
102 | padding-left: 10px; | ||
102 | 103 | } | |
103 | 104 | ||
104 | 105 | #nav-buttons { | |
… | … | ||
115 | 115 | } | |
116 | 116 | ||
117 | 117 | #meta { | |
118 | padding-left:25px; | ||
118 | margin-right: 20px; | ||
119 | float: right; | ||
119 | 120 | } | |
120 | 121 | ||
121 | 122 | #info { | |
122 | float: right; | ||
123 | margin-right: 20px; | ||
123 | padding-left:25px; | ||
124 | 124 | } | |
125 | 125 | ||
126 | 126 | /*** list view styles ****/ | |
… | … | ||
139 | 139 | ||
140 | 140 | li.resource-list { | |
141 | 141 | clear: both; | |
142 | overflow: auto; | ||
142 | overflow: hidden; | ||
143 | 143 | text-align: left; | |
144 | 144 | } | |
145 | 145 | ||
146 | li.comments { | ||
147 | text-indent: 1em; | ||
148 | } | ||
149 | span.comments-button { | ||
150 | float: right; | ||
151 | padding: 17px; | ||
152 | } | ||
153 | span.comments-button:hover { | ||
154 | background-color: #808080; | ||
155 | border-radius: 15px; | ||
156 | cursor:pointer; | ||
157 | } | ||
158 | div.comments { | ||
159 | width: 300px; | ||
160 | display:none; | ||
161 | } | ||
162 | span.comment-content { | ||
163 | color: #808080; | ||
164 | } | ||
165 | .comment-author { | ||
166 | float: right; | ||
167 | } | ||
168 | |||
169 | .half { | ||
170 | width: 27px; | ||
171 | height: 27px; | ||
172 | } | ||
173 | |||
146 | 174 | li.resource-list + li.resource-list { | |
147 | 175 | border-top: 2px solid #c0c0c0; | |
148 | 176 | } | |
… | … | ||
476 | 476 | margin: 5px; | |
477 | 477 | position: relative; | |
478 | 478 | } | |
479 | div.comment-content-column { | ||
480 | padding: 10px 0px 0px 40px; | ||
481 | float: left; | ||
482 | width: 100%; | ||
483 | margin: 5px; | ||
484 | position: relative; | ||
485 | } | ||
479 | 486 | ||
480 | 487 | /* New Resource Form */ | |
481 | 488 | ||
… | … | ||
570 | 570 | width: 400px; | |
571 | 571 | height: 100px; | |
572 | 572 | } | |
573 | #textarea-comment { | ||
574 | border: 2px solid #c0c0c0; | ||
575 | text-indent: 5px; | ||
576 | margin:10px 30px; | ||
577 | width: 280px; | ||
578 | height: 25px; | ||
579 | } | ||
580 | .comment-button { | ||
581 | position: absolute; | ||
582 | overflow: hidden; | ||
583 | right: 0px; | ||
584 | bottom: 14px; | ||
585 | } | ||
573 | 586 | ||
574 | 587 | .sugar-button { | |
575 | 588 | border-radius: 15px; | |
… | … | ||
638 | 638 | */ | |
639 | 639 | .scrollable .items { | |
640 | 640 | /* this cannot be too large */ | |
641 | width:20000em; | ||
641 | height:20000em; | ||
642 | 642 | position:absolute; | |
643 | 643 | } | |
644 | 644 | .resource-scrollable .items { | |
… | … | ||
664 | 664 | /* prev, next, prevPage and nextPage buttons */ | |
665 | 665 | a.browse { | |
666 | 666 | background:url(/static/images/hori_large.png) no-repeat; | |
667 | /*display:block;*/ | ||
667 | display:block; | ||
668 | 668 | width:30px; | |
669 | 669 | height:30px; | |
670 | /*float:left;*/ | ||
671 | margin:4px 0 0 10px; | ||
670 | float:left; | ||
671 | margin:4px 0 0 0; | ||
672 | 672 | cursor:pointer; | |
673 | 673 | font-size:1px; | |
674 | margin-left: 10px; | ||
674 | 675 | } | |
675 | 676 | ||
676 | 677 | /* right */ | |
… | … | ||
701 | 701 | ||
702 | 702 | /* disabled navigational button */ | |
703 | 703 | a.disabled { | |
704 | visibility:hidden !important; | ||
704 | display: none !important; | ||
705 | 705 | } |
Binary files differ
app/static/icons/comments.svg
(56 / 0)
  | |||
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | <svg | ||
3 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
4 | xmlns:cc="http://creativecommons.org/ns#" | ||
5 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
6 | xmlns:svg="http://www.w3.org/2000/svg" | ||
7 | xmlns="http://www.w3.org/2000/svg" | ||
8 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
9 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
10 | enable-background="new 0 0 55 55" | ||
11 | height="24" | ||
12 | version="1.1" | ||
13 | viewBox="0 0 24 24" | ||
14 | width="24" | ||
15 | x="0px" | ||
16 | xml:space="preserve" | ||
17 | y="0px" | ||
18 | id="svg2985" | ||
19 | inkscape:version="0.48.2 r9819" | ||
20 | sodipodi:docname="moon.svg" | ||
21 | inkscape:export-filename="/home/icarito/Proyectos/mejorar-sistema/app/static/icons/moon.png" | ||
22 | inkscape:export-xdpi="2000" | ||
23 | inkscape:export-ydpi="2000"><metadata | ||
24 | id="metadata2994"><rdf:RDF><cc:Work | ||
25 | rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type | ||
26 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs | ||
27 | id="defs2992" /><sodipodi:namedview | ||
28 | pagecolor="#ffffff" | ||
29 | bordercolor="#666666" | ||
30 | borderopacity="1" | ||
31 | objecttolerance="10" | ||
32 | gridtolerance="10" | ||
33 | guidetolerance="10" | ||
34 | inkscape:pageopacity="0" | ||
35 | inkscape:pageshadow="2" | ||
36 | inkscape:window-width="1024" | ||
37 | inkscape:window-height="600" | ||
38 | id="namedview2990" | ||
39 | showgrid="false" | ||
40 | inkscape:zoom="13.634611" | ||
41 | inkscape:cx="20.879025" | ||
42 | inkscape:cy="12.824565" | ||
43 | inkscape:window-x="0" | ||
44 | inkscape:window-y="26" | ||
45 | inkscape:window-maximized="0" | ||
46 | inkscape:current-layer="svg2985" /><g | ||
47 | id="g3982" | ||
48 | transform="matrix(0.61708674,0,0,0.61708674,2.0884416,9.444028)"><path | ||
49 | id="rect29408" | ||
50 | d="m 9.9416247,-12.186452 c -1.071319,0 -1.920649,0.863414 -1.920649,1.913566 l 0,15.0616157 c 0,1.050152 0.84933,1.882702 1.920649,1.882702 l 14.1372303,0 c 0.856319,1.103703 2.522718,2.893206 6.517611,4.3826843 C 28.817847,9.0051887 28.821637,7.6137547 29.022164,6.6714317 l 2.896716,0 c 1.071317,0 1.952132,-0.83255 1.952134,-1.882702 l 0,-15.0616157 c 0,-1.050152 -0.880817,-1.913566 -1.952134,-1.913566 l -21.9772553,0 z" | ||
51 | style="color:#000000;fill:#e9e9e9;fill-opacity:1;fill-rule:nonzero;stroke:#787878;stroke-width:0.99999982;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" | ||
52 | inkscape:connector-curvature="0" /><path | ||
53 | style="color:#000000;fill:#e9e9e9;fill-opacity:1;fill-rule:nonzero;stroke:#787878;stroke-width:0.99999946;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" | ||
54 | d="m 21.315591,-3.2929492 c 1.039074,0 1.862841,0.8706099 1.862841,1.9295139 l 0,15.1871393 c 0,1.058904 -0.823767,1.898393 -1.862841,1.898393 l -13.7117283,0 c -0.830545,1.112901 -2.446789,2.917318 -6.3214426,4.419209 1.7250846,-2.066003 1.7214086,-3.469033 1.5269176,-4.419209 l -2.80952961064,0 C -1.0392644,15.722097 -1.8935686,14.882608 -1.8935706,13.823704 l 0,-15.1871393 c 0,-1.058904 0.8543062,-1.9295139 1.89337868936,-1.9295139 l 21.31578291064,0 z" | ||
55 | id="path29441" | ||
56 | inkscape:connector-curvature="0" /></g></svg> |
  | |||
1 | {%- for item in result %} | ||
2 | <li class="resource-list"> | ||
3 | <div class="comment-content-column"> | ||
4 | <div class="resource-content"> | ||
5 | {%- if item['author'] %} | ||
6 | <img class="half" src="/static/icons/sugar-xo.png" /> | ||
7 | {%- endif %} | ||
8 | <span class="comment-content">{{item['message']}}</span> | ||
9 | </div> | ||
10 | <div class="resource-meta"> | ||
11 | {%- for tag in item['tags'] %} | ||
12 | <span class="tag">{{tag}}</span> | ||
13 | {%- endfor %} | ||
14 | </div> | ||
15 | </div> | ||
16 | </li> | ||
17 | {%- endfor %} | ||
18 | <form id="comment_form_{{resource_guid}}" class="comment-form" data-guid="{{resource_guid}}" method="POST" action="/submit_comment"> | ||
19 | <input type="hidden" name="resource_guid" value="{{resource_guid}}" /> | ||
20 | <input type="hidden" name="resource_type" value="solution" /> | ||
21 | <textarea id="textarea-comment" name="comment"></textarea> | ||
22 | <input class="comment-button sugar-button" type="submit" value="{{_('comment')}}" /> | ||
23 | </form> |
  | |||
35 | 35 | <span class="tag">{{tag}}</span> | |
36 | 36 | {%- endfor %} | |
37 | 37 | </div> | |
38 | <span class="comments-button" | ||
39 | id="comments-button-{{item['guid']}}" | ||
40 | data-guid="{{item['guid']}}"> | ||
41 | <img src="/static/icons/comments.png" /> | ||
42 | </span> | ||
43 | <div class="comments" id="comments-{{item['guid']}}"></div> | ||
38 | 44 | </div> | |
39 | 45 | <div class="icon-column"> | |
40 | 46 | {%- if item['author'] %} |
app/templates/base.html
(0 / 8)
  | |||
12 | 12 | <div id="content"> | |
13 | 13 | {% block view %}{% endblock view %} | |
14 | 14 | </div> | |
15 | {%- block bottom_palette %} | ||
16 | <div id='bottom-palette'> | ||
17 | <div id='nav-buttons'> | ||
18 | <a class="prev browse up pagination_button"></a> | ||
19 | <a class="next browse down pagination_button"></a> | ||
20 | </div> | ||
21 | </div> | ||
22 | {%- endblock bottom_palette %} | ||
23 | 15 | <script type="text/javascript"> | |
24 | 16 | {%- block script -%} | |
25 | 17 | function init_styles(inactive_color) { |
  | |||
22 | 22 | <script type='text/javascript'> | |
23 | 23 | $(function() { | |
24 | 24 | // initialize scrollable | |
25 | $(".scrollable").scrollable(); | ||
25 | $(".scrollable").scrollable( {vertical:true} ); | ||
26 | 26 | ||
27 | 27 | var api = $("#scrollable").data("scrollable"); | |
28 | 28 | var last_page = {{page}}; | |
… | … | ||
51 | 51 | }); | |
52 | 52 | </script> | |
53 | 53 | {% endblock view %} | |
54 | {%- block bottom_palette %} | ||
55 | <div id='bottom-palette'> | ||
56 | <div id='nav-buttons'> | ||
57 | <a class="prev browse left pagination_button"></a> | ||
58 | <a class="next browse right pagination_button"></a> | ||
59 | </div> | ||
60 | </div> | ||
61 | {%- endblock bottom_palette %} |
app/templates/context-view.html
(20 / 0)
  | |||
66 | 66 | {tabs: 'h2', effect: 'slide', initialIndex: null} | |
67 | 67 | ); | |
68 | 68 | ||
69 | $('span.comments-button').click( function() { | ||
70 | var guid = $(this).data('guid'); | ||
71 | $('#comments-button-'+guid).slideUp( function () { | ||
72 | $('#comments-'+guid).slideDown(); | ||
73 | }); | ||
74 | $.get('/_comments/'+guid, {}, function ( data ) { | ||
75 | $('#comments-'+guid).empty().append( data ); | ||
76 | $('#comment_form_'+guid).submit( function() { | ||
77 | var guid = $(this).data('guid'); | ||
78 | $.post( '/submit_comment', | ||
79 | $(this).serialize(), | ||
80 | function(response) { | ||
81 | $.get('/_comments/'+guid, {}, function ( data ) { | ||
82 | $('#comments-'+guid).empty().append( data ); }); | ||
83 | }); | ||
84 | return false; | ||
85 | }); | ||
86 | }); | ||
87 | }); | ||
88 | |||
69 | 89 | $('.solution-link').click( function() { | |
70 | 90 | $.get($(this).data('href') + '?_pjax', {}, function ( data ) { $('#resource-section').empty().append( data ); } ); | |
71 | 91 | $('#bottom-palette').slideUp(); |
app/templates/toolbar.html
(6 / 0)
  | |||
40 | 40 | <span id="meta">{{meta}}</span> | |
41 | 41 | <span id="info">{{info}}</span> | |
42 | 42 | </div> | |
43 | <div id='bottom-palette'> | ||
44 | <div id='nav-buttons'> | ||
45 | <a class="prev browse up"></a> | ||
46 | <a class="next browse down"></a> | ||
47 | </div> | ||
48 | </div> |
sweets.recipe
(1 / 1)
  | |||
8 | 8 | license = GPLv3+ | |
9 | 9 | homepage = http://wiki.sugarlabs.org/go/Platform_Team/Sugar_Network/Browser | |
10 | 10 | ||
11 | version = 0.1 | ||
11 | version = 0.2 | ||
12 | 12 | stability = developer | |
13 | 13 | ||
14 | 14 | requires = flask; flask-babel; sugar-network |