Merge user feeds & followers #118
@ -41610,6 +41610,80 @@ function PhotoViewModel(urls) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This model is used by gallery/user_profile.blade.php, to handle a user's profile.
|
||||
* @constructor
|
||||
*/
|
||||
function UserViewModel(urls)
|
||||
{
|
||||
this.el = '#user-app';
|
||||
|
||||
this.data = {
|
||||
feed_items: [],
|
||||
is_loading: true,
|
||||
selected_view: 'profile'
|
||||
};
|
||||
|
||||
this.computed = {
|
||||
isFeed: function() {
|
||||
return this.selected_view === 'feed';
|
||||
},
|
||||
isProfile: function() {
|
||||
return this.selected_view === 'profile';
|
||||
}
|
||||
};
|
||||
|
||||
this.methods = {
|
||||
loadFeedItems: function(e)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
$.get(urls.feed_url, function (data)
|
||||
{
|
||||
for (var i = 0; i < data.length; i++)
|
||||
{
|
||||
// User name
|
||||
if (data[i].params.user_name && data[i].params.user_url)
|
||||
{
|
||||
data[i].description = data[i].description
|
||||
.replace(
|
||||
':user_name',
|
||||
'<a href="' + data[i].params.user_url + '">' + data[i].params.user_name + '</a>'
|
||||
);
|
||||
}
|
||||
|
||||
// Photo name
|
||||
if (data[i].params.photo_name && data[i].params.photo_url)
|
||||
{
|
||||
data[i].description = data[i].description
|
||||
.replace(
|
||||
':photo_name',
|
||||
'<a href="' + data[i].params.photo_url + '">' + data[i].params.photo_name + '</a>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
self.feed_items = data;
|
||||
self.is_loading = false;
|
||||
});
|
||||
},
|
||||
switchToFeed: function(e) {
|
||||
this.selected_view = 'feed';
|
||||
history.pushState('', '', urls.current_url + '?tab=feed');
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
},
|
||||
switchToProfile: function(e) {
|
||||
this.selected_view = 'profile';
|
||||
history.pushState('', '', urls.current_url + '?tab=profile');
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
function StorageLocationViewModel()
|
||||
{
|
||||
this.el = '#storage-options';
|
||||
|
2
public/js/blue-twilight.min.js
vendored
2
public/js/blue-twilight.min.js
vendored
File diff suppressed because one or more lines are too long
@ -134,14 +134,14 @@ function UserViewModel(urls)
|
||||
},
|
||||
switchToFeed: function(e) {
|
||||
this.selected_view = 'feed';
|
||||
history.pushState('data to be passed', 'Title of the page', urls.current_url + '?tab=feed');
|
||||
history.pushState('', '', urls.current_url + '?tab=feed');
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
},
|
||||
switchToProfile: function(e) {
|
||||
this.selected_view = 'profile';
|
||||
history.pushState('data to be passed', 'Title of the page', urls.current_url + '?tab=profile');
|
||||
history.pushState('', '', urls.current_url + '?tab=profile');
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
|
@ -98,6 +98,8 @@ return [
|
||||
'feed_tab' => 'Activity',
|
||||
'no_albums_p1' => 'No Photo Albums',
|
||||
'no_albums_p2' => ':user_name has not created any albums yet.',
|
||||
'no_feed_activity_p1' => 'No Activity',
|
||||
'no_feed_activity_p2' => 'There is no activity to show for :user_name.',
|
||||
'profile_tab' => 'Profile'
|
||||
],
|
||||
'user_settings' => [
|
||||
|
@ -124,6 +124,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center" v-if="feed_items.length == 0">
|
||||
<h4 class="text-danger"><b>@lang('gallery.user_profile.no_feed_activity_p1')</b></h4>
|
||||
<p>@lang('gallery.user_profile.no_feed_activity_p2', ['user_name' => $user->name])</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -133,7 +137,7 @@
|
||||
<script type="text/javascript">
|
||||
var viewModel = new UserViewModel({
|
||||
current_url: '{{ url()->current() }}',
|
||||
feed_url: '{{ \App\User::currentOrAnonymous()->feedJsonUrl() }}'
|
||||
feed_url: '{{ $user->feedJsonUrl() }}'
|
||||
});
|
||||
|
||||
var app = new Vue(viewModel);
|
||||
|
Loading…
Reference in New Issue
Block a user