Changeset 980
- Timestamp:
- 11/13/08 23:35:22 (8 weeks ago)
- Location:
- huginmunin/trunk/web/hm/app
- Files:
-
- 3 added
- 6 removed
- 10 modified
-
media/css/quickrate.css (modified) (4 diffs)
-
media/js/jquery.rte.js (modified) (1 diff)
-
templates/models/item_add.html (added)
-
templates/models/recent_activity.html (modified) (1 diff)
-
templates/quickrate/intro.html (deleted)
-
templates/quickrate/issues.html (deleted)
-
templates/quickrate/issues_reported.html (deleted)
-
templates/quickrate/points_awarded.html (deleted)
-
templates/quickrate/quickrate_extension.html (added)
-
templates/quickrate/rate_review.html (modified) (2 diffs)
-
templates/quickrate/review.html (added)
-
templates/quickrate/save_progress.html (deleted)
-
templates/quickrate/saved.html (deleted)
-
templates/quickrate/select_interest.html (modified) (1 diff)
-
templates/test/maps.html (modified) (1 diff)
-
urls.py (modified) (1 diff)
-
views/main.py (modified) (2 diffs)
-
views/main_urls.py (modified) (2 diffs)
-
views/quickrate_main.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
huginmunin/trunk/web/hm/app/media/css/quickrate.css
r875 r980 11 11 /************* divs ****************/ 12 12 13 .review {padding: 0 5.8em; color: 4e5377;} 13 h1 { text-align: center; } 14 .title_interest { padding: .2em; background-color: #fffef9; border: medium double rgb(251,250,233); margin: auto; overflow: auto;} 14 15 15 .description {color: 000000; background-color: fffef9; width:80%; height:28%; padding: 1.1em; overflow: auto; margin: auto; 16 border: medium double rgb(251,250,233);} 16 .review {padding: 0 5.8em; color: #4e5377;} 17 17 18 .small {font: 90% Verdana,sans-serif; padding: 2% 5% 1% 6.5%;} 18 .review_description { 19 color: 000000; background-color: #fffef9; 20 width:80%; max-height:28%; 21 padding: 1.1em; 22 overflow: auto; 23 margin: auto; 24 border: medium double rgb(251,250,233); 25 } 19 26 20 .interests {padding: .08em 6em 3em .58em; margin: auto; 27 .helper_instructions { 28 padding: 2em 0em 1em 4em; 29 font: 90% Verdana,sans-serif; 21 30 } 31 32 .interests { 33 /* padding: .08em 6em 9em .58em; doesn't do anything since only contains floats */ 34 margin: auto; 35 clear: both; 36 } 37 38 /*.parent { float: left; width: 25%; min-width: 200px; padding: 0em; overflow: hidden;}*/ 39 .parent_description { display: inline; } 40 .child_description { margin-left: 2em; margin-right: 1em; padding-bottom: .3em; } /* even empty descriptions have <br>, so will wrap when browser width compresses */ 41 .child form { padding: 0px; margin: 0px; } 42 .child { padding: .3em 0em .1em .3em; } 43 44 .spacer { clear:both; height: 3em; } /* interests and float_links_box both contain only floats, so would be right on top of each other 45 (especially because interests can't specify a specific height (unknown)). margin don't do nothing. 46 use spacer with clear both and specified height. */ 22 47 23 48 .rating_choice {padding: 1.1em .58em 5.8em .58em; margin: auto; 24 49 } 25 26 .float_links_box {background-color: 3a3d69; width:80%; height:2.2em; margin: auto; 27 border: thin double rgb(239,168,166); float: bottom; 50 .float_links_box { 51 background-color: #3a3d69; 52 width:80%; height:2.2em; 53 margin: auto; 54 border: thin double rgb(239,168,166); 55 clear: both; 28 56 } 29 57 30 .float_links 31 { 32 float: left;33 width: 15%;34 margin: -1em -3% -2% 3%; 35 padding: .2%; 36 }58 .float_links { 59 float: left; 60 width: 22%; 61 margin: -1em 0px -2em 0px; 62 text-align: center; 63 } 64 .float_links a:hover { text-decoration: underline; } 37 65 38 66 … … 46 74 /************* lists ****************/ 47 75 76 /*ul { list-style: none outside; padding: 0em 0em 0em 0em; } 77 */ 78 79 /* 48 80 li.center {text-align: center} 49 81 … … 51 83 52 84 ul { padding: 0 1.4em; } 53 85 */ 54 86 55 87 /************* text/font ****************/ … … 59 91 li {line-height: 130%} 60 92 93 .parent_label { font-size: 1.2em; font-weight: bold; } 94 95 .child_label { } 61 96 62 97 /************* colors ****************/ 63 98 64 .light_brown {color: fdf8fd}99 .light_brown {color: #fdf8fd} 65 100 66 .green {color: 449b70}101 .green {color: #449b70} 67 102 68 .blue {color: 245fd8}103 .blue {color: #245fd8} 69 104 70 .red {color: efa8a6}105 .red {color: #efa8a6} 71 106 72 .orange {color: f4c385}107 .orange {color: #f4c385} 73 108 74 .purple {color: e5bafd}109 .purple {color: #e5bafd} 75 110 76 .light_green {color: b7e9b0}111 .light_green {color: #b7e9b0} 77 112 78 .gold {color: fbe688}113 .gold {color: #fbe688} 79 114 80 .light_gold {color: fbfae6} 115 .light_gold {color: #fbfae6} 116 117 .child_label { color: #245fd8; } /* BLUE */ 118 119 .parent_label { color: #449b70; } /* GREEN */ 81 120 82 121 -
huginmunin/trunk/web/hm/app/media/js/jquery.rte.js
r963 r980 72 72 // Mozilla need this to display caret 73 73 if($.trim(content)=='') 74 content = '<br>'; 74 //content = '<br>'; 75 content = ' '; 75 76 var doc = "<html><head>"+css+"</head><body class='frameBody'>"+content+"</body></html>"; 76 77 tryEnableDesignMode(iframe, doc, function() { -
huginmunin/trunk/web/hm/app/templates/models/recent_activity.html
r936 r980 14 14 {% paginate %} 15 15 <hr class="divider" /> 16 17 <DIV id="add_item"> 18 {% include 'models/item_add.html' %} 19 </DIV> 16 20 </DIV> 17 21 -
huginmunin/trunk/web/hm/app/templates/quickrate/rate_review.html
r874 r980 1 <html> 2 <head> 3 <link rel="stylesheet" type="text/css" href="/Main/media/css/quickrate.css"></link> 4 </head> 5 <body> 1 {% extends "quickrate/quickrate_extension.html" %} 6 2 7 <div class="floatright"> 8 <a href="http://bilumi.org/">9 <img border="0" src="http://bilumi.org/blog/wp-content/uploads/upcLogo.png" width="242" alt="">10 </a>11 </div> 3 {% block title %} 4 Rate <a href="{% url node review.node.id %}">{{ review.node.label }}</a> on 5 <span class="title_interest">{{ review.dimension.label }} <small><a href="{% url select_interest review.id %}"> (change)</a></small></span> 6 based on this review 7 {% endblock %} 12 8 13 <div> 14 <h1>How positive or negative is this review?</h1>15 </div> 9 {% block helper_question %} 10 Based on the above review, how positive or negative is {{ review.node.label }}'s reputation in {{ review.dimension.label }}? 11 {% endblock %} 16 12 17 <div class="review"> 18 <h2>{{label}}</h2> 19 <h3>{{interest}}</h3> 20 <div class="description"> 21 {{description}} 22 </div> 23 </div> 24 25 <div class="small"> 26 <p>Based on the above review, how good or bad do you judge that the {{interest}} reputation of {{label}} is? Please rate {{label}} by choosing a summary rating below. Then click "submit".</p> 27 </div> 28 13 {% block form %} 29 14 <div class="rating_choice"> 30 15 <form method="post" action=""> … … 33 18 </form> 34 19 </div> 35 36 <div class="float_links_box"> 37 <div class="float_links"> 38 <h2 class="orange">Details</h2><br></div> 39 <div class="float_links"> 40 <h2 class="purple">Respond</h2><br></div> 41 <div class="float_links"> 42 <h2 class="red">Issues</h2><br></div> 43 <div class="float_links"> 44 <h2 class="light_green">Skip</h2><br></div> 45 <div class="float_links"> 46 <h2> 47 <a href="http://bilumi.org/blog/donate/" class="gold"> 48 Donate</a></h2><br></div> 49 <div class="float_links"> 50 <a href="http://bilumi.org/"><img border=0 src="http://www.bilumi.org/blog/wp-content/uploads/RavensIconFlat.gif" alt="" width="100%" class="bottom_icon"></a><br></div> 51 </div> 52 53 </body> 54 </html> 20 {% endblock %} -
huginmunin/trunk/web/hm/app/templates/quickrate/select_interest.html
r932 r980 1 {% extends " user_extension.html" %}1 {% extends "quickrate/quickrate_extension.html" %} 2 2 3 {% block top_box_title %} 4 <div class="floatright"> 5 <a href="http://bilumi.org/"> 6 <img border="0" src="http://bilumi.org/blog/wp-content/uploads/upcLogo.png" width="242" alt=""> 7 </a> 8 </div> 9 10 <div> 11 <h1>Which consumer interest best matches this review?</h1></td></tr> 12 </div> 13 14 <div class="review";> 15 <h2>{{label}}</h2> 16 <div class="description"> 17 {{description}} 18 </div> 19 </div> 20 21 <div class="small"> 22 <p> Which socially responsible interest does the above review most apply to? - Your opinion counts! 23 </p> 24 </div> 25 26 <div class="interests"> 27 <table class="pos_auto"> 28 <tr> 29 {% for parent in interests %} 30 <td> 31 <ul type="none"> 32 <li class=center><a href="/Main/quickrate/rate_review/{{id}}/{{parent.interest.slug}}/"> 33 <h3 class="green">{{parent.interest.label}}</h3> 34 </a> {{parent.interest.description}} 35 </li> 36 <ul class="outside"> 37 {% for child in parent.children %} 38 <li><a class="blue" href="/Main/quickrate/rate_review/{{id}}/{{child.interest.slug}}/"> 39 {{child.interest.label}} 40 </a> {{child.interest.description}} 41 </li> 42 {% endfor %} 43 </ul> 44 </ul> 45 </td> 46 {% endfor %} 47 </tr> 48 </table> 49 </div> 50 51 <div class="float_links_box"> 52 <div class="float_links"> 53 <h2 class="orange">Details</h2><br></div> 54 <div class="float_links"> 55 <h2 class="purple">Respond</h2><br></div> 56 <div class="float_links"> 57 <h2 class="red">Issues</h2><br></div> 58 <div class="float_links"> 59 <h2 class="light_green">Skip</h2><br></div> 60 <div class="float_links"> 61 <h2> 62 <a href="http://bilumi.org/blog/donate/" class="gold"> 63 Donate</a></h2><br></div> 64 <div class="float_links"> 65 <a href="http://bilumi.org/"><img border=0 src="http://www.bilumi.org/blog/wp-content/uploads/RavensIconFlat.gif" alt="" width="100%" class="bottom_icon"></a><br></div> 66 </div> 67 3 {% block title %} 4 Which consumer interest does this review support for rating <a href="{% url node review.node.id %}">{{ review.node.label }}</a>?</h1> 68 5 {% endblock %} 69 6 7 {% block helper_question %} 8 Click on the interest below that best matches the above review{# - Your opinion counts! #} 9 {% endblock %} 70 10 71 {# --------------------------------------------------------------Items for right menu below------------- #} 11 {% block form %} 12 <DIV class="interests"> 13 <script type="text/javascript"> 14 $(document).ready(function() { 15 $(".children").hide(); 16 $(".parent").click( function() { 17 $(".children").hide("slow"); 18 $(this).children(".children").show("slow"); 19 }).css("cursor","pointer"); 20 }); 21 </script> 22 {% for parent in interests %} 23 <DIV class="parent"> 24 <span class="parent_label">{{ parent.interest.label }}</span> 25 {% ifnotequal parent.interest.description "<br>" %} {# rte turns empty descriptions in <br> by default #} 26 <span class="parent_description">{{ parent.interest.description|safe }}</span> 27 {% endifnotequal %} 28 29 <DIV class="children"> 30 {% for child in parent.children %} 31 <DIV class="child"> 32 <FORM method=POST> 33 <INPUT type="submit" name="interest" value="{{ child.label }}" /> 34 </FORM> 35 {% ifnotequal child.description "<br>" %} {# rte turns empty descriptions in <br> by default #} 36 <span class="child_description"> 37 {{ child.description|safe }} 38 </span> 39 {% endifnotequal %} 40 </DIV> 41 {% endfor %} 42 </DIV> 72 43 73 {% block right_menu_list_elements %} 44 </DIV> 45 {% endfor %} 46 </DIV> 47 48 <div class="spacer"> 49 </div> 74 50 {% endblock %} -
huginmunin/trunk/web/hm/app/templates/test/maps.html
r966 r980 6 6 7 7 <style> 8 .marker_text { padding: 0px; margin: 0px; vertical-align: middle; font-family:Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: .8em; max-width: 300px; max-height: 200px; overflow: scroll; }8 .marker_text { padding: 0px; margin: 0px; vertical-align: middle; font-family:Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: .8em; max-width: 300px; max-height: 200px; overflow: auto; } 9 9 .marker_text h2 { padding: 5px 10px 0px 10px; margin: 0px; background: #daffdf; border: 1px solid #9acca4; border-right: none; border-left: none;} 10 10 .marker_text .rating { padding-top: 3px; } -
huginmunin/trunk/web/hm/app/urls.py
r899 r980 9 9 (r'^account/', include('app.views.account_urls')), 10 10 (r'^api/', include('app.views.ext_api_urls')), 11 (r'^quickrate/', include('app.views.quickrate_urls')), 11 12 (r'^', include('app.views.main_urls')), 12 13 ) -
huginmunin/trunk/web/hm/app/views/main.py
r979 r980 768 768 template = request.REQUEST['template'] 769 769 data = {} 770 m = None 770 771 if model == 'Behavior': 771 772 n = Node.get(int(request.REQUEST['node_id'])) … … 774 775 m = Node() 775 776 if request.POST: 776 form = ModelForm(request.POST, instance=m, prefix=model+'new') 777 if m: form = ModelForm(request.POST, instance=m, prefix=model+'new') 778 else: form = ModelForm(request.POST, prefix=model+'new') 777 779 if form.is_valid(): 778 780 m = form.save() 779 781 return json_response(render_string(request, template, { model.lower(): m, 'object': m, 'o': m, 'mname': model })) 780 782 else: 781 form = ModelForm(instance=m, prefix=model+'new') 783 if m: form = ModelForm(instance=m, prefix=model+'new') 784 else: form = ModelForm(prefix=model+'new') 782 785 action_url = request.get_full_path() 783 786 cancel_url = reverse('ajax_cancel_edit', args=(model, 'new'))+'?'+request.GET.urlencode() -
huginmunin/trunk/web/hm/app/views/main_urls.py
r969 r980 25 25 (r'^node/tags?/(?P<tags>[\w\/]+)/$', main.node_list_by_tag), 26 26 (r'^add_new_behavior/', main.add_new_behavior), 27 28 # browse centric view29 (r'^browse/browse_a_z/$', quickrate_main.browse_a_z),30 (r'^browse/browse_by_type/$', quickrate_main.browse_by_type),31 (r'^browse/new_listing/$', quickrate_main.new_listing),32 27 33 28 url(r'^browse/$', main.graph_centric, name="browse"), … … 93 88 (r'^feedback/$', main.feedback), 94 89 95 # quick rate96 (r'^quickrate/rate_review/(?P<review_id>\d+)/(?P<interest_slug>\w+)/$', quickrate_main.rate_review),97 (r'^quickrate/select_interest/(?P<review_id>\d+)/$', quickrate_main.select_interest),98 (r'^quickrate/intro/$', quickrate_main.intro),99 (r'^quickrate/points_awarded/$', quickrate_main.points_awarded),100 (r'^quickrate/save_progress/$', quickrate_main.save_progress),101 (r'^quickrate/issues/$', quickrate_main.issues),102 (r'^quickrate/saved/$', quickrate_main.saved),103 (r'^quickrate/issues_reported/$', quickrate_main.issues_reported),104 (r'^quickrate/$', quickrate_main.index), # catches quickrate/ and quickrate/select_interest/105 106 90 ) -
huginmunin/trunk/web/hm/app/views/quickrate_main.py
r913 r980 2 2 # BILUMI imports 3 3 from db.models import * 4 from app.lib.view_utils import * 5 from app.lib.params import run_params 4 6 5 7 # Django imports … … 11 13 from django.utils import simplejson 12 14 15 #python 16 import random 17 13 18 def index(request): 14 return HttpResponseRedirect(reverse('app.views.quickrate_main.select_interest', args=(1,))) 15 16 17 def __extract_interests(): 18 """ 19 @returns: recursive structure of interests 20 [ 21 { 22 'interest': {'slug','label','description'}, 23 'children': [ {'interest': {...}, 'children': [...] } ], 24 }, ... 25 ] 26 slug is currently id but could be label 27 28 """ 29 return simplejson.load(open(settings.DB_PATH+'fixtures/dimensions.json')) 19 a = Action.objects.select_related().filter(item_type__model='behavior').exclude(user=current_user()) 20 b = a[random.randint(0, a.count())].item 21 if not b.dimension: 22 return HttpResponseRedirect(reverse('select_interest', args=(b.id,))) 23 else: 24 return HttpResponseRedirect(reverse('rate_review', args=(b.id,))) 30 25 31 26 def select_interest(request, review_id): 32 27 review = Behavior.objects.get(id=int(review_id)) 33 dict = {'id':review.id, 34 'label':review.label, 35 'description':review.description} 36 dict['interests'] = __extract_interests() 37 print dict['interests'] 38 return render_to_response('quickrate/select_interest.html', dict) 28 if request.method == 'POST': 29 params = run_params(request.POST) 30 if 'interest' in params: 31 interest = Dimension.get(label=params['interest']) 32 if interest != review.dimension: 33 existing_interest = Behavior.objects.filter(node=review.node, description=review.description, dimension=interest) 34 if len(existing_interest) > 0: 35 review = existing_interest[0] 36 else: 37 review = Behavior.add(node=review.node, description=review.description, label=review.label, url=review.url, dimension=interest) 38 return HttpResponseRedirect(reverse('rate_review', args=(review.id,))) 39 interests = [] 40 for interest in Dimension.objects.filter(parent=None): 41 children = [] 42 for child in Dimension.objects.filter(parent=interest): 43 children.append(child) 44 interests.append({'interest':interest, 45 'children':children}) 46 return render_response(request, 'quickrate/select_interest.html', locals()) 39 47 40 48 class RatingForm(forms.Form): … … 50 58 rating = forms.ChoiceField(choices) 51 59 52 def rate_review(request, review_id , interest_slug):60 def rate_review(request, review_id): 53 61 review = Behavior.objects.get(id=int(review_id)) 54 interest = Dimension.objects.get(id=int(interest_slug)) # should check whether int like id or name55 dict = {'id':review.id,56 'label':review.label,57 'description':review.description,58 'interest':interest.label}59 62 if request.method == 'POST': 60 63 form = RatingForm(request.POST) … … 65 68 #user.profile.save() 66 69 # save rating 67 review.add_rating(int(form.cleaned_data['rating']) )68 return HttpResponseRedirect(reverse(' app.views.quickrate_main.select_interest', args=(1,)))70 review.add_rating(int(form.cleaned_data['rating']), current_user()) 71 return HttpResponseRedirect(reverse('quickrate')) 69 72 else: 70 73 form = RatingForm() 71 dict['form'] = form 72 return render_to_response('quickrate/rate_review.html', dict) 74 return render_response(request, 'quickrate/rate_review.html', locals()) 73 75 74 def intro(request): 75 return render_to_response('quickrate/intro.html') 76 77 def points_awarded(request): 78 return render_to_response('quickrate/points_awarded.html') 79 80 def save_progress(request): 81 return render_to_response('quickrate/save_progress.html') 82 83 def issues(request): 84 return render_to_response('quickrate/issues.html') 85 86 def saved(request): 87 return render_to_response('quickrate/saved.html') 88 89 def issues_reported(request): 90 return render_to_response('quickrate/issues_reported.html') 91 92 def portfolio(request): 93 return render_to_response('user/portfolio.html') 94 95 def create_portfolio(request): 96 return render_to_response('user/create_portfolio.html') 97 98 def activity(request): 99 return render_to_response('user/activity.html') 100 101 def status(request): 102 return render_to_response('user/status.html') 103 104 def avatar(request): 105 return render_to_response('user/avatar.html') 106 107 def view_pages(request): 108 109 return render_to_response('user/view_pages.html') 110 111 def message_board(request): 112 return render_to_response('user/message_board.html') 113 114 def personal_messages(request): 115 return render_to_response('user/personal_messages.html') 116 117 def write_message(request): 118 return render_to_response('user/write_message.html') 119 120 def notepad(request): 121 return render_to_response('user/notepad.html') 122 123 def browse_a_z(request): 124 return render_to_response('browse/browse_a_z.html') 125 126 def browse_by_type(request): 127 return render_to_response('browse/browse_by_type.html') 128 129 def new_listing(request): 130 return render_to_response('browse/new_listing.html') 131 132 def test_page(request, page): 133 dict = {'user': User.objects.get(id=1), 134 'users': User.objects.all(), 135 'interests': __extract_interests(), 136 'products': Node.objects.all()} 137 return render_to_response(page) 76 def flag(request, review_id): 77 pass