1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 14:42:10 +00:00

Merge pull request #1053 from haiwen/discussion

Add group discussion
This commit is contained in:
Daniel Pan
2016-03-29 17:46:49 +08:00
36 changed files with 647 additions and 1235 deletions

View File

@@ -42,6 +42,7 @@ require.config({
jstree: 'lib/jstree.1.0',
select2: 'lib/select2-3.5.2',
moment: 'lib/moment-with-locales',
marked: 'lib/marked.min',
underscore: 'lib/underscore',
backbone: 'lib/backbone',
@@ -136,6 +137,8 @@ define([
case 'group_import_members': return siteRoot + 'ajax/group/' + options.group_id + '/members/import/';
case 'group_repos': return siteRoot + 'api2/groups/' + options.group_id + '/repos/';
case 'toggle_group_modules': return siteRoot + 'ajax/group/' + options.group_id + '/toggle-modules/';
case 'group_discussions': return siteRoot + 'api2/groups/' + options.group_id + '/discussions/';
case 'group_discussion': return siteRoot + 'api2/groups/' + options.group_id + '/discussions/' + options.discussion_id + '/';
// Misc
case 'thumbnail_create': return siteRoot + 'thumbnail/' + options.repo_id + '/create/';
@@ -475,6 +478,15 @@ define([
Moment.locale(language_code);
},
getRelativeTimeStr: function(m) {
var now = new Date();
if (m - now > 0) {
return gettext("Just now");
} else {
return m.fromNow();
}
},
closePopup: function(e, popup, popup_switch) {
var target = e.target || event.srcElement;
if (!popup.hasClass('hide') && !popup.is(target) && !popup.find('*').is(target) && !popup_switch.is(target) && !popup_switch.find('*').is(target) ) {
@@ -817,6 +829,17 @@ define([
}
}
return group_name;
},
setCaretPosition:function(input, pos) {
var range;
if (document.selection) {
range = input.createTextRange();
range.move("character", pos);
return range.select();
} else {
return input.setSelectionRange(pos, pos);
}
}
}