Skip to content

Commit

Permalink
fixed display of spoilers in timelines
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroensmeets committed May 15, 2017
1 parent eaa87e4 commit 809cbf6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
35 changes: 19 additions & 16 deletions Classes/Class.Post.ux
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<object ux:Property="status" />
<object ux:Property="account" />
<object ux:Property="spoilerText" />
<object ux:Property="cleanContent" />
<object ux:Property="clickableContent" />
<object ux:Property="mentions" />
Expand Down Expand Up @@ -153,25 +152,29 @@

</DockPanel>

<WhileString Value="{Property pc.spoilerText}" Test="IsNotEmpty">
<StackPanel Orientation="Vertical" Margin="24,8,16,0">
<Clicked>
<Set postcontent.Visibility="Visible" />
<Set showSpoilerButton.Visibility="Collapsed" />
</Clicked>
<Text Value="{Property pc.spoilerText}" TextWrapping="Wrap" FontSize="14" TextColor="palette.clrText" Font="Regular" />
<StackPanel ux:Name="showSpoilerButton" Orientation="Horizontal" Margin="0,8,0,8" HitTestMode="LocalBounds">
<FaView Color="palette.clrIcon" FontSize="15" Margin="0,0,4,0" Alignment="Center" />
<Text Value="show more" Color="palette.clrText" Font="Italic" FontSize="15" Alignment="Center" />
<With Data="{Property pc.status}">
<WhileString Value="{spoiler_text}" Test="IsNotEmpty">
<StackPanel Orientation="Vertical" Margin="24,8,16,0">
<Clicked>
<Set postcontent.Visibility="Visible" />
<Set showSpoilerButton.Visibility="Collapsed" />
</Clicked>
<Text Value="{spoiler_text}" TextWrapping="Wrap" FontSize="14" TextColor="palette.clrText" Font="Regular" />
<StackPanel ux:Name="showSpoilerButton" Orientation="Horizontal" Margin="0,8,0,16" HitTestMode="LocalBounds">
<FaView Color="palette.clrText" FontSize="15" Margin="0,0,8,0" Alignment="Center" />
<Text Value="show more" Color="palette.clrText" Font="Italic" FontSize="15" Alignment="Center" />
</StackPanel>
</StackPanel>
</StackPanel>
</WhileString>
</WhileString>
</With>

<StackPanel ux:Name="postcontent" Orientation="Vertical" Margin="24,8,16,0">

<WhileString Value="{Property pc.spoilerText}" Test="IsNotEmpty">
<Change postcontent.Visibility="Collapsed" />
</WhileString>
<With Data="{Property pc.status}">
<WhileString Value="{spoiler_text}" Test="IsNotEmpty">
<Change postcontent.Visibility="Collapsed" />
</WhileString>
</With>

<StackPanel Orientation="Vertical" Clicked="{gotoPost}">
<Each Items="{Property pc.cleanContent}">
Expand Down
8 changes: 8 additions & 0 deletions Pages/WritePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,26 @@ function doToot() {
return;
}

console.log( 2 );

var _spoiler = '';
if ( showSpoilerText.value && ( '' != spoilerText.value.replace(/\s+/g, '') ) ) {
_spoiler = spoilerText.value;
}

console.log( 3 );

var _media_ids = [];
// console.log( 'media_attachments has length ' + media_attachments.length );
media_attachments.forEach( function( item ) {
// console.log( 'item in media array: ' + JSON.stringify( item ) );
_media_ids.push( item.id );
});

console.log( 4 );

return;

api.sendPost(

txtToToot.value, inReplyToPostId.value, _media_ids, tootVisibility.value, isSensitive.value, _spoiler
Expand Down
10 changes: 6 additions & 4 deletions Pages/WritePage.ux
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@

</DockPanel>

<!-- attachments -->
<ImageGallery sensitive="false" attachments="{attachments}" />

<!-- error when too many images -->
<WhileTrue Value="{errorTooManyImages}">
<Text Value="You can attach a maximum of 4 images to one post." TextWrapping="Wrap" Color="palette.clrText" Font="Italic" Margin="0,12,0,0" />
Expand All @@ -84,9 +81,14 @@
<DockPanel Margin="16">
<MastodonButton Dock="Right" text="Share" Clicked="{doToot}" />
</DockPanel>

<WhileTrue Value="{errorInSending}">
<Text Value="Could not send your toot at this time. Sorry!" TextWrapping="Wrap" Color="palette.clrText" Font="Italic" Margin="0,12,0,0" />
<Text Value="Could not send your toot at this time. Sorry!" TextWrapping="Wrap" Color="palette.clrText" Font="Italic" Margin="0,8,0,16" />
</WhileTrue>

<!-- attachments -->
<ImageGallery sensitive="false" attachments="{attachments}" />

</StackPanel>
</Panel>
</ScrollView>
Expand Down

0 comments on commit 809cbf6

Please sign in to comment.