1 00:00:00,670 --> 00:00:02,820 Hell you are welcome in this show. 2 00:00:03,070 --> 00:00:08,990 We are going to split the views from the show template to show a template. 3 00:00:08,980 --> 00:00:10,170 It's a big crowd. 4 00:00:10,390 --> 00:00:20,020 So I'm going to split the viewers from there and create two separate views within the comments directly. 5 00:00:20,200 --> 00:00:26,310 So this is what our show template looks like at the moment which is this should dot hastier mailed. 6 00:00:26,370 --> 00:00:26,800 He. 7 00:00:26,850 --> 00:00:27,910 B. 8 00:00:28,000 --> 00:00:36,290 So what I want to do I want to separate the leave forms and this area here. 9 00:00:36,310 --> 00:00:39,440 I've added for the comments. 10 00:00:39,610 --> 00:00:46,300 So if we look at the view here the view area here we've got these are all the views belonging to the 11 00:00:46,310 --> 00:00:52,060 post and we're using this show view which belong so they post what I want to do is create really fight 12 00:00:52,150 --> 00:00:55,220 expand this comments directly. 13 00:00:55,570 --> 00:00:57,270 There is no views here. 14 00:00:57,310 --> 00:01:01,430 I want to create a couple that we can transfer these. 15 00:01:01,480 --> 00:01:04,120 Were going to split this into two separate. 16 00:01:04,300 --> 00:01:05,140 He is. 17 00:01:05,410 --> 00:01:11,920 So to begin I'm just going to right click on the comments falder and click on new file. 18 00:01:11,920 --> 00:01:16,460 I'm going to do file save those. 19 00:01:17,650 --> 00:01:19,650 I'm going to call this. 20 00:01:20,170 --> 00:01:25,800 I'm going to make it a partial file and call it on the score. 21 00:01:27,810 --> 00:01:28,850 Comments. 22 00:01:29,880 --> 00:01:31,250 Comments. 23 00:01:31,330 --> 00:01:33,290 But here is t e mail. 24 00:01:36,380 --> 00:01:38,620 E r b. 25 00:01:39,040 --> 00:01:45,580 So a partial files have on the score be prefixed before the name of your father. 26 00:01:46,040 --> 00:01:56,840 I'm going to save this parshall's basically partial files allow you to easily organize and reuse your 27 00:01:56,840 --> 00:01:57,790 view with the code. 28 00:01:57,800 --> 00:02:08,770 In your view scanner allows you to easily organize and you really use it for any of your Real's application. 29 00:02:08,840 --> 00:02:17,210 Partial file mainly typically have an on the score at the beginning and you also named them the same 30 00:02:17,210 --> 00:02:22,490 way you name your files so as the dot his TMF dot E R B. 31 00:02:22,850 --> 00:02:23,690 So one going to do. 32 00:02:23,690 --> 00:02:32,070 Now I'm going to go to the show template here and I would just grab this. 33 00:02:33,430 --> 00:02:35,630 So I'm just going to grab this. 34 00:02:38,510 --> 00:02:47,380 Right click cut and go to the comments underscore comments and paste that in there just one as saved 35 00:02:47,380 --> 00:02:49,650 that matches or saved. 36 00:02:50,290 --> 00:02:53,350 Okay so we've got some space in here now. 37 00:02:53,350 --> 00:03:01,030 Next thing I want to do is create on Mother template and when I go back in to the comments you hear 38 00:03:01,630 --> 00:03:07,220 right click and go new do file same vows. 39 00:03:07,240 --> 00:03:09,600 This also is going to be a partial. 40 00:03:09,750 --> 00:03:13,800 I am going to do on this core form. 41 00:03:15,580 --> 00:03:16,450 DOT. 42 00:03:17,620 --> 00:03:21,940 Hey T email dot E R B. 43 00:03:22,460 --> 00:03:29,430 And I'm going to say that I'm going to go to the show and win and grab all this. 44 00:03:31,020 --> 00:03:35,620 I cut and pasted in there. 45 00:03:37,390 --> 00:03:39,100 And click save. 46 00:03:39,160 --> 00:03:42,380 So you can see the show. 47 00:03:42,380 --> 00:03:42,820 Sure. 48 00:03:42,840 --> 00:03:51,920 For you now is looking a bit tidier just like we have a link to delete post. 49 00:03:51,940 --> 00:03:58,650 I want there to be a link to delete the comments so I go back to the comments area here. 50 00:03:59,020 --> 00:04:06,260 I'm just going to paste in and does a tab and just paste team the code here. 51 00:04:06,490 --> 00:04:12,560 So this is what we're going to use to remove any comments or this is a link. 52 00:04:12,560 --> 00:04:17,500 So set in a link here and a text just put here is remove comma. 53 00:04:17,500 --> 00:04:25,300 You can put whatever text you like you can put delete or whatever just put rim of comment and here past 54 00:04:25,300 --> 00:04:29,070 team the variables so a bit comment. 55 00:04:29,110 --> 00:04:36,600 Don't post the poser blunt to the comment and or saw the actual comment as would be the variable. 56 00:04:36,610 --> 00:04:40,090 The inside be a read here and then we have a method. 57 00:04:40,120 --> 00:04:46,330 The method is going to be delete and we are going to have a confirmation so that if you want to delete 58 00:04:46,750 --> 00:04:49,270 a comment you will be prompted and ask. 59 00:04:49,270 --> 00:04:51,660 Do you really really really want to. 60 00:04:52,510 --> 00:04:56,420 So why need to do so get rid of this p tag here. 61 00:04:56,830 --> 00:05:02,730 Let's close in one here and make this the closing P tag. 62 00:05:02,740 --> 00:05:03,720 Does the opening. 63 00:05:03,760 --> 00:05:09,630 And this would be the closing so one going to do is remove this div. 64 00:05:09,640 --> 00:05:10,510 Here I am. 65 00:05:13,390 --> 00:05:16,840 So that it ends here right does begin indeed. 66 00:05:16,870 --> 00:05:18,790 And that's the end indeed. 67 00:05:19,330 --> 00:05:22,200 And that's the clause in paragraph. 68 00:05:22,210 --> 00:05:24,480 That's the opening paragraph tag. 69 00:05:24,780 --> 00:05:33,670 So I'm going to also remove fits here because we've got an end in tag there so there is no conflict 70 00:05:35,540 --> 00:05:37,150 so I'll save this. 71 00:05:37,180 --> 00:05:42,210 What this would do it will create a link in our comment. 72 00:05:42,290 --> 00:05:46,430 How Give was an option to delete if we want to. 73 00:05:46,510 --> 00:05:51,970 So let's go to the form side of things and try and fix this one as. 74 00:05:52,720 --> 00:05:53,000 O. 75 00:05:53,000 --> 00:05:53,380 K.. 76 00:05:53,380 --> 00:05:55,180 This looks o k. 77 00:05:55,370 --> 00:05:56,910 Can't see anything to change it. 78 00:05:56,910 --> 00:05:58,140 It looks fine. 79 00:05:58,220 --> 00:06:06,910 Just going to see that but we need to make a reference to them inside our show template. 80 00:06:06,920 --> 00:06:15,200 We need to find a way of rendering this two forms because our parshall's we go in. 81 00:06:15,210 --> 00:06:22,460 There's a way we can add it and it will be rendered from within the shawl template. 82 00:06:22,460 --> 00:06:24,590 Here to save time. 83 00:06:24,590 --> 00:06:27,950 I'm just going to add the path here. 84 00:06:27,980 --> 00:06:34,490 So when this is all we need in order to render because our partial farr's we don't need to specify the 85 00:06:34,490 --> 00:06:36,920 full path so we just typee. 86 00:06:36,920 --> 00:06:45,410 We just use a render in order to render the forms sorted timid or a B and the comments. 87 00:06:45,470 --> 00:06:47,400 Okay just read this two line of code here. 88 00:06:47,400 --> 00:06:56,080 Does should render it fun of the thing we need to do is add a action inside a commons controller that 89 00:06:56,120 --> 00:06:59,330 would enable laws to delete the comments at the moment. 90 00:06:59,330 --> 00:07:05,420 We can't delete any comments if we try I will get an error cos we've not added the action to do that 91 00:07:06,140 --> 00:07:07,360 to save time. 92 00:07:07,370 --> 00:07:12,970 I am going to go to the kamens controller. 93 00:07:13,360 --> 00:07:18,250 I have already written out the code I'm just going to paste in just to save time. 94 00:07:18,290 --> 00:07:23,710 The process is identical to what we've been doing so find during the course. 95 00:07:23,720 --> 00:07:29,290 So you should be familiar with it by now hopefully pasting. 96 00:07:29,330 --> 00:07:32,200 Read this try method here. 97 00:07:32,270 --> 00:07:38,890 So basically this is the method to enable you to delete any comment. 98 00:07:38,990 --> 00:07:45,800 So here this we describe here we did def and move the pause variable we said that 2 did post a variable 99 00:07:45,800 --> 00:07:46,610 in the model. 100 00:07:46,660 --> 00:07:48,760 This this is from the Post's model. 101 00:07:49,160 --> 00:07:53,810 And again it will look for the post a d to. 102 00:07:53,840 --> 00:08:00,780 That would be the reference to comment on and here require the comment variable we set in that too that 103 00:08:00,800 --> 00:08:07,620 puts a variable dot comments out of find again the we use in the idea. 104 00:08:07,640 --> 00:08:13,900 From that comment and then to Destro we need to call the district action or method. 105 00:08:13,920 --> 00:08:15,650 We do that usedn't is variable. 106 00:08:15,650 --> 00:08:17,120 Comments don't destroy. 107 00:08:17,450 --> 00:08:26,620 Once a comment has been destroyed we need to redirect the user to this path here which is post on this 108 00:08:26,630 --> 00:08:28,210 core path PPO's was. 109 00:08:28,330 --> 00:08:31,070 Message is be read destroyed or delete it. 110 00:08:31,070 --> 00:08:32,630 He gets redirected. 111 00:08:32,840 --> 00:08:36,390 So I click C and that should be it. 112 00:08:36,410 --> 00:08:38,310 So now let's try and do it. 113 00:08:38,340 --> 00:08:40,250 Go back to our form. 114 00:08:40,360 --> 00:08:42,590 Hopefully everything's gone right. 115 00:08:43,130 --> 00:08:44,090 I'll just refresh. 116 00:08:44,090 --> 00:08:45,760 Make sure there's no errors. 117 00:08:46,160 --> 00:08:50,920 I'm just going to add it teschke comment here are just see. 118 00:08:52,980 --> 00:08:53,830 Tester. 119 00:08:55,810 --> 00:08:56,440 No C. 120 00:08:56,440 --> 00:08:57,010 Just 121 00:08:59,440 --> 00:09:01,100 testing. 122 00:09:01,560 --> 00:09:03,320 And I'll quote the comment. 123 00:09:04,240 --> 00:09:04,680 All right. 124 00:09:04,720 --> 00:09:06,490 So I'm not going to comment now. 125 00:09:06,490 --> 00:09:10,030 So See this link here to read more comment. 126 00:09:10,220 --> 00:09:20,620 Remote saying Do you really want to see excelon So the comment the delete is working correctly as design. 127 00:09:20,980 --> 00:09:22,500 So that's it for this lecture. 128 00:09:22,510 --> 00:09:28,980 We have implemented the delete option so we are able to create comments. 129 00:09:28,990 --> 00:09:32,980 We are also able to delete comments. 130 00:09:32,980 --> 00:09:35,500 Thankyou so much for watching in the next link. 131 00:09:35,510 --> 00:09:38,870 Sure we are going to implement some security. 132 00:09:38,870 --> 00:09:45,360 Of course we don't want anyone to just be able to answer comments and do our kind of stuff on our blog. 133 00:09:45,370 --> 00:09:48,760 I will implement on basic security. 134 00:09:48,760 --> 00:09:51,250 Thanks for watching and bye for now.