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
Showing
16 changed files
with
186 additions
and
23 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
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,6 @@ | ||
#!/usr/bin/env ruby | ||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. | ||
|
||
APP_PATH = File.expand_path('../../config/application', __FILE__) | ||
require File.expand_path('../../config/boot', __FILE__) | ||
require 'rails/commands' |
This file was deleted.
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,15 @@ | ||
<p> | ||
<a class="action" href="#" rel="first">first</a> | | ||
<a class="action" href="#" rel="prev">prev</a> | ||
|
||
(<span id="count2"></span> / <span id="total2"></span>) | ||
<a class="action" href="#" rel="next">next</a> | | ||
<a class="action" href="#" rel="last">last</a> | show : | ||
<select name="perpage"> | ||
<option value="1">1 per page</option> | ||
<option value="2">2 per page</option> | ||
<option value="5">5 per page</option> | ||
</select> | ||
</p> | ||
<%= javascript_include_tag 'paginate.js' %> | ||
|
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<h4> Welcome to Restaurant Finder ...... </h4> | ||
<p>Both me and my roommate eat out a lot and are usually very indecisive about where to eat this is meant to help with that problem by outputting a list in random order of the restaurants that meet certain criteria. Originally my plan was to write an algorithm that wighted choices based on things like when we last ate there, our tendency to select one restaurant over anther, etc... But i underestimated the amount of time working with a language in which i had no real experience in. To manage restaurant or categories visit their respective admin sections. For ease in data entry there is the ability to enter restaurants by MenuPages™ url. The categories to the left are dynamically generated from the database. Feel free to add, remove, change any data you need to. I did not write any functional test for rails as i am not there yet learning wise. Please use the css validation link below as i have used some css 3 and you need to pass css3 to the validator via url.</p> | ||
<p>My roommate and I eat out a lot and are fairly indecisive about where to eat. This program is designed to help with that problem by outputting a list, in random order, of the restaurants that meet certain criteria. Originally, my plan was to write an algorithm that weighted choices based on criteria like when we last ate there, our tendency to select one restaurant over another, and similar factors. Having said that, I underestimated the amount of time required when working with a new language. To manage restaurant choices or categories visit their respective admin sections. For ease with respect to data entry, I have allowed for the opportunity of entering restaurants by MenuPages™ URL. The categories to the left are dynamically generated from the database. Feel free to add, remove, or change any data that you need to. I did not write any functional test for rails, as I am not at that point in terms of my learning curve. Please use the css validation link below as I have used some css 3 and you need to pass css3 to the validator via URL.</p> |
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 +1,6 @@ | ||
<%= render :partial => "results", :collection => @results %> | ||
<% if @pagination %> | ||
<%= render :partial => "paginate" %> | ||
<% end %> | ||
<ul id="wrapper2" class="wrapper"> | ||
<%= render :partial => "results", :collection => @results %> | ||
</ul> |
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ en: | |
hello: "Hello world" | ||
time: | ||
formats: | ||
default: "%a, %d %b %Y %H:%M:%S" | ||
default: "%a, %d %b %Y %H:%M:%S" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
public/javascripts/active_scaffold/default/date_picker_bridge.js
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
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,114 @@ | ||
// JQuery event-driven pagination plugin | ||
// Written by Mark Perkins, mark@allmarkedup.com | ||
// License: http://unlicense.org/ (i.e. do what you want with it!) | ||
|
||
;(function($) { | ||
|
||
var defaults = { | ||
perPage : 5, // number of items per page | ||
startPage : 1, // page to begin on - NOT zero indexed | ||
atEnd : 'stop' // loop / stop | ||
}; | ||
|
||
$.fn.evtpaginate = function( options ) | ||
{ | ||
return this.each(function(){ | ||
|
||
var opts = $.extend(true, {}, defaults, options); // set options | ||
var wrap = opts.wrapper = $(this); | ||
|
||
wrap.bind( 'show.evtpaginate', function( e, pageNum ){ show( opts, pageNum-1 ); }); | ||
wrap.bind( 'next.evtpaginate', function(){ next( opts ); }); | ||
wrap.bind( 'prev.evtpaginate', function(){ prev( opts ); }); | ||
wrap.bind( 'first.evtpaginate', function(){ show( opts, 0 ); }); | ||
wrap.bind( 'last.evtpaginate', function(){ show( opts, opts.totalPages-1 ); }); | ||
wrap.bind( 'refresh.evtpaginate', function( e, newopts ){ refresh( opts, newopts ); }); | ||
|
||
setUp( opts ); | ||
}); | ||
}; | ||
|
||
function setUp( opts ) | ||
{ | ||
opts.perPage = parseInt(opts.perPage); | ||
opts.items = opts.wrapper.children(); | ||
opts.totalItems = opts.items.size(); | ||
opts.totalPages = Math.ceil( opts.totalItems / opts.perPage ); | ||
opts.currentPage = parseInt(opts.startPage) - 1; | ||
opts.first = isFirstPage( opts, opts.currentPage ); | ||
opts.last = isLastPage( opts, opts.currentPage ); | ||
opts.pages = []; | ||
|
||
if ( opts.currentPage > opts.totalPages-1 ) opts.currentPage = opts.totalPages-1; | ||
|
||
opts.items.hide(); | ||
|
||
for ( var i = 0; i < opts.totalPages; i++ ) | ||
{ | ||
var startItem = i*opts.perPage; | ||
opts.pages[i] = opts.items.slice( startItem, (startItem + opts.perPage) ); | ||
} | ||
|
||
show( opts, opts.currentPage ); | ||
|
||
opts.wrapper.trigger( 'initialized.evtpaginate', [opts.currentPage+1, opts.totalPages] ); | ||
} | ||
|
||
function refresh( opts, newopts ) | ||
{ | ||
if ( newopts !== undefined ) $.extend(true, opts, newopts); // update options | ||
opts.startPage = parseInt(opts.currentPage)+1; | ||
setUp( opts ); | ||
} | ||
|
||
function next( opts ) | ||
{ | ||
switch( opts.atEnd ) | ||
{ | ||
case 'loop': show( opts, (opts.last ? 0 : opts.currentPage + 1) ); break; | ||
default: show( opts, (opts.last ? opts.totalPages - 1 : opts.currentPage + 1) ); break; // stop when getting to last page | ||
} | ||
} | ||
|
||
function prev( opts ) | ||
{ | ||
switch( opts.atEnd ) | ||
{ | ||
case 'loop': show( opts, (opts.first ? opts.totalPages - 1 : opts.currentPage - 1) ); break; | ||
default: show( opts, (opts.first ? 0 : opts.currentPage - 1) ); break; // stop when getting to first page | ||
} | ||
} | ||
|
||
function show( opts, pageNum ) | ||
{ | ||
if ( pageNum > opts.totalPages-1 ) pageNum = opts.totalPages-1; | ||
|
||
if ( ! opts.pages[opts.currentPage].is(':animated') ) | ||
{ | ||
opts.wrapper.trigger( 'started.evtpaginate', opts.currentPage+1 ); | ||
|
||
$.fn.evtpaginate.swapPages( opts, pageNum, function(){ | ||
|
||
opts.currentPage = pageNum; | ||
opts.first = isFirstPage( opts, opts.currentPage ) ? true : false; | ||
opts.last = isLastPage( opts, opts.currentPage ) ? true : false; | ||
|
||
opts.wrapper.trigger( 'finished.evtpaginate', [opts.currentPage+1, opts.first, opts.last] ); | ||
|
||
}); | ||
} | ||
} | ||
|
||
// public, can override this if neccessary | ||
$.fn.evtpaginate.swapPages = function( opts, pageNum, onFinish ) | ||
{ | ||
opts.pages[opts.currentPage].hide(); | ||
opts.pages[pageNum].show(); | ||
onFinish(); | ||
}; | ||
|
||
// utility functions | ||
function isFirstPage( opts, internalPageNum ) { return ( internalPageNum === 0 ); } | ||
function isLastPage( opts, internalPageNum ) { return ( internalPageNum === opts.totalPages-1 ); } | ||
|
||
})(jQuery); |
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,19 @@ | ||
$(function(){ | ||
var wrap2 = $('#wrapper2'); | ||
$('.action').click(function(){ | ||
var action = $(this).attr('rel'); // get the appropriate action from the rel attribute | ||
wrap2.trigger(action+'.evtpaginate'); | ||
return false; | ||
}); | ||
$('select[name=perpage]').change(function(){ | ||
wrap2.trigger('refresh.evtpaginate', { perPage : $(this).val() } ); | ||
return false; | ||
}); | ||
// listen out for events triggered by the plugin to update the counter | ||
wrap2.bind( 'initialized.evtpaginate', function(e, startnum, totalnum ){ | ||
$('#count2').text(startnum); | ||
$('#total2').text(totalnum); | ||
}); | ||
wrap2.bind( 'finished.evtpaginate', function(e, num, isFirst, isLast ){ $('#count2').text(num); } ); | ||
wrap2.evtpaginate({perPage:4, atEnd:'loop'}); // call the plugin! | ||
}); |
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