Jump to content


Photo

PW 2.2 - Comments fieldtype improvements


  • Please log in to reply
31 replies to this topic

#21 Bill

Bill

    Jr. Member

  • Members
  • PipPip
  • 36 posts
  • 4

Posted 09 February 2012 - 04:34 PM

Improvement? Or just an issue with me!? :)

After a fresh install of PW 2.1 - fetching the upstream/dev,
When i add this...



/** added as per comment module docs (api) from pw's site **/
echo $page->comments->render();
echo $page->comments->renderForm();



to the 'basic-page' template, to make this...


include("./head.inc");

echo $page->body;


/** added as per comment module docs (api) from pw's site **/
echo $page->comments->render();
echo $page->comments->renderForm();

include("./foot.inc");


I get a nice little form but a massive 3 inch space in b/w the Your Name/Email and the textarea form area 'Comment'.

Like this...
About Us.png

(gulp!)
I'm sure it's cuz i'm new to PW overall, but would *love* some input :).

C:\Users\ortelladmin\Pictures

#22 apeisa

apeisa

    Hero Member

  • Moderators
  • 3,159 posts
  • 1707

  • LocationVihti, Finland

Posted 09 February 2012 - 04:38 PM

wortell, welcome to the forums.

That is just an css issue with demo site & comments that has been there since beginning. Don't remember exact fix there, but probably changing .CommentForm_text clear: both to clear: left. Or then adding float: left.

#23 Bill

Bill

    Jr. Member

  • Members
  • PipPip
  • 36 posts
  • 4

Posted 09 February 2012 - 05:35 PM

That is just an css issue with demo site & comments that has been there since beginning. Don't remember exact fix there, but probably changing .CommentForm_text clear: both to clear: left. Or then adding float: left.


NP! :) thanks. will try.

#24 ryan

ryan

    Reiska

  • Administrators
  • 7,808 posts
  • 6600

  • LocationAtlanta, GA

Posted 09 February 2012 - 06:16 PM

Apeisa is right. Change this line:


        .CommentForm_text {
                clear: both;
        }

To this:


        .CommentForm_text {
                clear: left;
        }

I will update that in the basic profile (thought I had, but now see I didn't).

#25 Bill

Bill

    Jr. Member

  • Members
  • PipPip
  • 36 posts
  • 4

Posted 10 February 2012 - 02:04 PM

Apeisa is right. Change this line:


		.CommentForm_text {
				clear: both;
		}

To this:


		.CommentForm_text {
				clear: left;
		}

I will update that in the basic profile (thought I had, but now see I didn't).


Thx... it's one of the things I've come to 'follow' and love - hence investigating further for my own works - about PW, is the support is 'solid!' Unlike *ahem!* other framework "Gods" to be, where the inconsistent, unprofessional, undocumented help is not only frustrating to deal with but in many cases non-existent.

All in all thanks so much, guys. It worked.

I've merged my 2.2 master 'fork'd' of P21 with the dev/ branch and hoping to help contribute :P.

#26 ryan

ryan

    Reiska

  • Administrators
  • 7,808 posts
  • 6600

  • LocationAtlanta, GA

Posted 10 February 2012 - 02:15 PM

Thanks for the kind feedback Wortell. Glad you are enjoying ProcessWire and thanks for your interest in contributing too--always welcome and appreciated.

#27 Bill

Bill

    Jr. Member

  • Members
  • PipPip
  • 36 posts
  • 4

Posted 10 February 2012 - 02:15 PM

Not sure if this is the right location for this question but when I place a comment, into the comment box, it simply shows a "Thanks for the comment..." on that page refresh, without the latest comment showing. Yet, it's in the database, cuz if I go to that page again (without doing a refresh - via GET), it's there clearly submitted and now showing.

-- is this the intended effect? just curious is there a setting to effect the 'message' being 'shown' on that next page refresh?

Plus, as a symptom of the above - when i didn't see it there initially, i hit the (f5) refresh and of course it resubmitted the form _POST, thus two entries.

-- this is the classic refresh issue... but...

Suggestion:

If there's not already a fix in place for this effect, to cover both issue above - that i'm clearly missing, could PW, after saving the comment, do an automatic _GET header-redirect (with or without an href.name tag associated), so as to not only:

-- show the comment, instant feedback to the user
-- minimize the comment from being submitted twice

(In addition - the form would be available as well, if the admin wanted it to be such, otherwise, if the person wants to enter another... etc... they have to hit the REFRESH (doh!) or if they're smart - to not duplicate, they'll go to the URL and force the _GET just to get the comment form again.)

Again, i'm sure i'm not the only one to uncover this, but confirming if this is possibly another area to help enhance? (putting it mildly as possible :P)

editting a few moments later...
I see this is somewhat touched on here:
http://processwire.c...__fromsearch__1

Don't want to duplicate, i think my thoughts above are adding to this link thread above and i can move it there if you'd like, Ryan.

Edited by Bill, 10 February 2012 - 02:28 PM.


#28 Bill

Bill

    Jr. Member

  • Members
  • PipPip
  • 36 posts
  • 4

Posted 10 February 2012 - 02:23 PM

Also...

is there also the ability to auto-js hide the form, and make it available via .js click toggle? (or ajax?)

just askin'

@Ryan - just boot me if there is a better spot to ask/deal with these issues, tho it seems this PW2.2 Comment thread seems sufficient for the time being. thanks again.

#29 ryan

ryan

    Reiska

  • Administrators
  • 7,808 posts
  • 6600

  • LocationAtlanta, GA

Posted 10 February 2012 - 02:37 PM

We've got a queue of changes and improvements planned for the Comments module, and improvements in the area you've mentioned are part of it.

The comments output/processing comes in two parts, $page->comments->render(); and $page->comments->renderForm(); Usually you call renderForm(); after render(), which means that the comment form doesn't get processed until after the list of comments has already been rendered. Of course, you could reverse that and render the form first and then get your comment in the list. But that doesn't solve the double post issue, which we really need a redirect to do.

So the recommended way to handle it now is to $session->redirect('./'); after a comment is submitted. ProcessWire can't do this for you just because it doesn't know if you are calling upon it before or after you've started output (depending on the way you structure your templates). So it's playing safe by not attempting any redirects and instead lets you maintain control over how you want it to proceed.

// get comments before any output sent
$list = $page->comments->render(); 
$form = $page->comments->renderForm();

if($input->post->text && strpos($form, 'success')) {
    $session->redirect('./'); 
}

// ... later on when you are sending output
echo $list . $form;

More here:
http://processwire.c...types/comments/

Also note the default behavior and markup created by the comments module was always intended as just an example. It's meant to be iterated and handled like pages are, where you make your own comment markup and form. But I usually go the easier route and just use the built-in 'example' output. :)

#30 ryan

ryan

    Reiska

  • Administrators
  • 7,808 posts
  • 6600

  • LocationAtlanta, GA

Posted 10 February 2012 - 02:42 PM

is there also the ability to auto-js hide the form, and make it available via .js click toggle? (or ajax?)


Of course, but PW doesn't get involved in this stuff (it does no JS output on it's own for the front-end of your site). But you can add on whatever JS functionality you want to it.

#31 neildaemond

neildaemond

    Sr. Member

  • Members
  • PipPipPipPip
  • 123 posts
  • 32

  • LocationHong Kong

Posted 12 February 2012 - 10:14 PM

the roadmap about comments section didn't happen to mention anything about a "receive email notifications on new comments" check box, did it?

I think this would be a nice feature~

#32 ryan

ryan

    Reiska

  • Administrators
  • 7,808 posts
  • 6600

  • LocationAtlanta, GA

Posted 13 February 2012 - 02:34 PM

I like that feature too, but something we'll probably accomplish with an optional module that bolts on to it. Emails getting fired off every time someone responds to a comment could get out-of-hand on a large comment thread. So it's one of those things that really has to be built very carefully (which we can do).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users