compass-jquery-plugin 0.3.0.0 → 0.3.1.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +69 -13
- data/Rakefile +1 -1
- data/VERSION.yml +2 -2
- data/gem_tasks/jqgrid.rake +119 -0
- data/gem_tasks/jrails.rake +78 -77
- data/gem_tasks/mobile.rake +156 -0
- data/gem_tasks/rubygems.rake +5 -1
- data/gem_tasks/secret_sauce.rake +64 -0
- data/lib/jquery/gridify.rb +42 -0
- data/lib/jquery/gridify/assertions.rb +37 -0
- data/lib/jquery/gridify/grid.rb +210 -0
- data/lib/jquery/gridify/grid_column.rb +134 -0
- data/lib/jquery/gridify/grid_finder.rb +223 -0
- data/lib/jquery/gridify/grid_options.rb +279 -0
- data/lib/jquery/gridify/grid_view.rb +435 -0
- data/lib/jquery/jqgrid.rb +5 -0
- data/lib/jquery/jqgrid/jqgrid.rb +438 -0
- data/lib/jquery/mobile.rb +3 -0
- data/lib/jquery/secret_sauce.rb +9 -0
- data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +14 -0
- data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +18 -0
- data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +6 -0
- data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +118 -0
- data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +226 -0
- data/lib/jquery/secret_sauce/model/find_for_grid.rb +42 -0
- data/templates/dynatree/jquery.dynatree.js +258 -147
- data/templates/dynatree/jquery.dynatree.min.js +81 -79
- data/templates/dynatree/jquery/dynatree/aero.scss +35 -18
- data/templates/dynatree/jquery/dynatree/aero/drop_sibling_here.png +0 -0
- data/templates/dynatree/jquery/dynatree/aqua.scss +36 -19
- data/templates/dynatree/jquery/dynatree/aqua/drop_sibling_here.png +0 -0
- data/templates/dynatree/jquery/dynatree/crystal.scss +38 -21
- data/templates/dynatree/jquery/dynatree/crystal/drop_sibling_here.png +0 -0
- data/templates/dynatree/jquery/dynatree/xp.scss +59 -42
- data/templates/dynatree/jquery/dynatree/xp/drop_sibling_here.png +0 -0
- data/templates/dynatree/manifest.rb +4 -0
- data/templates/jqgrid/config/initializers/jqgrid.rb +4 -0
- data/templates/jqgrid/config/locales/jquery/jqgrid/de.yml +7 -0
- data/templates/jqgrid/config/locales/jquery/jqgrid/en.yml +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-bg.js +132 -0
- data/templates/jqgrid/i18n/jqgrid/locale-bg.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +132 -0
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cat.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cat.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cn.js +132 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cn.min.js +5 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cs.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cs.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-da.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-da.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-de.js +133 -0
- data/templates/jqgrid/i18n/jqgrid/locale-de.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-el.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-el.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-en.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-en.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-es.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-es.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fa.js +125 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fa.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fi.js +130 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fi.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fr.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fr.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-gl.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-gl.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-he.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-he.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-hu.js +129 -0
- data/templates/jqgrid/i18n/jqgrid/locale-hu.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-is.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-is.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-it.js +1 -0
- data/templates/jqgrid/i18n/jqgrid/locale-it.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ja.js +155 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ja.min.js +5 -0
- data/templates/jqgrid/i18n/jqgrid/locale-nl.js +149 -0
- data/templates/jqgrid/i18n/jqgrid/locale-nl.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-no.js +1 -0
- data/templates/jqgrid/i18n/jqgrid/locale-no.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pl.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pl.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pt.js +125 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pt.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ro.js +139 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ro.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ru.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ru.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sk.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sk.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sr.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sr.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sv.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sv.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-tr.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-tr.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ua.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ua.min.js +7 -0
- data/templates/jqgrid/jquery.jqGrid.js +11604 -0
- data/templates/jqgrid/jquery.jqGrid.min.js +472 -0
- data/templates/jqgrid/jquery/jqGrid.scss +692 -0
- data/templates/jqgrid/manifest.rb +72 -0
- data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +13 -0
- data/templates/jqtouch/jquery/touch/apple.scss +5 -5
- data/templates/jqtouch/jquery/touch/default.scss +5 -5
- data/templates/jqtouch/jquery/touch/jqt.scss +5 -5
- data/templates/jrails/config/initializers/jrails.rb +3 -0
- data/templates/jrails/jquery-ui.js +45 -62
- data/templates/jrails/jquery-ui.min.js +22 -22
- data/templates/jrails/jquery.js +340 -206
- data/templates/jrails/jquery.min.js +152 -151
- data/templates/jrails/jquery.tmpl.js +489 -0
- data/templates/jrails/jquery.tmpl.min.js +12 -0
- data/templates/jrails/jquery.tmplPlus.js +98 -0
- data/templates/jrails/jquery.tmplPlus.min.js +3 -0
- data/templates/jrails/jquery/ui/_theme.scss +3 -1
- data/templates/jrails/manifest.rb +4 -0
- data/templates/jstree/jquery.jstree.js +4479 -4468
- data/templates/jstree/jquery.jstree.min.js +4 -3
- data/templates/mobile/config/initializers/mobile.rb +6 -0
- data/templates/mobile/glyphish/Read me first - license.txt +14 -0
- data/templates/mobile/glyphish/icons-black/01-refresh.png +0 -0
- data/templates/mobile/glyphish/icons-black/02-redo.png +0 -0
- data/templates/mobile/glyphish/icons-black/03-loopback.png +0 -0
- data/templates/mobile/glyphish/icons-black/04-squiggle.png +0 -0
- data/templates/mobile/glyphish/icons-black/05-shuffle.png +0 -0
- data/templates/mobile/glyphish/icons-black/06-magnifying-glass.png +0 -0
- data/templates/mobile/glyphish/icons-black/07-map-marker.png +0 -0
- data/templates/mobile/glyphish/icons-black/08-chat.png +0 -0
- data/templates/mobile/glyphish/icons-black/09-chat2.png +0 -0
- data/templates/mobile/glyphish/icons-black/10-medical.png +0 -0
- data/templates/mobile/glyphish/icons-black/100-coffee.png +0 -0
- data/templates/mobile/glyphish/icons-black/101-gameplan.png +0 -0
- data/templates/mobile/glyphish/icons-black/102-walk.png +0 -0
- data/templates/mobile/glyphish/icons-black/103-map.png +0 -0
- data/templates/mobile/glyphish/icons-black/104-index-cards.png +0 -0
- data/templates/mobile/glyphish/icons-black/105-piano.png +0 -0
- data/templates/mobile/glyphish/icons-black/106-sliders.png +0 -0
- data/templates/mobile/glyphish/icons-black/107-widescreen.png +0 -0
- data/templates/mobile/glyphish/icons-black/108-badge.png +0 -0
- data/templates/mobile/glyphish/icons-black/109-chicken.png +0 -0
- data/templates/mobile/glyphish/icons-black/11-clock.png +0 -0
- data/templates/mobile/glyphish/icons-black/110-bug.png +0 -0
- data/templates/mobile/glyphish/icons-black/111-user.png +0 -0
- data/templates/mobile/glyphish/icons-black/112-group.png +0 -0
- data/templates/mobile/glyphish/icons-black/113-navigation.png +0 -0
- data/templates/mobile/glyphish/icons-black/114-balloon.png +0 -0
- data/templates/mobile/glyphish/icons-black/115-bow-and-arrow.png +0 -0
- data/templates/mobile/glyphish/icons-black/116-controller.png +0 -0
- data/templates/mobile/glyphish/icons-black/117-todo.png +0 -0
- data/templates/mobile/glyphish/icons-black/118-coathanger.png +0 -0
- data/templates/mobile/glyphish/icons-black/119-piggybank.png +0 -0
- data/templates/mobile/glyphish/icons-black/12-eye.png +0 -0
- data/templates/mobile/glyphish/icons-black/120-headphones.png +0 -0
- data/templates/mobile/glyphish/icons-black/121-lanscape.png +0 -0
- data/templates/mobile/glyphish/icons-black/122-stats.png +0 -0
- data/templates/mobile/glyphish/icons-black/123-id-card.png +0 -0
- data/templates/mobile/glyphish/icons-black/124-bullhorn.png +0 -0
- data/templates/mobile/glyphish/icons-black/125-food.png +0 -0
- data/templates/mobile/glyphish/icons-black/126-moon.png +0 -0
- data/templates/mobile/glyphish/icons-black/127-sock.png +0 -0
- data/templates/mobile/glyphish/icons-black/128-bone.png +0 -0
- data/templates/mobile/glyphish/icons-black/129-golf.png +0 -0
- data/templates/mobile/glyphish/icons-black/13-target.png +0 -0
- data/templates/mobile/glyphish/icons-black/130-dice.png +0 -0
- data/templates/mobile/glyphish/icons-black/14-tag.png +0 -0
- data/templates/mobile/glyphish/icons-black/15-tags.png +0 -0
- data/templates/mobile/glyphish/icons-black/16-line-chart.png +0 -0
- data/templates/mobile/glyphish/icons-black/17-bar-chart.png +0 -0
- data/templates/mobile/glyphish/icons-black/18-envelope.png +0 -0
- data/templates/mobile/glyphish/icons-black/19-gear.png +0 -0
- data/templates/mobile/glyphish/icons-black/20-gear2.png +0 -0
- data/templates/mobile/glyphish/icons-black/21-skull.png +0 -0
- data/templates/mobile/glyphish/icons-black/22-skull-n-crossbones.png +0 -0
- data/templates/mobile/glyphish/icons-black/23-bird.png +0 -0
- data/templates/mobile/glyphish/icons-black/24-gift.png +0 -0
- data/templates/mobile/glyphish/icons-black/25-weather.png +0 -0
- data/templates/mobile/glyphish/icons-black/26-bandaid.png +0 -0
- data/templates/mobile/glyphish/icons-black/27-planet.png +0 -0
- data/templates/mobile/glyphish/icons-black/28-star.png +0 -0
- data/templates/mobile/glyphish/icons-black/29-heart.png +0 -0
- data/templates/mobile/glyphish/icons-black/30-key.png +0 -0
- data/templates/mobile/glyphish/icons-black/31-ipod.png +0 -0
- data/templates/mobile/glyphish/icons-black/32-iphone.png +0 -0
- data/templates/mobile/glyphish/icons-black/33-cabinet.png +0 -0
- data/templates/mobile/glyphish/icons-black/34-coffee.png +0 -0
- data/templates/mobile/glyphish/icons-black/35-shopping-bag.png +0 -0
- data/templates/mobile/glyphish/icons-black/36-toolbox.png +0 -0
- data/templates/mobile/glyphish/icons-black/37-suitcase.png +0 -0
- data/templates/mobile/glyphish/icons-black/38-airplane.png +0 -0
- data/templates/mobile/glyphish/icons-black/39-spraycan.png +0 -0
- data/templates/mobile/glyphish/icons-black/40-inbox.png +0 -0
- data/templates/mobile/glyphish/icons-black/41-picture-frame.png +0 -0
- data/templates/mobile/glyphish/icons-black/42-photos.png +0 -0
- data/templates/mobile/glyphish/icons-black/43-film-roll.png +0 -0
- data/templates/mobile/glyphish/icons-black/44-shoebox.png +0 -0
- data/templates/mobile/glyphish/icons-black/45-movie1.png +0 -0
- data/templates/mobile/glyphish/icons-black/46-movie2.png +0 -0
- data/templates/mobile/glyphish/icons-black/47-fuel.png +0 -0
- data/templates/mobile/glyphish/icons-black/48-fork-and-knife.png +0 -0
- data/templates/mobile/glyphish/icons-black/49-battery.png +0 -0
- data/templates/mobile/glyphish/icons-black/50-beaker.png +0 -0
- data/templates/mobile/glyphish/icons-black/51-outlet.png +0 -0
- data/templates/mobile/glyphish/icons-black/52-pinetree.png +0 -0
- data/templates/mobile/glyphish/icons-black/53-house.png +0 -0
- data/templates/mobile/glyphish/icons-black/54-lock.png +0 -0
- data/templates/mobile/glyphish/icons-black/55-network.png +0 -0
- data/templates/mobile/glyphish/icons-black/56-cloud.png +0 -0
- data/templates/mobile/glyphish/icons-black/57-download.png +0 -0
- data/templates/mobile/glyphish/icons-black/58-bookmark.png +0 -0
- data/templates/mobile/glyphish/icons-black/59-flag.png +0 -0
- data/templates/mobile/glyphish/icons-black/60-signpost.png +0 -0
- data/templates/mobile/glyphish/icons-black/61-brightness.png +0 -0
- data/templates/mobile/glyphish/icons-black/62-contrast.png +0 -0
- data/templates/mobile/glyphish/icons-black/63-runner.png +0 -0
- data/templates/mobile/glyphish/icons-black/64-zap.png +0 -0
- data/templates/mobile/glyphish/icons-black/65-note.png +0 -0
- data/templates/mobile/glyphish/icons-black/66-microphone.png +0 -0
- data/templates/mobile/glyphish/icons-black/67-tshirt.png +0 -0
- data/templates/mobile/glyphish/icons-black/68-paperclip.png +0 -0
- data/templates/mobile/glyphish/icons-black/69-display.png +0 -0
- data/templates/mobile/glyphish/icons-black/70-tv.png +0 -0
- data/templates/mobile/glyphish/icons-black/71-compass.png +0 -0
- data/templates/mobile/glyphish/icons-black/72-pin.png +0 -0
- data/templates/mobile/glyphish/icons-black/73-radar.png +0 -0
- data/templates/mobile/glyphish/icons-black/74-location.png +0 -0
- data/templates/mobile/glyphish/icons-black/75-phone.png +0 -0
- data/templates/mobile/glyphish/icons-black/76-baby.png +0 -0
- data/templates/mobile/glyphish/icons-black/77-ekg.png +0 -0
- data/templates/mobile/glyphish/icons-black/78-stopwatch.png +0 -0
- data/templates/mobile/glyphish/icons-black/79-medical-bag.png +0 -0
- data/templates/mobile/glyphish/icons-black/80-shopping-cart.png +0 -0
- data/templates/mobile/glyphish/icons-black/81-dashboard.png +0 -0
- data/templates/mobile/glyphish/icons-black/82-dogpaw.png +0 -0
- data/templates/mobile/glyphish/icons-black/83-calendar.png +0 -0
- data/templates/mobile/glyphish/icons-black/84-lightbulb.png +0 -0
- data/templates/mobile/glyphish/icons-black/85-trophy.png +0 -0
- data/templates/mobile/glyphish/icons-black/86-camera.png +0 -0
- data/templates/mobile/glyphish/icons-black/87-wineglass.png +0 -0
- data/templates/mobile/glyphish/icons-black/88-beermug.png +0 -0
- data/templates/mobile/glyphish/icons-black/89-dumbbell.png +0 -0
- data/templates/mobile/glyphish/icons-black/90-lifebuoy.png +0 -0
- data/templates/mobile/glyphish/icons-black/91-beaker2.png +0 -0
- data/templates/mobile/glyphish/icons-black/92-testtube.png +0 -0
- data/templates/mobile/glyphish/icons-black/93-thermometer.png +0 -0
- data/templates/mobile/glyphish/icons-black/94-pill.png +0 -0
- data/templates/mobile/glyphish/icons-black/95-equalizer.png +0 -0
- data/templates/mobile/glyphish/icons-black/96-book.png +0 -0
- data/templates/mobile/glyphish/icons-black/97-puzzle.png +0 -0
- data/templates/mobile/glyphish/icons-black/98-palette.png +0 -0
- data/templates/mobile/glyphish/icons-black/99-umbrella.png +0 -0
- data/templates/mobile/glyphish/icons-white/09-chat2.png +0 -0
- data/templates/mobile/glyphish/icons-white/100-coffee.png +0 -0
- data/templates/mobile/glyphish/icons-white/18-envelope.png +0 -0
- data/templates/mobile/glyphish/icons-white/19-gear.png +0 -0
- data/templates/mobile/glyphish/icons-white/21-skull.png +0 -0
- data/templates/mobile/glyphish/icons-white/30-key.png +0 -0
- data/templates/mobile/glyphish/icons-white/34-coffee.png +0 -0
- data/templates/mobile/glyphish/icons-white/88-beermug.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/band-aid.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/chat.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/clock.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/eye.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/flag.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/fork-and-knife.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/gear.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/heart.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/lightning-bolt.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/magnifying-glass.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/map-marker.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/map-pin.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/microphone.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/music-note.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/paw.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/plus.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/puzzle.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/star.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/tag.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/tshirt.png +0 -0
- data/templates/mobile/jquery.mobile.js +3995 -0
- data/templates/mobile/jquery.mobile.min.js +28 -0
- data/templates/mobile/jquery/mobile/_base.scss +1344 -0
- data/templates/mobile/jquery/mobile/default.scss +745 -0
- data/templates/mobile/jquery/mobile/default/ajax-loader.png +0 -0
- data/templates/mobile/jquery/mobile/default/form-check-off.png +0 -0
- data/templates/mobile/jquery/mobile/default/form-check-on.png +0 -0
- data/templates/mobile/jquery/mobile/default/form-radio-off.png +0 -0
- data/templates/mobile/jquery/mobile/default/form-radio-on.png +0 -0
- data/templates/mobile/jquery/mobile/default/icon-search-black.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-18-black.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-18-white.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-36-black.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-36-white.png +0 -0
- data/templates/mobile/jquery/mobile/valencia.scss +807 -0
- data/templates/mobile/jquery/mobile/valencia/ajax-loader.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/form-check-off.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/form-check-on.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/form-radio-off.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/form-radio-on.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icon-search-black.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-18-black.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-18-white.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-36-black.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-36-white.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/texture_05.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/texture_075.png +0 -0
- data/templates/mobile/lib/tasks/jquery.mobile.rake +106 -0
- data/templates/mobile/manifest.rb +191 -0
- data/templates/secret_sauce/app/views/shared/_ui_form_error_messages.html.haml +6 -0
- data/templates/secret_sauce/app/views/shared/_ui_grid_for_without_block.js.haml +144 -0
- data/templates/secret_sauce/app/views/shared/_ui_static_dialog.html.haml +6 -0
- data/templates/secret_sauce/config/initializers/secret_sauce.rb +8 -0
- data/templates/secret_sauce/jquery/secret_sauce.scss +33 -0
- data/templates/secret_sauce/manifest.rb +10 -0
- data/templates/secret_sauce/secret_sauce.js +12 -0
- data/templates/secret_sauce/secret_sauce.min.js +1 -0
- metadata +313 -17
- data/.gitignore +0 -22
- data/compass-jquery-plugin.gemspec +0 -1064
@@ -0,0 +1,9 @@
|
|
1
|
+
module SecretSauce#:nodoc:
|
2
|
+
end
|
3
|
+
|
4
|
+
require 'jquery/secret_sauce/controller/ui_dialog_controls'
|
5
|
+
require 'jquery/secret_sauce/controller/ui_grid_controls'
|
6
|
+
require 'jquery/secret_sauce/helpers/ui_dialog_helper'
|
7
|
+
require 'jquery/secret_sauce/helpers/ui_form_helper'
|
8
|
+
require 'jquery/secret_sauce/helpers/ui_grid_helper'
|
9
|
+
require 'jquery/secret_sauce/model/find_for_grid'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ActionController
|
2
|
+
class Base
|
3
|
+
|
4
|
+
def render_refresh_grid
|
5
|
+
render :js => refresh_grid("#{params[:controller]}_table")
|
6
|
+
end
|
7
|
+
|
8
|
+
def render_close_dialog_and_refresh_grid
|
9
|
+
render :js => close_dialog("#{params["controller"]}_#{params["action"]}_dialog")+refresh_grid("#{params[:controller]}_table")
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def refresh_grid(grid_id)
|
15
|
+
"jQuery('##{grid_id}').trigger('reloadGrid');"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module SecretSauce
|
2
|
+
module Helpers
|
3
|
+
module UiFormHelper
|
4
|
+
class UiFormBuilder < ActionView::Helpers::FormBuilder
|
5
|
+
|
6
|
+
def submit(value, options={})
|
7
|
+
options = {:id => "#{object_name}_submit"}.merge(options)
|
8
|
+
@template.instance_variable_set("@ui_form_submit", [value, options])
|
9
|
+
nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def error_messages
|
13
|
+
@template.error_messages_for(object_name)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# renders a jquery-ui templated static dialog box (cannot be resized or moved, appears on base z-index)
|
18
|
+
# to be used for things like forms
|
19
|
+
def ui_static_dialog(options={}, &block)
|
20
|
+
body = capture(&block)
|
21
|
+
concat(ui_static_dialog_tags(options))
|
22
|
+
body
|
23
|
+
concat(%q{
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
})
|
28
|
+
end
|
29
|
+
|
30
|
+
# flat tags for static dialog
|
31
|
+
def ui_static_dialog_tags(options={})
|
32
|
+
options[:width] = 100 unless options[:width]
|
33
|
+
options[:height] = 100 unless options[:height]
|
34
|
+
options[:title] = "Dialog" unless options[:title]
|
35
|
+
options[:parent] = '' unless options[:parent]
|
36
|
+
options[:style] = "width: #{options[:width]}px;"
|
37
|
+
if options[:center]
|
38
|
+
options[:parent] = "width: 100%;"
|
39
|
+
options[:style] << " margin-left: auto; margin-right: auto;"
|
40
|
+
end
|
41
|
+
render :partial => 'shared/ui_static_dialog', :locals => options
|
42
|
+
end
|
43
|
+
|
44
|
+
# builds a form within a ui_static_dialog using UiFormBuilder in this case we are using a
|
45
|
+
# custom version of form_for instead of the original to wrap jquery-ui components inside
|
46
|
+
# of the form
|
47
|
+
def ui_form_for(record_or_name_or_array, *args, &proc)
|
48
|
+
raise ArgumentError, "Missing block" unless block_given?
|
49
|
+
|
50
|
+
if params[:layout] == "dialog"
|
51
|
+
return form_for(record_or_name_or_array, *args, &proc)
|
52
|
+
else
|
53
|
+
options = args.extract_options!
|
54
|
+
options[:builder] = UiFormBuilder
|
55
|
+
|
56
|
+
if !options[:submit]
|
57
|
+
options[:submit] = {:value => "Save Changes", :options => {}}
|
58
|
+
else
|
59
|
+
options[:submit][:value] = "Save Changes" if !options[:submit][:value]
|
60
|
+
options[:submit][:options] = {} if !options[:submit][:options]
|
61
|
+
end
|
62
|
+
|
63
|
+
case record_or_name_or_array
|
64
|
+
when String, Symbol
|
65
|
+
object_name = record_or_name_or_array
|
66
|
+
when Array
|
67
|
+
object = record_or_name_or_array.last
|
68
|
+
object_name = ActionController::RecordIdentifier.singular_class_name(object)
|
69
|
+
apply_form_for_options!(record_or_name_or_array, options)
|
70
|
+
args.unshift object
|
71
|
+
else
|
72
|
+
object = record_or_name_or_array
|
73
|
+
object_name = ActionController::RecordIdentifier.singular_class_name(object)
|
74
|
+
apply_form_for_options!([object], options)
|
75
|
+
args.unshift object
|
76
|
+
end
|
77
|
+
concat("<div id='#{object_name}_form_container'>")
|
78
|
+
concat(form_tag(options.delete(:url) || {}, options.delete(:html) || {}))
|
79
|
+
concat(ui_static_dialog_tags(options[:dialog_options]))
|
80
|
+
fields_for(object_name, *(args << options), &proc)
|
81
|
+
concat(%Q{
|
82
|
+
</div>
|
83
|
+
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
|
84
|
+
#{ui_submit_tag(@ui_form_submit[0], @ui_form_submit[1]) if @ui_form_submit}
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
</form>
|
89
|
+
</div>})
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# render a button pane
|
94
|
+
def ui_button_pane(&block)
|
95
|
+
body = capture(&block)
|
96
|
+
concat("<div class='ui-dialog-buttonpane ui-widget-content ui-helper-clearfix'>")
|
97
|
+
body
|
98
|
+
concat("</div>")
|
99
|
+
end
|
100
|
+
|
101
|
+
# render a submit tag themed with jquery ui
|
102
|
+
def ui_submit_tag(value = "Save changes", options = {})
|
103
|
+
if options[:class]
|
104
|
+
options[:class] << " ui-state-default ui-corner-all"
|
105
|
+
else
|
106
|
+
options[:class] = "ui-state-default ui-corner-all"
|
107
|
+
end
|
108
|
+
submit_tag(value, options)
|
109
|
+
end
|
110
|
+
|
111
|
+
def error_messages_for(*params)
|
112
|
+
render :partial => "shared/ui_form_error_messages", :locals => {:messages => super(*params) }
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
|
@@ -0,0 +1,226 @@
|
|
1
|
+
module SecretSauce
|
2
|
+
module Helpers
|
3
|
+
# This module wraps the great jqGrid plugin for jQuery and jQuery UI (http://www.trirand.com/blog).
|
4
|
+
module UiGridHelper
|
5
|
+
# Renders a table using jqGrid[http://www.trirand.com/blog]. This method can be used for quickly
|
6
|
+
# 'scaffolding' a model resource. It accepts arguments similiar to form_for. The first argument
|
7
|
+
# must be either Symbol, or an Array. If a Symbol, it should be the name of the resource to build
|
8
|
+
# the grid for.
|
9
|
+
# == Parameters
|
10
|
+
# Most of the documentation for the parameters are pulled from the jqGrid documentation found here:
|
11
|
+
# http://www.secondpersonplural.ca/jqgriddocs/index.htm
|
12
|
+
# * <tt>:alternate_rows -</tt> Set a zebra-striped grid. Default is set to false.
|
13
|
+
# * <tt>:caption -</tt> Defines the caption for the grid. This caption appear above the
|
14
|
+
# table header. If caption is nil, no caption will be referenced. By default the
|
15
|
+
# caption will be guessed from the <tt>name_or_array</tt> arguement.
|
16
|
+
# * <tt>:cell_edit -</tt> Enables (disables) cell editing.
|
17
|
+
# See CellEditing[http://www.secondpersonplural.ca/jqgriddocs/_2h30tykyb.htm] for more details.
|
18
|
+
# * <tt>:cell_submit -</tt> Determines where the contents of the cell are saved: 'remote' or 'clientArray'.
|
19
|
+
# See CellEditing[http://www.secondpersonplural.ca/jqgriddocs/_2h30tykyb.htm] for more details.
|
20
|
+
# * <tt>:cell_url -</tt> The url where the cell is to be saved.
|
21
|
+
# See CellEditing[http://www.secondpersonplural.ca/jqgriddocs/_2h30tykyb.htm] for more details.
|
22
|
+
# * <tt>:column_model -</tt> Array which describes the parameters of the columns.
|
23
|
+
# For a full description of all valid values see
|
24
|
+
# colModel[http://www.secondpersonplural.ca/jqgriddocs/_2eb0fihps.htm]. By default column_model
|
25
|
+
# is set for ActiveRecord::Base#find_for_grid.
|
26
|
+
# * <tt>:column_names -</tt> Array which describes the column labels in the grid.
|
27
|
+
# * <tt>:datastring -</tt> The string of data when datatype parameter is set to xmlstring or jsonstring.
|
28
|
+
# * <tt>:datatype -</tt> Defines what type of information to expect to represent data in the grid.
|
29
|
+
# Valid options are xml - we expect xml data; xmlstring - we expect xml data as string;
|
30
|
+
# json - we expect JSON data; jsonstring - we expect JSON data as string;
|
31
|
+
# clientSide - we expect data defined at client side (array data)
|
32
|
+
# * <tt>:deselect_after_sort -</tt> Applicable only when we use <tt>datatype => "clientSide"</tt>.
|
33
|
+
# Deselects currently-selected row(s) when a sort is applied.
|
34
|
+
# * <tt>:edit_url -</tt> Defines the url for inline and form editing.
|
35
|
+
# * <tt>:expand_column -</tt> Indicates which column (name from <tt>:column_model</tt>)
|
36
|
+
# should be used to expand the tree grid. If not set the first one is used. Valid only when
|
37
|
+
# treeGrid option is set to true.
|
38
|
+
# * <tt>:force_fit -</tt>If set to true, and resizing the width of a column,
|
39
|
+
# the adjacent column (to the right) will resize so that the overall grid width is
|
40
|
+
# maintained (e.g., reducing the width of column 2 by 30px will increase the size of column 3 by
|
41
|
+
# 30px). In this case there is no horizontal scrolbar. Note: this option is not compatible with
|
42
|
+
# <tt>shrink_to_fit</tt> option - i.e if <tt>:shrink_to_fit</tt> is set to false,
|
43
|
+
# <tt>:force_fit</tt> is ignored.
|
44
|
+
# * <tt>:grid_state -</tt> Determines the current state of the grid (i.e. when used with hiddengrid,
|
45
|
+
# <tt>:hide_grid</tt> and caption options). Can have either of two states: 'visible' or 'hidden'
|
46
|
+
# * <tt>:hidden_grid -</tt> If set to true the grid initially is hidden. The data is not
|
47
|
+
# loaded (no request is sent) and only the caption layer is shown. When the show/hide
|
48
|
+
# button is clicked the first time to show grid, the request is sent to the server,
|
49
|
+
# the data is loaded, and grid is shown. From this point we have a regular grid. This option
|
50
|
+
# has effect only if the caption property is not empty and the <tt>:hide_grid</tt> property (see below)
|
51
|
+
# is set to true.
|
52
|
+
# * <tt>:hide_grid -</tt> Enables or disables the show/hide grid button, which appears on the right side
|
53
|
+
# of the Caption layer. Takes effect only if the caption property is not an empty string.
|
54
|
+
# * <tt>:height -</tt> The height of the grid. Can be set as percentage or any valid measured value.
|
55
|
+
# * <tt>:image_path -</tt>Defines the path to the images that are used in the grid. Set this option
|
56
|
+
# without / at end.
|
57
|
+
# * <tt>:json_reader -</tt> Array which describes the structure of the expected json data. For a full
|
58
|
+
# description and default setting, see JSONData[http://www.secondpersonplural.ca/jqgriddocs/_2eb0f6jhe.htm].
|
59
|
+
# * <tt>:load_once -</tt> If this flag is set to true, the grid loads the data from the server
|
60
|
+
# only once (using the appropriate datatype). After the first request the <tt>:data_type</tt> parameter is
|
61
|
+
# automatically changed to clientSide and all further manipulations are done on the client side.
|
62
|
+
# The functions of the pager (if present) are disabled.
|
63
|
+
# * <tt>:load_text -</tt> The text which appear when requesting and sorting data.
|
64
|
+
# * <tt>:load_ui -</tt> This option controls what to do when an ajax operation is in progress.
|
65
|
+
# * disable - disables the jqGrid progress indicator. This way you can use your own indicator.
|
66
|
+
# * enable (default) - enables the red "Loading" message in the upper left of the grid.
|
67
|
+
# * block - enables the progress indicator using the characteristics you have specified in the
|
68
|
+
# css for div.loadingui and blocks all actions in the grid until the ajax request is finished.
|
69
|
+
# Note that this disables paging, sorting and all actions on toolbar, if any.
|
70
|
+
# * <tt>:request_type -</tt> Defines the type of request to make ("POST" or "GET").
|
71
|
+
# * <tt>:multikey -</tt> This parameter have sense only multiselect option is set to true.
|
72
|
+
# Defines the key which will be pressed when we make multiselection. The possible values are:
|
73
|
+
# shiftKey - the user should press Shift Key altKey - the user should press
|
74
|
+
# Alt Key ctrlKey - the user should press Ctrl Key.
|
75
|
+
# * <tt>:multibox -</tt> This option works only when <tt>:multiselect => true</tt>.
|
76
|
+
# When multiselect is set to true, clicking anywhere on a row selects that row;
|
77
|
+
# when multiboxonly is also set to true, the row is selected only when the checkbox
|
78
|
+
# is clicked (Yahoo style).
|
79
|
+
# * <tt>:multiselect -</tt> If this flag is set to true a multi selection of rows is enabled.
|
80
|
+
# A new column at left side is added. Can be used with any datatype option.
|
81
|
+
# * <tt>:param_keys -</tt> Customizes names of the fields sent to the server on a Post:
|
82
|
+
# default values for these fields are "page", "rows", "sidx", and "sord".
|
83
|
+
# For example, with this setting, you can change the sort order element from "sidx" to "mysort":
|
84
|
+
# The string that will be posted to the server will then be
|
85
|
+
# /foo/bars?page=1&rows=10&mysort=myindex&sord=asc rather than
|
86
|
+
# /foo/bars?page=1&rows=10&sidx=myindex&sord=asc.
|
87
|
+
# * <tt>:post_data -</tt> This array is passed directly to the url. This is associative
|
88
|
+
# array and can be used this way: {name1:value1...}.
|
89
|
+
# * <tt>:resize_class -</tt> Assigns a class to columns that are resizable so that we can show
|
90
|
+
# a resize handle only for ones that are resizable.
|
91
|
+
# * <tt>:scroll -</tt> Creates dynamic scrolling grids. When enabled, the pager elements are
|
92
|
+
# disabled and we can use the vertical scrollbar to load data. This option currently should be
|
93
|
+
# used carefully on big data sets, since the swapper isn't that intelligent, which means that
|
94
|
+
# all the data is loaded and a lot of memory will be used if the dataset is large.
|
95
|
+
# You must be sure to have a initial vertical scroll in grid, i.e. the height
|
96
|
+
# should not be set to auto.
|
97
|
+
# * <tt>:scroll_rows -</tt> When enabled, selecting a row with setSelection scrolls the grid so
|
98
|
+
# that the selected row is visible. This is especially useful when we have a verticall
|
99
|
+
# scrolling grid and we use form editing with navigation buttons (next or previous row).
|
100
|
+
# On navigating to a hidden row, the grid scrolls so the selected row becomes visible.
|
101
|
+
# * <tt>:sort_class -</tt> The class to be applied to the currently sorted column, i.e. applied
|
102
|
+
# to the th element.
|
103
|
+
# * <tt>:shrink_to_fit -</tt> This option describes the type of calculation of the initial width of
|
104
|
+
# each column against with the width of the grid. If the value is true and the value in width
|
105
|
+
# option is set then: Every column width is scaled according to the defined option width.
|
106
|
+
# Example: if we define two columns with a width of 80 and 120 pixels, but want the grid to
|
107
|
+
# have a 300 pixels - then the columns are recalculated as
|
108
|
+
# follows: 1- column = 300(new width)/200(sum of all width)*80(column width) = 120 and 2 column =
|
109
|
+
# 300/200*120 = 180. The grid width is 300px. If the value is false and the value in width option is set
|
110
|
+
# then: The width of the grid is the width set in option. The column width are not recalculated and have the
|
111
|
+
# values defined in colModel.
|
112
|
+
# * <tt>:sort_asc_image -</tt> Links to image url which are used when the user sort a column.
|
113
|
+
# * <tt>:sort_desc_image -</tt> Links to image url which are used when the user sort a column.
|
114
|
+
# * <tt>:sort_name -</tt> The initial sorting name when we use datatypes xml or json
|
115
|
+
# (data returned from server).
|
116
|
+
# * <tt>:sort_order -</tt> The initial sorting order when we use datatypes xml
|
117
|
+
# or json (data returned from server).
|
118
|
+
# * <tt>:toolbar -</tt> This option defines the toolbar of the grid. This is array with two
|
119
|
+
# values in which the first value enables the toolbar and the second defines the position
|
120
|
+
# relative to body Layer. Possible values "top" or "bottom".
|
121
|
+
# * <tt>:tree_grid -</tt> Enables (disables) the tree grid format. For more details see
|
122
|
+
# TreeGrid[http://www.secondpersonplural.ca/jqgriddocs/_2h30rxa7u.htm]
|
123
|
+
# * <tt>:user_data -</tt> This array contain custom information from the request. Can be used at any time.
|
124
|
+
# * <tt>:width -</tt> If this option is not set, the width of the grid is a sum of the widths of the
|
125
|
+
# columns defined in the colModel (in pixels). If this option is set, the initial width of each
|
126
|
+
# column is set according to the value of <tt>:shrink_to_fit</tt> option.
|
127
|
+
# * <tt>:xml_reader -</tt> Array which describes the structure of the expected xml data.
|
128
|
+
# For a full description refer to Data Types.
|
129
|
+
def ui_grid_for(*args)
|
130
|
+
name_or_array = args.first
|
131
|
+
options = args.extract_options!
|
132
|
+
option_map = {
|
133
|
+
:alternate_rows => "altRows", # bool
|
134
|
+
:caption => "caption", # string
|
135
|
+
:cell_edit => "cellEdit", # bool
|
136
|
+
:cell_submit => "cellSubmit", # string
|
137
|
+
:cell_url => "cellUrl", # string
|
138
|
+
:column_model => "colModel", # array
|
139
|
+
:column_names => "colNames", # array
|
140
|
+
:datastring => "dataStr", # string
|
141
|
+
:datatype => "datatype", # string
|
142
|
+
:deslect_after_sort => "deselectAfterSort", # bool
|
143
|
+
:edit_url => "editUrl", # string
|
144
|
+
:expand_column => "ExpandColumn", # string
|
145
|
+
:footer_row => "footerrow", # bool TODO: ADD DOCUMENTATION
|
146
|
+
:force_fit => "forceFit", # bool
|
147
|
+
:grid_state => "gridstate", # string
|
148
|
+
:hidden_grid => "hiddengrid", # bool
|
149
|
+
:hide_grid => "hidegrid", # bool
|
150
|
+
:height => "height", # string
|
151
|
+
:image_path => "imgpath", # string
|
152
|
+
:json_reader => "jsonReader", # array
|
153
|
+
:load_complete => "loadComplete", # string TODO: ADD DOCUMENTATION
|
154
|
+
:load_once => "loadonce", # bool
|
155
|
+
:load_text => "load_text", # string
|
156
|
+
:load_ui => "loadui", # string
|
157
|
+
:request_method => "mtype", # string
|
158
|
+
:multikey => "multikey", # string
|
159
|
+
:multibox => "multiboxonly", # bool
|
160
|
+
:multiselect => "multiselect", # bool
|
161
|
+
:pager => "pager", # string TODO: ADD DOCUMENATION
|
162
|
+
:param_keys => "prmnames", # array
|
163
|
+
:post_data => "postData", # array
|
164
|
+
:resize_class => "resizeclass", # string
|
165
|
+
:restful => "restful", # bool
|
166
|
+
:row_num => "rowNum", # integer TODO: ADD DOCUMENATION
|
167
|
+
:row_list => "rowList", # array TODO: ADD DOCUMENATION
|
168
|
+
:scroll => "scroll", # bool
|
169
|
+
:scroll_rows => "scrollrows", # bool
|
170
|
+
:sort_class => "sortclass", # string
|
171
|
+
:shrink_to_fit => "shrinkToFit", # bool
|
172
|
+
:sort_asc_image => "sortascimg", # string
|
173
|
+
:sort_desc_image => "sortdescimg", # string
|
174
|
+
:sort_name => "sortname", # string
|
175
|
+
:sort_order => "sortorder", # string
|
176
|
+
:toolbar => "toolbar", # array
|
177
|
+
:tree_grid => "treeGrid", # bool
|
178
|
+
:user_data => "userData", # array
|
179
|
+
:url => "url", # string TODO: ADD DOCUMENATION
|
180
|
+
:view_records => "viewrecords", # bool TODO: ADD DOCUMENTATION
|
181
|
+
:width => "width", # string
|
182
|
+
:xml_reader => "xmlReader", # array
|
183
|
+
}
|
184
|
+
if name_or_array.class == Symbol
|
185
|
+
options[:grid] = {} unless options[:grid]
|
186
|
+
options[:nav] = {} unless options[:nav]
|
187
|
+
options[:actions] = {} unless options[:actions]
|
188
|
+
options[:url] = "/#{name_or_array}" unless options[:url]
|
189
|
+
column_model = name_or_array.to_s.singularize.classify.constantize.new.attributes.keys.collect do |m|
|
190
|
+
{:name => m, :index => m, :label => m.titleize, :width => (1024 / name_or_array.to_s.singularize.classify.constantize.new.attributes.length)}
|
191
|
+
end
|
192
|
+
grid_options = {
|
193
|
+
##########################################
|
194
|
+
#:url => "/#{name_or_array}.json",
|
195
|
+
:url => "#{options[:url]}.json",
|
196
|
+
##########################################
|
197
|
+
:alternate_rows => true,
|
198
|
+
:caption => "#{name_or_array}".titleize,
|
199
|
+
:column_model => column_model,
|
200
|
+
:datatype => "json",
|
201
|
+
:restful => true,
|
202
|
+
:json_reader => {:repeatitems => false},
|
203
|
+
#:height => 22 * 30,
|
204
|
+
:height => :auto,
|
205
|
+
:row_num => 20,
|
206
|
+
:row_list => [10, 20, 30],
|
207
|
+
:pager => "#{name_or_array}_pager",
|
208
|
+
:hide_grid => false,
|
209
|
+
:view_records => true,
|
210
|
+
}
|
211
|
+
grid_options.merge!(options[:grid])
|
212
|
+
mapped_options = {}
|
213
|
+
grid_options.each do |k,v|
|
214
|
+
mapped_options[option_map[k]] = v
|
215
|
+
end
|
216
|
+
options[:nav].replace({
|
217
|
+
:edit => false,
|
218
|
+
:add => false,
|
219
|
+
:del => false
|
220
|
+
}.merge(options[:nav]))
|
221
|
+
render(:file => 'shared/_ui_grid_for_without_block.js.haml', :locals => {:options => mapped_options, :name => name_or_array, :url => options[:url], :nav => options[:nav], :actions => options[:actions]})
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class Base
|
3
|
+
# takes params from request and returns records serialized to json. handles the majority of the functionality
|
4
|
+
# for searching, sorting, and serializing records to be consumed by jqGrid.
|
5
|
+
def self.find_for_grid_2(params)
|
6
|
+
search_options = {:limit => params["rows"]}
|
7
|
+
search_options[:offset] = (params["page"].to_i * params["rows"].to_i) - params["rows"].to_i
|
8
|
+
search_options[:order] = "#{params['sidx']} #{params['sord']}" if params["sidx"] != ""
|
9
|
+
if params["_search"] == "true"
|
10
|
+
string_search_operations = {
|
11
|
+
"eq" => "=",
|
12
|
+
"ne" => "<>",
|
13
|
+
"bw" => "LIKE",
|
14
|
+
"bn" => "NOT LIKE",
|
15
|
+
"ew" => "LIKE",
|
16
|
+
"en" => "NOT LIKE",
|
17
|
+
"cn" => "LIKE",
|
18
|
+
"nc" => "NOT LIKE"
|
19
|
+
}
|
20
|
+
integer_search_operations = {
|
21
|
+
"eq" => "=",
|
22
|
+
"ne" => "<>",
|
23
|
+
"lt" => "<",
|
24
|
+
"le" => "<=",
|
25
|
+
"gt" => ">",
|
26
|
+
"ge" => ">="
|
27
|
+
}
|
28
|
+
if [:text, :string].include?(self.columns.select {|c| c.name == params["searchField"]}.first.type) && string_search_operations.keys.include?(params["searchOper"])
|
29
|
+
search_options[:conditions] = "#{params["searchField"]} "
|
30
|
+
search_options[:conditions] << "#{string_search_operations[params["searchOper"]]}"
|
31
|
+
search_options[:conditions] << "'#{"%" if ["ew", "en", "cn", "nc"].include?(params["searchOper"])}#{params["searchString"]}#{"%" if ["nc", "cn", "bn", "bw"].include?(params["searchOper"])}'"
|
32
|
+
elsif [:integer].include?(self.columns.select {|c| c.name == params["searchField"]}.first.type) && integer_search_operations.keys.include?(params["searchOper"])
|
33
|
+
search_options[:conditions] = "#{params["searchField"]} #{integer_search_operations[params["searchOper"]]} #{params["searchString"]}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
count = self.count(:all, :conditions => search_options[:conditions]).to_f
|
37
|
+
# raise count.inspect
|
38
|
+
array = self.find(:all, search_options).collect {|r| r.attributes }
|
39
|
+
{:total => (count / params["rows"].to_f).ceil, :page => params["page"], :records => count, :rows => array }.to_json
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|