Skip to content

Commit

Permalink
Merge pull request #607 from nextcloud/feature/211/activity
Browse files Browse the repository at this point in the history
Activity integration
  • Loading branch information
juliusknorr authored Sep 7, 2018
2 parents 0ee0a58 + b979e37 commit f5691e6
Show file tree
Hide file tree
Showing 46 changed files with 2,649 additions and 118 deletions.
4 changes: 4 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ pipeline:
- cd ../server/
- ./occ app:enable $APP_NAME
- cd apps/$APP_NAME
- composer install
- phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
- phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
when:
Expand All @@ -153,6 +154,7 @@ pipeline:
- php occ app:enable deck
- cd apps/$APP_NAME
# Run phpunit tests
- composer install
- phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
- phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
when:
Expand All @@ -171,6 +173,7 @@ pipeline:
- cd ../server/
- php occ app:enable deck
- cd apps/$APP_NAME
- composer install
- phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
- phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
when:
Expand All @@ -189,6 +192,7 @@ pipeline:
- cd ../server/
- php occ app:enable deck
- cd apps/$APP_NAME
- composer install
- phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
- phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
when:
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extends:
env:
browser: true
amd: true
es6: true

globals:
global: false
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ before_script:
- cd apps/deck

script:
- composer install
- make test-unit

after_success:
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ clean-build:
clean-dist:
rm -rf js/node_modules

install-deps:
install-deps: install-deps-js
composer install

install-deps-js:
cd js && npm install

build: build-js
build: install-deps build-js

build-js: install-deps
build-js: install-deps-js
cd js && npm run build

build-js-dev: install-deps
Expand Down
8 changes: 7 additions & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
*
*/

if ((@include_once __DIR__ . '/../vendor/autoload.php')===false) {
throw new Exception('Cannot include autoload. Did you run install dependencies using composer?');
}

$app = new \OCA\Deck\AppInfo\Application();
$app->registerNavigationEntry();
$app->registerNotifications();
$app->registerNotifications();

\OC_Util::addStyle('deck', 'activity');
10 changes: 5 additions & 5 deletions appinfo/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/

namespace OCA\Deck\AppInfo;
Expand All @@ -28,4 +28,4 @@
/**
* Additional autoloader registration, e.g. registering composer autoloaders
*/
// require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../vendor/autoload.php';
13 changes: 12 additions & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- 🚀 Get your project organized

</description>
<version>0.5.0-dev2</version>
<version>0.5.0-dev3</version>
<licence>agpl</licence>
<author>Julius Härtl</author>
<namespace>Deck</namespace>
Expand All @@ -40,4 +40,15 @@
<commands>
<command>OCA\Deck\Command\UserExport</command>
</commands>
<activity>
<settings>
<setting>OCA\Deck\Activity\Setting</setting>
</settings>
<filters>
<filter>OCA\Deck\Activity\Filter</filter>
</filters>
<providers>
<provider>OCA\Deck\Activity\DeckProvider</provider>
</providers>
</activity>
</info>
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
"email": "jus@bitgrid.net"
}
],
"require": {},
"require": {
"cogpowered/finediff": "0.3.*"
},
"require-dev": {
"roave/security-advisories": "dev-master",
"christophwurst/nextcloud": "^13.0",
"jakub-onderka/php-parallel-lint": "^1.0.0"
}
Expand Down
23 changes: 23 additions & 0 deletions css/activity.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.activitymessage .visualdiff ins {
background-color: rgba(70, 186, 97, 0.2);
text-decoration: none;
}

.activitymessage .visualdiff del {
background-color: rgba(233, 50, 45, 0.2);
text-decoration: none;
}

.activityTabView .avatardiv-container {
display: inline-block;
bottom: -3px;
margin-left: 3px;
}

.activityTabView .avatar-name-wrapper {
font-weight: bold;
}

.activityTabView .activitysubject a {
font-weight: bold;
}
2 changes: 1 addition & 1 deletion css/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

.icon-badge {
background-image: url('../../../core/img/places/calendar-dark.svg');
background-image: url('../img/calendar-dark.svg');
}

.icon-toggle-compact-collapsed {
Expand Down
1 change: 0 additions & 1 deletion css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,6 @@ input.input-inline {

.tab {
height: 100%;
overflow: scroll;
}
}

Expand Down
1 change: 1 addition & 0 deletions img/calendar-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions js/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/

/* global angular */
Expand Down Expand Up @@ -48,13 +48,15 @@ import ngsortable from 'ng-sortable';
import md from 'angular-markdown-it';
import nganimate from 'angular-animate';
import 'angular-file-upload';
import ngInfiniteScroll from 'ng-infinite-scroll';

var app = angular.module('Deck', [
ngsanitize,
uirouter,
angularuiselect,
ngsortable, md, nganimate,
'angularFileUpload'
'angularFileUpload',
ngInfiniteScroll
]);

export default app;
99 changes: 99 additions & 0 deletions js/controller/ActivityController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/* global OC OCA */

class ActivityController {
constructor ($scope, CardService, ActivityService) {
'ngInject';
this.cardservice = CardService;
this.activityservice = ActivityService;
this.$scope = $scope;
this.type = '';
this.loading = false;

const self = this;
this.$scope.$watch(function () {
return self.element.id;
}, function (params) {
if (self.getData(self.element.id).length === 0) {
self.loading = true;
self.fetchUntilResults();
}
self.activityservice.fetchNewerActivities(self.type, self.element.id).then(function () {});
}, true);
}

getData(id) {
return this.activityservice.getData(this.type, id);
}

parseMessage(subject, parameters) {
OCA.Activity.RichObjectStringParser._userLocalTemplate = '<span class="avatar-name-wrapper"><avatar ng-attr-contactsmenu ng-attr-tooltip ng-attr-user="{{ id }}" ng-attr-displayname="{{name}}" ng-attr-size="16"></avatar> {{ name }}</span>';
return OCA.Activity.RichObjectStringParser.parseMessage(subject, parameters);
}

fetchUntilResults () {
const self = this;
let dataLengthBefore = self.getData(self.element.id).length;
let _executeFetch = function() {
let promise = self.activityservice.fetchMoreActivities(self.type, self.element.id);
promise.then(function (data) {
let dataLengthAfter = self.getData(self.element.id).length;
if (data !== null && (dataLengthAfter <= dataLengthBefore || dataLengthAfter < 5)) {
_executeFetch();
} else {
self.loading = false;
}
}, function () {
self.loading = false;
self.$scope.$apply();
});

};
_executeFetch();
}

page() {
if (!this.activityservice.since[this.type][this.element.id].finished) {
this.loading = true;
this.fetchUntilResults();
} else {
this.loading = false;
}
}

loadingNewer() {
return this.activityservice.runningNewer;
}

}

let activityComponent = {
templateUrl: OC.linkTo('deck', 'templates/part.card.activity.html'),
controller: ActivityController,
bindings: {
type: '@',
element: '='
}
};
export default activityComponent;
8 changes: 8 additions & 0 deletions js/controller/BoardController.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,14 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
};
};

$scope.colorValue = function(color) {
const re = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
if (re.test(color)) {
return color;
}
return '';
};

$scope.attachmentCount = function(card) {
if (Array.isArray(card.attachments)) {
return card.attachments.filter((obj) => obj.deletedAt === 0).length;
Expand Down
16 changes: 10 additions & 6 deletions js/directive/avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
import app from '../app/App.js';

Expand All @@ -32,6 +32,10 @@ app.directive('avatar', function() {
link: function(scope, element, attr){
scope.uid = attr.displayname;
scope.displayname = attr.displayname;
scope.size = attr.size;
if (typeof scope.size === 'undefined') {
scope.size = 32;
}
var value = attr.user;
var avatardiv = $(element).find('.avatardiv');
if(typeof attr.contactsmenu !== 'undefined' && attr.contactsmenu !== 'false') {
Expand All @@ -44,8 +48,8 @@ app.directive('avatar', function() {
placement: 'top'
});
}
avatardiv.avatar(value, 32, false, false, false, attr.displayname);
avatardiv.avatar(value, scope.size, false, false, false, attr.displayname);
},
controller: function () {}
};
});
});
Loading

0 comments on commit f5691e6

Please sign in to comment.