Skip to content

Commit

Permalink
Merge branch 'release/2.0.0-beta14'
Browse files Browse the repository at this point in the history
  • Loading branch information
shprink committed Oct 30, 2016
2 parents 3b1ad9b + a384443 commit 8ddc2fc
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 29 deletions.
2 changes: 1 addition & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ All the necessary plugins will be installed as well:

## Android

### Preriquisites
### Prerequisites

* Android SDK
* Ant
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@
* [CONFIG] There is no more dev/prod distinction, WPHC turn debug OFF when building the prod app automatically.
* [ABOUT] The About feature has been removed. You can use Pages to achieve the same purpose.

<a name="2.0.0-beta14"></a>
### 2.0.0-beta14 (2016-10-30)

To upgrade checkout `git fetch --all && git checkout v2.0.0-beta14` and run `npm i`

* [BUG] Fix Pagination on customPosts <https://github.com/shprink/wordpress-hybrid-client/issues/283>
* [FEATURE] Custom posts and custom taxos queries are customizale through the conf <https://github.com/shprink/wordpress-hybrid-client/issues/288>
* Add a new scss variable `$barHasIconTitleMarginLeft`

<a name="2.0.0-beta13"></a>
### 2.0.0-beta13 (2016-10-22)

To upgrade checkout `git checkout v2.0.0-beta13` and run `npm i`
To upgrade checkout `git fetch --all && git checkout v2.0.0-beta13` and run `npm i`

* [FEATURE] Display app icon in the menu header <https://github.com/shprink/wordpress-hybrid-client/issues/5>
* [FEATURE] Progressive Web App support (Manifest & service workers)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ It's always best to create two smaller PRs than one big one.

### Style

Always use four spaces, no tabs. This goes for any HTML, CSS, or Javascript.
Follow .editconfig
7 changes: 6 additions & 1 deletion config/config.default.cson
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# API
"api":
"baseUrl": "http://dev.julienrenaux.fr/wp-json"
"baseUrl": "https://dev.julienrenaux.fr/wp-json"
"timeout": 30000
"maxAttempt": 3

Expand Down Expand Up @@ -151,6 +151,11 @@
"capacity": 25
"maxAge": 10800000

# ANY CUSTOM POSTS (this is just an example with movie type)
"movie":
"query":
"per_page": 2

# TRANSLATIONS
"translation":
"displayed" : ["en", "fr", "zh", "es", "pl", "de", "pt", "it", "nl", "ru", "tr"]
Expand Down
35 changes: 27 additions & 8 deletions lib/abstract/AbstractList.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,30 @@ export default class {
this.page = 1;
this.isPaginationOver = false;
this.service.clearCache();
this.doLoadMore(true).then(angular.bind(this, (response) => {
this.doLoadMore(true).then((response) => {
this.$log.debug('[AbstractList] refresh', response);
})).finally(() => this.$scope.$broadcast('scroll.refreshComplete'));
}).finally(() => this.$scope.$broadcast('scroll.refreshComplete'));
}

doLoadMore(refresh = false) {
let self = this;
// prevent multiple call when the server takes some time to answer
if (this.isLoadingMore || this.isPaginationOver) {
return this.$q.when(null);
}
this.isLoadingMore = true;
return this.service.get(angular.merge(this.getQuery(), _.get(this.config, `[${this.type}].query`) || {})).then((response) => {
self.page++;
self.list = (self.list && !refresh) ? self.list.concat(response.data) : response.data;
self.isPaginationOver = (response.data.length === 0 || response.data.length < _.get(this.config, `${this.type}.query.per_page`));

const query = this.getMergedQuery();
this.$log.debug('[AbstractList] type', this.type);
this.$log.debug('[AbstractList] query', query);

return this.service.get(query).then((response) => {
this.page++;
this.list = (this.list && !refresh) ? this.list.concat(response.data) : response.data;
this.isPaginationOver = (response.data.length === 0 || response.data.length < query.per_page);
this.$log.debug('[AbstractList] data loded');
this.$log.debug('[AbstractList] data loded: page', this.page);
this.$log.debug('[AbstractList] data loded: items', response.data);
this.$log.debug('[AbstractList] data loded: isPaginationOver', this.isPaginationOver);
this.onDataLoaded(response);
return response;
}).finally(() => this.isLoadingMore = false);
Expand All @@ -54,10 +62,21 @@ export default class {
getQuery() {
return {
page: this.page,
per_page: 5,
"_embed": true
}
}

getMergedQuery() {
let typeQuery = _.get(this.config, `[${this.type}].query`, {});
if (this.type === 'customPosts' && this.$stateParams.slug) {
typeQuery = _.get(this.config, `[${this.$stateParams.slug}].query`, {})
} else if (this.type === 'taxonomiesPosts' && this.postType) {
typeQuery = _.get(this.config, `[${this.postType}].query`, {})
}
return Object.assign(this.getQuery(), typeQuery);
}

setType(type = null) {
this.type = type;
}
Expand All @@ -70,7 +89,7 @@ export default class {
this.title = title;
}

onDataLoaded(response){
onDataLoaded(response) {

}
}
4 changes: 2 additions & 2 deletions lib/customPosts/customPosts.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import AbstractList from '../abstract/AbstractList.js';

export default class extends AbstractList {

constructor($WPHCCustomPosts, $injector, $filter) {
constructor($WPHCCustomPosts, $scope, $injector, $filter) {
'ngInject';

super($injector);
super($injector, $scope);
this.setType('customPosts');
this.setService($WPHCCustomPosts);
this.postType = _.get(this.$stateParams, 'slug');
Expand Down
2 changes: 1 addition & 1 deletion lib/scss/_bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ $logoSize : $bar-height - (2 * $bar-padding-portrait);
height: $logoSize;
}
.title{
margin-left: $logoSize + 10;
margin-left: $logoSize + $barHasIconTitleMarginLeft;
}
}
6 changes: 6 additions & 0 deletions lib/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,9 @@ $menu-icon-level-color: lighten($menu-icon-color, 10%) !default;
$menu-max-depth: 6 !default;
$menu-pane-expand-duration: 0.25s !default;
$menu-pane-hover-duration: 0.25s !default;



// Bar
// -------------------------------
$barHasIconTitleMarginLeft: 20 !default;
2 changes: 1 addition & 1 deletion lib/templates/module/author.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ <h2 ng-bind-html="postsCtrl.author.name"></h2>
</div>
</div>
<wphc-posts posts="postsCtrl.list"></wphc-posts>
<ion-infinite-scroll immediate-check="true" ng-if="postsCtrl.list && !postsCtrl.isPaginationOver" on-infinite="postsCtrl.loadMore()" distance="1%">test</ion-infinite-scroll>
<ion-infinite-scroll immediate-check="true" ng-if="postsCtrl.list && !postsCtrl.isPaginationOver" on-infinite="postsCtrl.loadMore()" distance="1%"></ion-infinite-scroll>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion lib/templates/module/authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<wphc-loader ng-if="!authorsCtrl.list" on-load="authorsCtrl.init()"></wphc-loader>
<ion-refresher pulling-text="{{ 'pullToRefresh' | translate}}" on-refresh="authorsCtrl.refresh()"></ion-refresher>
<wphc-authors authors="authorsCtrl.list"></wphc-authors>
<ion-infinite-scroll immediate-check="true" ng-if="authorsCtrl.list && !authorsCtrl.isPaginationOver" on-infinite="authorsCtrl.loadMore()" distance="1%">test</ion-infinite-scroll>
<ion-infinite-scroll immediate-check="true" ng-if="authorsCtrl.list && !authorsCtrl.isPaginationOver" on-infinite="authorsCtrl.loadMore()" distance="1%"></ion-infinite-scroll>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion lib/templates/module/customPosts-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<wphc-loader ng-if="!customPostsCtrl.list" on-load="customPostsCtrl.init()"></wphc-loader>
<ion-refresher pulling-text="{{ 'pullToRefresh' | translate}}" on-refresh="customPostsCtrl.refresh()"></ion-refresher>
<wphc-custom-posts-list list="customPostsCtrl.list" type="{{customPostsCtrl.postType}}"></wphc-custom-posts-list>
<ion-infinite-scroll immediate-check="true" ng-if="customPostsCtrl.list && !customPostsCtrl.isPaginationOver" on-infinite="customPostsCtrl.loadMore()" distance="1%">test</ion-infinite-scroll>
<ion-infinite-scroll immediate-check="true" ng-if="customPostsCtrl.list && !customPostsCtrl.isPaginationOver" on-infinite="customPostsCtrl.loadMore()" distance="1%"></ion-infinite-scroll>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion lib/templates/module/pages-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<wphc-loader ng-if="!pagesCtrl.list" on-load="pagesCtrl.init()"></wphc-loader>
<ion-refresher pulling-text="{{ 'pullToRefresh' | translate}}" on-refresh="pagesCtrl.refresh()"></ion-refresher>
<wphc-pages pages="pagesCtrl.list"></wphc-pages>
<ion-infinite-scroll immediate-check="true" ng-if="pagesCtrl.list && !pagesCtrl.isPaginationOver" on-infinite="pagesCtrl.loadMore()" distance="1%">test</ion-infinite-scroll>
<ion-infinite-scroll immediate-check="true" ng-if="pagesCtrl.list && !pagesCtrl.isPaginationOver" on-infinite="pagesCtrl.loadMore()" distance="1%"></ion-infinite-scroll>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion lib/templates/module/posts-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<wphc-loader ng-if="!postsCtrl.list" on-load="postsCtrl.init()"></wphc-loader>
<ion-refresher pulling-text="{{ 'pullToRefresh' | translate}}" on-refresh="postsCtrl.refresh()"></ion-refresher>
<wphc-posts show-author posts="postsCtrl.list"></wphc-posts>
<ion-infinite-scroll immediate-check="true" ng-if="postsCtrl.list && !postsCtrl.isPaginationOver" on-infinite="postsCtrl.loadMore()" distance="1%">test</ion-infinite-scroll>
<ion-infinite-scroll immediate-check="true" ng-if="postsCtrl.list && !postsCtrl.isPaginationOver" on-infinite="postsCtrl.loadMore()" distance="1%"></ion-infinite-scroll>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion lib/templates/module/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
<wphc-loader ng-if="!searchCtrl.list" on-load="searchCtrl.init()"></wphc-loader>
<ion-refresher pulling-text="{{ 'pullToRefresh' | translate}}" on-refresh="searchCtrl.refresh()"></ion-refresher>
<wphc-posts show-toolbar="::searchCtrl.showToolbar" posts="searchCtrl.list"></wphc-posts>
<ion-infinite-scroll immediate-check="true" ng-if="searchCtrl.list && !searchCtrl.isPaginationOver" on-infinite="searchCtrl.loadMore()" distance="1%">test</ion-infinite-scroll>
<ion-infinite-scroll immediate-check="true" ng-if="searchCtrl.list && !searchCtrl.isPaginationOver" on-infinite="searchCtrl.loadMore()" distance="1%"></ion-infinite-scroll>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion lib/templates/module/taxonomies-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<wphc-loader ng-if="!taxonomiesCtrl.list" on-load="taxonomiesCtrl.init()"></wphc-loader>
<ion-refresher pulling-text="{{ 'pullToRefresh' | translate}}" on-refresh="taxonomiesCtrl.refresh()"></ion-refresher>
<wphc-taxonomies taxonomies="taxonomiesCtrl.list" term="taxonomiesCtrl.term" post-type="taxonomiesCtrl.postType"></wphc-taxonomies>
<ion-infinite-scroll immediate-check="true" ng-if="taxonomiesCtrl.list && !taxonomiesCtrl.isPaginationOver" on-infinite="taxonomiesCtrl.loadMore()" distance="1%">test</ion-infinite-scroll>
<ion-infinite-scroll immediate-check="true" ng-if="taxonomiesCtrl.list && !taxonomiesCtrl.isPaginationOver" on-infinite="taxonomiesCtrl.loadMore()" distance="1%"></ion-infinite-scroll>
</ion-content>
</ion-view>
12 changes: 6 additions & 6 deletions lib/translations/nl.cson
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"home": "Home"
"tags": "Tags"
"pages": "Pagina's"
"posts": "Posts"
"posts": "Berichten"
"authors": "Auteurs"
"search": "Zoeken"
"bookmarks": "bladwijzers"
"socialNetworks": "Sociale netwerken"
"categories": "Categorieën"
"settings": "Instellingen"
"customPosts": "Eigen posts"
"customTaxonomy": "Eigen taxanomie"
"customPosts": "Aangepaste berichten"
"customTaxonomy": "Aangepaste taxanomie"
"pushNotifications":
"newContent":
"title": "Nieuwe inhoud!"
Expand Down Expand Up @@ -55,7 +55,7 @@
"pages":
"title": "Pagina's"
"posts":
"title": "Posts"
"title": "Berichten"
"featured": "Uitgelicht"
"post":
"comments": "Reactie's"
Expand All @@ -65,9 +65,9 @@
"params":
"title": "Instellingen"
"offlineMode": "Offline mode (binnenkort)"
"fontSize": "Post lettertype grootte"
"fontSize": "Lettertype grootte"
"language": "Taal"
"pushNotifications": "Push meldingen"
"pushNotifications": "Push berichten"
"languages":
"en": "Engels"
"fr": "Frans"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wordpress-hybrid-client",
"version": "2.0.0-beta13",
"version": "2.0.0-beta14",
"title": "wordpress-hybrid-client",
"description": "AngularJS client using Ionic Framework and based on the json-rest-api plugin: https://wordpress.org/plugins/json-rest-api/ with CORS enabled.",
"main": "index.js",
Expand Down

0 comments on commit 8ddc2fc

Please sign in to comment.