What am I doing wrong?

After posting a comment: First I see a "Success!" flash that I can't locate 
source of, and page doesn't refresh (load doesn't display). 

I hit "refresh page" and I see the correct session flash 'Comment 
Approved.' from my code and load data correctly displays.

thanks,

Alex Glaros

CONTROLLERS

def documentation_professional_licensing_collaborative_data_model():
    specificWebPageID = db(db.web_page.web_page_title == 
request.env.request_uri).select(db.web_page.id,limitby = (0,1)).first().id
    specificWebPage = db.web_page(specificWebPageID)
    specificSuperObjectID = specificWebPage.super_object_fk
    session.specificSuperObjectID = specificSuperObjectID
    return locals()

def generic_comments():
    specificSuperObjectID = request.get_vars.specificSuperObjectID
    specificSuperObjectID = session.specificSuperObjectID #forgot which one 
of these is used
    is_owner = (lambda row: row.created_by == auth.user_id) if auth.user 
else False 
    db.SuperObjectComment.super_object_FK.readable = 
db.SuperObjectComment.super_object_FK.writable = False 
    objectComments = db(db.SuperObjectComment.super_object_FK == 
specificSuperObjectID).select(orderby=db.SuperObjectComment.created_on)
    db.SuperObjectComment.super_object_FK.default = specificSuperObjectID
    db.SuperObjectComment.super_object_comment.comment = ''
    generic_form_view_comment = SQLFORM(db.SuperObjectComment)
    if generic_form_view_comment.process().accepted:
        session.flash = T('Comment Approved.') #doesn't work cause of modal
        redirect(request.env.http_web2py_component_location, 
client_side=True)
    elif generic_form_view_comment.errors:
        session.flash = T('Comment form has errors. Scroll down to see.')
    return locals()
    


VIEW OF HTML PAGE

{{=LOAD('default','generic_comments.load',ajax = True, vars = 
dict(specificSuperObjectID = specificSuperObjectID))}}

VIEW OF LOAD DOC

<h4>{{=generic_form_view_comment}}</h4>  <!-- this displays the form that 
user posts comments in -->

    <!-- %%%%%%%%%%%%%%%%%%%%%%  COMMENTS LISTED BELOW 
%%%%%%%%%%%%%%%%%%%%%%%%%% -->

  <table class="table table-striped" style="float:right">

  {{for objectComment in objectComments:}}
  <tr>
    <td 
style="color:gray;font-size:80%">{{=prettydate(objectComment.created_on)}}</td>
    <td>{{=A(objectComment.created_by.first_name, 
_href=URL('default','view_user_profile.html', 
args=objectComment.created_by))}} {{=A(objectComment.created_by.last_name, 
_href=URL('default','view_user_profile.html', 
args=objectComment.created_by))}}</td>

    <td><pre style="white-space: pre-wrap;border:0; word-wrap: break-word; 
word-break:keep-all; background-color:#FFFFFF ;
      font-family: arial;
      margin-bottom: 10px;
      overflow: auto;
      padding: 15px;
      width: auto;">{{=objectComment.super_object_comment}}</pre></td>
    <td> 
{{if auth.user_id == objectComment.created_by:}} 
   {{=A("Edit", _href=URL('default','edit_object_comment.html', 
args=objectComment.id, 
vars=dict(controller_to_return_to=request.env.http_web2py_component_location)), 
_class='btn-sm btn-warning', _style="margin:0px",  ajax=True)}}
</td>
<td>
   <a href="{{=URL('default','delete_object_comment.html', 
args=objectComment.id, 
vars=dict(controller_to_return_to=request.env.http_web2py_component_location, 
ajax=True))}}" data-toggle="tooltip" data-placement="bottom" title="Delete 
this comment" style="margin:0px; padding:0px"><span style="font-size:100%; 
color:Black" class="glyphicon glyphicon-trash" aria-hidden="true" 
aria-label="image of trash can"></span></a>
</td>  
      {{pass}}
  </tr>
  {{pass}}
</table>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to