summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Profiles/ViewProfile.cshtml
blob: 9ba337d843cd6303db9738e025d2139d184ede4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@model Project_Unite.Models.ApplicationUser
@{
    ViewBag.Title = Model.DisplayName;
    ViewBag.Banner = Model.BannerUrl;
}

<div class="row">
        <div class="col-xs-3">
        <img class="avatar" src="@Model.AvatarUrl" width="128" height="128" />
        @if (!string.IsNullOrWhiteSpace(Model.FullName))
        {
            <h4>@Model.FullName</h4>
        }
        <h5>@Model.DisplayName</h5>

<ul class="nav nav-pills nav-stacked">
    @if (Request.IsAuthenticated)
    {
        if (Model.ShowEmail)
        {
            if (Model.EmailConfirmed == true)
            {
                <li><a href="mailto:@Model.Email">Email @Model.Email</a></li>
            }
        }
    }
    @if (Model.UserName != User.Identity.Name)
    {
        if (ACL.IsFollowed(User.Identity.Name, Model.Id))
        {
            <li><a href="@Url.Action("UnfollowUser", "Profiles", new { id = Model.Id })"><span class="glyphicon glyphicon-eye-close"></span> Unfollow</a></li>
        }
        else
        {
        <li><a href="@Url.Action("FollowUser", "Profiles", new { id = Model.Id })"><span class="glyphicon glyphicon-eye-open"></span> Follow</a></li>
        }
    }
</ul>

            <hr/>

            <strong>User stats</strong><br/>
            <ul>
                <li><strong>@Model.Codepoints</strong> Codepoints</li>
                @if (Model.ShowJoinDate)
                {
                    <li><strong>Joined at: </strong>@Model.JoinedAt</li>
                }
                @if (Model.ShowPostAndTopicCounts)
                {
                <li><strong>Posts: </strong>@Model.PostCount</li>
                <li><strong>Topics: </strong>@Model.TopicCount</li>
                }
            </ul>

            @if (Model.Followers.Count() > 0 && Model.ShowFollowers)
            {
            <h4>Followers</h4>
            <ul>
                @foreach (var f in Model.Followers)
                {
                    <li>@Html.UserLink(f.Follower)</li>
                }
            </ul>
            }

            @if (Model.Followed.Count() > 0 && Model.ShowFollowed)
            {
            <h4>Following</h4>
            <ul>
                @foreach (var f in Model.Followed)
                {
                    <li>@Html.UserLink(f.Followed)</li>
                }
            </ul>
            }

    </div>
    <div class="col-xs-9">

        <h2>About @Model.DisplayName</h2>

        @if (!string.IsNullOrWhiteSpace(Model.Bio))
        {
            <h3>Bio</h3>
            <p>@Html.Markdown(Model.Bio)</p>
        }

        <div class="row">
            <div class="col-xs-6">
                <h3>Interests</h3>
                @if (string.IsNullOrWhiteSpace(Model.Interests))
                {
                    <p>Nothing to show here.</p>
                }
                else
                {
                    <p>@Html.Markdown(Model.Interests)</p>
                }
            </div><div class="col-xs-6">
                <h3>Hobbies</h3>
                @if (string.IsNullOrWhiteSpace(Model.Hobbies))
                {
                    <p>Nothing to show here.</p>
                }
                else
                {
                    <p>@Html.Markdown(Model.Hobbies)</p>
                }
            </div>
        </div>



        <h2>Posts</h2>

        @if(Model.UserName == User.Identity.Name)
        {
            Html.RenderPartial("~/Views/Profiles/_NewPost.cshtml", new Project_Unite.Models.UserPost());
        }
         @if(Model.Posts.Count() == 0)
         {
             <h3>Nothing to show here...</h3>

             <p>This user hasn't posted anything to their profile just yet. You can follow them to get notified when they do, or you can keep checking back!</p>
         }
        @foreach(var post in Model.Posts.OrderByDescending(x => x.PostedAt))
        {
            
            <div class="panel">
                <div class="panel-body">
                <p><strong>Posted on @post.PostedAt</strong>:</p>
                <p>@Html.Markdown(post.PostContents)</p>
                <ul class="nav nav-pills">
                    @{ 
                        string likeLink = "#";
                        string dislikeLink = "";
                        if(Model.UserName != User.Identity.Name)
                        {
                            likeLink = "/Profiles/LikePost/" + post.Id;
                            dislikeLink = likeLink.Replace("Like", "Dislike");
                        }
                    }
                    <li><a href="@likeLink"><span class="glyphicon glyphicon-thumbs-up"></span> @post.Likes.Length</a></li>
                    <li><a href="@dislikeLink"><span class="glyphicon glyphicon-thumbs-down"></span> @post.Dislikes.Length</a></li>

                </ul>
                </div>
            </div>
        }
    </div>
</div>