allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [allura] 03/04: Handled review comments
Date Mon, 06 Jan 2020 23:05:11 GMT
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 59144b629c5969346d95dd16d5879cbeaf3cd44e
Author: Vrinda A <vrinda.a@in.bosch.com>
AuthorDate: Mon Jan 6 14:40:27 2020 +0530

    Handled review comments
---
 ForgeFeedback/forgefeedback/__init__.py            |   0
 ForgeFeedback/forgefeedback/feedback_main.py       | 180 ++++++++++++---------
 ForgeFeedback/forgefeedback/model/__init__.py      |   3 -
 ForgeFeedback/forgefeedback/model/feedback.py      |  26 ++-
 .../forgefeedback/nf/feedback/css/feedback.css     |   0
 ForgeFeedback/forgefeedback/templates/__init__.py  |   0
 .../templates/feedback/common_feedback.html        |  47 +++---
 .../templates/feedback/edit_feedback.html          |  35 +---
 .../templates/feedback/feedback_list.html          |   0
 .../forgefeedback/templates/feedback/index.html    |  19 ++-
 .../templates/feedback/new_feedback.html           |   4 +-
 ForgeFeedback/forgefeedback/tests/__init__.py      |   1 -
 .../forgefeedback/tests/functional/__init__.py     |   1 -
 .../forgefeedback/tests/functional/test_root.py    |  75 ++++-----
 .../forgefeedback/tests/test_feedback_roles.py     |   4 +-
 ForgeFeedback/forgefeedback/tests/unit/__init__.py |   1 -
 .../forgefeedback/tests/unit/test_feedback.py      |  31 ++--
 .../tests/unit/test_root_controller.py             |  39 ++---
 ForgeFeedback/forgefeedback/version.py             |   7 +-
 ForgeFeedback/setup.py                             |   0
 20 files changed, 241 insertions(+), 232 deletions(-)

diff --git a/ForgeFeedback/forgefeedback/__init__.py b/ForgeFeedback/forgefeedback/__init__.py
old mode 100644
new mode 100755
diff --git a/ForgeFeedback/forgefeedback/feedback_main.py b/ForgeFeedback/forgefeedback/feedback_main.py
old mode 100644
new mode 100755
index 0f9a555..4f04b61
--- a/ForgeFeedback/forgefeedback/feedback_main.py
+++ b/ForgeFeedback/forgefeedback/feedback_main.py
@@ -1,4 +1,4 @@
-#	Licensed to the Apache Software Foundation (ASF) under one
+#       Licensed to the Apache Software Foundation (ASF) under one
 #       or more contributor license agreements.  See the NOTICE file
 #       distributed with this work for additional information
 #       regarding copyright ownership.  The ASF licenses this file
@@ -26,7 +26,7 @@ from tg import tmpl_context as c, app_globals as g
 from ming.odm import session
 from ming.orm import session
 
-## profanityfilter package ##
+# profanityfilter package
 from profanityfilter import ProfanityFilter
 
 # Pyforge-specific imports
@@ -35,7 +35,7 @@ from allura import model as M
 from allura import version
 from allura.app import (
     Application,
-    )
+)
 from allura.controllers import BaseController
 from allura.controllers.feed import FeedController
 from allura.lib.decorators import require_post
@@ -53,12 +53,11 @@ log = logging.getLogger(__name__)
 
 class ForgeFeedbackApp(Application):
 
-
     __version__ = version.__version__
     permissions = [
-        'read', 'update', 'create', 
+        'read', 'update', 'create',
         'post', 'admin', 'delete'
-        ]
+    ]
 
     permissions_desc = {
         'read': 'View ratings.',
@@ -72,15 +71,17 @@ class ForgeFeedbackApp(Application):
     ]
     tool_label = 'Feedback'
     tool_description = """
-        Feedbacks are given for the tools in the form of reviews and ratings, edit and delete
the feedback"""
+        Feedbacks are given for the tools in the form of reviews and ratings,
+        edit and delete the feedback"""
     default_mount_label = 'Feedback'
     default_mount_point = 'feedback'
     ordinal = 8
+    max_instances = 1
 
     def __init__(self, project, config):
         Application.__init__(self, project, config)
         self.root = RootController()
-   
+
     def install(self, project):
         'Set up any default permissions and roles here'
         super(ForgeFeedbackApp, self).install(project)
@@ -110,82 +111,101 @@ class ForgeFeedbackApp(Application):
 
 class RootController(BaseController, FeedController):
 
-    def _check_security(self):        
+    def _check_security(self):
         require_access(c.app, 'read')
 
     @expose('jinja:forgefeedback:templates/feedback/index.html')
-    def index(self,**kw):        
-        require_access(c.app, 'read')        
+    def index(self, **kw):
+        require_access(c.app, 'read')
         user_has_already_reviewed = False
         rating_by_user = Feedback.query.find({
-                'reported_by_id' : c.user._id,'project_id' : c.project._id}
-                 ).count() 
-        if (rating_by_user > 0) :
-             user_has_already_reviewed = True
-        return dict(review_list= self.get_review_list(), user_has_already_reviewed = user_has_already_reviewed,
rating=self.getRating())
-   
-    # the list of all the feedbacks given by various users is listed on the index page  
   
+            'reported_by_id': c.user._id, 'project_id': c.project._id}
+        ).count()
+        if (rating_by_user > 0):
+            user_has_already_reviewed = True
+        return dict(review_list=self.get_review_list(),
+                    user_has_already_reviewed=user_has_already_reviewed,
+                    rating=c.project.rating)
+
+    """ the list of all the feedbacks given by
+    various users is listed on the index page """
     @expose('jinja:forgefeedback:templates/feedback/index.html')
-    def get_review_list(self, **kw):      
-        self.review_list = Feedback.query.find(dict(project_id=c.project._id)).sort('created_date',
pymongo.DESCENDING).all()
+    def get_review_list(self, **kw):
+        self.review_list = Feedback.query.find({'project_id': c.project._id})\
+                            .sort('created_date', pymongo.DESCENDING).all()
         return self.review_list
 
-    # The new feedback given by the logged in user which includes the review, rating, project
id and the user id are all flushed into the database
+    """ The new feedback given by the logged in user which includes
+    the review, rating, project id and the user id are all flushed
+    into the database """
     @require_post()
     @expose('jinja:forgefeedback:templates/feedback/index.html')
     def create_feedback(self, description=None, rating=None, **kw):
         """saving the review for the first time """
         require_access(c.app, 'create')
-        p = Feedback( description=description , rating=rating, user_id=c.user._id, project_id=c.project._id)
+        p = Feedback(description=description, rating=rating,
+                     user_id=c.user._id, project_id=c.project._id)
         session(p).flush()
         flash('Feedback successfully added')
         M.main_orm_session.flush()
-	g.director.create_activity(c.user, 'posted', p,related_nodes=[c.project], tags=['description'])
-        return dict(review_list = self.get_review_list(), rating=self.getRating())
-    
-    # called on click of the Feedback link 
+        g.director.create_activity(c.user, 'posted', p, related_nodes=[
+                                   c.project], tags=['description'])
+        return dict(review_list=self.get_review_list(),
+                    rating=self.getRating())
+
+    # called on click of the Feedback link
     @with_trailing_slash
     @expose('jinja:forgefeedback:templates/feedback/new_feedback.html')
     def new_feedback(self, **kw):
         require_access(c.app, 'create')
         return dict(action=c.app.config.url() + 'create')
-       
-    #called on click of edit review link and displays the previous feedback 
+
+    # called on click of edit review link and displays the previous feedback
     @expose('jinja:forgefeedback:templates/feedback/edit_feedback.html')
     def edit_feedback(self, **kw):
-        self.review = Feedback.query.find({'reported_by_id' : c.user._id,'project_id' : c.project._id}).first()
    
-        return dict(description = self.review.description, rating=self.review.rating)
-    
-    # The edited feedback will be updated in the index page 
+        self.review = Feedback.query.find(
+                {'reported_by_id': c.user._id, 'project_id': c.project._id}
+                ).first()
+        return dict(description=self.review.description,
+                    rating=self.review.rating)
+
+    # The edited feedback will be updated in the index page
+    @require_post()
     @expose('jinja:forgefeedback:templates/feedback/index.html')
-    def edit_user_review(self,description=None, rating=None, **kw):
-    
-            Feedback.query.update(
-                    {'reported_by_id': c.user._id,'project_id' : c.project._id},
-                    {'$set': {'description': description, 'rating':rating}})
-            self.rating = Feedback.query.find({'reported_by_id' : c.user._id,'project_id'
: c.project._id}).first()
-            flash('Feedback successfully edited')
-            g.director.create_activity(c.user,'modified', self.rating, related_nodes=[c.project],
tags=['description'])
-            return dict(review_list = self.get_review_list(), rating=self.getRating())
-
-    #called when user clicks on delete link in feedback page
+    def edit_user_review(self, description=None, rating=None, **kw):
+        Feedback.query.update(
+            {'reported_by_id': c.user._id, 'project_id': c.project._id},
+            {'$set': {'description': description, 'rating': rating}})
+        self.rating = Feedback.query.find(
+            {'reported_by_id': c.user._id, 'project_id': c.project._id})\
+            .first()
+        flash('Feedback successfully edited')
+        g.director.create_activity(
+            c.user, 'modified', self.rating,
+            related_nodes=[c.project], tags=['description'])
+        return dict(
+            review_list=self.get_review_list(), rating=self.getRating())
+
+    # called when user clicks on delete link in feedback page
     @without_trailing_slash
+    @require_post()
     @expose('jinja:forgefeedback:templates/feedback/index.html')
     def delete_feedback(self, **kw):
-        user_review = Feedback.query.find({'reported_by_id' : c.user._id,'project_id' : c.project._id}).first()
   
-        Feedback.query.remove(dict({'reported_by_id' : c.user._id,'project_id' : c.project._id}))
-        rating_by_user = Feedback.query.find({
-                'reported_by_id' : c.user._id,'project_id' : c.project._id}
-                ).count()
-        if (rating_by_user > 0) :
-             user_has_already_reviewed = True
-        else :
-             user_has_already_reviewed = False
-        flash('Feedback successfully deleted')
-        M.main_orm_session.flush()
-        return dict(review_list = self.get_review_list(), user_has_already_reviewed = user_has_already_reviewed,
rating=self.getRating())
-    
-    #This method is used to check for profanity in feedback text
+        user_review = Feedback.query.find(
+            {'reported_by_id': c.user._id, 'project_id': c.project._id}
+            ).first()
+        if user_review:
+            Feedback.query.remove(dict(
+                {'reported_by_id': c.user._id, 'project_id': c.project._id}))
+            M.main_orm_session.flush()
+            self.getRating()
+            flash('Feedback successfully deleted')
+            return 'Success'
+        else:
+            flash('Feedback was not deleted')
+            return 'Failed'
+
+    # This method is used to check for profanity in feedback text
     @expose()
     def feedback_check(self, description=None):
         pf = ProfanityFilter()
@@ -195,36 +215,36 @@ class RootController(BaseController, FeedController):
             result = 'None'
         return result
 
-
-    # This method count the number of stars finds their sum and calculates the average of
all the star rating count    
+    """ This method count the number of stars finds their sum and
+    calculates the average of all the star rating count """
     def getRating(self, **kw):
-
-        
-        onestarcount = TM.Feedback.query.find({'rating':'1','project_id':c.project._id}).count()
-        twostarcount = TM.Feedback.query.find({'rating':'2','project_id':c.project._id}).count()
-        threestarcount = TM.Feedback.query.find({'rating':'3','project_id':c.project._id}).count()
-        fourstarcount = TM.Feedback.query.find({'rating':'4','project_id':c.project._id}).count()
-        fivestarcount = TM.Feedback.query.find({'rating':'5','project_id':c.project._id}).count()
-        sum_of_ratings = float(fivestarcount + fourstarcount + threestarcount + twostarcount
+ onestarcount)
+        onestarcount = TM.Feedback.query.find(
+            {'rating': '1', 'project_id': c.project._id}).count()
+        twostarcount = TM.Feedback.query.find(
+            {'rating': '2', 'project_id': c.project._id}).count()
+        threestarcount = TM.Feedback.query.find(
+            {'rating': '3', 'project_id': c.project._id}).count()
+        fourstarcount = TM.Feedback.query.find(
+            {'rating': '4', 'project_id': c.project._id}).count()
+        fivestarcount = TM.Feedback.query.find(
+            {'rating': '5', 'project_id': c.project._id}).count()
+        sum_of_ratings = float(
+            fivestarcount + fourstarcount + threestarcount + twostarcount +
+            onestarcount)
         if (sum_of_ratings != 0):
-            average_user_ratings =float((5*fivestarcount)+(4*fourstarcount)+(3*threestarcount)+(2*twostarcount)+(1*onestarcount))/sum_of_ratings
+            average_user_ratings = float(
+                (5*fivestarcount) + (4*fourstarcount) +
+                (3*threestarcount) + (2*twostarcount) +
+                (1*onestarcount)) / sum_of_ratings
             float_rating = float(average_user_ratings)
             int_rating = int(float_rating)
             float_point_value = float_rating - int_rating
-            if(float_point_value < 0.25 ):
-                c.project.rating= int_rating
-            elif(float_point_value>=0.25<0.75):
+            if(float_point_value < 0.25):
+                c.project.rating = int_rating
+            elif(float_point_value >= 0.25 < 0.75):
                 c.project.rating = 0.5 + int_rating
             elif(float_point_value >= 0.75):
-                c.project.rating=float(int_rating)+1                  
+                c.project.rating = float(int_rating)+1
             return average_user_ratings
         if (sum_of_ratings == 0):
             c.project.rating = 0.0
- 
-
-                               
-    
-
-
-
-
diff --git a/ForgeFeedback/forgefeedback/model/__init__.py b/ForgeFeedback/forgefeedback/model/__init__.py
old mode 100644
new mode 100755
index 19f031b..fc61e16
--- a/ForgeFeedback/forgefeedback/model/__init__.py
+++ b/ForgeFeedback/forgefeedback/model/__init__.py
@@ -16,6 +16,3 @@
 #       under the License.
 
 from feedback import Feedback
-
-
-
diff --git a/ForgeFeedback/forgefeedback/model/feedback.py b/ForgeFeedback/forgefeedback/model/feedback.py
old mode 100644
new mode 100755
index 2ef7326..7cb61e5
--- a/ForgeFeedback/forgefeedback/model/feedback.py
+++ b/ForgeFeedback/forgefeedback/model/feedback.py
@@ -1,4 +1,4 @@
-#	Licensed to the Apache Software Foundation (ASF) under one
+#       Licensed to the Apache Software Foundation (ASF) under one
 #       or more contributor license agreements.  See the NOTICE file
 #       distributed with this work for additional information
 #       regarding copyright ownership.  The ASF licenses this file
@@ -30,7 +30,7 @@ from ming.orm import FieldProperty, ForeignIdProperty, RelationProperty
 
 from allura.model.artifact import VersionedArtifact
 from allura.model.auth import AlluraUserProperty, User
-from allura.model.project import ProjectRole 
+from allura.model.project import ProjectRole
 from allura.model.timeline import ActivityObject
 from allura.lib import helpers as h
 
@@ -38,10 +38,10 @@ log = logging.getLogger(__name__)
 
 
 class Feedback(VersionedArtifact, ActivityObject):
-   
+
     class __mongometa__:
-	name = 'feedback'
-   	
+        name = 'feedback'
+
     type_s = 'Feedback'
     _id = FieldProperty(schema.ObjectId)
     created_date = FieldProperty(datetime, if_missing=datetime.utcnow)
@@ -57,7 +57,7 @@ class Feedback(VersionedArtifact, ActivityObject):
             created_date_dt=self.created_date,
             text=self.description,
         )
-        return result 
+        return result
 
     @property
     def activity_name(self):
@@ -66,17 +66,11 @@ class Feedback(VersionedArtifact, ActivityObject):
     @property
     def activity_extras(self):
         d = ActivityObject.activity_extras.fget(self)
-        d.update(summary=self.description) 
+        d.update(summary=self.description)
         return d
-    def url(self):
-      return self.app_config.url()
-
-Mapper.compile_all()
-
-
-
-
-
 
+    def url(self):
+        return self.app_config.url()
 
 
+Mapper.compile_all()
diff --git a/ForgeFeedback/forgefeedback/nf/feedback/css/feedback.css b/ForgeFeedback/forgefeedback/nf/feedback/css/feedback.css
old mode 100644
new mode 100755
diff --git a/ForgeFeedback/forgefeedback/templates/__init__.py b/ForgeFeedback/forgefeedback/templates/__init__.py
old mode 100644
new mode 100755
diff --git a/ForgeFeedback/forgefeedback/templates/feedback/common_feedback.html b/ForgeFeedback/forgefeedback/templates/feedback/common_feedback.html
old mode 100644
new mode 100755
index 48db583..6bd6634
--- a/ForgeFeedback/forgefeedback/templates/feedback/common_feedback.html
+++ b/ForgeFeedback/forgefeedback/templates/feedback/common_feedback.html
@@ -15,7 +15,7 @@
        KIND, either express or implied.  See the License for the
        specific language governing permissions and limitations
        under the License.
-This is used when user is trying to imput a new review 
+       This is used when user is trying to imput a new review 
 
 -#}
 
@@ -28,7 +28,7 @@ This is used when user is trying to imput a new review
 <!-- macro for feedback alert message -->
 {% macro alert_message() %}
 	<div id="check">
-		<p id="status_msg" style="color:#f33;"> <i class="fa fa-exclamation-triangle"></i>
Profanity alert! Please update your feedback.</p>
+		<p id="status_msg" style="color:#f33;display:none;"> <i class="fa fa-exclamation-triangle"></i>
Profanity alert! Please update your feedback.</p>
 	</div>
 {% endmacro %}
 
@@ -59,27 +59,32 @@ function manage()
 
 </script>
 
-<script type="text/javascript">
-$('#status_msg').hide();
-
-$("#description").keyup(function(){
-	var description = $("#description").val();
-	$.ajax({
-		url:'{{url}}feedback_check',
-		type:'GET',
-		data: {'description':description},
-		success: function(status){
-			if (status == 'true'){
-				$('#button').attr('disabled', true);
-				$('#status_msg').show();
-			}
-			else{
-				$('#status_msg').hide();
-			}
-		}
-	});
+<script>
+    $('#feedback_form').submit(function(event){
+    event.preventDefault();
+    var description = $("#description").val();
+    
+    $.ajax({
+        context: this,
+        url:'{{url}}feedback_check',
+        type:'GET',
+        data: {'description':description},
+        success: function(status){
+            if (status == 'true'){
+                $('#button').attr('disabled', true);
+                $('#status_msg').show();
+            }
+            else{
+                $('#status_msg').hide();
+                $('#button').attr('disabled', false);
+                this.submit();
+            }
+        }
+        
+    });
 });
 </script>
+
 {% endmacro %}
 
 
diff --git a/ForgeFeedback/forgefeedback/templates/feedback/edit_feedback.html b/ForgeFeedback/forgefeedback/templates/feedback/edit_feedback.html
old mode 100644
new mode 100755
index 8f11e2a..bf6ec75
--- a/ForgeFeedback/forgefeedback/templates/feedback/edit_feedback.html
+++ b/ForgeFeedback/forgefeedback/templates/feedback/edit_feedback.html
@@ -15,7 +15,7 @@
        KIND, either express or implied.  See the License for the
        specific language governing permissions and limitations
        under the License.
-This is used when user is trying to imput a new review 
+       This is used when user is trying to imput a new review 
 
 -#}
 
@@ -39,7 +39,7 @@ p {
 </style>
 
 <div class="feed">
-<form action="{{ c.app.url }}edit_user_review" method="post">
+<form action="{{ c.app.url }}edit_user_review" method="post" id="feedback_form">
 
 <div class="row">
 <div class="col-25">
@@ -50,31 +50,12 @@ p {
 	</div>
         <div class="col-75">
 <fieldset class="rating">
-    {% if rating == '5' %}
-      <input type="radio" id="star5" name="rating" value="5" checked="checked" onclick="manage()"
/><label for="star5" title="Excellent!"></label>
-    {% else %}
-      <input type="radio" id="star5" name="rating" value="5" onclick="manage()" /><label
for="star5" title="Excellent!"></label>
-    {% endif %}
-    {% if rating == '4' %}
-      <input type="radio" id="star4" name="rating" value="4" checked="checked" onclick="manage()"
/><label for="star4" title="Great!"></label>
-    {% else %}
-      <input type="radio" id="star4" name="rating" value="4" onclick="manage()" /><label
for="star4" title="Great!"></label>
-    {% endif %}
-    {% if rating == '3' %}
-      <input type="radio" id="star3" name="rating" value="3" checked="checked" onclick="manage()"
/><label for="star3" title="Good!"></label>
-    {% else %}
-      <input type="radio" id="star3" name="rating" value="3" onclick="manage()" /><label
for="star3" title="Good!"></label>
-    {% endif %}
-    {% if rating == '2' %}
-      <input type="radio" id="star2" name="rating" value="2" checked="checked" onclick="manage()"
/><label for="star2" title="Average"></label>
-    {% else %}
-      <input type="radio" id="star5" name="rating" value="5" onclick="manage()" /><label
for="star5" title="Excellent!"></label>
-    {% endif %} 
-    {% if rating == '1' %}
-      <input type="radio" id="star1" name="rating" value="1" checked="checked" onclick="manage()"
/><label for="star1" title="Poor"></label>
-    {% else %}
-      <input type="radio" id="star5" name="rating" value="5" onclick="manage()" /><label
for="star5" title="Excellent!"></label>
-    {% endif %} 
+    
+    <input type="radio" id="star5" name="rating" value="5" {% if rating == '5' %} checked="checked"
{% endif %} onclick="manage()" /><label for="star5" title="Excellent"></label>
+    <input type="radio" id="star4" name="rating" value="4" {% if rating == '4' %} checked="checked"
{% endif %} onclick="manage()" /><label for="star4" title="Great"></label>
+    <input type="radio" id="star3" name="rating" value="3" {% if rating == '3' %} checked="checked"
{% endif %} onclick="manage()" /><label for="star3" title="Good"></label>
+    <input type="radio" id="star2" name="rating" value="2" {% if rating == '2' %} checked="checked"
{% endif %} onclick="manage()" /><label for="star2" title="Average"></label>
+    <input type="radio" id="star1" name="rating" value="1" {% if rating == '1' %} checked="checked"
{% endif %} onclick="manage()" /><label for="star1" title="Poor"></label>
     
 </fieldset>
 </div>
diff --git a/ForgeFeedback/forgefeedback/templates/feedback/feedback_list.html b/ForgeFeedback/forgefeedback/templates/feedback/feedback_list.html
old mode 100644
new mode 100755
diff --git a/ForgeFeedback/forgefeedback/templates/feedback/index.html b/ForgeFeedback/forgefeedback/templates/feedback/index.html
old mode 100644
new mode 100755
index fe96856..853c4d1
--- a/ForgeFeedback/forgefeedback/templates/feedback/index.html
+++ b/ForgeFeedback/forgefeedback/templates/feedback/index.html
@@ -9,7 +9,7 @@
 
          http://www.apache.org/licenses/LICENSE-2.0
 
- e     Unless required by applicable law or agreed to in writing,
+       Unless required by applicable law or agreed to in writing,
        software distributed under the License is distributed on an
        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
        KIND, either express or implied.  See the License for the
@@ -38,7 +38,7 @@
 	{% if user_has_already_reviewed == False %}   
 	<p><h2> Provide your <a href="{{c.app.url}}new_feedback">Feedback</a>
for {{c.project.name}} </h2></p>
 	{% else %} 
-	<p><h2><a href="{{c.app.url}}edit_feedback"> Edit </a> or <a
href="{{c.app.url}}delete_feedback"> Delete </a> your feedback for {{c.project.name}}
</h2> </p>
+	<p><h2><a href="{{c.app.url}}edit_feedback"> Edit </a> or <a
class="post-link" href="#"> Delete </a> your feedback for {{c.project.name}} </h2>
</p>
 	{% endif %}  
 </div>
 {% else %}
@@ -50,7 +50,20 @@
         {% include 'forgefeedback:templates/feedback/feedback_list.html' %}
     </ul>  
 </div>
-{% endblock %}
 
+{% endblock %}
 
+{% block extra_js %}
+<script>
+    $('.post-link').click(function() {
+    var cval = $.cookie('_session_id');
+    $.post( '{{c.app.url}}delete_feedback', {'_session_id':cval},
+        function(){ 
+            window.location.href = '{{c.app.url}}';
+            }
+    );
+    
+    });
+</script>
+{% endblock %}
 
diff --git a/ForgeFeedback/forgefeedback/templates/feedback/new_feedback.html b/ForgeFeedback/forgefeedback/templates/feedback/new_feedback.html
old mode 100644
new mode 100755
index b472aab..bf93b3b
--- a/ForgeFeedback/forgefeedback/templates/feedback/new_feedback.html
+++ b/ForgeFeedback/forgefeedback/templates/feedback/new_feedback.html
@@ -15,7 +15,7 @@
        KIND, either express or implied.  See the License for the
        specific language governing permissions and limitations
        under the License.
-This is used when user is trying to imput a new review 
+       This is used when user is trying to imput a new review 
 
 -#}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
@@ -37,7 +37,7 @@ p {
 </style>
 
 <div class="feed">
-    <form action="{{ c.app.url }}create_feedback" method="post">
+    <form action="{{ c.app.url }}create_feedback" method="post" id="feedback_form">
 
     <div class="row">
         <div class="col-25">
diff --git a/ForgeFeedback/forgefeedback/tests/__init__.py b/ForgeFeedback/forgefeedback/tests/__init__.py
old mode 100644
new mode 100755
index 77505f1..144e298
--- a/ForgeFeedback/forgefeedback/tests/__init__.py
+++ b/ForgeFeedback/forgefeedback/tests/__init__.py
@@ -14,4 +14,3 @@
 #       KIND, either express or implied.  See the License for the
 #       specific language governing permissions and limitations
 #       under the License.
-
diff --git a/ForgeFeedback/forgefeedback/tests/functional/__init__.py b/ForgeFeedback/forgefeedback/tests/functional/__init__.py
old mode 100644
new mode 100755
index 77505f1..144e298
--- a/ForgeFeedback/forgefeedback/tests/functional/__init__.py
+++ b/ForgeFeedback/forgefeedback/tests/functional/__init__.py
@@ -14,4 +14,3 @@
 #       KIND, either express or implied.  See the License for the
 #       specific language governing permissions and limitations
 #       under the License.
-
diff --git a/ForgeFeedback/forgefeedback/tests/functional/test_root.py b/ForgeFeedback/forgefeedback/tests/functional/test_root.py
old mode 100644
new mode 100755
index b97eafa..e99fdb5
--- a/ForgeFeedback/forgefeedback/tests/functional/test_root.py
+++ b/ForgeFeedback/forgefeedback/tests/functional/test_root.py
@@ -17,7 +17,8 @@
 from tg import tmpl_context as c
 from tg import config
 
-from nose.tools import assert_equal, assert_in, assert_not_in, assert_true, assert_false,
assert_raises
+from nose.tools import assert_equal, assert_in, assert_not_in
+from nose.tools import assert_true, assert_false, assert_raises
 
 from allura import model as M
 from alluratest.controller import TestController
@@ -26,44 +27,46 @@ from allura.tests import decorators as td
 
 from forgefeedback import model as FM
 
+
 class TestFeedback(TestController):
-	def setUp(self):
-		TestController.setUp(self)
-	
-	def test_feedback(self):
-		c.user = M.User.by_username('test-admin')
-		self.app.get('/feedback/')
-		r = self.app.get('/p/test/feedback')
-		assert 'test' in r
-		assert_in('<a href="/p/test/feedback/new_feedback">Feedback</a>', r) 
 
-	def test_new_feedback(self):
-		c.user = M.User.by_username('test-admin')
-		self.app.get('/feedback/')
-		r = self.app.get('/p/test/feedback/new_feedback/')
-		assert_in('Provide your feedback for <b> Test Project</b>',r)
-		assert_in('Enter your feedback here', r)
+    def setUp(self):
+        TestController.setUp(self)
+
+    def test_feedback(self):
+        c.user = M.User.by_username('test-admin')
+        self.app.get('/feedback/')
+        r = self.app.get('/p/test/feedback')
+        assert 'test' in r
+        assert_in('<a href="/p/test/feedback/new_feedback">Feedback</a>', r)
+
+    def test_new_feedback(self):
+        c.user = M.User.by_username('test-admin')
+        self.app.get('/feedback/')
+        r = self.app.get('/p/test/feedback/new_feedback/')
+        assert_in('Provide your feedback for <b> Test Project</b>', r)
+        assert_in('Enter your feedback here', r)
+
+    def test_create_feedback(self):
+        resp = post_feedback(self)
+        assert_in('Good tool', resp)
 
-	def test_create_feedback(self):
-		resp = post_feedback(self)
-		assert_in('Good tool',resp)
-	
-	def test_edit_feedback(self):
-		post_feedback(self)
-		data = {'rating': '2','description':'Not useful'}
-		resp = self.app.post('/p/test/feedback/edit_user_review',data)
-		assert_in('Not useful',resp)
+    def test_edit_feedback(self):
+        post_feedback(self)
+        data = {'rating': '2', 'description': 'Not useful'}
+        resp = self.app.post('/p/test/feedback/edit_user_review', data)
+        assert_in('Not useful', resp)
+
+    def test_delete_feedback(self):
+        post_feedback(self)
+        resp = self.app.post('/p/test/feedback/delete_feedback')
+        assert_in('Success', resp)
 
-	def test_delete_feedback(self):
-		post_feedback(self)
-		resp=self.app.get('/p/test/feedback/delete_feedback')
-		assert_in('<a href="/p/test/feedback/new_feedback">Feedback</a>',resp)
-		
 
 def post_feedback(self):
-	c.user =M.User.by_username('test-admin')
-        self.app.get('/feedback/')
-        self.app.get('/p/test/feedback')
-        data = {'rating':'4','description':'Good tool'}
-        resp = self.app.post('/p/test/feedback/create_feedback/',data)
-	return resp
+    c.user = M.User.by_username('test-admin')
+    self.app.get('/feedback/')
+    self.app.get('/p/test/feedback')
+    data = {'rating': '4', 'description': 'Good tool'}
+    resp = self.app.post('/p/test/feedback/create_feedback/', data)
+    return resp
diff --git a/ForgeFeedback/forgefeedback/tests/test_feedback_roles.py b/ForgeFeedback/forgefeedback/tests/test_feedback_roles.py
old mode 100644
new mode 100755
index bd7f902..a8ea087
--- a/ForgeFeedback/forgefeedback/tests/test_feedback_roles.py
+++ b/ForgeFeedback/forgefeedback/tests/test_feedback_roles.py
@@ -25,12 +25,13 @@ from allura.lib import security
 from allura.tests import decorators as td
 from allura.lib import helpers as h
 
+
 def setUp():
     setup_basic_test()
     setup_with_tools()
 
 
-@td.with_tool('u/test-user-1','feedback')
+@td.with_tool('u/test-user-1', 'feedback')
 @td.with_user_project('test-user-1')
 def setup_with_tools():
     setup_global_objects()
@@ -51,4 +52,3 @@ def test_role_assignments():
     assert_equal(check_access('create'), (True, True, False))
     assert_equal(check_access('update'), (True, False, False))
     assert_equal(check_access('delete'), (True, False, False))
-
diff --git a/ForgeFeedback/forgefeedback/tests/unit/__init__.py b/ForgeFeedback/forgefeedback/tests/unit/__init__.py
old mode 100644
new mode 100755
index 9c6667a..193f766
--- a/ForgeFeedback/forgefeedback/tests/unit/__init__.py
+++ b/ForgeFeedback/forgefeedback/tests/unit/__init__.py
@@ -48,4 +48,3 @@ class FeedbackTestWithModel(object):
 
     def tearDown(self):
         ThreadLocalORMSession.close_all()
-
diff --git a/ForgeFeedback/forgefeedback/tests/unit/test_feedback.py b/ForgeFeedback/forgefeedback/tests/unit/test_feedback.py
old mode 100644
new mode 100755
index 604041e..03f6944
--- a/ForgeFeedback/forgefeedback/tests/unit/test_feedback.py
+++ b/ForgeFeedback/forgefeedback/tests/unit/test_feedback.py
@@ -22,20 +22,21 @@ from tg import tmpl_context as c
 from forgefeedback.tests.unit import FeedbackTestWithModel
 from forgefeedback import model as M
 
+
 class TestFeedback(FeedbackTestWithModel):
 
-	def test_feedback(self):
-	   feedback = M.Feedback()
-	   feedback.rating='4'
-	   feedback.description='Very good tool'
-	   assert_equal(feedback.rating, '4')
-	   assert_equal(feedback.description, 'Very good tool')
-	   assert_equal(feedback.activity_extras['summary'], feedback.description)
-	   assert_true('allura_id' in feedback.activity_extras)
- 
-	def test_index(self):
-	    feedback= M.Feedback()
-	    feedback.rating= '4'
-	    feedback.description ='Good tool'
- 	    result= feedback.index()
-	    assert_equal(result["text"], 'Good tool')
+    def test_feedback(self):
+        feedback = M.Feedback()
+        feedback.rating = '4'
+        feedback.description = 'Very good tool'
+        assert_equal(feedback.rating, '4')
+        assert_equal(feedback.description, 'Very good tool')
+        assert_equal(feedback.activity_extras['summary'], feedback.description)
+        assert_true('allura_id' in feedback.activity_extras)
+
+    def test_index(self):
+        feedback = M.Feedback()
+        feedback.rating = '4'
+        feedback.description = 'Good tool'
+        result = feedback.index()
+        assert_equal(result["text"], 'Good tool')
diff --git a/ForgeFeedback/forgefeedback/tests/unit/test_root_controller.py b/ForgeFeedback/forgefeedback/tests/unit/test_root_controller.py
old mode 100644
new mode 100755
index f99332c..4b000b1
--- a/ForgeFeedback/forgefeedback/tests/unit/test_root_controller.py
+++ b/ForgeFeedback/forgefeedback/tests/unit/test_root_controller.py
@@ -30,6 +30,7 @@ from forgefeedback.tests.unit import FeedbackTestWithModel
 from forgefeedback.model import Feedback
 from forgefeedback import feedback_main
 
+
 class TestFeedbackApp(FeedbackTestWithModel):
 
     def setUp(self):
@@ -39,28 +40,28 @@ class TestFeedbackApp(FeedbackTestWithModel):
 
     def test_index(self):
         reviews = feedback_main.RootController().index()
-        assert reviews['user_has_already_reviewed']==False
+        assert True if not reviews['user_has_already_reviewed'] else False
         create_feedbacks()
         reviews = feedback_main.RootController().index()
-        assert reviews['user_has_already_reviewed']==True
-        
+        assert True if reviews['user_has_already_reviewed'] else False
+
     def test_feedback(self):
         create_feedbacks()
         reviews = feedback_main.RootController().get_review_list()
-        assert reviews[0].description =='Very good tool'
-        assert reviews[1].description =='Not Useful'
-        assert reviews[0].rating =='5'
-        assert reviews[1].rating =='2'
+        assert reviews[0].description == 'Very good tool'
+        assert reviews[1].description == 'Not Useful'
+        assert reviews[0].rating == '5'
+        assert reviews[1].rating == '2'
 
     def test_getRating(self):
         create_feedbacks()
-        rating=feedback_main.RootController().getRating()
-        assert_equal(rating,3.5)
+        rating = feedback_main.RootController().getRating()
+        assert_equal(rating, 3.5)
 
     def test_edit_feedback(self):
         create_feedbacks()
-        old_feedback= feedback_main.RootController().edit_feedback()
-        assert old_feedback['description'] =='Very good tool'
+        old_feedback = feedback_main.RootController().edit_feedback()
+        assert old_feedback['description'] == 'Very good tool'
 
     def test_check_feedback(self):
         feed_check = feedback_main.RootController().feedback_check('good')
@@ -68,13 +69,15 @@ class TestFeedbackApp(FeedbackTestWithModel):
         feed_check = feedback_main.RootController().feedback_check('shit')
         assert feed_check == 'true'
 
+
 def create_feedbacks():
-		feedback_1= create_feedback('2', 'Not Useful')
-                c.user = User(username='test-admin')
-                h.set_context('test', 'feedback', neighborhood='Projects')
-                feedback_2 = create_feedback('5', 'Very good tool')
+    feedback_1 = create_feedback('2', 'Not Useful')
+    c.user = User(username='test-admin')
+    h.set_context('test', 'feedback', neighborhood='Projects')
+    feedback_2 = create_feedback('5', 'Very good tool')
+
 
 def create_feedback(rating, description):
-                feedback = Feedback(rating=rating, description=description)
-                session(feedback).flush()
-                return feedback	
+    feedback = Feedback(rating=rating, description=description)
+    session(feedback).flush()
+    return feedback
diff --git a/ForgeFeedback/forgefeedback/version.py b/ForgeFeedback/forgefeedback/version.py
old mode 100644
new mode 100755
index 1333217..3ea72c5
--- a/ForgeFeedback/forgefeedback/version.py
+++ b/ForgeFeedback/forgefeedback/version.py
@@ -1,4 +1,4 @@
-#Licensed to the Apache Software Foundation (ASF) under one
+# Licensed to the Apache Software Foundation (ASF) under one
 #       or more contributor license agreements.  See the NOTICE file
 #       distributed with this work for additional information
 #       regarding copyright ownership.  The ASF licenses this file
@@ -17,8 +17,3 @@
 
 __version_info__ = (0, 0)
 __version__ = '.'.join(map(str, __version_info__))
-
-
-
-
-
diff --git a/ForgeFeedback/setup.py b/ForgeFeedback/setup.py
old mode 100644
new mode 100755


Mime
View raw message