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 39 additions and 7 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()

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"/js/activity.js": "/js/activity.js?id=7915246c3bc2b7e9770e",
"/js/app.js": "/js/app.js?id=ea57709b5a7ef8657ff4",
"/css/app.css": "/css/app.css?id=0d2d3f52adde32658692",
"/js/components.js": "/js/components.js?id=f6de7bd1e3ec76ab599a",
"/css/app.css": "/css/app.css?id=e8047f495e5dfbca1445",
"/js/components.js": "/js/components.js?id=0968269f096caeb14dff",
"/js/timeline.js": "/js/timeline.js?id=83c85c7144756ee9a72e"
}

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