Permalink
Browse files

Merged devel

  • Loading branch information...
m0g committed Jan 18, 2017
2 parents bad8579 + 081105c commit bafd01c015e920920aca0400aefb7be61ad24c9b
Showing with 5,485 additions and 188 deletions.
  1. +3 −0 .gitignore
  2. +5 −15 .travis.yml
  3. +22 −0 KNOWN-ISSUES.MD
  4. +9 −1 README.md
  5. +1 −1 client/.jshintrc
  6. +7 −0 client/app/images/ingest.svg
  7. +10 −0 client/app/images/ingest_active.svg
  8. +112 −94 client/app/scripts/liveblog-edit/directives.js
  9. +16 −16 client/app/scripts/liveblog-edit/module.js
  10. +4 −1 client/app/scripts/liveblog-edit/pages-manager.service.js
  11. +59 −31 client/app/scripts/liveblog-edit/posts.service.js
  12. +22 −7 client/app/scripts/liveblog-edit/styles/liveblog-edit.scss
  13. +14 −3 client/app/scripts/liveblog-edit/unread.posts.service.js
  14. +21 −3 client/app/scripts/liveblog-edit/views/main.html
  15. +5 −1 client/app/scripts/liveblog-edit/views/post.html
  16. +9 −1 client/app/scripts/liveblog-edit/views/settings.html
  17. +49 −0 client/app/scripts/liveblog-syndication/actions/incoming-syndication.js
  18. +120 −0 client/app/scripts/liveblog-syndication/actions/ingest-panel.js
  19. +44 −0 client/app/scripts/liveblog-syndication/controllers/base.js
  20. +7 −0 client/app/scripts/liveblog-syndication/controllers/consumers.js
  21. +7 −0 client/app/scripts/liveblog-syndication/controllers/producers.js
  22. +124 −0 client/app/scripts/liveblog-syndication/directives/attach-syndicated-blogs-modal.js
  23. +72 −0 client/app/scripts/liveblog-syndication/directives/consumer-edit.js
  24. +49 −0 client/app/scripts/liveblog-syndication/directives/consumer-list.js
  25. +25 −0 client/app/scripts/liveblog-syndication/directives/contacts-edit.js
  26. +38 −0 client/app/scripts/liveblog-syndication/directives/copy-to-clipboard.js
  27. +16 −0 client/app/scripts/liveblog-syndication/directives/first-contact.js
  28. +59 −0 client/app/scripts/liveblog-syndication/directives/incoming-syndication.js
  29. +55 −0 client/app/scripts/liveblog-syndication/directives/ingest-panel-dropdown.js
  30. +54 −0 client/app/scripts/liveblog-syndication/directives/ingest-panel.js
  31. +23 −0 client/app/scripts/liveblog-syndication/directives/notifications-count.js
  32. +63 −0 client/app/scripts/liveblog-syndication/directives/producer-edit.js
  33. +28 −0 client/app/scripts/liveblog-syndication/directives/producer-list.js
  34. +19 −0 client/app/scripts/liveblog-syndication/directives/synd-rm-blog.js
  35. +20 −0 client/app/scripts/liveblog-syndication/directives/syndication-switch.js
  36. +41 −0 client/app/scripts/liveblog-syndication/flux.js
  37. +45 −0 client/app/scripts/liveblog-syndication/index.js
  38. +27 −0 client/app/scripts/liveblog-syndication/reducers/incoming-syndication.js
  39. +106 −0 client/app/scripts/liveblog-syndication/reducers/ingest-panel.js
  40. +172 −0 client/app/scripts/liveblog-syndication/styles/syndication.less
  41. +66 −0 client/app/scripts/liveblog-syndication/views/attach-syndicated-blogs-modal.html
  42. +62 −0 client/app/scripts/liveblog-syndication/views/consumer-edit-form.html
  43. +49 −0 client/app/scripts/liveblog-syndication/views/consumer-list-item.html
  44. +72 −0 client/app/scripts/liveblog-syndication/views/consumer-list.html
  45. +69 −0 client/app/scripts/liveblog-syndication/views/contacts-edit-form.html
  46. +72 −0 client/app/scripts/liveblog-syndication/views/incoming-syndication.html
  47. +47 −0 client/app/scripts/liveblog-syndication/views/ingest-panel-dropdown.html
  48. +34 −0 client/app/scripts/liveblog-syndication/views/ingest-panel.html
  49. +75 −0 client/app/scripts/liveblog-syndication/views/producer-edit-form.html
  50. +43 −0 client/app/scripts/liveblog-syndication/views/producer-list-item.html
  51. +75 −0 client/app/scripts/liveblog-syndication/views/producer-list.html
  52. +21 −0 client/app/scripts/liveblog-syndication/views/syndication-switch.html
  53. +33 −0 client/app/styles/sass/liveblog.scss
  54. +4 −3 client/package.json
  55. +3 −2 client/protractor-conf.js
  56. +244 −0 client/spec/consumers_spec.js
  57. +1 −1 client/spec/editor_contribution_posts_spec.js
  58. +12 −0 client/spec/helpers/assert-toast-msg.js
  59. +36 −0 client/spec/helpers/pages.js
  60. +96 −0 client/spec/helpers/webhook.js
  61. +458 −0 client/spec/helpers/webhook.json
  62. +199 −0 client/spec/producers_spec.js
  63. +89 −0 client/spec/syndication_spec.js
  64. +1 −0 client/tasks/options/template.js
  65. +7 −0 server/app.py
  66. +24 −0 server/features/blogs.feature
  67. +2 −1 server/features/environment.py
  68. +97 −0 server/features/steps/steps_syndication.py
  69. +74 −0 server/features/syndication_blogs.feature
  70. +99 −0 server/features/syndication_consumers.feature
  71. +47 −0 server/features/syndication_posts.feature
  72. +122 −0 server/features/syndication_producers.feature
  73. +26 −3 server/liveblog/blogs/blogs.py
  74. +31 −4 server/liveblog/posts/posts.py
  75. +38 −0 server/liveblog/prepopulate/test.json
  76. +36 −0 server/liveblog/syndication/__init__.py
  77. +50 −0 server/liveblog/syndication/auth.py
  78. +166 −0 server/liveblog/syndication/blogs.py
  79. +114 −0 server/liveblog/syndication/consumer.py
  80. +14 −0 server/liveblog/syndication/exceptions.py
  81. +304 −0 server/liveblog/syndication/producer.py
  82. +279 −0 server/liveblog/syndication/syndication.py
  83. +71 −0 server/liveblog/syndication/tasks.py
  84. +279 −0 server/liveblog/syndication/utils.py
  85. +49 −0 server/liveblog/syndication/validation.py
  86. +46 −0 server/liveblog/tests/__init__.py
  87. +59 −0 server/liveblog/tests/environment.py
  88. +1 −0 server/liveblog/tests/test_settings.py
  89. +1 −0 server/requirements.txt
  90. +6 −0 server/settings.py
@@ -73,6 +73,9 @@ dump.rdb
client/config.js
server/test-env.local
# Vagrant
.vagrant
# PyCharm idea folders
.idea/
@@ -69,9 +69,11 @@ install:
before_script:
- if [ "${TARGET}" != "${TARGET/e2e/}" ]; then
cd $TRAVIS_BUILD_DIR/client ;
grunt build --server='http://127.0.0.1:5000/api' --ws='ws://127.0.0.1:5100' ;
cd $TRAVIS_BUILD_DIR/client/dist ;
cd server ;
(nohup env SUPERDESK_URL='http://127.0.0.1:5000/api' SUPERDESK_CLIENT_URL='http://127.0.0.1:9000' WEB_CONCURRENCY=3 WEB_TIMEOUT=8 SUPERDESK_TESTING='True' honcho start &) ;
cd ../client ;
SYNDICATION=true grunt build --server='http://127.0.0.1:5000/api' --ws='ws://127.0.0.1:5100' ;
cd dist ;
while [ ! -f index.html ]; do sleep .5; done ;
(nohup python3 -m http.server 9000 &) ;
cd $TRAVIS_BUILD_DIR/server ;
@@ -103,10 +105,6 @@ script:
./node_modules/.bin/webdriver-manager update &&
./node_modules/.bin/protractor-flake --node-bin node --max-attempts=1 -- protractor-conf.js --suite=a
--stackTrace --verbose
--baseUrl 'http://127.0.0.1:9000'
--params.baseBackendUrl 'http://127.0.0.1:5000/api'
--params.username 'admin'
--params.password 'admin'
--capabilities.browserName "${TARGET/e2e_first_/}"
;
fi
@@ -120,10 +118,6 @@ script:
./node_modules/.bin/webdriver-manager update &&
./node_modules/.bin/protractor-flake --node-bin node --max-attempts=1 -- protractor-conf.js --suite=b
--stackTrace --verbose
--baseUrl 'http://127.0.0.1:9000'
--params.baseBackendUrl 'http://127.0.0.1:5000/api'
--params.username 'admin'
--params.password 'admin'
--capabilities.browserName "${TARGET/e2e_second_/}"
;
fi
@@ -137,10 +131,6 @@ script:
./node_modules/.bin/webdriver-manager update &&
./node_modules/.bin/protractor-flake --node-bin node --max-attempts=1 -- protractor-conf.js --suite=c
--stackTrace --verbose
--baseUrl 'http://127.0.0.1:9000'
--params.baseBackendUrl 'http://127.0.0.1:5000/api'
--params.username 'admin'
--params.password 'admin'
--capabilities.browserName "${TARGET/e2e_third_/}"
;
fi
@@ -36,3 +36,25 @@ mongorestore -h 10.0.250.27 temporarymaster
Now, we have the database and the elasticsearch content safely saved in our testinstance.
All we need to do next is follow all the steps in order to put back the content from testinstance into master instance.
### Protractor is not working
The current version of liveblog is relying in a old version of protractor. If you are experiencing issues, it is probably due to the fact that your web browser is too recent for protractor. One way to solve this problem is to download and install an older version of firefox:
```bash
wget -c https://ftp.mozilla.org/pub/firefox/releases/35.0/linux-x86_64/en-US/firefox-35.0.tar.bz2
tar xvzf firefox-35.0.tar.bz2
rm firefox-35.0.tar.bz2
sudo mv firefox /opt/protractor-firefox
```
and then add the following lines to your protractor config (in capabilities):
```javascript
capabilities: {
browserName: "firefox",
firefox_binary: "/opt/protractor-firefox/firefox",
binary_: "/opt/protractor-firefox/firefox"
},
```
@@ -144,6 +144,15 @@ $ pip install -r docker/requirements.txt
$ ./scripts/docker-local-demo.sh
```
### Testing
How to run the behaviore tests for the syndication feature:
```
cd server
behave --format progress2 --logging-level ERROR features/syndication.feature
```
### Vagrant LXC Installation
#### Setting things up
@@ -186,4 +195,3 @@ Once the provisioning done whil still in the virtual machine:
```
/opt/liveblog/scripts/start-dev.sh
```
@@ -1,5 +1,5 @@
{
"es3": true,
"es5": true,
"node": true,
"browser": true,
"bitwise": true,
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="28px" height="24px" viewBox="0 0 28 24" style="enable-background:new 0 0 28 24;" xml:space="preserve">
<path id="XMLID_30_" d="M24,9h-6l0-8h-8v8H4l10,10L24,9z"/>
<rect id="XMLID_27_" x="4" y="21" width="20" height="3"/>
</svg>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="28px" height="24px" viewBox="0 0 28 24" style="enable-background:new 0 0 28 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#007FB3;}
</style>
<path id="XMLID_30_" class="st0" d="M24,9h-6l0-8h-8v8H4l10,10L24,9z"/>
<rect id="XMLID_27_" x="4" y="21" class="st0" width="20" height="3"/>
</svg>
@@ -16,84 +16,102 @@ angular.module('liveblog.edit')
'postsService', 'notify', '$q', '$timeout', 'session', 'PagesManager',
function(postsService, notify, $q, $timeout, session, PagesManager) {
LbPostsListCtrl.$inject = ['$scope', '$element'];
function LbPostsListCtrl($scope, $element) {
$scope.lbSticky = $scope.lbSticky === 'true';
var vm = this;
angular.extend(vm, {
isLoading: true,
blogId: $scope.lbPostsBlogId,
status: $scope.lbPostsStatus,
sticky: $scope.lbSticky,
allowUnpublishing: $scope.lbPostsAllowUnpublishing,
allowReordering: $scope.lbPostsAllowReordering,
allowEditing: $scope.lbPostsAllowEditing,
allowDeleting: $scope.lbPostsAllowDeleting,
allowPublishing: $scope.lbPostsAllowPublishing,
isUnreadPost: $scope.lbPostsIsUnreadPost,
onPostSelected: $scope.lbPostsOnPostSelected,
showReorder: false,
hideAllPosts: false,
originalOrder: 0,
pagesManager: new PagesManager($scope.lbPostsBlogId,
$scope.lbPostsStatus,
//if the list is a list with sticky posts, show them all in the 1st pages
$scope.lbSticky === true? 100: 10,
$scope.lbPostsOrderBy || 'editorial',
$scope.lbSticky),
fetchNewPage: function() {
vm.isLoading = true;
return vm.pagesManager.fetchNewPage().then(function() {
vm.isLoading = false;
});
},
startReorder: function(post) {
vm.reorderPost = post;
},
clearReorder: function() {
vm.reorderPost = false;
$timeout(function() {
vm.keepHighlighted = false;
}, 2000);
$timeout(function() {
vm.hideAllPosts = false;
}, 200);
},
getOrder: function(position) {
return angular.element($element.find('.posts').find('li .lb-post').get(position)).scope().post.order;
},
reorder: function(index, location) {
if (vm.allowReordering) {
var position = index;
var order, before, after;
if (position === 0) {
order = vm.getOrder(0) + 1;
} else if (position === $element.find('.posts').find('li .lb-post').length - 1) {
order = vm.getOrder(position) - 1;
} else {
if (location === 'above') {
before = vm.getOrder(position - 1);
after = vm.getOrder(position);
LbPostsListCtrl.$inject = ['$scope', '$element'];
function LbPostsListCtrl($scope, $element) {
$scope.lbSticky = $scope.lbSticky === 'true';
var vm = this;
angular.extend(vm, {
isLoading: true,
blogId: $scope.lbPostsBlogId,
status: $scope.lbPostsStatus,
sticky: $scope.lbSticky,
allowUnpublishing: $scope.lbPostsAllowUnpublishing,
allowReordering: $scope.lbPostsAllowReordering,
allowEditing: $scope.lbPostsAllowEditing,
allowDeleting: $scope.lbPostsAllowDeleting,
allowPublishing: $scope.lbPostsAllowPublishing,
isUnreadPost: $scope.lbPostsIsUnreadPost,
onPostSelected: $scope.lbPostsOnPostSelected,
showReorder: false,
hideAllPosts: false,
originalOrder: 0,
pagesManager: new PagesManager(
$scope.lbPostsBlogId,
$scope.lbPostsStatus,
//if the list is a list with sticky posts, show them all in the 1st pages
$scope.lbSticky === true? 100: 10,
$scope.lbPostsOrderBy || 'editorial',
$scope.lbSticky,
null,
$scope.lbPostsNoSyndication === true ? true : false
),
fetchNewPage: function() {
vm.isLoading = true;
return vm.pagesManager.fetchNewPage().then(function() {
vm.isLoading = false;
});
},
startReorder: function(post) {
vm.reorderPost = post;
},
clearReorder: function() {
vm.reorderPost = false;
$timeout(function() {
vm.keepHighlighted = false;
}, 2000);
$timeout(function() {
vm.hideAllPosts = false;
}, 200);
},
getOrder: function(position) {
return angular.element($element.find('.posts').find('li .lb-post').get(position)).scope().post.order;
},
reorder: function(index, location) {
if (vm.allowReordering) {
var position = index;
var order, before, after;
if (position === 0) {
order = vm.getOrder(0) + 1;
} else if (position === $element.find('.posts').find('li .lb-post').length - 1) {
order = vm.getOrder(position) - 1;
} else {
before = vm.getOrder(position);
after = vm.getOrder(position + 1);
}
order = after + (before - after) / 2;
}
vm.updatePostOrder(vm.reorderPost, order);
},
updatePostOrder: function(post, order) {
vm.hideAllPosts = true;
postsService.savePost(post.blog, post, undefined, {order: order}).then(function() {
vm.keepHighlighted = order;
vm.clearReorder();
}, function() {
vm.hideAllPosts = false;
notify.pop();
notify.error(gettext('Something went wrong. Please reload and try again later'));
});
}
},
updatePostOrder: function(post, order) {
vm.hideAllPosts = true;
postsService.savePost(post.blog, post, undefined, {order: order}).then(function() {
vm.keepHighlighted = order;
vm.clearReorder();
}, function() {
vm.hideAllPosts = false;
notify.pop();
notify.error(gettext('Something went wrong. Please reload and try again later'));
});
});
}
return {
scope: {
lbPostsBlogId: '=',
lbPostsStatus: '@',
lbSticky: '@',
lbStickyInstance: '=',
lbPostsNoSyndication: '=',
lbPostsOrderBy: '@',
lbPostsAllowUnpublishing: '=',
lbPostsAllowReordering: '=',
lbPostsAllowEditing: '=',
lbPostsAllowDeleting: '=',
lbPostsAllowPublishing: '=',
lbPostsOnPostSelected: '=',
lbPostsIsUnreadPost: '=',
lbPostsInstance: '='
},
removePostFromList: function(post) {
vm.pagesManager.removePost(post);
@@ -124,7 +142,7 @@ angular.module('liveblog.edit')
vm.isLoading = false;
});
}
});
};
$scope.lbPostsInstance = vm;
// retrieve first page
vm.fetchNewPage()
@@ -144,29 +162,29 @@ angular.module('liveblog.edit')
});
});
}
return {
scope: {
lbPostsBlogId: '=',
lbPostsStatus: '@',
lbSticky: '@',
lbStickyInstance: '=',
lbPostsOrderBy: '@',
lbPostsAllowUnpublishing: '=',
lbPostsAllowReordering: '=',
lbPostsAllowEditing: '=',
lbPostsAllowDeleting: '=',
lbPostsAllowPublishing: '=',
lbPostsOnPostSelected: '=',
lbPostsIsUnreadPost: '=',
lbPostsInstance: '='
},
restrict: 'EA',
transclude: true,
templateUrl: 'scripts/liveblog-edit/views/posts.html',
controllerAs: 'postsList',
controller: LbPostsListCtrl
};
}
//return {
// scope: {
// lbPostsBlogId: '=',
// lbPostsStatus: '@',
// lbSticky: '@',
// lbStickyInstance: '=',
// lbPostsOrderBy: '@',
// lbPostsAllowUnpublishing: '=',
// lbPostsAllowReordering: '=',
// lbPostsAllowEditing: '=',
// lbPostsAllowDeleting: '=',
// lbPostsAllowPublishing: '=',
// lbPostsOnPostSelected: '=',
// lbPostsIsUnreadPost: '=',
// lbPostsInstance: '='
// },
// restrict: 'EA',
// transclude: true,
// templateUrl: 'scripts/liveblog-edit/views/posts.html',
// controllerAs: 'postsList',
// controller: LbPostsListCtrl
//};
//}
])
.directive('lbItem', [function() {
return {
Oops, something went wrong.

0 comments on commit bafd01c

Please sign in to comment.