├── .gitignore
├── .meteor
├── .finished-upgraders
├── .gitignore
├── .id
├── packages
├── platforms
├── release
└── versions
├── LICENSE
├── README.md
├── client
├── helpers
│ └── helpers.js
├── home
│ ├── home.css
│ ├── home.html
│ └── home.js
├── layout
│ ├── layout.html
│ └── loading
│ │ └── loading.html
├── modales
│ ├── downloadFile
│ │ ├── downloadFile.html
│ │ └── downloadFile.js
│ ├── filterFile
│ │ ├── filterFile.html
│ │ └── filterFile.js
│ ├── progressFile
│ │ ├── progressFile.html
│ │ └── progressFile.js
│ ├── uploadEvent
│ │ ├── uploadEvent.html
│ │ └── uploadEvent.js
│ └── uploadFile
│ │ ├── uploadFile.html
│ │ └── uploadFile.js
└── profile
│ ├── audio.html
│ ├── image.html
│ ├── profile.css
│ ├── profile.html
│ ├── profile.js
│ └── video.html
├── lib
├── collection.js
├── drakula.css
└── routes.js
└── server
└── common.js
/.gitignore:
--------------------------------------------------------------------------------
1 | **/.DS_Store
--------------------------------------------------------------------------------
/.meteor/.finished-upgraders:
--------------------------------------------------------------------------------
1 | # This file contains information which helps Meteor properly upgrade your
2 | # app when you run 'meteor update'. You should check it into version control
3 | # with your project.
4 |
5 | notices-for-0.9.0
6 | notices-for-0.9.1
7 | 0.9.4-platform-file
8 | notices-for-facebook-graph-api-2
9 |
--------------------------------------------------------------------------------
/.meteor/.gitignore:
--------------------------------------------------------------------------------
1 | local
2 |
--------------------------------------------------------------------------------
/.meteor/.id:
--------------------------------------------------------------------------------
1 | # This file contains a token that is unique to your project.
2 | # Check it into your repository along with the rest of this directory.
3 | # It can be used for purposes such as:
4 | # - ensuring you don't accidentally deploy one app on top of another
5 | # - providing package authors with aggregated statistics
6 |
7 | 14jms4a1yhmuptgdctas
8 |
--------------------------------------------------------------------------------
/.meteor/packages:
--------------------------------------------------------------------------------
1 | # Meteor packages used by this project, one per line.
2 | # Check this file (and the other files in this directory) into your repository.
3 | #
4 | # 'meteor add' and 'meteor remove' will edit this file for you,
5 | # but you can also edit it by hand.
6 |
7 | meteor-platform
8 | iron:router
9 | cfs:standard-packages
10 | cfs:gridfs
11 | accounts-password
12 | accounts-ui
13 | mizzao:bootstrap-3
14 | sacha:spin
15 | cfs:graphicsmagick
16 | peppelg:bootstrap-3-modal
17 | markdown
18 | cfs:ui
19 |
--------------------------------------------------------------------------------
/.meteor/platforms:
--------------------------------------------------------------------------------
1 | server
2 | browser
3 |
--------------------------------------------------------------------------------
/.meteor/release:
--------------------------------------------------------------------------------
1 | METEOR@1.1.0.2
2 |
--------------------------------------------------------------------------------
/.meteor/versions:
--------------------------------------------------------------------------------
1 | accounts-base@1.2.0
2 | accounts-password@1.1.1
3 | accounts-ui@1.1.5
4 | accounts-ui-unstyled@1.1.7
5 | autoupdate@1.2.1
6 | base64@1.0.3
7 | binary-heap@1.0.3
8 | blaze@2.1.2
9 | blaze-tools@1.0.3
10 | boilerplate-generator@1.0.3
11 | callback-hook@1.0.3
12 | cfs:access-point@0.1.47
13 | cfs:base-package@0.0.29
14 | cfs:collection@0.5.5
15 | cfs:collection-filters@0.2.4
16 | cfs:data-man@0.0.6
17 | cfs:file@0.1.17
18 | cfs:graphicsmagick@0.0.18
19 | cfs:gridfs@0.0.33
20 | cfs:http-methods@0.0.28
21 | cfs:http-publish@0.0.13
22 | cfs:power-queue@0.9.11
23 | cfs:reactive-list@0.0.9
24 | cfs:reactive-property@0.0.4
25 | cfs:standard-packages@0.5.8
26 | cfs:storage-adapter@0.2.2
27 | cfs:tempstore@0.1.5
28 | cfs:ui@0.1.3
29 | cfs:upload-http@0.0.20
30 | cfs:worker@0.1.4
31 | check@1.0.5
32 | ddp@1.1.0
33 | deps@1.0.7
34 | ejson@1.0.6
35 | email@1.0.6
36 | fastclick@1.0.3
37 | geojson-utils@1.0.3
38 | html-tools@1.0.4
39 | htmljs@1.0.4
40 | http@1.1.0
41 | id-map@1.0.3
42 | iron:controller@1.0.7
43 | iron:core@1.0.7
44 | iron:dynamic-template@1.0.7
45 | iron:layout@1.0.7
46 | iron:location@1.0.7
47 | iron:middleware-stack@1.0.7
48 | iron:router@1.0.7
49 | iron:url@1.0.7
50 | jquery@1.11.3_2
51 | json@1.0.3
52 | launch-screen@1.0.2
53 | less@1.0.14
54 | livedata@1.0.13
55 | localstorage@1.0.3
56 | logging@1.0.7
57 | markdown@1.0.4
58 | meteor@1.1.6
59 | meteor-platform@1.2.2
60 | minifiers@1.1.5
61 | minimongo@1.0.8
62 | mizzao:bootstrap-3@3.3.1_1
63 | mobile-status-bar@1.0.3
64 | mongo@1.1.0
65 | mongo-livedata@1.0.8
66 | npm-bcrypt@0.7.8_2
67 | observe-sequence@1.0.6
68 | ordered-dict@1.0.3
69 | peppelg:bootstrap-3-modal@1.0.3
70 | raix:eventemitter@0.1.2
71 | random@1.0.3
72 | reactive-dict@1.1.0
73 | reactive-var@1.0.5
74 | reload@1.1.3
75 | retry@1.0.3
76 | routepolicy@1.0.5
77 | sacha:spin@2.0.4
78 | service-configuration@1.0.4
79 | session@1.1.0
80 | sha@1.0.3
81 | spacebars@1.0.6
82 | spacebars-compiler@1.0.6
83 | srp@1.0.3
84 | templating@1.1.1
85 | tracker@1.0.7
86 | ui@1.0.6
87 | underscore@1.0.3
88 | url@1.0.4
89 | webapp@1.2.0
90 | webapp-hashing@1.0.3
91 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Ethan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # simple-uploadFS
2 |
3 | This Is a Simple Demo from [FSCollection Package](https://github.com/CollectionFS/Meteor-CollectionFS).
4 |
5 | Packages on Use
6 | accounts-password
7 | accounts-ui
8 | peppelg:bootstrap-3-modal
9 | mizzao:bootstrap-3
10 | meteor-platform
11 | sacha:spin
12 | markdown
13 | iron:router
14 | iron:router
15 | cfs:ui
16 | cfs:standard-packages
17 | cfs:gridfs
18 | cfs:graphicsmagick
19 |
20 |
21 |
22 | Here is the [DEMO](http://demo.fscollection.meteor.com)
23 |
--------------------------------------------------------------------------------
/client/helpers/helpers.js:
--------------------------------------------------------------------------------
1 | highlightConfig = function(){
2 | hljs.configure({
3 | tabReplace: ' ',
4 | classPrefix: '',
5 | useBR:true
6 |
7 | })
8 |
9 | $('pre code').each(function(i, block) {
10 | hljs.highlightBlock(block);
11 | });
12 | }
--------------------------------------------------------------------------------
/client/home/home.css:
--------------------------------------------------------------------------------
1 | #profile{
2 | width:100px; /* you can use % */
3 | height: auto;
4 | position: absolute;
5 | right:0;
6 | top:0;
7 | }
8 | #header {
9 | position: fixed;
10 | width: 100%;
11 | height: 50px;
12 | top: 0;
13 | z-index: 1;
14 | }
15 | .center{
16 | position:absolute;
17 | display:block;
18 | height:700px;
19 | width:700px;
20 | left:50%;
21 | top:50%;
22 | margin-top:-200px;
23 | margin-left:-150px;
24 | }
25 | .centerProfile{
26 | position:absolute;
27 | display:block;
28 | height:700px;
29 | width:700px;
30 | left:20%;
31 | top:50%;
32 | margin-top:-350px;
33 | margin-left:-150px;
34 | }
35 | .imagesProfileSection{
36 | position:absolute;
37 | display:block;
38 | height:1200px;
39 | width:1200px;
40 | left:10%;
41 | top:50%;
42 | margin-top:100px;
43 | margin-left:-100px;
44 | }
45 | #imagesUser{
46 | width: 50%;
47 | }
--------------------------------------------------------------------------------
/client/home/home.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
16 |
17 |
18 |
19 |
20 |
For those who whants to upload images into their Awesome Meteor App
21 | {{#if currentUser}}
22 |
Get Started
23 | {{> loginButtons}}
24 | {{else}}
25 |
To get Started First Creat an Account
26 | {{> loginButtons}}
27 | {{/if}}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/client/home/home.js:
--------------------------------------------------------------------------------
1 | Template.home.helpers({
2 |
3 | })
--------------------------------------------------------------------------------
/client/layout/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{> yield}}
7 |
14 |
--------------------------------------------------------------------------------
/client/layout/loading/loading.html:
--------------------------------------------------------------------------------
1 |
2 | {{> postItem}}
3 |
--------------------------------------------------------------------------------
/client/modales/downloadFile/downloadFile.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 | {{#markdown}}{{> codeDownload}}{{/markdown}}
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | This Works Thanks to Simple **HTML**.
25 |
26 | this.name a href="this.url download=true" class="btn btn-primary">Download a
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/client/modales/downloadFile/downloadFile.js:
--------------------------------------------------------------------------------
1 | Template.downloadFile.onRendered(function(){
2 | //highlight configuration
3 | highlightConfig();
4 | })
--------------------------------------------------------------------------------
/client/modales/filterFile/filterFile.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 | {{#markdown}}{{> codeFilter}}{{/markdown}}
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | This Works Thanks to this Code.
25 |
26 | pdfStore = new FS.Store.GridFS("pdf", {
27 | transformWrite: function(fileObj, readStream, writeStream) {
28 | gm(readStream, fileObj.name)
29 | .gravity('Center')
30 | .autoOrient()
31 | .stream()
32 | .pipe(writeStream);
33 | }
34 | });
35 | //FSCollection Declatarion
36 | PdfFile = new FS.Collection("PdfFile", {
37 | stores: [pdfStore],
38 | filter: {
39 | maxSize: 2097152, //in bytes
40 | allow: {
41 | contentTypes: ['application/pdf'],
42 | extensions: ['pdf']
43 | },
44 | onInvalid: function (message) {
45 | if(Meteor.isClient){
46 | alert(message);
47 | } else{
48 | console.warn(message);
49 | }
50 | }
51 | }
52 | });
53 |
54 |
55 | On this Example im using the *transformWrite* function thanks to the cfs:graphicsmagick package.
56 |
57 | *What does transforWrite?*
58 | *transformWrite is a function that changes the file type*
59 |
60 | give it a try.
61 |
62 | meteor add cfs:graphicsmagick package.
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/client/modales/filterFile/filterFile.js:
--------------------------------------------------------------------------------
1 | Template.filterFile.onRendered(function(){
2 | //highlight configuration
3 | highlightConfig();
4 | })
--------------------------------------------------------------------------------
/client/modales/progressFile/progressFile.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 | {{#markdown}}{{> codeProgress}}{{/markdown}}
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | First install the Package.
25 |
26 |
27 | $ meteor add cfs:ui
28 |
29 |
30 | Second Put this on the **HTML**
31 |
32 |
33 | #each files
34 | #unless this.isUploaded
35 | FS.UploadProgressBar
36 | /unless
37 | /each
38 |
39 |
40 | Also dont forget to take a look into the [README](https://github.com/CollectionFS/Meteor-cfs-ui)
41 |
--------------------------------------------------------------------------------
/client/modales/progressFile/progressFile.js:
--------------------------------------------------------------------------------
1 | Template.progressFile.onRendered(function(){
2 | //highlight configuration
3 | highlightConfig();
4 | })
--------------------------------------------------------------------------------
/client/modales/uploadEvent/uploadEvent.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 | {{#markdown}}{{> codeEvent}}{{/markdown}}
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | First install the Package.
25 |
26 | $ meteor add cfs:ui
27 |
28 |
29 | Second Create a Dummy input file
30 |
31 |
32 |
33 |
34 | Third Declare and Subscribe Create this folder appName/lib/collections.js
35 | and create the FS.Collection.
36 |
37 | PostsImages = new FS.Collection("PostsImages", {
38 | stores: [new FS.Store.GridFS("PostsImages")]
39 | });
40 |
41 | if(Meteor.isClient){
42 | Meteor.subscrie('PostImages')
43 | }
44 |
45 |
46 |
47 | Four and last create this event.
48 |
49 | Template.example.events({
50 | 'change #imageInput': FS.EventHandlers.insertFiles(PostsImages, {
51 | metadata: function (fileObj) {
52 | return {
53 | owner: Meteor.userId()
54 | };
55 | },
56 | after: function (error, fileObj) {
57 | console.log("Congratulations You just upload a new image =D");
58 | }
59 | })
60 | });
61 |
62 | So what Really happend here, if you take close to the sytaxis FS.EventHandlers.insertFiles(collection, [options])
.
63 | First the collection option.
64 | 1.**collection:** An FS.Collection instance (in this case the PostImages Collection).
65 | Now the Options.
66 | 2.**options:**
67 | 2.1 **metadata:** (Optional) A function that takes an FS.File instance as its argument and returns an object containing the metadata to be added to the file object.
68 | 2.2 **after:** (Optional) A callback function for the FS.Collection.insert call.
69 | Also dont forget to take a look into the [README](https://github.com/CollectionFS/Meteor-cfs-ui)
70 |
--------------------------------------------------------------------------------
/client/modales/uploadEvent/uploadEvent.js:
--------------------------------------------------------------------------------
1 |
2 | Template.eventFile.onRendered(function(){
3 | //highlight configuration
4 | highlightConfig();
5 | })
--------------------------------------------------------------------------------
/client/modales/uploadFile/uploadFile.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 | {{#markdown}}{{> codeUpload}}{{/markdown}}
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | **First the Simple HTML**
26 |
27 |
28 |
29 | **Now the Js**
30 | The first thing you should do its create the Collection inside the follow directory.
31 |
32 | appName/lib/collections.js
33 | Second create the FS.Collection.
34 |
35 | PostsImages = new FS.Collection("PostsImages", {
36 | stores: [new FS.Store.GridFS("PostsImages")]
37 | });
38 |
39 | if(Meteor.isClient){
40 | Meteor.subscrie('PostImages')
41 | }
42 |
43 |
44 |
45 | **NOTE** We declare/subscribe on the /lib server since Meteor loads first this folder
46 | So collections will be avaible on both client/server.
47 |
48 | Now on the Server Code write this.
49 |
50 | appName/server/common.js
51 | Make the allow/denys Method here.
52 |
53 | PostsImages.allow({
54 | insert:function(){return true;},
55 | remove:function(){return true;},
56 | update:function(){return true;},
57 | download:function(){return true;}
58 | })
59 |
60 | //Publish Method.
61 | Meteor.publish('PostsImages',function(){
62 | return PostsImages.find()
63 | })
64 |
65 |
66 |
67 | And to Finish this little snipe, lets create a new Event.handler
68 |
69 | Template.example.events({
70 | 'change #exampleInput':function(){
71 | var file = $('#uploadImagePost').get(0).files[0] //Some jQuery to get the value.
72 | fsFile = new FS.File(file);
73 | fsFile.metadata = {coolText:"coolText"} //FS.File support metadata.
74 | PostsImages.insert(fsFile,function(err,result){
75 | if(!err){
76 | console.log(result) //you should get an id here since the full object take more less 10 sec to upload
77 | }
78 | })
79 | }
80 | })
81 |
82 | With this now you are able to insert some nice FileObjects into The Project.
83 |
84 | Dont Forget Read the [Documentation on GitHub](https://github.com/CollectionFS/Meteor-CollectionFS#getting-started)
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/client/modales/uploadFile/uploadFile.js:
--------------------------------------------------------------------------------
1 | Template.uploadFile.onRendered(function(){
2 | //highlight configuration
3 | highlightConfig();
4 | })
--------------------------------------------------------------------------------
/client/profile/audio.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | File Name {{this.name}}
7 | Current Extension {{this.extension}} of the File
8 | Current Type {{this.type}} of the File
9 | Current Size {{this.size}} of the File
10 | Download {{this.name}}
11 |
12 | Delete this
13 |
14 |
15 |
--------------------------------------------------------------------------------
/client/profile/image.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Image Name {{this.name}}
7 |
8 | Current URL {{this.url}} of the File
9 | Current Extension {{this.extension}} of the File
10 | Current Type {{this.type}} of the File
11 | Current Size {{this.size}} of the File
12 | Download {{this.name}}
13 |
14 | Delete this image
15 |
16 |
17 |
--------------------------------------------------------------------------------
/client/profile/profile.css:
--------------------------------------------------------------------------------
1 | #footer{
2 | position: fixed;
3 | }
4 | .formsProfile{
5 | margin-left: 350px;
6 | margin-top: 100px;
7 | }
8 |
9 | #footer {
10 | position:fixed;
11 | left:0px;
12 | bottom:0px;
13 | height:30px;
14 | width:100%;
15 | background:#999;
16 | }
17 |
18 |
19 | ul.rig {
20 | list-style: none;
21 | font-size: 0px;
22 | margin-left: -2.5%; /* should match li left margin */
23 | }
24 | ul.rig li {
25 | display: inline-block;
26 | padding: 10px;
27 | margin: 0 0 2.5% 2.5%;
28 | background: #fff;
29 | border: 1px solid #ddd;
30 | font-size: 16px;
31 | font-size: 1rem;
32 | vertical-align: top;
33 | box-shadow: 0 0 5px #ddd;
34 | box-sizing: border-box;
35 | -moz-box-sizing: border-box;
36 | -webkit-box-sizing: border-box;
37 | }
38 | ul.rig li img {
39 | max-width: 100%;
40 | height: auto;
41 | margin: 0 0 10px;
42 | }
43 | ul.rig li h3 {
44 | margin: 0 0 5px;
45 | }
46 | ul.rig li p {
47 | font-size: 1em;
48 | line-height: 1.5em;
49 | color: #999;
50 | }
51 | /* class for 2 columns */
52 | ul.rig.columns-2 li {
53 | width: 47.5%; /* this value + 2.5 should = 50% */
54 | }
55 | /* class for 3 columns */
56 | ul.rig.columns-3 li {
57 | width: 30.83%; /* this value + 2.5 should = 33% */
58 | }
59 | /* class for 4 columns */
60 | ul.rig.columns-4 li {
61 | width: 22.5%; /* this value + 2.5 should = 25% */
62 | }
63 |
64 | @media (max-width: 480px) {
65 | ul.grid-nav li {
66 | display: block;
67 | margin: 0 0 5px;
68 | }
69 | ul.grid-nav li a {
70 | display: block;
71 | }
72 | ul.rig {
73 | margin-left: 0;
74 | }
75 | ul.rig li {
76 | width: 100% !important; /* over-ride all li styles */
77 | margin: 0 0 20px;
78 | }
79 | }
--------------------------------------------------------------------------------
/client/profile/profile.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{#if currentUser}}
5 |
6 | {{#if showInputProfile}}
7 |
14 |
21 |
28 |
29 |
30 | Images Section
31 | {{#each showImagesUploadByUser}}
32 | {{#unless this.isUploaded}}
33 | {{> FS.UploadProgressBar bootstrap=true}}
34 | {{/unless}}
35 | {{> image}}
36 | {{/each}}
37 |
38 |
PDFS Section
39 | {{#each showPDFUploadByUser}}
40 | {{#unless this.isUploaded}}
41 | {{> FS.UploadProgressBar bootstrap=true}}
42 | {{/unless}}
43 | {{#if isImage}}
44 | {{> image}}
45 | {{else}}
46 | {{> pdfTemplate}}
47 | {{/if}}
48 | {{/each}}
49 | {{else}}
50 |
51 |
52 |
You should update an image to start.
53 |
54 |
55 |
56 |
57 | {{/if}}
58 | {{else}}
59 |
This Template its only Accessible when you already have an account
60 | {{/if}}
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/client/profile/profile.js:
--------------------------------------------------------------------------------
1 | //*******************************************************************************************************
2 | //*******************************************************************************************************
3 | //Profile Events Declarations Go here
4 | Template.profile.events({
5 | 'change #imageInput': FS.EventHandlers.insertFiles(PngPicture, {
6 | metadata: function (fileObj) {
7 | return {
8 | owner: Meteor.userId()
9 | };
10 | },
11 | after: function (error, fileObj) {
12 | console.log("Congratulations You just upload a new image =D", fileObj.name);
13 | }
14 | }),
15 | 'change #profileImage':function(){
16 | var file = $('#profileImage').get(0).files[0],
17 | fsFile = new FS.File(file);
18 | fsFile.metadata = {
19 | ownerId:Meteor.userId(),
20 | }
21 | ProfilePicture.insert(fsFile,function(err,result){
22 | if(!err){
23 | console.log("Congratulations You just upload a new image =D")
24 | }
25 | })
26 | },
27 | 'change #inputPdf':function(){
28 | var file = $('#inputPdf').get(0).files[0],
29 | fsFile = new FS.File(file);
30 | fsFile.metadata = {
31 | ownerId:Meteor.userId(),
32 | }
33 | PdfFile.insert(fsFile,function(err,result){
34 | if(!err){
35 | console.log("Congratulations You just upload a new PDF File =D")
36 | }
37 | })
38 | },
39 | 'change #inputPng':function(){
40 | var file = $('#inputPng').get(0).files[0],
41 | fsFile = new FS.File(file);
42 | fsFile.metadata = {
43 | ownerId:Meteor.userId(),
44 | }
45 | PngPicture.insert(fsFile,function(err,result){
46 | if(!err){
47 | console.log("Congratulations You just upload a new image File =D")
48 | }
49 | })
50 | },
51 | 'click #deleteImageUser':function(){
52 | var message = confirm('Are you sure you want to delete this file?');
53 | if(message === true){
54 | PngPicture.remove({_id:this._id})
55 | } else {
56 | console.log("Seems like you dont want to delete any file");
57 | }
58 | },
59 | 'click #deletePdfUser':function(){
60 | var message = confirm('Are you sure you want to delete this file?');
61 | if(message=== true){
62 | PdfFile.remove({_id:this._id})
63 | } else {
64 | console.log("Seems like you dont want to delete any file.");
65 | }
66 | },
67 | 'click #showModalUpload':function(){
68 | Modal.show('uploadFile')
69 | },
70 | 'click #showModalFilter':function(){
71 | Modal.show('filterFile')
72 | },
73 | 'click #showModalDownload':function(){
74 | Modal.show('downloadFile')
75 | },
76 | 'click #showModalProgress':function(){
77 | Modal.show('progressFile')
78 | },
79 | 'click #showModalUploadCfs':function(){
80 | Modal.show('eventFile')
81 | }
82 | })
83 | //*******************************************************************************************************
84 | //*******************************************************************************************************
85 | //Profile Helpers Declarations go Here.
86 |
87 | //here if there is already a file with the users name,
88 | //the input to upload photo gets hide and we show another
89 | Template.profile.helpers({
90 | profilePicture:function(){
91 | return ProfilePicture.find({'metadata.ownerId':Meteor.userId()});
92 | },
93 | showInputProfile:function(){
94 | var finde = ProfilePicture.find({'metadata.ownerId':Meteor.userId()}).count()
95 | if(finde >= 1){
96 | return true;
97 | }else{
98 | return false;
99 | }
100 | },
101 | showImagesUploadByUser:function(){
102 | return PngPicture.find({'metadata.ownerId':Meteor.userId()});
103 | },
104 | showPDFUploadByUser:function(){
105 | return PdfFile.find({'metadata.ownerId':Meteor.userId()});
106 | }
107 | });
108 | //*******************************************************************************************************
109 | //*******************************************************************************************************
110 |
111 | //Rendered Function to show/hide footer
112 | Template.profie.onRendered(function(){
113 | $(window).scroll(function() {
114 | if ($(this).scrollTop()) {
115 | $("#footer").hide();
116 | }else{
117 | $("#footer").show();
118 | }
119 | });
120 | })
121 |
--------------------------------------------------------------------------------
/client/profile/video.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Your browser does not support the video tag.
5 |
6 |
--------------------------------------------------------------------------------
/lib/collection.js:
--------------------------------------------------------------------------------
1 | //Global Storage Variable
2 | imageStore = new FS.Store.GridFS("imageStore");
3 |
4 | pdfStore = new FS.Store.GridFS("pdf");
5 |
6 | //FSCollection Declatarion
7 | //All FsCollections go here
8 | PdfFile = new FS.Collection("PdfFile", {
9 | stores: [pdfStore],
10 | filter: {
11 | maxSize: 2097152, //in bytes
12 | allow: {
13 | contentTypes: ['application/pdf'],
14 | extensions: ['pdf']
15 | },
16 | onInvalid: function (message) {
17 | if(Meteor.isClient){
18 | alert(message);
19 | } else{
20 | console.warn(message);
21 | }
22 | }
23 | }
24 | });
25 | ProfilePicture = new FS.Collection("ProfilePicture", {
26 | stores: [imageStore],
27 | filter: {
28 | maxSize: 2097152, //in bytes
29 | allow: {
30 | contentTypes: ['image/*'],
31 | extensions: ['png']
32 | },
33 | onInvalid: function (message) {
34 | if(Meteor.isClient){
35 | alert(message);
36 | } else{
37 | console.warn(message);
38 | }
39 | }
40 | }
41 | });
42 |
43 | PngPicture = new FS.Collection("PngPicture", {
44 | stores: [new FS.Store.GridFS("PngPicture")]
45 | });
46 |
47 | //Subscire Methods goes here
48 | if(Meteor.isClient) {
49 | Meteor.subscribe('PdfFile');
50 | Meteor.subscribe('ProfilePicture');
51 | Meteor.subscribe('PngPicture');
52 | }
--------------------------------------------------------------------------------
/lib/drakula.css:
--------------------------------------------------------------------------------
1 |
2 | /* Tomorrow Night Eighties Theme */
3 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */
4 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
5 | /* Edited by Ayman Farhat(http://aymanfarhat.com) for supporting inline code tags without pre */
6 | .tomorrow-comment, code .comment, code .title {
7 | color: #999999;
8 | }
9 |
10 | .tomorrow-red, code .variable, code .attribute, code .tag, code .regexp, code .ruby .constant, code .xml .tag .title, code .xml .pi, code .xml .doctype, code .html .doctype, code .css .id, code .css .class, code .css .pseudo {
11 | color: #f2777a;
12 | }
13 |
14 | .tomorrow-orange, code .number, code .codeprocessor, code .built_in, code .literal, code .params, code .constant {
15 | color: #f99157;
16 | }
17 |
18 | .tomorrow-yellow, code .ruby .class .title, code .css .rules .attribute {
19 | color: #ffcc66;
20 | }
21 |
22 | .tomorrow-green, code .string, code .value, code .inheritance, code .header, code .ruby .symbol, code .xml .cdata {
23 | color: #99cc99;
24 | }
25 |
26 | .tomorrow-aqua, code .css .hexcolor {
27 | color: #66cccc;
28 | }
29 |
30 | .tomorrow-blue, code .function, code .python .decorator, code .python .title, code .ruby .function .title, code .ruby .title .keyword, code .perl .sub, code .javascript .title, code .coffeescript .title {
31 | color: #6699cc;
32 | }
33 |
34 | .tomorrow-purple, code .keyword, code .javascript .function {
35 | color: #cc99cc;
36 | }
37 |
38 | pre code {
39 | display: block;
40 | padding: 0.5em;
41 | }
42 |
43 | code {
44 | background: #2B2B2B;
45 | color: #7f7f7f;
46 | padding: 0.3em;
47 | }
48 |
49 | code.coffeescript .javascript,
50 | code.javascript .xml,
51 | code.tex .formula,
52 | code.xml .javascript,
53 | code.xml .vbscript,
54 | code.xml .css,
55 | code.xml .cdata {
56 | opacity: 0.5;
57 | }
58 |
59 |
60 |
61 |
62 | .hljs {
63 | display: block;
64 | overflow-x: auto;
65 | padding: 0.5em;
66 | background: #2b2b2b;
67 | -webkit-text-size-adjust: none;
68 | }
69 |
70 | .hljs,
71 | .hljs-tag,
72 | .hljs-title,
73 | .css .hljs-rules,
74 | .css .hljs-value,
75 | .aspectj .hljs-function,
76 | .css .hljs-function .hljs-preprocessor,
77 | .hljs-pragma {
78 | color: #bababa;
79 | }
80 |
81 | .hljs-strongemphasis,
82 | .hljs-strong,
83 | .hljs-emphasis {
84 | color: #a8a8a2;
85 | }
86 |
87 | .hljs-bullet,
88 | .hljs-blockquote,
89 | .hljs-horizontal_rule,
90 | .hljs-number,
91 | .hljs-regexp,
92 | .alias .hljs-keyword,
93 | .hljs-literal,
94 | .hljs-hexcolor {
95 | color: #6896ba;
96 | }
97 |
98 | .hljs-tag .hljs-value,
99 | .hljs-code,
100 | .css .hljs-class,
101 | .hljs-class .hljs-title:last-child {
102 | color: #a6e22e;
103 | }
104 |
105 | .hljs-link_url {
106 | font-size: 80%;
107 | }
108 |
109 | .hljs-emphasis,
110 | .hljs-strongemphasis,
111 | .hljs-class .hljs-title:last-child,
112 | .hljs-typename {
113 | font-style: italic;
114 | }
115 |
116 | .hljs-keyword,
117 | .ruby .hljs-class .hljs-keyword:first-child,
118 | .ruby .hljs-function .hljs-keyword,
119 | .hljs-function,
120 | .hljs-change,
121 | .hljs-winutils,
122 | .hljs-flow,
123 | .nginx .hljs-title,
124 | .tex .hljs-special,
125 | .hljs-header,
126 | .hljs-attribute,
127 | .hljs-symbol,
128 | .hljs-symbol .hljs-string,
129 | .hljs-tag .hljs-title,
130 | .hljs-value,
131 | .alias .hljs-keyword:first-child,
132 | .css .hljs-tag,
133 | .css .unit,
134 | .css .hljs-important {
135 | color: #cb7832;
136 | }
137 |
138 | .hljs-function .hljs-keyword,
139 | .hljs-class .hljs-keyword:first-child,
140 | .hljs-aspect .hljs-keyword:first-child,
141 | .hljs-constant,
142 | .hljs-typename,
143 | .css .hljs-attribute {
144 | color: #cb7832;
145 | }
146 |
147 | .hljs-variable,
148 | .hljs-params,
149 | .hljs-class .hljs-title,
150 | .hljs-aspect .hljs-title {
151 | color: #b9b9b9;
152 | }
153 |
154 | .hljs-string,
155 | .css .hljs-id,
156 | .hljs-subst,
157 | .hljs-type,
158 | .ruby .hljs-class .hljs-parent,
159 | .hljs-built_in,
160 | .django .hljs-template_tag,
161 | .django .hljs-variable,
162 | .smalltalk .hljs-class,
163 | .django .hljs-filter .hljs-argument,
164 | .smalltalk .hljs-localvars,
165 | .smalltalk .hljs-array,
166 | .hljs-attr_selector,
167 | .hljs-pseudo,
168 | .hljs-addition,
169 | .hljs-stream,
170 | .hljs-envvar,
171 | .apache .hljs-tag,
172 | .apache .hljs-cbracket,
173 | .tex .hljs-command,
174 | .hljs-prompt,
175 | .hljs-link_label,
176 | .hljs-link_url {
177 | color: #e0c46c;
178 | }
179 |
180 | .hljs-comment,
181 | .hljs-javadoc,
182 | .hljs-annotation,
183 | .hljs-pi,
184 | .hljs-doctype,
185 | .hljs-deletion,
186 | .hljs-shebang,
187 | .apache .hljs-sqbracket,
188 | .tex .hljs-formula {
189 | color: #7f7f7f;
190 | }
191 |
192 | .hljs-decorator {
193 | color: #bab429;
194 | }
195 |
196 | .coffeescript .javascript,
197 | .javascript .xml,
198 | .tex .hljs-formula,
199 | .xml .javascript,
200 | .xml .vbscript,
201 | .xml .css,
202 | .xml .hljs-cdata,
203 | .xml .php,
204 | .php .xml {
205 | opacity: 0.5;
206 | }
--------------------------------------------------------------------------------
/lib/routes.js:
--------------------------------------------------------------------------------
1 | Router.configure({
2 | layoutTemplate:'layout',
3 | loadingTemplate: 'loading',
4 | })
5 |
6 | Router.route('/', function () {
7 | this.render('home')
8 | });
9 |
10 | Router.route('/profile', function () {
11 | this.render('profile')
12 | });
13 |
14 |
--------------------------------------------------------------------------------
/server/common.js:
--------------------------------------------------------------------------------
1 | //Allow/Deny methods
2 | ProfilePicture.allow({
3 | insert:function(){
4 | return true;
5 | },
6 | download:function(){return true;},
7 | remove:function(){return true;},
8 | update:function(){return true;},
9 |
10 | })
11 |
12 | PngPicture.allow({
13 | insert:function(){
14 | return true;
15 | },
16 | download:function(){return true;},
17 | remove:function(){return true;},
18 | update:function(){return true;},
19 |
20 | })
21 |
22 | PdfFile.allow({
23 | insert:function(){
24 | return true;
25 | },
26 | download:function(){return true;},
27 | remove:function(){return true;},
28 | update:function(){return true;},
29 |
30 | })
31 |
32 | //Publish methods
33 | Meteor.publish('ProfilePicture',function(){
34 | return ProfilePicture.find();
35 | })
36 |
37 | Meteor.publish('PngPicture',function(){
38 | return PngPicture.find();
39 | })
40 |
41 | Meteor.publish('PdfFile',function(){
42 | return PdfFile.find();
43 | })
44 |
45 |
--------------------------------------------------------------------------------