Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.42 KB | None | 0 0
  1. <div ng-controller="commentController">
  2. <div class="actionBox">
  3. <div class="scrollbarsupreme">
  4. <ul style="list-style-type: none">
  5. <li ng-repeat="x in comments">
  6. <div class="commenterImage">
  7. <p>{{x.UserName}} Says</p>
  8. <a href="/Account/Profile.aspx?userId={{x.UserId}}"></a>
  9. </div>
  10. <br />
  11. <div class="commentText">
  12. <p class="commentText">{{x.Comment}}</p>
  13. <span class="date sub-text">on {{x.LastUpdated | date : "short"}}</span>
  14. </div>
  15. <div ng-controller="replyController">
  16. <button type="button" style="color: #00b7fc; background-color:black; border:none" ng-click="getRepliesByParentId()" >Show Replies</button>
  17. <a ng-click="replyText=!replyText" style="color: #00b7fc; padding-left: 15%">Click to reply</a>
  18. <div ng-show="replyText">
  19. <div class="text-area-container">
  20. <textarea id="replyTextBox" class="chat-box" style="color:black" cols="50" rows="2" ng-model="textModel"></textarea>
  21. </div>
  22. <div class="button-container btn-group btn-group-chat">
  23. </div>
  24. <div>
  25. <button ng-click="replyFunction();" value="{{x.Id}}" type="submit" id="getParentId" style="background-color: #000; color: #00b7fc; border: 1px solid #00b7fc">Submit Reply</button>
  26. </div>
  27. </div>
  28. </div>
  29. <hr style="width: 95%" />
  30. </li>
  31. </ul>
  32. </div>
  33. </div>
  34. </div>
  35.  
  36. app.controller("commentController", function ($scope) {
  37. $scope.comments = [];
  38. $scope.replies = [];
  39.  
  40.  
  41. angular.element(document).ready(function () {
  42. //var parentId = $("#IdforParentId").val();
  43. var postId = vote.getAttribute("postid");
  44. WebServiceRequest("GetCommentsByPostId", "{'postId': '" + postId + "'}", commentSuccess, commentFailure)
  45. });
  46.  
  47. function commentSuccess(response) {
  48. $scope.comments = JSON.parse(response.d);
  49. $scope.$apply();
  50. var parentId = $("#IdforParentId").val();
  51. //alert(response.d);
  52. //WebServiceRequest("GetRepliesByParentId", "{'parentId': '" + parentId + "'}", repliesSuccess, repliesFailure)
  53. $("#cmtComment").val('');
  54. }
  55. function commentFailure(response) {
  56. alert(response.d.responseText);
  57. }
  58.  
  59. function repliesSuccess(response) {
  60. $scope.replies = JSON.parse(response.d)
  61. $scope.$apply();
  62. alert(response.d)
  63. }
  64. function repliesFailure(response) {
  65. alert(response.d.responseText);
  66. }
  67.  
  68. $("#btnSubmit").click(function (event) {
  69. event.preventDefault();
  70. var postid = vote.getAttribute("postid");
  71. var commentText = $("#cmtComment").val();
  72. var userid = '<%=getUserId()%>';
  73. WebServiceRequest("SubmitComment", "{'postid': '" + postid + "', 'commentText': '" + commentText + "', 'userid': '" + userid + "'}", commentSuccess, commentFailure)
  74. });
  75. });
  76. app.controller("replyController", function ($scope) {
  77. //$scope.textModel = "Reply Text Here"
  78. $scope.reply = [];
  79. $scope.replyFunction = function () {
  80. event.preventDefault();
  81. var postid = vote.getAttribute("postid");
  82. var commentText = $scope.textModel; //$("replyTextBox").val();
  83. var parentId = $("#getParentId").val();
  84. var userid = '<%=getUserId()%>';
  85. WebServiceRequest("SubmitReply", "{'parentId': '" + parentId + "', 'postid': '" + postid + "', 'commentText': '" + commentText + "', 'userid': '" + userid + "'}", replySuccess, replyFailure)
  86. }
  87.  
  88. $scope.getRepliesByParentId = function () {
  89. var parentId = $("#getParentId").val();
  90. WebServiceRequest("GetRepliesByParentId", "{'parentId': '" + parentId + "'}", repliesSuccess, repliesFailure)
  91. }
  92.  
  93. function repliesSuccess(response) {
  94. $scope.$reply = JSON.parse(response.d)
  95. $scope.$apply();
  96. alert(response.d)
  97. }
  98. function repliesFailure(response){
  99. alert(response.d.responseText);
  100. }
  101.  
  102. function replySuccess(response) {
  103. $scope.reply = JSON.parse(response.d);
  104. $scope.$apply();
  105. //alert(response.d);
  106. }
  107. function replyFailure(response) {
  108. alert(response.d.responseText);
  109. }
  110. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement