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

View file

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

View file

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

View file

@ -42,8 +42,11 @@ class StatusEntityLexer implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
$profile = $this->status->profile;
if($profile->no_autolink == false) {
$this->parseEntities(); $this->parseEntities();
} }
}
public function 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 { .notification-tooltip .arrow::before {
border-bottom-color:#dc3545 !important; 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> <label class="custom-file-label" for="avatarInput">Select a profile photo</label>
</div> </div>
<p><span class="small font-weight-bold">Must be a jpeg or png. Max avatar size: <span id="maxAvatarSize"></span></span></p> <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> <p class="mb-0"><button type="submit" class="btn btn-primary px-4 py-0 font-weight-bold">Upload</button></p>
</div> </div>
</form> </form>
@ -130,5 +131,18 @@
}); });
$('#maxAvatarSize').text(filesize({{config('pixelfed.max_avatar_size') * 1024}}, {round: 0})); $('#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> </script>
@endpush @endpush