Add automatic $.material.init() + example

This commit is contained in:
Dan Dascalescu 2014-12-16 03:11:05 -08:00
parent e07961e23d
commit b6bd06c68e
14 changed files with 73 additions and 4 deletions

View File

@ -47,9 +47,10 @@ If you encounter an issue while using this package, please CC @dandv when you fi
# DONE
* Automatically initialize the JS on client startup: `$.material.init()`
* Material Design Icons font loading test: EOT, SVG, TTF, WOFF
* Bootstrap plugin loading tests
* Visual check , inclding for the ripple effect
* Visual check, including for the ripple effect
# TODO

1
meteor/example/.meteor/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
local

View File

@ -0,0 +1,7 @@
# Meteor packages used by this project, one per line.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-platform
fezvrasta:bootstrap-material-design-noglyph

View File

@ -0,0 +1 @@
METEOR@1.0.1

View File

@ -0,0 +1,3 @@
body {
background: #8BC34A;
}

View File

@ -0,0 +1,14 @@
<body>
<h1>Watch the ripple effect on newly created buttons!</h1>
{{> hello}}
</body>
<template name="hello">
<button type="button" class="btn btn-info">Click Me</button>
<hr/>
{{#each buttons}}
<button type="button" class="btn btn-primary">{{name}}</button>
<br/>
{{/each}}
</template>

View File

@ -0,0 +1,15 @@
'use strict';
var Buttons = new Mongo.Collection(null);
Template.hello.helpers({
buttons: function () {
return Buttons.find();
}
});
Template.hello.events({
'click button': function (event, template) {
Buttons.insert({name: _.sample(['No, click ME!', 'Click me too!', 'Click here!', 'Hey!', 'Psst!'])});
}
});

View File

@ -0,0 +1 @@
../../../

5
meteor/example/run.bat Executable file
View File

@ -0,0 +1,5 @@
mklink ..\..\package.js "meteor/package-noglyph.js"
mklink package.json "../../package.json"
set MONGO_URL=mongodb://
meteor run
del ..\..\package.js package.json

15
meteor/example/run.sh Executable file
View File

@ -0,0 +1,15 @@
# sanity check: make sure we're in the root directory of the example
cd "$( dirname "$0" )"
# delete temp files even if Ctrl+C is pressed
int_trap() {
echo "Cleaning up..."
}
trap int_trap INT
ln -s "meteor/package-noglyph.js" ../../package.js
ln -s "../../package.json" package.json
MONGO_URL=mongodb:// meteor run
rm ../../package.js package.json

3
meteor/init.js Normal file
View File

@ -0,0 +1,3 @@
Meteor.startup(function () {
$.material.init();
});

View File

@ -26,7 +26,8 @@ Package.onUse(function (api) {
'dist/css/material-wfont.css', // includes @font-face rules to load the Roboto font
'dist/css/ripples.css',
'dist/js/material.js',
'dist/js/ripples.js'
'dist/js/ripples.js',
'meteor/init.js'
], where);
});

View File

@ -21,7 +21,8 @@ Package.onUse(function (api) {
'dist/css/material-wfont.css', // includes @font-face rules to load the Roboto font
'dist/css/ripples.css',
'dist/js/material.js',
'dist/js/ripples.js'
'dist/js/ripples.js',
'meteor/init.js'
], where);
});

View File

@ -26,7 +26,8 @@ Package.onUse(function (api) {
'dist/css/material-wfont.css', // includes @font-face rules to load the Roboto font
'dist/css/ripples.css',
'dist/js/material.js',
'dist/js/ripples.js'
'dist/js/ripples.js',
'meteor/init.js'
], where);
});