Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Added new comment functionality to comments component.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchisari authored and The Appleseed Project committed Jan 8, 2011
1 parent 37deea5 commit b7cea44
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 8 deletions.
8 changes: 7 additions & 1 deletion components/comments/controllers/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function Display ( $pView = null, $pData = array ( ) ) {
$this->Model = $this->GetModel ( );

$this->Comments = $this->Model->Load ( $Context, $Context_FK );
$count = $this->Model->Get ( 'Total' );

$this->View->Find ( '.title', 0)->innertext = __ ( "Read Comments", array ( 'count' => $count ) );

$ol = $this->View->Find ( '.comments', 0);

Expand All @@ -75,6 +78,9 @@ public function Display ( $pView = null, $pData = array ( ) ) {
unset ( $row );
}

$this->View->Find ( 'form[name="comment"] [name="Parent_ID"]', 0 )->value = "";
$this->View->Find ( 'form[name="comment"] [name="Context"]', 0 )->value = $this->Get ( 'Context' );

$this->View->Display();

return ( true );
Expand Down Expand Up @@ -128,7 +134,7 @@ public function Reply ( $pView = null, $pData = array ( ) ) {
return ( true );
}

public function Save ( $pView = null, $pData = array ( ) ) {
public function Post ( $pView = null, $pData = array ( ) ) {

$Context = $pData['Context'];
$Id = $pData['Id'];
Expand Down
2 changes: 2 additions & 0 deletions components/comments/languages/en-US/comments.lang
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

NO_COMMENTS=" "
READ_COMMENTS="Read %count$s comments"
DELETED_COMMENT="This comment has been deleted"
WRITE_A_COMMENT="Write a comment..."
16 changes: 14 additions & 2 deletions components/comments/views/comments.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<h1>Read Comments</h1>
<a class="anchor" name="comments"></a>
<h1 class="title"></h1>
<form name="comment" method="post">
<input type="hidden" name="Context" />
<input type="hidden" name="Parent_ID" />
<input type="hidden" name="Task" value="Reply" />
<textarea name="Body" placeholder="Write A Comment"></textarea>
<p class="buttons">
<button type="submit" name="Task" value="Post" />Post</button>
<button type="submit" name="Task" value="Cancel" />Cancel</button>
</p>
</form>
<ol class="comments outer">
<li>
<div class="comment">
Expand Down Expand Up @@ -35,4 +47,4 @@
</div>
</li>
<li class='nesting'></li>
</ol>
</ol>
13 changes: 13 additions & 0 deletions components/comments/views/none.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<a class="anchor" name="comments"></a>
<h1>No Comments</h1>
<form name="comment" method="post">
<input type="hidden" name="Context" />
<input type="hidden" name="Parent_ID" />
<input type="hidden" name="Task" value="Reply" />
<textarea name="Body" placeholder="Write A Comment"></textarea>
<p class="buttons">
<button type="submit" name="Task" value="Post" />Post</button>
<button type="submit" name="Task" value="Cancel" />Cancel</button>
</p>
</form>
6 changes: 3 additions & 3 deletions components/comments/views/reply.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<a class="anchor" name="comments"></a>
<h1>Reply To Comment</h1>
<ol class="comments outer">
<li>
Expand Down Expand Up @@ -42,8 +43,7 @@
<textarea name="Body" placeholder="Write A Comment"></textarea>
<p class="buttons">
<button type="submit" name="Task" value="Save" />Save</button>
<button type="submit" name="Task" value="Post" />Post</button>
<button type="submit" name="Task" value="Cancel" />Cancel</button>
</p>
</form>

</form>
7 changes: 5 additions & 2 deletions themes/default/style/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

section p { clear:both; margin-top:10px; }

a.anchor { display:none; }

/* Pagination */

nav.pagination ol { float:right; clear:both; margin-top:10px; }
Expand Down Expand Up @@ -96,8 +98,9 @@

/* Comments */
section.comments { clear:both; float:left; width:100%; }
section.comments form[name="comment"] textarea { margin-left:20px; width:672px; min-height:60px; }
section.comments form[name="comment"] .buttons { float:right; margin:0; }
section.comments form[name="comment"] textarea { width:692px; height:14px; }
section.comments form[name="comment"] textarea:focus { width:692px; height:56px; }
section.comments form[name="comment"] .buttons { float:right; margin:0; margin-bottom:5px; }
ol.comments.outer { font-size:110%; }
ol.comments { float:left; clear:both; width:100%; list-style-type:none; margin:0; }
ol.comments li { clear: left; }
Expand Down

0 comments on commit b7cea44

Please sign in to comment.