-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More general update work for bootstrap implementation.
Added several plugins that are generally needed. Created new layout for sessions controller. Re-styled the signup form. Added several default configs for form helpers to work with bootstrap.
- Loading branch information
Russ Johnson
committed
May 3, 2012
1 parent
045b4c7
commit 7c02692
Showing
16 changed files
with
412 additions
and
77 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
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,42 @@ | ||
<!--- | ||
|----------------------------------------------------------------------------------------------| | ||
| Parameter | Required | Type | Default | Description | | ||
|----------------------------------------------------------------------------------------------| | ||
| name | Yes | string | | table name, in pluralized form | | ||
| force | No | boolean | false | drop existing table of same name before creating | | ||
| id | No | boolean | true | if false, defines a table with no primary key | | ||
| primaryKey | No | string | id | overrides default primary key name | ||
|----------------------------------------------------------------------------------------------| | ||
EXAMPLE: | ||
t = createTable(name='employees',force=false,id=true,primaryKey='empId'); | ||
t.string(columnNames='name', default='', null=true, limit='255'); | ||
t.text(columnNames='bio', default='', null=true); | ||
t.time(columnNames='lunchStarts', default='', null=true); | ||
t.datetime(columnNames='employmentStarted', default='', null=true); | ||
t.integer(columnNames='age', default='', null=true, limit='1'); | ||
t.decimal(columnNames='hourlyWage', default='', null=true, precision='1', scale='2'); | ||
t.date(columnNames='dateOfBirth', default='', null=true); | ||
---> | ||
<cfcomponent extends="plugins.dbmigrate.Migration" hint="create users table"> | ||
<cffunction name="up"> | ||
<cfscript> | ||
t = createTable(name='users'); | ||
t.string(columnNames='username', limit='30'); | ||
t.string(columnNames='password', limit='50'); | ||
t.string(columnNames='email', limit='100'); | ||
t.string(columnNames='firstName', limit='50'); | ||
t.string(columnNames='lastName', limit='50'); | ||
t.boolean(columnNames='admin', default=false); | ||
t.string(columnNames='activationCode'); | ||
t.datetime(columnNames='activatedAt'); | ||
t.timestamps(); | ||
t.create(); | ||
</cfscript> | ||
</cffunction> | ||
<cffunction name="down"> | ||
<cfscript> | ||
dropTable('tableName'); | ||
</cfscript> | ||
</cffunction> | ||
</cfcomponent> |
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,15 @@ | ||
|
||
CREATE TABLE `users` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
`username` VARCHAR(30), | ||
`password` VARCHAR(50), | ||
`email` VARCHAR(100), | ||
`firstName` VARCHAR(50), | ||
`lastName` VARCHAR(50), | ||
`admin` TINYINT(1) DEFAULT 0, | ||
`activationCode` VARCHAR(255), | ||
`activatedAt` DATETIME, | ||
`createdat` DATETIME, | ||
`updatedat` DATETIME, | ||
`deletedat` DATETIME | ||
); |
Binary file not shown.
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 @@ | ||
# Required Fields | ||
|
||
## What is it? | ||
|
||
Use this plugin to append a marked up asterisk to the labels of required fields. | ||
It determines this by looking at validations set on the object form helpers' properties to determine whether or not validatesPresenceOf() is set (manually or automatically). | ||
|
||
## The Latest Version | ||
|
||
The latest version of this script can always be found at the | ||
Github project page which is located at | ||
https://github.com/liquifusion/cfwheels-required-fields | ||
|
||
## Documentation | ||
|
||
Documentation on how to use this plug-in can be found at | ||
http://cfwheels.org/plugins/listing/63 | ||
|
||
## Installation | ||
|
||
Copy this ZIP file into your CFWheels /plugins folder and then reload your application. | ||
|
||
## License | ||
|
||
None specified |
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,20 @@ | ||
<cfcomponent output="false"> | ||
|
||
<cfset $initRequiredFields()> | ||
|
||
<cffunction name="init"> | ||
<cfset this.version = "1.1.2,1.1.4,1.1.5"> | ||
<cfreturn this> | ||
</cffunction> | ||
|
||
<cfinclude template="model/validations.cfm"> | ||
<cfinclude template="view/forms.cfm"> | ||
<cfinclude template="view/miscellaneous.cfm"> | ||
|
||
<cffunction name="$initRequiredFields" mixin="controller" hint="Initializes application variables used to generate the required field indicator."> | ||
<cfparam name="application.requiredFields.containerElement" type="string" default="span"> | ||
<cfparam name="application.requiredFields.containerClass" type="string" default="required"> | ||
<cfparam name="application.requiredFields.indicatorText" type="string" default="*"> | ||
</cffunction> | ||
|
||
</cfcomponent> |
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,106 @@ | ||
<cfsetting enablecfoutputonly="true"> | ||
|
||
<cfset requiredFieldsMeta = {}> | ||
<cfset requiredFieldsMeta.version = "0.5"> | ||
|
||
<cfinclude template="stylesheets/style.cfm"> | ||
|
||
<cfoutput> | ||
|
||
<h1>Required Fields v#requiredFieldsMeta.version#</h1> | ||
<p> | ||
Use this plugin to append a marked up asterisk to the labels of required fields. | ||
</p> | ||
<p> | ||
By default the added markup looks like this: | ||
</p> | ||
<pre> | ||
<span class="required">*</span> | ||
</pre> | ||
|
||
<h2>Usage/Examples</h2> | ||
<p> | ||
The plugin will look at validations set on the object form helpers' properties to determine whether or | ||
not <tt><a href="http://cfwheels.org/docs/function/validatespresenceof">validatesPresenceOf()</a></tt> | ||
is set (<a href="http://cfwheels.org/docs/1-1/chapter/object-validation">manually or automatically</a>). | ||
</p> | ||
<p> | ||
You can override this by behavior when calling the form helper as well. Just set the <tt>required</tt> | ||
argument to <tt>true</tt> or <tt>false</tt> in the call to the form helper: | ||
</p> | ||
<pre> | ||
<!--- Force `name` field to required ---> | ||
##textField(objectName="category", property="name", required=true)## | ||
|
||
<!--- Force `slug` field to optional ---> | ||
##textField(objectName="category", property="slug", required=false)## | ||
</pre> | ||
|
||
<p> | ||
You can also use this plugin with the form tag functions by manually adding the <tt>required</tt> | ||
argument. | ||
</p> | ||
<pre> | ||
<--- The "Tag" form helpers always need the `required` argument ---> | ||
##textFieldTag(name="Search", value=params.search, required=true)## | ||
</pre> | ||
|
||
<h2>Configuration</h2> | ||
<p> | ||
You can modify some minor details of the required field indicator that appears. (By default, it is an | ||
asterisk.) | ||
</p> | ||
<p> | ||
Just set the following variables in <tt>config/settings.cfm</tt> or <tt>events/onapplicationstart.cfm</tt> | ||
to override. | ||
</p> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Setting</th> | ||
<th>Type</th> | ||
<th>Default</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><tt>application.requiredFields.containerElement</tt></td> | ||
<td><tt>string</tt></td> | ||
<td><tt>span</tt></td> | ||
<td>Container element around required field indicator.</td> | ||
</tr> | ||
<tr class="highlight"> | ||
<td><tt>application.requiredFields.containerClass</tt></td> | ||
<td><tt>string</tt></td> | ||
<td><tt>required</tt></td> | ||
<td>Class set on container element around required field indicator.</td> | ||
</tr> | ||
<tr> | ||
<td><tt>application.requiredFields.indicatorText</tt></td> | ||
<td><tt>string</tt></td> | ||
<td><tt>*</tt></td> | ||
<td>Required field indicator.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<h2>Uninstallation</h2> | ||
<p>To uninstall this plugin, simply delete the <tt>/plugins/RequiredFields-#requiredFieldsMeta.version#.zip</tt> file.</p> | ||
|
||
<h2>Credits</h2> | ||
<p> | ||
This plugin was created by <a href="http://www.clearcrystalmedia.com/pm/">Chris Peters</a> with support from | ||
<a href="http://www.liquifusion.com/">Liquifusion Studios</a>. Thanks to | ||
<a href="http://www.iamjamesgibson.com/">James Gibson</a> for technical advice and | ||
<a href="http://talltroym.posterous.com/">Troy Murray</a> for assistance with Wheels compatibility testing. | ||
</p> | ||
<p> | ||
To submit an issue or fork this plugin, visit the | ||
<a href="http://github.com/liquifusion/cfwheels-required-fields">liquifusion/cfwheels-required-fields</a> | ||
repository on GitHub. | ||
</p> | ||
|
||
</cfoutput> | ||
|
||
<cfsetting enablecfoutputonly="false"> |
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,29 @@ | ||
<cffunction name="$validationExists" mixin="model" returntype="boolean" access="public" output="false" hint="Checks to see if a validation has been created for a property."> | ||
<cfargument name="property" type="string" required="true"> | ||
<cfargument name="validation" type="string" required="true"> | ||
<cfargument name="when" type="string" required="false" default=""> | ||
<cfscript> | ||
var loc = {}; | ||
loc.returnValue = false; | ||
for (loc.when in variables.wheels.class.validations) | ||
{ | ||
if (!Len(arguments.when) || ListFindNoCase(arguments.when, LCase(loc.when))) | ||
{ | ||
if (StructKeyExists(variables.wheels.class.validations, loc.when)) | ||
{ | ||
loc.eventArray = variables.wheels.class.validations[loc.when]; | ||
loc.iEnd = ArrayLen(loc.eventArray); | ||
for (loc.i = 1; loc.i lte loc.iEnd; loc.i++) | ||
{ | ||
if (StructKeyExists(loc.eventArray[loc.i].args, "property") && loc.eventArray[loc.i].args.property == arguments.property and loc.eventArray[loc.i].method == "$#arguments.validation#") | ||
{ | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
</cfscript> | ||
<cfreturn false /> | ||
</cffunction> |
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,26 @@ | ||
<style type="text/css"> | ||
table { | ||
border: 1px solid #ccc; | ||
margin-bottom: 20px; | ||
} | ||
table caption { | ||
font-weight: bold; | ||
text-align: left; | ||
} | ||
table thead tr th, | ||
table tbody tr td { | ||
padding: 3px; | ||
} | ||
table thead tr th { | ||
border-bottom: 1px solid #ccc; | ||
} | ||
table tbody tr.highlight { | ||
background: #eee; | ||
} | ||
</style> |
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,57 @@ | ||
<cffunction name="$getFieldLabel" mixin="controller" returntype="string" access="public" output="false"> | ||
<cfargument name="objectName" type="any" required="true"> | ||
<cfargument name="property" type="string" required="true"> | ||
<cfargument name="label" type="string" required="true"> | ||
<cfscript> | ||
var loc = {}; | ||
loc.coreGetFieldLabel = core.$getFieldLabel; | ||
loc.label = loc.coreGetFieldLabel(argumentCollection=arguments); | ||
if (IsSimpleValue(arguments.objectName)) | ||
{ | ||
loc.object = Evaluate(arguments.objectName); | ||
if (loc.object.isNew()) | ||
{ | ||
loc.when = "onCreate,onSave"; | ||
} | ||
else { | ||
loc.when = "onUpdate,onSave"; | ||
} | ||
if (( IsObject(loc.object) && Len(loc.label) && loc.object.$validationExists(arguments.property, "validatesPresenceOf") | ||
&& ( !StructKeyExists(arguments, "required") || (StructKeyExists(arguments, "required") && arguments.required) ) ) | ||
|| ( StructKeyExists(arguments, "required") && arguments.required )) | ||
{ | ||
loc.label = $appendRequiredFieldIndicator(loc.label); | ||
} | ||
} | ||
else if (StructKeyExists(arguments, "required") && arguments.required) | ||
{ | ||
loc.label = $appendRequiredFieldIndicator(loc.label); | ||
} | ||
</cfscript> | ||
<cfreturn loc.label> | ||
</cffunction> | ||
|
||
<cffunction name="$appendRequiredFieldIndicator" mixin="controller" returntype="string" hint="Adds return value to label and returns it."> | ||
<cfargument name="label" type="string" required="true" hint="Label to modify."> | ||
<cfscript> | ||
var loc = { label=arguments.label }; | ||
loc.label &= " "; | ||
if(Len(application.requiredFields.containerElement)) { | ||
loc.label &= '<#application.requiredFields.containerElement#'; | ||
if(Len(application.requiredFields.containerClass)) { | ||
loc.label &= ' class="#application.requiredFields.containerClass#"'; | ||
} | ||
loc.label &= '>'; | ||
} | ||
loc.label &= application.requiredFields.indicatorText; | ||
if (Len(application.requiredFields.containerElement)) | ||
{ | ||
loc.label &= '</#application.requiredFields.containerElement#>'; | ||
} | ||
</cfscript> | ||
<cfreturn loc.label> | ||
</cffunction> |
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,10 @@ | ||
<cffunction name="$tag" returntype="string" access="public" output="false" hint="Creates a HTML tag with attributes."> | ||
<cfscript> | ||
var loc = { coreTag=core.$tag }; | ||
loc.myTag = loc.coreTag(argumentCollection=arguments); | ||
loc.myTag = Replace(loc.myTag, ' required="true"', ""); | ||
loc.myTag = Replace(loc.myTag, ' required="false"', ""); | ||
return loc.myTag; | ||
</cfscript> | ||
</cffunction> |
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,3 @@ | ||
.required { | ||
color: red; | ||
} |
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,4 +1,3 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
|
Oops, something went wrong.