Skip to content

Commit 287ebd1

Browse files
Move Tweet views back to DLL, OOPS
1 parent 58866fd commit 287ebd1

File tree

8 files changed

+167
-76
lines changed

8 files changed

+167
-76
lines changed

.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
A random bunch of MVC Feather controls and extensions to improve your sitefinity experience
99
- Tabstrip, Kendo or Bootstrap
1010
- Markdown Editor
11+
- Twitter
1112
- Google maps widget
1213
- Page Title widget
1314
- HTML Literal Editor (No designer or markup mangling, uses inbrowser VSCode editor)

MVC/Views/Twitter/DesignerView.Simple.cshtml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@
1515
</select>
1616
</div>
1717

18-
<div class="form-group">
18+
<div class="form-group" ng-show="properties.Mode.PropertyValue == 'SpecificTweet'">
19+
<label for="heading-text">
20+
Tweet Id
21+
</label>
22+
<input id="heading-text" type="text" class="form-control" ng-model="properties.TweetId.PropertyValue" />
23+
<div class="text-muted">
24+
Get this from the browser url when you click on a tweet, example<br />
25+
https://twitter.com/stevemcniven/status/<strong>1073618189756653574</strong>
26+
</div>
27+
</div>
28+
29+
<div class="form-group" ng-hide="properties.Mode.PropertyValue == 'SpecificTweet'">
1930
<label for="heading-text">
2031
Tweet count
2132
</label>

MVC/Views/Twitter/Resources/twitter.css

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
padding: 9px 12px;
55
border-bottom: 1px solid #e6ecf0;
66
}
7+
.twitter-feed .tweet:last-child {
8+
border-bottom: none;
9+
}
710
.twitter-feed .tweet > .context {
811
margin-left: 58px;
912
}
@@ -79,7 +82,6 @@
7982
padding-top: 1px;
8083
}
8184
.twitter-feed .tweet .content .stream-item-footer .ProfileTweet-actionList {
82-
font-size: 0;
8385
height: 18px;
8486
line-height: 1;
8587
margin-bottom: 2px;
@@ -99,6 +101,27 @@
99101
position: relative;
100102
vertical-align: text-bottom;
101103
}
104+
.twitter-feed .tweet .content .AdaptiveMediaOuterContainer {
105+
margin-top: 10px;
106+
}
107+
.twitter-feed .tweet .content .AdaptiveMediaOuterContainer .AdaptiveMedia {
108+
border: 1px solid rgba(0, 0, 0, 0.1);
109+
/*max-height: 506px;
110+
max-width: 506px;*/
111+
border-radius: 12px;
112+
display: inline-block;
113+
overflow: hidden;
114+
position: relative;
115+
vertical-align: top;
116+
width: 100%;
117+
}
118+
.twitter-feed .tweet .content .AdaptiveMediaOuterContainer .AdaptiveMedia .AdaptiveMedia-singlePhoto .AdaptiveMedia-photoContainer {
119+
bottom: 0;
120+
left: 0;
121+
position: absolute;
122+
right: 0;
123+
top: 0;
124+
}
102125
.twitter-feed .tweet .QuoteTweet {
103126
margin-top: 12px;
104127
border: solid 1px #e6ecf0;

MVC/Views/Twitter/Resources/twitter.less

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
padding: 9px 12px;
66
border-bottom: 1px solid #e6ecf0;
77

8+
&:last-child{
9+
border-bottom: none;
10+
}
11+
812
>.context{
913
margin-left: 58px;
1014

@@ -93,7 +97,6 @@
9397
padding-top: 1px;
9498

9599
.ProfileTweet-actionList {
96-
font-size: 0;
97100
height: 18px;
98101
line-height: 1;
99102
margin-bottom: 2px;
@@ -106,7 +109,7 @@
106109
.ProfileTweet-actionCount {
107110
color: #657786;
108111
display: inline-block;
109-
font-size: 12px;
112+
font-size: 12px;
110113
font-weight: bold;
111114
line-height: 1;
112115
margin-left: 6px;
@@ -116,6 +119,32 @@
116119
}
117120
}
118121
}
122+
123+
.AdaptiveMediaOuterContainer{
124+
margin-top: 10px;
125+
126+
.AdaptiveMedia{
127+
border: 1px solid rgba(0,0,0,0.1);
128+
/*max-height: 506px;
129+
max-width: 506px;*/
130+
border-radius: 12px;
131+
display: inline-block;
132+
overflow: hidden;
133+
position: relative;
134+
vertical-align: top;
135+
width: 100%;
136+
137+
.AdaptiveMedia-singlePhoto {
138+
.AdaptiveMedia-photoContainer {
139+
bottom: 0;
140+
left: 0;
141+
position: absolute;
142+
right: 0;
143+
top: 0;
144+
}
145+
}
146+
}
147+
}
119148
}
120149

121150
.QuoteTweet {

MVC/Views/Twitter/Resources/twitter.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MVC/Views/Twitter/Tweets.cshtml

Lines changed: 89 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,77 +5,104 @@
55
@using RandomSiteControlsMVC.Helpers;
66
@using Telerik.Sitefinity;
77

8-
@Html.StyleSheet("/Mvc/Views/Twitter/Resources/twitter.min.css", "head")
8+
@*@Html.StyleSheet("/Mvc/Views/Twitter/Resources/twitter.min.css", "head")*@
9+
@Html.StyleSheet(Url.EmbeddedResource("RandomSiteControlsMVC.Reference", "RandomSiteControlsMVC.MVC.Views.Twitter.Resources.twitter.min.css"), "head")
910

1011
@if (Model.Tweets.Count > 0)
1112
{
12-
<div class="twitter-feed @Model.CssClass">
13-
@foreach (var t in Model.Tweets)
14-
{
15-
var isRetweet = t.RetweetedStatus == null ? false : true;
16-
var author = t.RetweetedStatus == null ? t.Author : t.RetweetedStatus.Author;
17-
var user = t.RetweetedStatus == null ? t.User : t.RetweetedStatus.User;
13+
<div class="twitter-feed @Model.CssClass">
14+
@foreach (var t in Model.Tweets)
15+
{
16+
var isRetweet = t.RetweetedStatus == null ? false : true;
17+
var author = t.RetweetedStatus == null ? t.Author : t.RetweetedStatus.Author;
18+
var user = t.RetweetedStatus == null ? t.User : t.RetweetedStatus.User;
19+
var media = t.Entities.Where(x => x.EntityType == TweetSharp.TwitterEntityType.Media);
1820

19-
<div class="tweet">
20-
@if (t.RetweetedStatus != null)
21-
{
22-
<div class="context retweetedby">
23-
<a class="profile-link" href="https://www.twitter.com/@t.Author.ScreenName" rel="noopener">
24-
@t.Author.ScreenName Retweeted
25-
</a>
26-
</div>
27-
}
28-
<div class="content">
29-
<div class="stream-item-header">
30-
@*User Title*@
31-
<a class="account-group" href="https://www.twitter.com/@(author.ScreenName)">
32-
<img alt="@author.ScreenName" class="avatar rounded-circle" src="@author.ProfileImageUrl.Replace("http:","https:").Replace("_normal","_bigger")">
33-
<span class="FullNameGroup">
34-
<strong class="fullname u-textTruncate">@user.Name</strong>
35-
@if (user.IsVerified.HasValue && user.IsVerified.Value)
36-
{
37-
<span class="UserBadges">
38-
<span class="Icon">
39-
<img src="https://upload.wikimedia.org/wikipedia/commons/e/e4/Twitter_Verified_Badge.svg" alt="Verified" />
40-
</span>
41-
</span>
42-
}
43-
<span class="UserNameBreak">&nbsp;</span>
44-
</span>
45-
<span class="username u-dir u-textTruncate" dir="ltr" data-aria-label-part="">@@@(user.ScreenName)</span>
46-
</a>
47-
</div>
48-
@*Tweet body*@
49-
<div class="TweetTextSize">
50-
@Html.Raw(t.TextAsHtml)
51-
</div>
52-
@if (t.IsQuoteStatus && t.QuotedStatus != null)
21+
<div class="tweet">
22+
@if (t.RetweetedStatus != null)
5323
{
54-
<div class="QuoteTweet">
55-
<div class="tweet-content">
56-
<div class="QuoteTweet-authorAndText">
57-
<div class="QuoteTweet-originalAuthor">
24+
<div class="context retweetedby">
25+
<a class="profile-link" href="https://www.twitter.com/@t.Author.ScreenName" rel="noopener">
26+
@t.Author.ScreenName Retweeted
27+
</a>
28+
</div>
29+
}
30+
<div class="content">
31+
<div class="stream-item-header">
32+
@*User Title*@
33+
<a class="account-group" href="https://www.twitter.com/@(author.ScreenName)">
34+
<img alt="@author.ScreenName" class="avatar rounded-circle" src="@author.ProfileImageUrl.Replace("http:","https:").Replace("_normal","_bigger")">
35+
<span class="FullNameGroup">
36+
<strong class="fullname u-textTruncate">@user.Name</strong>
37+
@if (user.IsVerified.HasValue && user.IsVerified.Value)
38+
{
39+
<span class="UserBadges">
40+
<span class="Icon">
41+
<img src="https://upload.wikimedia.org/wikipedia/commons/e/e4/Twitter_Verified_Badge.svg" alt="Verified" />
42+
</span>
43+
</span>
44+
}
45+
<span class="UserNameBreak">&nbsp;</span>
46+
</span>
47+
<span class="username u-dir u-textTruncate" dir="ltr" data-aria-label-part="">@@@(user.ScreenName)</span>
48+
</a>
49+
</div>
50+
@*Tweet body*@
51+
<div class="TweetTextSize">
52+
@Html.Raw(t.TextAsHtml)
53+
</div>
54+
@if (t.IsQuoteStatus && t.QuotedStatus != null)
55+
{
56+
<div class="QuoteTweet">
57+
<div class="tweet-content">
58+
<div class="QuoteTweet-authorAndText">
59+
<div class="QuoteTweet-originalAuthor">
5860

59-
</div>
60-
<div class="QuoteTweet-text">
61-
@Html.Raw(t.QuotedStatus.Text)
61+
</div>
62+
<div class="QuoteTweet-text">
63+
@Html.Raw(t.QuotedStatus.Text)
64+
</div>
6265
</div>
6366
</div>
6467
</div>
65-
</div>
66-
}
67-
<div class="stream-item-footer">
68-
<div class="ProfileTweet-actionList">
69-
<div class="ProfileTweet-actionCount ">
70-
@t.RetweetCount
71-
</div>
72-
<div class="ProfileTweet-actionCount ">
73-
@t.FavoriteCount
74-
</div>
75-
</div>
68+
}
69+
@if (media.Count() > 0)
70+
{
71+
foreach (TweetSharp.TwitterMedia m in media)
72+
{
73+
if (m.MediaType == TweetSharp.TwitterMediaType.Photo)
74+
{
75+
<div class="AdaptiveMediaOuterContainer">
76+
<div class="AdaptiveMedia is-square">
77+
<div class="AdaptiveMedia-container">
78+
<div class="AdaptiveMedia-singlePhoto" style="padding-top: calc(0.5409153952843273 * 100% - 0.5px);">
79+
<div class="AdaptiveMedia-photoContainer js-adaptive-photo " style="background-color:rgba(64,64,10,1.0);">
80+
<img src="@m.MediaUrlHttps" alt="" style="width: 100%; top: -0px;">
81+
</div>
82+
</div>
83+
</div>
84+
</div>
85+
</div>
86+
}
87+
}
88+
}
89+
@*To impliment later... missing images*@
90+
@*<div class="stream-item-footer">
91+
<div class="ProfileTweet-actionList">
92+
<div class="ProfileTweet-action">
93+
<div class="ProfileTweet-actionCount ">
94+
@(t.RetweetCount > 0 ? t.RetweetCount.ToString() : "")
95+
</div>
96+
</div>
97+
<div class="ProfileTweet-action">
98+
<div class="ProfileTweet-actionCount ">
99+
@(t.FavoriteCount > 0 ? t.FavoriteCount.ToString() : "")
100+
</div>
101+
</div>
102+
</div>
103+
</div>*@
76104
</div>
77105
</div>
78-
</div>
79-
}
80-
</div>
106+
}
107+
</div>
81108
}

0 commit comments

Comments
 (0)