-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
179 changed files
with
6,248 additions
and
1,693 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
media/assets/scripts/app/collections/activities.77ea3149773c.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
define([ | ||
'underscore', | ||
'backbone', | ||
'common', | ||
'app/models/activity' | ||
], function(_, Backbone, Common, Activity) { | ||
'use strict'; | ||
|
||
var ActivityCollection = Backbone.Collection.extend({ | ||
model: Activity, | ||
url: function () { | ||
return Common.getUrl({name: 'events'}); | ||
} | ||
}); | ||
|
||
return ActivityCollection; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
define([ | ||
'underscore', | ||
'backbone', | ||
'common', | ||
'app/models/activity' | ||
], function(_, Backbone, Common, Activity) { | ||
'use strict'; | ||
|
||
var ActivityCollection = Backbone.Collection.extend({ | ||
model: Activity, | ||
url: function () { | ||
return Common.getUrl({name: 'events'}); | ||
} | ||
}); | ||
|
||
return ActivityCollection; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
define([ | ||
'underscore', | ||
'backbone' | ||
], function(_, Backbone) { | ||
'use strict'; | ||
|
||
var Activity = Backbone.Model.extend({}); | ||
|
||
return Activity; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
define([ | ||
'underscore', | ||
'backbone' | ||
], function(_, Backbone) { | ||
'use strict'; | ||
|
||
var Activity = Backbone.Model.extend({}); | ||
|
||
return Activity; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
media/assets/scripts/app/views/activities.7f54ead3ff85.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
define([ | ||
'jquery', | ||
'underscore', | ||
'backbone', | ||
'common', | ||
'app/collections/activities', | ||
'app/views/activity-item' | ||
], function($, _, Backbone, Common, ActivityCollection, ActivityItemView) { | ||
'use strict'; | ||
|
||
var ActivitiesView = Backbone.View.extend({ | ||
|
||
el: $('#activities'), | ||
|
||
activityGroupHdTemplate: _.template($('#activity-group-hd-tmpl').html()), | ||
activityGroupBdTemplate: _.template($('#activity-group-bd-tmpl').html()), | ||
|
||
initialize: function () { | ||
this.activities = new ActivityCollection(); | ||
|
||
this.$activitiesBody = this.$('#activities-body'); | ||
this.$activitiesMore = this.$('#activities-more'); | ||
this.$loadingTip = this.$('.loading-tip'); | ||
|
||
this.moreOffset = 0; | ||
}, | ||
|
||
events: { | ||
'click #activities-more': 'getMoreActivities' | ||
}, | ||
|
||
getMoreActivities: function () { | ||
var _this = this; | ||
this.$loadingTip.show(); | ||
this.$activitiesMore.hide(); | ||
this.activities.fetch({ | ||
remove: false, | ||
data: {'start': _this.moreOffset}, | ||
success: function() { | ||
_this.render(); | ||
} | ||
}); | ||
}, | ||
|
||
render: function () { | ||
var activitiesJson = this.activities.toJSON(), | ||
len = activitiesJson.length, | ||
more = activitiesJson[len-1]['more'], | ||
allActivities = []; | ||
|
||
this.$loadingTip.hide(); | ||
this.$activitiesMore.hide(); | ||
this.moreOffset = activitiesJson[len-1]['more_offset']; | ||
this.$activitiesBody.empty().show(); | ||
|
||
for (var i = 0; i < len; i++) { | ||
allActivities = allActivities.concat(activitiesJson[i]['events']); | ||
} | ||
|
||
// return sth. like {2015-07-27: [{...},], 2015-06-04: [{...}] ...} | ||
var groupedActivities = _.groupBy(allActivities, 'date'); | ||
|
||
var $groupDate, $groupActivities; | ||
for (var date in groupedActivities) { | ||
$groupDate = $(this.activityGroupHdTemplate({'date': date})); | ||
$groupActivities = $(this.activityGroupBdTemplate()); | ||
|
||
_.each(groupedActivities[date], function(activity) { | ||
var view = new ActivityItemView(activity); | ||
$groupActivities.append(view.render().el); | ||
}); | ||
|
||
this.$activitiesBody.append($groupDate).append($groupActivities); | ||
} | ||
|
||
if (more) { | ||
this.$activitiesMore.show(); | ||
} | ||
|
||
}, | ||
|
||
hide: function () { | ||
this.$el.hide(); | ||
}, | ||
|
||
show: function () { | ||
this.$el.show(); | ||
this.$activitiesBody.hide(); | ||
this.$activitiesMore.hide(); | ||
this.$loadingTip.show(); | ||
|
||
var _this = this; | ||
|
||
this.activities.fetch({ | ||
data: {'start': 0}, | ||
success: function() { | ||
_this.render(); | ||
} | ||
}); | ||
} | ||
|
||
}); | ||
|
||
return ActivitiesView; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
define([ | ||
'jquery', | ||
'underscore', | ||
'backbone', | ||
'common', | ||
'app/collections/activities', | ||
'app/views/activity-item' | ||
], function($, _, Backbone, Common, ActivityCollection, ActivityItemView) { | ||
'use strict'; | ||
|
||
var ActivitiesView = Backbone.View.extend({ | ||
|
||
el: $('#activities'), | ||
|
||
activityGroupHdTemplate: _.template($('#activity-group-hd-tmpl').html()), | ||
activityGroupBdTemplate: _.template($('#activity-group-bd-tmpl').html()), | ||
|
||
initialize: function () { | ||
this.activities = new ActivityCollection(); | ||
|
||
this.$activitiesBody = this.$('#activities-body'); | ||
this.$activitiesMore = this.$('#activities-more'); | ||
this.$loadingTip = this.$('.loading-tip'); | ||
|
||
this.moreOffset = 0; | ||
}, | ||
|
||
events: { | ||
'click #activities-more': 'getMoreActivities' | ||
}, | ||
|
||
getMoreActivities: function () { | ||
var _this = this; | ||
this.$loadingTip.show(); | ||
this.$activitiesMore.hide(); | ||
this.activities.fetch({ | ||
remove: false, | ||
data: {'start': _this.moreOffset}, | ||
success: function() { | ||
_this.render(); | ||
} | ||
}); | ||
}, | ||
|
||
render: function () { | ||
var activitiesJson = this.activities.toJSON(), | ||
len = activitiesJson.length, | ||
more = activitiesJson[len-1]['more'], | ||
allActivities = []; | ||
|
||
this.$loadingTip.hide(); | ||
this.$activitiesMore.hide(); | ||
this.moreOffset = activitiesJson[len-1]['more_offset']; | ||
this.$activitiesBody.empty().show(); | ||
|
||
for (var i = 0; i < len; i++) { | ||
allActivities = allActivities.concat(activitiesJson[i]['events']); | ||
} | ||
|
||
// return sth. like {2015-07-27: [{...},], 2015-06-04: [{...}] ...} | ||
var groupedActivities = _.groupBy(allActivities, 'date'); | ||
|
||
var $groupDate, $groupActivities; | ||
for (var date in groupedActivities) { | ||
$groupDate = $(this.activityGroupHdTemplate({'date': date})); | ||
$groupActivities = $(this.activityGroupBdTemplate()); | ||
|
||
_.each(groupedActivities[date], function(activity) { | ||
var view = new ActivityItemView(activity); | ||
$groupActivities.append(view.render().el); | ||
}); | ||
|
||
this.$activitiesBody.append($groupDate).append($groupActivities); | ||
} | ||
|
||
if (more) { | ||
this.$activitiesMore.show(); | ||
} | ||
|
||
}, | ||
|
||
hide: function () { | ||
this.$el.hide(); | ||
}, | ||
|
||
show: function () { | ||
this.$el.show(); | ||
this.$activitiesBody.hide(); | ||
this.$activitiesMore.hide(); | ||
this.$loadingTip.show(); | ||
|
||
var _this = this; | ||
|
||
this.activities.fetch({ | ||
data: {'start': 0}, | ||
success: function() { | ||
_this.render(); | ||
} | ||
}); | ||
} | ||
|
||
}); | ||
|
||
return ActivitiesView; | ||
}); |
40 changes: 40 additions & 0 deletions
40
media/assets/scripts/app/views/activity-item.bea485958936.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
define([ | ||
'jquery', | ||
'underscore', | ||
'backbone', | ||
'common', | ||
'app/views/details' | ||
], function($, _, Backbone, Common, DetailesView) { | ||
'use strict'; | ||
|
||
var ActivityItem = Backbone.View.extend({ | ||
tagName: 'li', | ||
|
||
className: 'event-item', | ||
|
||
template: _.template($('#activity-item-tmpl').html()), | ||
|
||
events: { | ||
'click .lsch': 'showDetails' | ||
}, | ||
|
||
initialize: function(activity) { | ||
this.activity = activity; | ||
}, | ||
|
||
showDetails: function () { | ||
var options = { | ||
'repo_id': this.activity.repo_id, | ||
'cmmt_id': this.activity.commit_id | ||
}; | ||
new DetailesView(options); | ||
}, | ||
|
||
render: function () { | ||
this.$el.html(this.template({'activity': this.activity})); | ||
return this; | ||
} | ||
}); | ||
|
||
return ActivityItem; | ||
}); |
Oops, something went wrong.