Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ionScroll #375

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.idea
.versions
.build*
.DS_Store
49 changes: 0 additions & 49 deletions .versions

This file was deleted.

50 changes: 29 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

### Build [Ionic](http://ionicframework.com/) apps in [Meteor](https://www.meteor.com/)!

## NOTE: This package is no longer being actively maintained.

If you are interested in maintaining it, contact me through [my Github profile](https://github.com/nickw). Now that Meteor is officially supporting (and actively recommending) React and Angular, I suggest using [Ionic](https://github.com/driftyco/ionic), [Ionic 2](https://github.com/driftyco/ionic2) or [Reapp](https://github.com/reapp) as alternatives for building hybrid mobile apps with Meteor.

## Overview

This is an attempt at **real Ionic and Meteor integration**. This is not just Ionic's CSS framework wrapped in a Meteor package. It aims to be a complete port of [Ionic’s Angular directives](http://ionicframework.com/docs/api/) to [Meteor Blaze](https://www.meteor.com/blaze) templates.

Note: This is a forked of meteoric:ionic, which is now not maintained. In response, I decided to fork it, and maintain this package for my own. I have written acceptance test on [JoeyAndres/ionic-demo](https://github.com/JoeyAndres/ionic-demo), which is a fork of meteoric/demo.

## Why?
[Ionic](http://ionicframework.com/) is arguably the most comprehensive, polished, cross-platform mobile framework available. But unfortunately a large portion of its functionality comes from Angular directives. [I'm not a fan of trying to force-fit Angular into Meteor](https://medium.com/space-camp/your-meteor-app-probably-doesnt-need-angular-13986a0323f6), so I wanted to see if I could rewrite Ionic specifically for Meteor.

Expand All @@ -22,14 +20,27 @@ Check out the [GUIDE.md](GUIDE.md) for a guide on how to get started.

**Beta** See the TODO section below to see which Angular Directives have been ported to Blaze.

## Install

```bash
meteor add jandres:ionic
```

## Dependencies
Rather than include compiled or CDN versions of Ionic's CSS Framework we’ve extraced it into two separate packages:

- [meteoric:ionicons-sass](http://github.com/meteoric/ionicons-sass) Ionic’s Ionicons set wrapped for Meteor.
- [meteoric:ionic-sass](http://github.com/meteoric/ionic-sass) The base Ionic CSS Framework wrapped for Meteor.
- [seba:ionic-sass](https://github.com/sebakerckhof/meteor-ionic-sass/) Ionic's scss only package and currently up to date with ionic v1.1.0

## Examples

### Demo of all components
The demo app of various ionic components

[Demo](http://jandres-ionic.meteor.com/) | [Code](https://github.com/JoeyAndres/ionic-demo)

## Pre-fork Examples

The following are examples prior to this fork.

### Contacts App
A simple CRUD app to manage contacts.

Expand All @@ -40,13 +51,6 @@ A [Product Hunt](http://producthunt.com) clone built in Meteor Ionic. (In Progre

[Demo](http://meteorhunt.meteor.com/) | [Code](https://github.com/meteoric/meteorhunt)

### Demo of all components
The demo app of various meteoric components

[Demo](http://meteor-ionic.meteor.com/) | [Code](https://github.com/meteoric/demo)

You can also keep track of the various other repos from the [Meteoric team](https://github.com/meteoric)

## TODO

### Angular Directives to convert to Blaze:
Expand All @@ -67,15 +71,15 @@ You can also keep track of the various other repos from the [Meteoric team](http
* [x] ion-footer-bar
* [x] Keyboard (requires [cordova](http://cordova.apache.org/) integration)
* [ ] Lists (needs edit/remove/sort functionality)
* [ ] ion-list
* [ ] ion-item
* [ ] ion-delete-button
* [ ] ion-reorder-button
* [ ] ion-option-button
* [x] ion-list
* [x] ion-item
* [x] ion-delete-button
* [x] ion-reorder-button
* [x] ion-option-button
* [ ] collection-repeat
* [x] Loading
* [x] Modal
* [x] Navigation (requires [iron:router](https://github.com/EventedMind/iron-router) integration)
* [x] Navigation (requires [iron:router](https://github.com/EventedMind/iron-router) integration)a
* [x] ion-nav-view
* [x] ion-view
* [x] ion-nav-bar
Expand All @@ -88,7 +92,7 @@ You can also keep track of the various other repos from the [Meteoric team](http
* [x] Popover
* [x] Popup
* [ ] Scroll
* [ ] ion-scroll
* [x] ion-scroll: Need to modify iscroll (massive re-engineering and cleanup) to add features.
* [ ] ion-infinite-scroll
* [x] Side Menus
* [x] ion-side-menus
Expand All @@ -101,6 +105,10 @@ You can also keep track of the various other repos from the [Meteoric team](http
* [x] Tabs (requires [iron:router](https://github.com/EventedMind/iron-router) integration)
* [x] ion-tabs
* [x] ion-tab

### Code Style Change:
These are code styles that I want to impose on this forked repo.
* [ ] Get rid of all session variables

## License
[MIT License](https://github.com/meteoric/meteor-ionic/blob/master/LICENSE)
72 changes: 44 additions & 28 deletions components/ionContent/ionContent.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
Template.ionContent.onCreated(function() {
this.ionSideMenuContainerParent = this.parent((t) => t.view.name === "Template.ionSideMenuContainer", true);

_.extend(this, {
hasBouncing: (!!this.ionSideMenuContainerParent && this.ionSideMenuContainerParent.hasBouncing) || new ReactiveVar(null)
});

this.autorun(() => {
if (!Template.currentData()) return;
let hasBouncing = Template.currentData().hasBouncing;
if (!!this.ionSideMenuContainerParent) {
this.ionSideMenuContainerParent.hasBouncing.set(hasBouncing);
}
});
});

Template.ionContent.helpers({
classes: function () {
var classes = ['content'];
classes: function () {
var classes = ['content'];

if (this.class) {
classes.push(this.class);
}
if (this.class) {
classes.push(this.class);
}

if (this.scroll !== false) {
classes.push('overflow-scroll');
}
if (this.scroll !== false) {
classes.push('overflow-scroll');
}

if (Session.get('hasHeader')) {
classes.push('has-header');
}
if (Session.get('hasHeader')) {
classes.push('has-header');
}

if (Session.get('hasSubheader')) {
classes.push('has-subheader');
}
if (Session.get('hasSubheader')) {
classes.push('has-subheader');
}

if (Session.get('hasTabs')) {
classes.push('has-tabs');
}
if (Session.get('hasTabs')) {
classes.push('has-tabs');
}

if (Session.get('hasTabsTop')) {
classes.push('has-tabs-top');
}
if (Session.get('hasTabsTop')) {
classes.push('has-tabs-top');
}

if (Session.get('hasFooter')) {
classes.push('has-footer');
}
if (Session.get('hasFooter')) {
classes.push('has-footer');
}

if (Session.get('hasSubfooter')) {
classes.push('has-subfooter');
}
if (Session.get('hasSubfooter')) {
classes.push('has-subfooter');
}

return classes.join(' ');
}
return classes.join(' ');
}
});
8 changes: 8 additions & 0 deletions components/ionDeleteButton/ionDeleteButton.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template name="ionDeleteButton">
<div class="item-left-edit item-delete enable-pointer-events
{{#if showDelete}}visible active{{/if}}">
<ion-delete-button
class="{{class}} button icon button-icon item-left-editable">
</ion-delete-button>
</div>
</template>
13 changes: 13 additions & 0 deletions components/ionDeleteButton/ionDeleteButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Template.ionDeleteButton.onCreated(function() {
let parent = this.parent((t) => t.view.name === "Template.ionItem", true);
if (!parent) { throw "Template.ionDeleteButton must be a descendant of Template.ionItem."; }
_.extend(this, {
showDelete: parent.showDelete
});
});

Template.ionDeleteButton.helpers({
showDelete: function() {
return Template.instance().showDelete.get();
}
});
8 changes: 4 additions & 4 deletions components/ionHeaderBar/ionHeaderBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
IonHeaderBar = {
alignTitle: function () {
var align = this.data.alignTitle || 'center';
var align = this.alignTitle;
var $title = this.$('.title');

if (Platform.isAndroid() && !this.alignTitle) {
Expand Down Expand Up @@ -49,9 +49,9 @@ IonHeaderBar = {
}
};

Template.ionHeaderBar.created = function () {
this.data = this.data || {};
};
Template.ionHeaderBar.onCreated(function() {
this.alignTitle = this.data? (this.data.alignTitle || 'center') : 'center';
});

Template.ionHeaderBar.rendered = function () {
Session.set('hasHeader', true);
Expand Down
17 changes: 9 additions & 8 deletions components/ionItem/ionItem.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template name="ionItem">
{{#if isAnchor}}
<a class="{{itemClasses}}" href="{{url}}" id="{{idAttribute}}" target="{{target}}">
{{> UI.contentBlock}}
</a>
{{#if itemComplex}}
<div class="{{class}} item item-complex item-left-editable item-right-editable">

<!-- Note: Children can only inherit data context. -->
<!-- To inherit helper, the basically have to be passed as data context.-->
{{> UI.contentBlock isAnchor=isAnchor url=url target=target}}
</div>
{{else}}
<div class="{{itemClasses}}" id="{{idAttribute}}">
{{> UI.contentBlock}}
</div>
{{> UI.contentBlock isAnchor=isAnchor url=url target=target class=class}}
{{/if}}
</template>
</template>
Loading