forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
387f45c
commit 0a7a51d
Showing
6 changed files
with
122 additions
and
1 deletion.
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
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,48 @@ | ||
/* CSS declarations go here */ | ||
a.madewith_link { | ||
text-decoration: none; | ||
} | ||
|
||
.madewith_badge { | ||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
width: 300px; | ||
height: 129px; | ||
background-size: 300px 129px; | ||
text-shadow: 1px 1px black, 1px -1px black, -1px 1px black, -1px -1px black; | ||
border: 1px solid black; | ||
} | ||
|
||
.madewith_badge_inner { | ||
margin: 10px; | ||
height: 109px; | ||
background-color: rgba(0, 0, 0, 0.3); | ||
position: relative; | ||
} | ||
|
||
.madewith_text { | ||
position: absolute; | ||
top: 15px; | ||
width: 280px; | ||
text-align: center; | ||
color: white; | ||
font-weight: 700; | ||
font-size: 1.9em; | ||
} | ||
|
||
.madewith_votes { | ||
position: absolute; | ||
bottom: 15px; | ||
width: 280px; | ||
color: white; | ||
font-size: 1.5em; | ||
text-align: center; | ||
} | ||
|
||
.madewith_upvote { | ||
color: yellow; | ||
cursor: pointer; | ||
} | ||
|
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,17 @@ | ||
<body> | ||
{{> madewith}} | ||
</body> | ||
|
||
<template name="madewith"> | ||
<a class="madewith_link" href="http://madewith.meteor.com/{{shortname}}" target="_blank"> | ||
<div class="madewith_badge"> | ||
<div class="madewith_badge_inner"> | ||
<div class="madewith_text">Made with Meteor</div> | ||
<div class="madewith_votes"> | ||
<span class="madewith_upvote">▲</span> | ||
<span class="madewith_vote_count">{{vote_count}} points</span> | ||
</div> | ||
</div> | ||
</div> | ||
</a> | ||
</template> |
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,41 @@ | ||
(function () { | ||
// automatically capture this app's hostname | ||
var hostname = window.location.host; | ||
var match = hostname.match(/(.*)\.meteor.com$/); | ||
var shortname = match ? match[1] : hostname; | ||
|
||
// connect to madewith and subscribe to my app's record | ||
var server = Meteor.connect("http://localhost:3000/sockjs"); | ||
var sub = server.subscribe("my_app", hostname); | ||
|
||
// minimongo collection to hold my singleton app record. | ||
var apps = new Meteor.Collection('apps', server); | ||
|
||
server.methods({ | ||
vote: function (hostname) { | ||
apps.update({name: hostname}, {$inc: {vote_count: 1}}); | ||
} | ||
}); | ||
|
||
Template.madewith.vote_count = function() { | ||
var app = apps.findOne(); | ||
return app ? app.vote_count : ''; | ||
}; | ||
|
||
Template.madewith.shortname = function () { | ||
return shortname; | ||
}; | ||
|
||
Template.madewith.events = { | ||
'click .madewith_upvote': function(event) { | ||
var app = apps.findOne(); | ||
if (app) { | ||
server.call('vote', hostname); | ||
// stop these so you don't click through the link to go to the | ||
// app. | ||
event.stopPropagation(); | ||
event.preventDefault(); | ||
} | ||
} | ||
}; | ||
})(); |
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
Package.describe({ | ||
summary: "Made With Meteor badge" | ||
}); | ||
|
||
Package.on_use(function (api) { | ||
api.use(['livedata', 'underscore', 'liveui', 'templating'], 'client'); | ||
|
||
api.add_files([ | ||
'madewith.css', | ||
'madewith_badge.css', | ||
'madewith.html', | ||
'madewith.js'], 'client'); | ||
}); |