Skip to content

Commit

Permalink
[dist] Update to 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xiez committed Nov 3, 2015
1 parent c035744 commit 4490f47
Show file tree
Hide file tree
Showing 179 changed files with 6,248 additions and 1,693 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/* lib view */
.repo-file-list .file-locked-icon {
position:absolute;
right:0;
bottom:0;
}
.repo-file-list .dirent-name {
width:220px;
}
Expand All @@ -14,9 +19,7 @@
}
.repo-file-list .hidden-op {
min-width: 100px;
}
.displayed-op .op {
margin-left:5px;
white-space:nowrap;
}
.hidden-op a {
color:#444;
Expand Down
9 changes: 6 additions & 3 deletions media/assets/css/backbone.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/* lib view */
.repo-file-list .file-locked-icon {
position:absolute;
right:0;
bottom:0;
}
.repo-file-list .dirent-name {
width:220px;
}
Expand All @@ -14,9 +19,7 @@
}
.repo-file-list .hidden-op {
min-width: 100px;
}
.displayed-op .op {
margin-left:5px;
white-space:nowrap;
}
.hidden-op a {
color:#444;
Expand Down
17 changes: 17 additions & 0 deletions media/assets/scripts/app/collections/activities.77ea3149773c.js
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;
});
17 changes: 17 additions & 0 deletions media/assets/scripts/app/collections/activities.js
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;
});
10 changes: 10 additions & 0 deletions media/assets/scripts/app/models/activity.dbdb311e9b4c.js
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;
});
10 changes: 10 additions & 0 deletions media/assets/scripts/app/models/activity.js
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;
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ define([
'org/lib/:repo_id(/*path)': 'showOrgRepoDir',
'common/lib/:repo_id(/*path)': 'showCommonDir',
'starred/': 'showStarredFile',
'activities/': 'showActivities',
// Default
'*actions': 'showRepos'
},
Expand Down Expand Up @@ -90,6 +91,11 @@ define([
this.myHomeView.showStarredFile();
},

showActivities: function() {
this.switchCurrentView(this.myHomeView);
this.myHomeView.showActivities();
},

showMyRepoDir: function(repo_id, path) {
if (path) {
path = '/' + path;
Expand Down
6 changes: 6 additions & 0 deletions media/assets/scripts/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ define([
'org/lib/:repo_id(/*path)': 'showOrgRepoDir',
'common/lib/:repo_id(/*path)': 'showCommonDir',
'starred/': 'showStarredFile',
'activities/': 'showActivities',
// Default
'*actions': 'showRepos'
},
Expand Down Expand Up @@ -90,6 +91,11 @@ define([
this.myHomeView.showStarredFile();
},

showActivities: function() {
this.switchCurrentView(this.myHomeView);
this.myHomeView.showActivities();
},

showMyRepoDir: function(repo_id, path) {
if (path) {
path = '/' + path;
Expand Down
105 changes: 105 additions & 0 deletions media/assets/scripts/app/views/activities.7f54ead3ff85.js
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;
});
105 changes: 105 additions & 0 deletions media/assets/scripts/app/views/activities.js
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 media/assets/scripts/app/views/activity-item.bea485958936.js
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;
});
Loading

0 comments on commit 4490f47

Please sign in to comment.