Merge pull request #773 from pixelfed/frontend-ui-refactor

Frontend ui refactor
This commit is contained in:
daniel 2019-01-10 20:56:22 -07:00 committed by GitHub
commit cb872373e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 3 deletions

View file

@ -54,6 +54,7 @@ class InternalApiController extends Controller
$attachments = [];
$status = new Status;
$mimes = [];
$cw = false;
foreach($medias as $k => $media) {
$m = Media::findOrFail($media['id']);
@ -64,7 +65,8 @@ class InternalApiController extends Controller
$m->license = $media['license'];
$m->caption = strip_tags($media['alt']);
$m->order = isset($media['cursor']) && is_int($media['cursor']) ? (int) $media['cursor'] : $k;
if($media['cw'] == true) {
if($media['cw'] == true || $profile->cw == true) {
$cw = true;
$m->is_nsfw = true;
$status->is_nsfw = true;
}
@ -84,6 +86,9 @@ class InternalApiController extends Controller
$media->save();
}
$visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility;
$cw = $profile->cw == true ? true : $cw;
$status->is_nsfw = $cw;
$status->visibility = $visibility;
$status->scope = $visibility;
$status->type = StatusController::mimeTypeCheck($mimes);

View file

@ -125,6 +125,9 @@ class StatusController extends Controller
$profile = $user->profile;
$visibility = $this->validateVisibility($request->visibility);
$cw = $profile->cw == true ? true : $cw;
$visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility;
$status = new Status();
$status->profile_id = $profile->id;
$status->caption = strip_tags($request->caption);

View file

@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
class Instance extends Model
{
//
protected $fillable = ['domain'];
}

View file

@ -42,7 +42,10 @@ class StatusEntityLexer implements ShouldQueue
*/
public function handle()
{
$this->parseEntities();
$profile = $this->status->profile;
if($profile->no_autolink == false) {
$this->parseEntities();
}
}
public function parseEntities()

BIN
public/css/app.css vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -455,3 +455,10 @@ details summary::-webkit-details-marker {
.notification-tooltip .arrow::before {
border-bottom-color:#dc3545 !important;
}
#previewAvatar {
img {
max-width: 100%;
height: auto;
}
}

View file

@ -22,6 +22,7 @@
<label class="custom-file-label" for="avatarInput">Select a profile photo</label>
</div>
<p><span class="small font-weight-bold">Must be a jpeg or png. Max avatar size: <span id="maxAvatarSize"></span></span></p>
<div id="previewAvatar"></div>
<p class="mb-0"><button type="submit" class="btn btn-primary px-4 py-0 font-weight-bold">Upload</button></p>
</div>
</form>
@ -130,5 +131,18 @@
});
$('#maxAvatarSize').text(filesize({{config('pixelfed.max_avatar_size') * 1024}}, {round: 0}));
$('#avatarInput').on('change', function(e) {
var file = document.getElementById('avatarInput').files[0];
var reader = new FileReader();
reader.addEventListener("load", function() {
$('#previewAvatar').html('<img src="' + reader.result + '" class="rounded-circle box-shadow mb-3" width="100%" height="100%"/>');
}, false);
if (file) {
reader.readAsDataURL(file);
}
});
</script>
@endpush