Skip to content

Commit

Permalink
More css clean up. Added several migrations for tweaking user table. …
Browse files Browse the repository at this point in the history
…Resized password field and added several indexes
  • Loading branch information
Russ Johnson committed Jul 10, 2012
1 parent b72eb8e commit a546dcd
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .htaccess
Expand Up @@ -5,7 +5,7 @@

# UNCOMMENT ALL LINES BELOW THIS ONE TO TURN ON THE URL REWRITING RULES

# Options +FollowSymLinks
# RewriteEngine On
# RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|sitemap.xml|rewrite.cfm)($|/.*$) [NC]
# RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|sitemap.xml|rewrite.cfm)($|/.*$) [NC]
RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]
9 changes: 2 additions & 7 deletions config/settings.cfm
Expand Up @@ -5,18 +5,13 @@
<cfset set(dataSourcePassword="")>
--->

<!---
If you leave this setting commented out, Wheels will try to determine the URL rewrite capabilities automatically.
The URLRewriting setting can bet set to "On", "Partial" or "Off".
To run with "Partial" rewriting, the "PATH_INFO" variable needs to be supported by the web server.
To run with rewriting "On", you need to apply the necessary rewrite rules on the web server first.
<cfset set(URLRewriting="Partial")>
--->
<cfscript>
set(URLRewriting="on");
// form defaults for bootstrap
set(functionName='textField', labelPlacement='before', prependToLabel='<div class="control-group">', labelClass='control-label', class='input-xlarge', prepend='<div class="controls">', append='</div></div>');
set(functionName='textFieldTag', labelPlacement='before', prependToLabel='<div class="control-group">', labelClass='control-label', class='input-xlarge', prepend='<div class="controls">', append='</div></div>');
set(functionName='passwordField', labelPlacement='before', prependToLabel='<div class="control-group">', labelClass='control-label', class='input-xlarge', prepend='<div class="controls">', append='</div></div>');
set(functionName='flash', prepend='<div class="alert"><button class="close" data-dismiss="alert">x</button>', append='</div>');
</cfscript>
31 changes: 31 additions & 0 deletions db/migrate/20120710180454_Resize_password_column.cfc
@@ -0,0 +1,31 @@
<!---
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Parameter | Required | Type | Default | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| table | Yes | string | | existing table name |
| columnName | Yes | string | | name for column to change |
| columnType | Yes | string | | new type for column |
| referenceName | No | string | | name for new reference column, see documentation for references function, required if columnType is 'reference' |
| default | No | string | | default value for column |
| null | No | boolean | | whether nulls are allowed |
| limit | No | number | | character or integer size limit for column |
| precision | No | number | | precision value for decimal columns, i.e. number of digits the column can hold |
| scale | No | number | | scale value for decimal columns, i.e. number of digits that can be placed to the right of the decimal point (must be less than or equal to precision) |
| addColumns | No | number | false | if true, attempts to add columns and database will likely throw an error if column already exists |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
EXAMPLE:
changeColumn(table='members',columnType='string',columnName='status',limit=50);
--->
<cfcomponent extends="plugins.dbmigrate.Migration" hint="Resize password column">
<cffunction name="up">
<cfscript>
changeColumn(table='users', columnType='string', columnName='password', limit=100);
</cfscript>
</cffunction>
<cffunction name="down">
<cfscript>
changeColumn(table='users',columnName='password', limit=50);
</cfscript>
</cffunction>
</cfcomponent>
27 changes: 27 additions & 0 deletions db/migrate/20120710180721_Add_indexes_to_users.cfc
@@ -0,0 +1,27 @@
<!---
|----------------------------------------------------------------------------------------------------------------------------|
| Parameter | Required | Type | Default | Description |
|----------------------------------------------------------------------------------------------------------------------------|
| table | Yes | string | | table name |
| columnNames | Yes | string | | one or more column names to index, comma separated |
| unique | No | boolean | false | if true will create a unique index constraint |
| indexName | No | string | | use for index name. Defaults to table name + underscore + first column name |
|----------------------------------------------------------------------------------------------------------------------------|
EXAMPLE:
addIndex(table='members',columnNames='username',unique=true);
--->
<cfcomponent extends="plugins.dbmigrate.Migration" hint="Add indexes to users">
<cffunction name="up">
<cfscript>
addIndex(table='users',columnNames='username',unique=true);
addIndex(table='users',columnNames='email',unique=true);
</cfscript>
</cffunction>
<cffunction name="down">
<cfscript>
removeIndex(table='users', indexName='users_username');
addIndex(table='users',columnNames='users_email',unique=true);
</cfscript>
</cffunction>
</cfcomponent>
2 changes: 2 additions & 0 deletions db/sql/20120710180454_Resize_password_column_up.sql
@@ -0,0 +1,2 @@

ALTER TABLE `users` CHANGE `password` `password` VARCHAR(100);
2 changes: 2 additions & 0 deletions db/sql/20120710180721_Add_indexes_to_users_down.sql
@@ -0,0 +1,2 @@

DROP INDEX `users_username` ON `users`;
3 changes: 3 additions & 0 deletions db/sql/20120710180721_Add_indexes_to_users_up.sql
@@ -0,0 +1,3 @@

CREATE UNIQUE INDEX `users_username` ON `users`(`username`);
CREATE UNIQUE INDEX `users_email` ON `users`(`email`);
9 changes: 9 additions & 0 deletions stylesheets/custom.css
@@ -1,3 +1,12 @@
.required {
color: red;
}

ul.alert {
margin: 2px 0;
}

ul.alert li {
margin: 0;
list-style: none;
}
1 change: 0 additions & 1 deletion views/sessions/layout.cfm
Expand Up @@ -29,7 +29,6 @@
<div class="container">
<cfoutput>#includePartial('/shared/render_flash')#</cfoutput>

<!-- Main hero unit for a primary marketing message or call to action -->
<div>
<cfoutput>#contentForLayout()#</cfoutput>
</div>
Expand Down
24 changes: 9 additions & 15 deletions views/shared/_render_flash.cfm
@@ -1,17 +1,11 @@
<cfoutput>
<div class="flash">
<cfif flashKeyExists('error')>
<div class="message error">
<p>#flash('error')#</p>
</div>
<cfelseif flashKeyExists('success')>
<div class="message success">
<p>#flash('success')#</p>
</div>
<cfelseif flashKeyExists('warning')>
<div class="message warning">
<p>#flash('warning')#</p>
</div>
</cfif>
</div>
<cfif flashKeyExists('error')>
#flash('error')#
<cfelseif flashKeyExists('success')>
<p>#flash('success')#</p>
<cfelseif flashKeyExists('warning')>
<p>#flash('warning')#</p>
<cfelseif flashKeyExists('info')>
<p>#flash('info')#</p>
</cfif>
</cfoutput>
2 changes: 1 addition & 1 deletion views/users/new.cfm
@@ -1,7 +1,7 @@
<cfoutput>
<h2> Please complete the form to create your account</h2>
<div>
#errorMessagesFor("user")#
#errorMessagesFor('user', 'alert alert-error')#

#startFormTag(action="create", class="form-horizontal well")#

Expand Down

0 comments on commit a546dcd

Please sign in to comment.