-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cloud Code setup for view counting and initial work on gallery sortin…
…g per #64
- Loading branch information
1 parent
99bc483
commit d2e3ee3
Showing
8 changed files
with
153 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
_site | ||
_cloudcode/config/global.json | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
// Use Parse.Cloud.define to define as many cloud functions as you want. | ||
// For example: | ||
Parse.Cloud.define("hello", function(request, response) { | ||
response.success("Hello world!"); | ||
}); | ||
|
||
Parse.Cloud.define("incrementViewCount", function(request, response) { | ||
Parse.Cloud.useMasterKey(); | ||
|
||
var Gallery = Parse.Object.extend("Gallery"); | ||
var gallery = new Gallery(); | ||
|
||
gallery.id = request.params.id; | ||
|
||
gallery.increment("viewCount", 1); | ||
gallery.save(null, { | ||
success: function(item) { | ||
response.success(true); | ||
}, | ||
error: function(item, error) { | ||
response.error("Could not increment view count."); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
<html> | ||
<head> | ||
<title>My ParseApp site</title> | ||
<style> | ||
body { font-family: Helvetica, Arial, sans-serif; } | ||
div { width: 800px; height: 400px; margin: 40px auto; padding: 20px; border: 2px solid #5298fc; } | ||
h1 { font-size: 30px; margin: 0; } | ||
p { margin: 40px 0; } | ||
em { font-family: monospace; } | ||
a { color: #5298fc; text-decoration: none; } | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<h1>Congratulations! You're already hosting with Parse.</h1> | ||
<p>To get started, edit this file at <em>public/index.html</em> and start adding static content.</p> | ||
<p>If you want something a bit more dynamic, delete this file and check out <a href="https://parse.com/docs/hosting_guide#webapp">our hosting docs</a>.</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters