merging with /development and fixing conflicts

This commit is contained in:
Sacha Greif 2013-02-04 12:06:07 +09:00
commit 0c98936902
9 changed files with 25 additions and 7151 deletions

View file

@ -12,4 +12,5 @@ router
moment
spiderable
email
profiler
profiler
database-forms

View file

@ -2,7 +2,7 @@
* In this file you should write your main styles. (or centralize your imports)
* Import this file using the following HTML or equivalent:
* <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */
/* line 17, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 17, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
@ -23,38 +23,38 @@ time, mark, audio, video {
font-size: 100%;
vertical-align: baseline; }
/* line 22, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 22, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
html {
line-height: 1; }
/* line 24, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 24, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
ol, ul {
list-style: none; }
/* line 26, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 26, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
table {
border-collapse: collapse;
border-spacing: 0; }
/* line 28, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 28, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
caption, th, td {
text-align: left;
font-weight: normal;
vertical-align: middle; }
/* line 30, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 30, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
q, blockquote {
quotes: none; }
/* line 103, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 103, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
q:before, q:after, blockquote:before, blockquote:after {
content: "";
content: none; }
/* line 32, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 32, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
a img {
border: none; }
/* line 116, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
/* line 116, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
display: block; }
@ -793,13 +793,13 @@ body.pageslide-open {
padding-left: 4px;
padding-right: 4px;
margin-right: 10px; }
/* line 48, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss */
/* line 48, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss */
.nav > li:first-child, .nav > li.first {
padding-left: 0; }
/* line 49, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss */
/* line 49, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss */
.nav > li:last-child {
padding-right: 0; }
/* line 50, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss */
/* line 50, ../../../../.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss */
.nav > li.last {
padding-right: 0; }
/* line 140, ../sass/modules/_header.scss */

View file

@ -1,63 +0,0 @@
/* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
*/
// Inspired by base2 and Prototype
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
this.Class = function(){};
// Create a new Class that inherits from this class
Class.extend = function(prop) {
var _super = this.prototype;
// Instantiate a base class (but only create the instance,
// don't run the init constructor)
initializing = true;
var prototype = new this();
initializing = false;
// Copy the properties over onto the new prototype
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
(function(name, fn){
return function() {
var tmp = this._super;
// Add a new ._super() method that is the same method
// but on the super-class
this._super = _super[name];
// The method only need to be bound temporarily, so we
// remove it when we're done executing
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name]) :
prop[name];
}
// The dummy class constructor
function Class() {
// All construction is actually done in the init method
if ( !initializing && this.init )
this.init.apply(this, arguments);
}
// Populate our constructed prototype object
Class.prototype = prototype;
// Enforce the constructor to be what we expect
Class.prototype.constructor = Class;
// And make this class extendable
Class.extend = arguments.callee;
return Class;
};
})();

View file

@ -1,26 +0,0 @@
// A class that generates a form on the current page based on a FromModel object (see form_model.js)
var DatabaseForm = Class.extend({
// Grab the form element from the DOM and add inputs to it based on the model object provided
generateFor: function (model, formSelector) {
this.model = model;
this.formOptions = model.formOptions;
$(formSelector).jsonForm({ schema: this.model.formSchema() });
},
// Read the values currently entered into the form and set them onto the model. Save the model to the database.
submit: function (createHandler, updateHandler) {
this.updateModelFromFormValues()
this.model.save(createHandler, updateHandler)
},
updateModelFromFormValues: function() {
for (field in this.model.schema) {
var regexExpression = ':regex(id, jsonform.*' + field + ')';
var htmlElement = $(regexExpression);
if (this.model.schema[field].constructor == Boolean) this.model.schema[field] = !!htmlElement.attr('checked');
else this.model.schema[field] = htmlElement.val();
}
}
});

View file

@ -1,124 +0,0 @@
// A utility class that we use in FormModel to set up a convention for the default labels for each form input field.
var StringUtils = {
/*
Assumes that the argument is a camel-case string.
It places spaces between each word and capitalizes the first letter. So, a string like "camelCase" becomes "Camel Case".
*/
humanize: function(string) {
return this.capitalize(this.convertCamelToSpaces(string));
},
capitalize: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
convertCamelToSpaces: function(string) {
return string.replace(/([A-Z])/g, function(match) {
return ' ' + match;
});
}
}
// A class that provides all the functionality required to generate a form from a database record.
var FormModel = Class.extend({
/*
Class constructor:
collection: The MongoDB collection the record will be saved to.
data: The record data if generating a form for an already-existing record. This argument is optional.
*/
init: function(collection, data) {
this.collection = collection;
/*
blankSchema is an object that each extending class must provide.
It contains all the fields to be saved to the database and their default values.
The schema field holds the data to be saved to the database.
*/
this.schema = this.blankSchema;
// jsonform options that would override the defaults
this.formOptions = {};
this.load(data)
},
// If data has been provided in the constructor, load it into the current object
load: function(data) {
if (data) {
this._id = data._id;
for (field in this.schema) {
if (data[field]) this.schema[field] = data[field];
}
}
},
// Generate a jsonform schema for this object based on the form options given and conventions
formSchema: function() {
var formSchema = {};
// Each field stored in the database is represented by a form input
for (var field in this.schema) {
formSchema[field] = {
// If type is already given in formOptions, use that, otherwise guess the input type by inspecting the field type
type: this.option(field, 'type') || this.schema[field].constructor.name.toLowerCase(),
// If the label text is already specified in formOptions, use that, otherwise use a humanized version of the field name (see StringUtils)
title: this.option(field, 'title') || StringUtils.humanize(field),
// Use the field name as an ID; jsonform will add a prefix to avoid name conflicts
id: field,
// Display the data in the input
default: this.schema[field]
}
// If an 'enum' option is provided in formOptions, turn the input into a select by adding the enum options to the jsonform schema
if(this.option(field, 'enum')) formSchema[field]['enum'] = this.option(field, 'enum');
}
return formSchema;
},
option: function(field, optionName) {
if (this.formOptions[field]) return this.formOptions[field][optionName];
return null;
},
// Overwrite the default label for a field by adding a 'title' entry to its form options
overwriteTitle: function(field, title) {
if (this.formOptions[field]) this.formOptions[field]['title'] = title;
else this.formOptions[field] = { 'title': title };
},
// Overwrite the default type for a field by adding a 'type' entry to its form options
overwriteType: function(field, type) {
if (this.formOptions[field]) this.formOptions[field]['type'] = type;
else this.formOptions[field] = { 'type': type };
},
// Make the input type of a string field be a select by editing formOptions appropriately
makeSelect: function(field, options) {
if (this.formOptions[field]) this.formOptions[field]['enum'] = options;
else this.formOptions[field] = { 'enum': options };
},
/*
If the record was originally loaded from the database, update it.
Otherwise, create a new record with the appropriate data.
createHandler, updateHandler: Functions to run after the database operations completes (such as displaying a message confirming things were saved properly).
These usually come from a DatabaseForm, which in turn gets them from a template helper.
*/
save: function(createHandler, updateHandler) {
if (this._id) {
this.collection.update(this._id, {$set: this.schema}, updateHandler);
} else {
this._id = this.collection.insert(this.schema, createHandler);
}
}
});

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,7 @@
"packages": {
"router": {},
"moment": {},
"profiler": {"git": "https://github.com/tmeasday/meteor-profiler.git"}
"profiler": {"git": "https://github.com/tmeasday/meteor-profiler.git"},
"database-forms": {}
}
}

View file

@ -11,7 +11,8 @@
"profiler": {
"git": "https://github.com/tmeasday/meteor-profiler.git",
"branch": "master"
}
},
"database-forms": {}
},
"packages": {
"router": {
@ -29,10 +30,15 @@
"branch": "master",
"commit": "25a14a4e94a4748745738031baab1400860eede7"
},
"database-forms": {
"git": "https://github.com/lyudmil/database-forms.git",
"tag": "v0.0.1",
"commit": "3e458c17f1c6e3499188be01182cdade92683357"
},
"page-js": {
"git": "https://github.com/tmeasday/meteor-page-js.git",
"tag": "v1.3.1",
"commit": "ee0b651869928abe50b5d06d7f32ccd2e657883a"
"tag": "v1.3.3",
"commit": "c1e9832af3fc2b2f5139a16d93a82ca6fa0655da"
},
"node-modules": {
"git": "https://github.com/possibilities/meteor-node-modules.git",