Skip to content

Commit

Permalink
initial commit - tested only with meteor preview 0.7.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sing-Li committed Jan 13, 2014
0 parents commit 3a8a370
Show file tree
Hide file tree
Showing 44 changed files with 1,133 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.meteor
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
To try out this sample code, you need to first make sure that
Meteor is installed and running on your system.

This sample code has been tested against Meteor 0.6.3.1.

Please note that Meteor 0.6.3.1 officially supports only MacOSX and Linux.

See official Meteor website for support of Windows.

Once you are sure that Meteor is running fine, perform the following:

1 create a new directory for the code
2 copy the content of the download to the new directory
3 chmod +x instcode.sh
(you may wish to perform the steps inside the instcode.sh script manually)
4 ./instcode.sh

-------------------------------------------------------------------------------
The instcode.sh script performs the following:

1. use meteor to create three new projects
2. remove the default contents of the projects
3. add and remove the security and login packages required for each project
4. replace the contents of the projects with the downloaded code

-------------------------------------------------------------------------------

NOTE: When you run the sales and fotoshare projects for the very first time,
Meteor may immediately reboot with an exception thrown. The bootstrap code
will create the two users - sing and joe - the first time it is executed.




Binary file added SalesByRegion.xlsx
Binary file not shown.
2 changes: 2 additions & 0 deletions fotoshare/client/css/jquery.mobile-1.3.0.min.css

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions fotoshare/client/css/zjquery.mobile.pagination.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*!
* jQuery Mobile Framework : drag pagination plugin
* Copyright (c) Filament Group, Inc
* Authored by Scott Jehl, [email protected]
* Dual licensed under the MIT or GPL Version 2 licenses.
*/
.ui-pagination {
left: 0;
width: 100%;
}
.ui-pagination, .ui-pagination li {
list-style: none;
margin: 0;
padding: 0;
top: 0;
position: fixed;
}
.ui-pagination li {
overflow: hidden;
width: 2.5em;
height: 4.5em;
}
.ui-pagination li a {
padding: .7em .4em .7em .45em;
opacity: .7;
position: absolute;
z-index: 999;
}
.ui-pagination .ui-pagination-prev {
left: 0;
top: 150px;
}
.ui-pagination .ui-pagination-next {
top: 150px;
right: 0;
}
.ui-pagination .ui-pagination-prev a {
right: 0;
padding-left: 1.45em;
}
.ui-pagination .ui-pagination-next a {
left: 0;
padding-right: 1.45em;
}
.ui-page.ui-page-prev {
left: -100%;
display: block;
overflow: visible;
}
.ui-page.ui-page-next {
left: 100%;
display: block;
overflow: visible;
}
.ui-pagination-dragging,
.ui-pagination-dragging .ui-page,
.ui-pagination-snapping,
.ui-pagination-snapping .ui-page {
width: 100%;
}
/* NOTE: comment this part out if your page is element-heavy!! */
.ui-page * {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
transform: rotateY(0deg);
}
.ui-pagination-snapping .ui-page {
-webkit-transition: -webkit-transform .3s ease-out;
-moz-transition: -moz-transform .3s ease-out;
-ms-transition: -moz-transform .3s ease-out;
-o-transition: -o-transform .3s ease-out;
transition: transform .3s ease-out;
}
10 changes: 10 additions & 0 deletions fotoshare/client/fotoshare.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* CSS declarations go here */
img {width: 100%}
.apic {margin: 0 ; padding: 0}

.ui-icon-loading {
opacity: 0;
}


.logindialog { height:300px;}
67 changes: 67 additions & 0 deletions fotoshare/client/fotoshare.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>developerWorks fotoshare via Meteor</title>

</head>

<body>
<div data-role="page" id="login">
<div data-role="header">
<h1>dW Foto Share</h1>
</div> <!-- /header -->

<div data-role="content">

<div class="logindialog">

{{loginButtons}}

</div>
</div> <!-- content -->
</div> <!-- page -->

{{> pages}}
</body>

<template name="pages">
{{#if currentUser}}
{{resetIndex}}
{{#each photos}}
{{> photopage}}
{{incIndex}}
{{/each}}
{{/if}}

</template>

<template name="photopage">
<div data-role="page" id="p{{index}}">
<div data-role="header">
<h1>dW Foto Share</h1>
</div> <!-- /header -->

<div data-role="content" class="apic">

<img src="{{img}}" />
<ul data-role="pagination">
{{#if indexIsZero}}
<li class="ui-pagination-next"><a href="#p{{indexNext}}">Next</a></li>
{{else}}
<li class="ui-pagination-prev"><a href="#p{{indexPrev}}">Prev</a></li>
<li id="x{{index}}" class="ui-pagination-next"><a href="#p{{indexNext}}">Next</a></li>
{{/if}}
</ul>

</div> <!-- /content -->

<div data-role="footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="#" data-icon="gear" class="fs-share ui-btn-active">Share</a></li>
<li><a href="#" data-icon="delete" class="fs-logoff">Log off</a></li>
</ul>
</div><!-- /navbar -->
</div><!-- /footer -->
</div> <!-- /page -->

</template>
76 changes: 76 additions & 0 deletions fotoshare/client/fotoshare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

Fotos = new Meteor.Collection("fotoshare_photos");

Meteor.subscribe("photos");

var curIndex;

Template.pages.photos = function () {
return Fotos.find({});
};

// no access to handlebar @index yet in meteor - implement own index
Template.pages.resetIndex = function () {
curIndex = 0;
}

Template.photopage.index = function() {
return curIndex;
}

Template.pages.incIndex = function() {
curIndex = curIndex + 1;
}

Template.photopage.indexIsZero = function() {
return (curIndex === 0);
}

Template.photopage.indexPrev = function() {
return (curIndex - 1);
}

Template.photopage.indexNext = function() {
return (curIndex + 1);
}

Template.photopage.events({
'click .fs-logoff': function () {
Meteor.logout(function() {
location.reload();
});
},
'click .fs-share': function() {
Meteor.call('shareThisPhoto', this._id, function (error, retval) {
console.log(retval);
});
}
});

Template.pages.rendered = function() {
var curLast = $('#x' + (curIndex - 1));
var secLast = $('#x' + (curIndex - 2));
if (curLast) {
curLast.prop('disabled', true);
curLast.hide();
}
if (secLast) {
if (secLast.prop('disabled')) {
secLast.removeProp('disabled');
secLast.show();
}
}

$.mobile.initializePage();
Meteor.defer(function() {
$.mobile.changePage('#p' + (curIndex -1));
});
};



Template.photopage.rendered = function () {
console.log('called PAGE rendered');
};


3 changes: 3 additions & 0 deletions fotoshare/client/js/aadelaybind.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$(document).bind("mobileinit", function(){
$.mobile.autoInitializePage = false;
});
2 changes: 2 additions & 0 deletions fotoshare/client/js/jquery.mobile-1.3.0.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 3a8a370

Please sign in to comment.