Skip to content

Commit

Permalink
.....
Browse files Browse the repository at this point in the history
  • Loading branch information
Nourmasrieh committed May 23, 2023
1 parent 9bb0759 commit 34bc040
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 33 deletions.
18 changes: 9 additions & 9 deletions client/scss/_socialselement.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
top: 1rem;
right: 1rem;
i{
color: $White;
color: #fff;
}
}
.username{
Expand All @@ -23,7 +23,7 @@
}
}
.card-footer {
background-color: $White;
background-color: #fff;
& *{
color: $PrimaryColor !important;
font-size: 16px !important;
Expand All @@ -44,22 +44,22 @@
padding: 0;
text-decoration: none;
text-align: center;
color: $White;
color: #fff;
font-weight: normal;
font-size: 22px;
font-size: 24px;
line-height: 2;
border-radius: 1.6875rem;
transition: all 0.5s ease;
margin-right: 0.25rem;
margin-bottom: 0.25rem;
background: $SecondaryColor;
*{
color: $White !important;
color: #fff !important;
}
&:hover{
color: $PrimaryColor !important;
background: $White;
border-color: $White;
background: #fff;
border-color: #fff;
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
Expand All @@ -69,8 +69,8 @@
}
&:focus {
color: $PrimaryColor !important;
background: $White;
border-color: $White;
background: #fff;
border-color: #fff;
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
Expand Down
8 changes: 2 additions & 6 deletions src/Cli/DeleteSocial.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ class DeleteSocial extends BuildTask
protected $description = 'Delete Social(Facebook + Instagram)';

public function run($request) {
$listFacebookPosts = FacebookPosts::get();
foreach($listFacebookPosts as $item) {
$item->delete();
}
$listInstagramPosts = InstagramPosts::get();
foreach($listInstagramPosts as $item) {
$listPosts = AllPosts::get();
foreach($listPosts as $item) {
$item->delete();
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/DataObjects/AllPosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

class AllPosts extends DataObject
{
private static $singular_name = 'Posts';
private static $plural_name = 'Facebook und Instagram Posts';
private static $table_name = 'SocialPosts';
private static $db = [
'PlatformID' => 'Text',
'PlatformLink' => 'Text',
Expand Down
6 changes: 4 additions & 2 deletions src/DataObjects/FacebookProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace NourAlmasrieh\SocialWall;

use SilverStripe\Dev\Debug;
use SilverStripe\Assets\Image;
use SilverStripe\Assets\Folder;
use SilverStripe\ORM\DataObject;
Expand Down Expand Up @@ -92,9 +93,10 @@ public function RequestFreshData()
$file->publishFile();
$newpost->BildID = $fileID;
}
$content = $posts['message'];
/*$content = $posts['message'];
$content1 = preg_replace('/[^\p{L}\p{N}\s]/u', '', $content);
$newpost->Message = $content1;
$newpost->Message = $content1;*/
$newpost->Message = $posts["message"];
$newpost->CreatedDate = $posts["updated_time"];
$newpost->UserName = $posts["username"];
$newpost->PlatformLink = $posts["permalink_url"];
Expand Down
7 changes: 5 additions & 2 deletions src/DataObjects/InstagramProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace NourAlmasrieh\SocialWall;

use SilverStripe\Dev\Debug;
use SilverStripe\Assets\Image;
use SilverStripe\Assets\Folder;
use SilverStripe\ORM\DataObject;
Expand Down Expand Up @@ -102,9 +103,11 @@ public function RequestFreshData()
$newpost->BildID = $fileID;
}
}
$content = $posts['caption'];
/*$content = $posts['caption'];
$content1 = preg_replace('/[^\p{L}\p{N}\s]/u', '', $content);
$newpost->Message = $content1;
$newpost->Message = $content1;*/
$newpost->Message = $posts["caption"];
Debug::dump($newpost->Message);die;
$newpost->CreatedDate = $posts["timestamp"];
$newpost->PlatformLink = $posts["permalink"];
$newpost->Platform = "instagram";
Expand Down
5 changes: 3 additions & 2 deletions src/Elements/SocialsElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ public function getCMSFields()
$columns = array_keys($allFields);

$fields->insertBefore('Title', DropdownField::create('PostsStyle', 'Posts', [
'mixed' => 'Zufällige Posts',
'mixed' => 'Zufällige Posts (Neueste Post) angezeitgt wird',
'custom' => 'Spezielle Auswahl - Posts können individuell angepasst werden',
'bothstyle' => 'Erste 4er-Reihe - die Neueste Post & Zweite 4er-Reihe - die besondere Post können angepasst werden',
])->setEmptyString('Auswählen'));
$fields->addFieldsToTab('Root.Main', ColorField::create('BackgroundColor','Hintergrund Farbe'));
$fields->addFieldsToTab('Root.Main', TextField::create('SubTitle', 'SubTitle'));;
Expand All @@ -93,7 +94,7 @@ public function getCMSFields()
$fields->addFieldToTab('Root.Main', CheckboxField::create('ShowOnInstagram', 'Sollen nur die Posts von Instagram angezeigt?'));
$fields->addFieldToTab('Root.Main', CheckboxField::create('ShowOnMasonry', 'In Masonry angezeigt?'));

if ($this->PostsStyle == 'custom') {
if ($this->PostsStyle == 'custom' || $this->owner->PostsStyle == 'bothstyle') {
$fields->addFieldsToTab('Root.Posts',
GridField::create(
'SpeziellePosts',
Expand Down
4 changes: 0 additions & 4 deletions src/ModelAdmins/SocialModelAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@

class SocialModelAdmin extends ModelAdmin
{

private static $managed_models = [
AllConfSocial::class,
FacebookProvider::class,
InstagramProvider::class,
AllPosts::class,
FacebookPosts::class,
InstagramPosts::class,
];
private static $url_segment = 'socialadmin';
private static $menu_title = 'Social Admin';
private static $menu_icon_class = 'font-icon-thumbnails';

}
19 changes: 16 additions & 3 deletions templates/NourAlmasrieh/SocialWall/Includes/ElementStyleA.ss
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
<div class="container typography socialcards my-md-4 my-xl-5">
<div class="swiper-container mt-5" id="social__element--{$ID}">
<div class="swiper-wrapper mb-5">
<% if $PostsStyle == custom %>
<% if $PostsStyle == 'mixed' %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC') %>
<div class="swiper-slide socialcard">
<% include NourAlmasrieh\SocialWall\Includes\Slides %>
</div>
<% end_loop %>
<% else_if $PostsStyle == 'custom' %>
<% loop $SpeziellePosts.Sort('SortOrder', 'ASC') %>
<% with $AllPosts %>
<div class="swiper-slide socialcard">
<% include NourAlmasrieh\SocialWall\Includes\Slides %>
</div>
<% end_with %>
<% end_loop %>
<% else %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC') %>
<% else_if $PostsStyle == 'bothstyle' %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC').Limit(4) %>
<div class="swiper-slide socialcard">
<% include NourAlmasrieh\SocialWall\Includes\Slides %>
</div>
<% end_loop %>
<% loop $SpeziellePosts.Sort('SortOrder', 'ASC').Limit(4) %>
<% with $AllPosts %>
<div class="swiper-slide socialcard">
<% include NourAlmasrieh\SocialWall\Includes\Slides %>
</div>
<% end_with %>
<% end_loop %>
<% end_if %>
</div>
<div class="swiper-pagination"></div>
Expand Down
40 changes: 35 additions & 5 deletions templates/NourAlmasrieh/SocialWall/Includes/ElementStyleB.ss
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
<div class="container typography cards_style">
<div class="row mt-5 socialcards" <% if $ShowOnMasonry %> data-masonry='{"percentPosition": true }'<% end_if %>>
<% if $PostsStyle == custom %>
<% if $PostsStyle == 'mixed' %>
<% if $ShowOnMasonry %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC') %>
<div class="col-md-6 col-lg-4 col-xl-3 socialcard mb-3 mb-md-4">
<% include NourAlmasrieh\SocialWall\Includes\Cards %>
</div>
<% end_loop %>
<% else %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC') %>
<div class="col-md-6 col-lg-4 col-xl-3 socialcard mb-3 mb-md-4">
<% include NourAlmasrieh\SocialWall\Includes\Slides %>
</div>
<% end_loop %>
<% end_if %>
<% else_if $PostsStyle == 'custom' %>
<% if $ShowOnMasonry %>
<% loop $SpeziellePosts.Sort('SortOrder', 'ASC') %>
<% with $AllPosts %>
Expand All @@ -18,23 +32,38 @@
<% end_with %>
<% end_loop %>
<% end_if %>
<% else %>
<% else_if $PostsStyle == 'bothstyle' %>
<% if $ShowOnMasonry %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC') %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC').Limit(4) %>
<div class="col-md-6 col-lg-4 col-xl-3 socialcard mb-3 mb-md-4">
<% include NourAlmasrieh\SocialWall\Includes\Cards %>
</div>
<% end_loop %>
<% loop $SpeziellePosts.Sort('SortOrder', 'ASC').Limit(4) %>
<% with $AllPosts %>
<div class="col-md-6 col-lg-4 col-xl-3 socialcard mb-3 mb-md-4">
<% include NourAlmasrieh\SocialWall\Includes\Cards %>
</div>
<% end_with %>
<% end_loop %>
<% else %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC') %>
<% loop $getOnPosts.Sort('CreatedDate', 'DESC').Limit(4) %>
<div class="col-md-6 col-lg-4 col-xl-3 socialcard mb-3 mb-md-4">
<% include NourAlmasrieh\SocialWall\Includes\Slides %>
</div>
<% end_loop %>
<% loop $SpeziellePosts.Sort('SortOrder', 'ASC').Limit(4) %>
<% with $AllPosts %>
<div class="col-md-6 col-lg-4 col-xl-3 socialcard mb-3 mb-md-4">
<% include NourAlmasrieh\SocialWall\Includes\Slides %>
</div>
<% end_with %>
<% end_loop %>
<% end_if %>
<% end_if %>
</div>
</div>
<% if $ShowOnMasonry %>
<script>
var msnry = new Masonry( '.socialcards', {
// options...
Expand All @@ -44,4 +73,5 @@
// options...
});
}, 1500)
</script>
</script>
<% end_if %>

0 comments on commit 34bc040

Please sign in to comment.