muck-engine 0.2.16 → 0.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.16
1
+ 0.2.17
@@ -0,0 +1,15 @@
1
+ class HelperController < ApplicationController
2
+
3
+ def load_states_for_country
4
+ country_id = params[:id]
5
+ @states = State.find(:all, :select => 'id, name', :conditions => ["country_id = ?", country_id], :order => "name" )
6
+ label, prompt = Country.build_state_prompts(country_id, true)
7
+ @states.insert(0, State.new(:name => prompt)) if @states.length > 0
8
+ # set cookies so we can remember the last value the user selected
9
+ cookies[:prefered_country_id] = country_id
10
+ respond_to do |format|
11
+ format.js { render :json => {:states => @states, :label => label, :prompt => prompt}.as_json }
12
+ end
13
+ end
14
+
15
+ end
@@ -121,7 +121,7 @@ class MuckCustomFormBuilder < ActionView::Helpers::FormBuilder
121
121
  # creates a select control with languages. Default id is 'languages'. If 'retain' is passed for the class value the value of this
122
122
  # control will be written into a cookie with the key 'languages'.
123
123
  def language_select(method, options = {}, html_options = {}, additional_language = nil)
124
- @languages ||= (additional_country ? [additional_language] : []) + Language.find(:all, :order => 'name asc')
124
+ @languages ||= (additional_language ? [additional_language] : []) + Language.find(:all, :order => 'name asc')
125
125
  self.menu_select(method, I18n.t('muck.engine.choose_language'), @languages, options.merge(:prompt => I18n.t('muck.engine.select_language_prompt'), :wrapper_id => 'languages-container'), html_options.merge(:id => 'languages'))
126
126
  end
127
127
 
@@ -0,0 +1,3 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ map.resources :helper, :controller => 'muck/helper', :collection => { :load_states_for_country => :get }
3
+ end
@@ -0,0 +1,8 @@
1
+ class ActionController::Routing::RouteSet
2
+ def load_routes_with_muck_engine!
3
+ muck_engine_routes = File.join(File.dirname(__FILE__), *%w[.. .. config muck_engine_routes.rb])
4
+ add_configuration_file(muck_engine_routes) unless configuration_files.include? muck_engine_routes
5
+ load_routes_without_muck_engine!
6
+ end
7
+ alias_method_chain :load_routes!, :muck_engine
8
+ end
@@ -681,167 +681,227 @@ class MuckEngine
681
681
  ['Wyoming', 'WY', us_id]
682
682
  ].each {|s| State.create(:name => s[0], :abbreviation => s[1], :country_id => s[2]) unless State.find_by_name(s[0]) }
683
683
 
684
- # TODO figure out the UK
685
- # ireland_id = Country.find_by_abbreviation('IE').id
686
- # channel_islands_id
687
- # [
688
- # ['Aberdeenshire', 'ABD', Scotland],
689
- # ['Anglesey', 'AGY', Wales],
690
- # ['Alderney', 'ALD', channel_islands_id],
691
- # ['Angus', 'ANS', Scotland],
692
- # ['Co. Antrim', 'ANT', Northern ireland_id],
693
- # ['Argyllshire', 'ARL', Scotland],
694
- # ['Co. Armagh', 'ARM', Northern ireland_id],
695
- # ['Avon', 'AVN', England],
696
- # ['Ayrshire', 'AYR', Scotland],
697
- # ['Banffshire', 'BAN', Scotland],
698
- # ['Bedfordshire', 'BDF', England],
699
- # ['Berwickshire', 'BEW', Scotland],
700
- # ['Buckinghamshire', 'BKM', England],
701
- # ['Borders', 'BOR', Scotland],
702
- # ['Breconshire', 'BRE', Wales],
703
- # ['Berkshire', 'BRK', England],
704
- # ['Bute', 'BUT', Scotland],
705
- # ['Caernarvonshire', 'CAE', Wales],
706
- # ['Caithness', 'CAI', Scotland],
707
- # ['Cambridgeshire', 'CAM', England],
708
- # ['Co. Carlow', 'CAR', ireland_id],
709
- # ['Co. Cavan', 'CAV', ireland_id],
710
- # ['Central', 'CEN', Scotland],
711
- # ['Cardiganshire', 'CGN', Wales],
712
- # ['Cheshire', 'CHS', England],
713
- # ['Co. Clare', 'CLA', ireland_id],
714
- # ['Clackmannanshire', 'CLK', Scotland],
715
- # ['Cleveland', 'CLV', England],
716
- # ['Cumbria', 'CMA', England],
717
- # ['Carmarthenshire', 'CMN', Wales],
718
- # ['Cornwall', 'CON', England],
719
- # ['Co. Cork', 'COR', ireland_id],
720
- # ['Cumberland', 'CUL', England],
721
- # ['Clwyd', 'CWD', Wales],
722
- # ['Derbyshire', 'DBY', England],
723
- # ['Denbighshire', 'DEN', Wales],
724
- # ['Devon', 'DEV', England],
725
- # ['Dyfed', 'DFD', Wales],
726
- # ['Dumfries-shire', 'DFS', Scotland],
727
- # ['Dumfries and Galloway', 'DGY', Scotland],
728
- # ['Dunbartonshire', 'DNB', Scotland],
729
- # ['Co. Donegal', 'DON', ireland_id],
730
- # ['Dorset', 'DOR', England],
731
- # ['Co. Down', 'DOW', Northern ireland_id],
732
- # ['Co. Dublin', 'DUB', ireland_id],
733
- # ['Co. Durham', 'DUR', England],
734
- # ['East Lothian', 'ELN', Scotland],
735
- # ['East Riding of Yorkshire', 'ERY', England],
736
- # ['Essex', 'ESS', England],
737
- # ['Co. Fermanagh', 'FER', Northern ireland_id],
738
- # ['Fife', 'FIF', Scotland],
739
- # ['Flintshire', 'FLN', Wales],
740
- # ['Co. Galway', 'GAL', ireland_id],
741
- # ['Glamorgan', 'GLA', Wales],
742
- # ['Gloucestershire', 'GLS', England],
743
- # ['Grampian', 'GMP', Scotland],
744
- # ['Gwent', 'GNT', Wales],
745
- # ['Guernsey', 'GSY', channel_islands_id],
746
- # ['Greater Manchester', 'GTM', England],
747
- # ['Gwynedd', 'GWN', Wales],
748
- # ['Hampshire', 'HAM', England],
749
- # ['Herefordshire', 'HEF', England],
750
- # ['Highland', 'HLD', Scotland],
751
- # ['Hertfordshire', 'HRT', England],
752
- # ['Humberside', 'HUM', England],
753
- # ['Huntingdonshire', 'HUN', England],
754
- # ['Hereford and Worcester', 'HWR', England],
755
- # ['Inverness-shire', 'INV', Scotland],
756
- # ['Isle of Wight', 'IOW', England],
757
- # ['Jersey', 'JSY', channel_islands_id],
758
- # ['Kincardineshire', 'KCD', Scotland],
759
- # ['Kent', 'KEN', England],
760
- # ['Co. Kerry', 'KER', ireland_id],
761
- # ['Co. Kildare', 'KID', ireland_id],
762
- # ['Co. Kilkenny', 'KIK', ireland_id],
763
- # ['Kirkcudbrightshire', 'KKD', Scotland],
764
- # ['Kinross-shire', 'KRS', Scotland],
765
- # ['Lancashire', 'LAN', England],
766
- # ['Co. Londonderry', 'LDY', Northern ireland_id],
767
- # ['Leicestershire', 'LEI', England],
768
- # ['Co. Leitrim', 'LET', ireland_id],
769
- # ['Co. Laois', 'LEX', ireland_id],
770
- # ['Co. Limerick', 'LIM', ireland_id],
771
- # ['Lincolnshire', 'LIN', England],
772
- # ['Lanarkshire', 'LKS', Scotland],
773
- # ['Co. Longford', 'LOG', ireland_id],
774
- # ['Co. Louth', 'LOU', ireland_id],
775
- # ['Lothian', 'LTN', Scotland],
776
- # ['Co. Mayo', 'MAY', ireland_id],
777
- # ['Co. Meath', 'MEA', ireland_id],
778
- # ['Merionethshire', 'MER', Wales],
779
- # ['Mid Glamorgan', 'MGM', Wales],
780
- # ['Montgomeryshire', 'MGY', Wales],
781
- # ['Midlothian', 'MLN', Scotland],
782
- # ['Co. Monaghan', 'MOG', ireland_id],
783
- # ['Monmouthshire', 'MON', Wales],
784
- # ['Morayshire', 'MOR', Scotland],
785
- # ['Merseyside', 'MSY', England],
786
- # ['Nairn', 'NAI', Scotland],
787
- # ['Northumberland', 'NBL', England],
788
- # ['Norfolk', 'NFK', England],
789
- # ['North Riding of Yorkshire', 'NRY', England],
790
- # ['Northamptonshire', 'NTH', England],
791
- # ['Nottinghamshire', 'NTT', England],
792
- # ['North Yorkshire', 'NYK', England],
793
- # ['Co. Offaly', 'OFF', ireland_id],
794
- # ['Orkney', 'OKI', Scotland],
795
- # ['Oxfordshire', 'OXF', England],
796
- # ['Peebles-shire', 'PEE', Scotland],
797
- # ['Pembrokeshire', 'PEM', Wales],
798
- # ['Perth', 'PER', Scotland],
799
- # ['Powys', 'POW', Wales],
800
- # ['Radnorshire', 'RAD', Wales],
801
- # ['Renfrewshire', 'RFW', Scotland],
802
- # ['Ross and Cromarty', 'ROC', Scotland],
803
- # ['Co. Roscommon', 'ROS', ireland_id],
804
- # ['Roxburghshire', 'ROX', Scotland],
805
- # ['Rutland', 'RUT', England],
806
- # ['Shropshire', 'SAL', England],
807
- # ['Selkirkshire', 'SEL', Scotland],
808
- # ['Suffolk', 'SFK', England],
809
- # ['South Glamorgan', 'SGM', Wales],
810
- # ['Shetland', 'SHI', Scotland],
811
- # ['Co. Sligo', 'SLI', ireland_id],
812
- # ['Somerset', 'SOM', England],
813
- # ['Sark', 'SRK', channel_islands_id],
814
- # ['Surrey', 'SRY', England],
815
- # ['Sussex', 'SSX', England],
816
- # ['Strathclyde', 'STD', Scotland],
817
- # ['Stirlingshire', 'STI', Scotland],
818
- # ['Staffordshire', 'STS', England],
819
- # ['Sutherland', 'SUT', Scotland],
820
- # ['East Sussex', 'SXE', England],
821
- # ['West Sussex', 'SXW', England],
822
- # ['South Yorkshire', 'SYK', England],
823
- # ['Tayside', 'TAY', Scotland],
824
- # ['Co. Tipperary', 'TIP', ireland_id],
825
- # ['Tyne and Wear', 'TWR', England],
826
- # ['Co. Tyrone', 'TYR', Northern ireland_id],
827
- # ['Warwickshire', 'WAR', England],
828
- # ['Co. Waterford', 'WAT', ireland_id],
829
- # ['Co. Westmeath', 'WEM', ireland_id],
830
- # ['Westmorland', 'WES', England],
831
- # ['Co. Wexford', 'WEX', ireland_id],
832
- # ['West Glamorgan', 'WGM', Wales],
833
- # ['Co. Wicklow', 'WIC', ireland_id],
834
- # ['Wigtownshire', 'WIG', Scotland],
835
- # ['Wiltshire', 'WIL', England],
836
- # ['Western Isles', 'WIS', Scotland],
837
- # ['West Lothian', 'WLN', Scotland],
838
- # ['West Midlands', 'WMD', England],
839
- # ['Worcestershire', 'WOR', England],
840
- # ['West Riding of Yorkshire', 'WRY', England],
841
- # ['West Yorkshire', 'WYK', England],
842
- # ['Yorkshire', 'YKS', England]
843
- # ].each {|s| State.create(:name => s[0], :abbreviation => s[1], :country_id => s[2]) }
684
+ # The UK
685
+ ireland_id = Country.find_by_abbreviation('IE').id
686
+ #northern_ireland_id = Country.find_by_abbreviation('NIR').id
687
+ scotland_id = Country.find_by_abbreviation('SCT').id
688
+ england_id = Country.find_by_abbreviation('ENG').id
689
+ wales_id = Country.find_by_abbreviation('WAL').id
690
+ #channel_islands_id = Country.find_by_abbreviation('CHI').id
691
+ [
692
+ # Scotland
693
+ #['Aberdeen', 'ABD', scotland_id],
694
+ ['Aberdeenshire', 'ABD', scotland_id],
695
+ ['Angus (Forfarshire)', 'ANS', scotland_id],
696
+ #['Argyllshire', 'ARL', scotland_id],
697
+ ['Argyll', '', scotland_id],
698
+ #['Argyll and Bute', 'BUT', scotland_id],
699
+ ['Ayrshire', 'AYR', scotland_id],
700
+ ['Banffshire', 'BAN', scotland_id],
701
+ ['Berwickshire', 'BEW', scotland_id],
702
+ #['Borders', 'BOR', scotland_id],
703
+ ['Bute', 'BUT', scotland_id],
704
+ ['Caithness', 'CAI', scotland_id],
705
+ #['Central', 'CEN', scotland_id],
706
+ ['Clackmannanshire', 'CLK', scotland_id],
707
+ ['Dumfries-shire', 'DFS', scotland_id],
708
+ #['Dumfries and Galloway', 'DGY', scotland_id],
709
+ ['Dunbartonshire', 'DNB', scotland_id],
710
+ #['Dundee', '', scotland_id],
711
+ #['East Ayrshire', '', scotland_id],
712
+ #['East Dunbartonshire', '', scotland_id],
713
+ ['East Lothian', 'ELN', scotland_id],
714
+ #['East Renfrewshire', '', scotland_id],
715
+ #['Edinburgh', '', scotland_id],
716
+ #['Falkirk', '', scotland_id],
717
+ ['Fife', 'FIF', scotland_id],
718
+ #['Glasgow', '', scotland_id],
719
+ #['Grampian', 'GMP', scotland_id],
720
+ #['Highland', 'HLD', scotland_id],
721
+ ['Inverness-shire', 'INV', scotland_id],
722
+ ['Inverclyde', '', scotland_id],
723
+ ['Kincardineshire', 'KCD', scotland_id],
724
+ ['Kirkcudbrightshire', 'KKD', scotland_id],
725
+ ['Kinross-shire', 'KRS', scotland_id],
726
+ ['Lanarkshire (Glasgow)', 'LKS', scotland_id],
727
+ #['Lothian', 'LTN', scotland_id],
728
+ ['Midlothian (Edinburgh)', 'MLN', scotland_id],
729
+ ['Moray', '', scotland_id],
730
+ #['Morayshire', 'MOR', scotland_id],
731
+ #['North Ayrshire', '', scotland_id],
732
+ #['North Lanarkshire', '', scotland_id],
733
+ #['Nairn', 'NAI', scotland_id],
734
+ ['Nairnshire', 'NAI', scotland_id],
735
+ ['Orkney', 'OKI', scotland_id],
736
+ ['Peeblesshire', 'PEE', scotland_id],
737
+ ['Perthshire', 'PER', scotland_id],
738
+ #['Perth and Kinross', '', scotland_id],
739
+ ['Renfrewshire', 'RFW', scotland_id],
740
+ ['Ross and Cromarty', 'ROC', scotland_id],
741
+ ['Roxburghshire', 'ROX', scotland_id],
742
+ #['Scottish Borders', '', scotland_id],
743
+ ['Selkirkshire', 'SEL', scotland_id],
744
+ ['Shetland', 'SHI', scotland_id],
745
+ #['South Ayrshire', '', scotland_id],
746
+ #['South Lanarkshire', '', scotland_id],
747
+ #['Strathclyde', 'STD', scotland_id],
748
+ #['Stirling', 'STI', scotland_id],
749
+ ['Stirlingshire', 'STI', scotland_id],
750
+ ['Sutherland', 'SUT', scotland_id],
751
+ #['Tayside', 'TAY', scotland_id],
752
+ #['Wigtownshire', 'WIG', scotland_id],
753
+ ['Western Isles', 'WIS', scotland_id],
754
+ #['West Dunbartonshire', '', scotland_id],
755
+ ['West Lothian', 'WLN', scotland_id],
756
+ ['Wigtownshire', '', scotland_id],
757
+
758
+ # Wales
759
+ #['Anglesey', 'AGY', wales_id],
760
+ #['Breconshire', 'BRE', wales_id],
761
+ #['Caernarvonshire', 'CAE', wales_id],
762
+ #['Cardiganshire', 'CGN', wales_id],
763
+ #['Carmarthenshire', 'CMN', wales_id],
764
+ ['Clwyd', 'CWD', wales_id],
765
+ #['Denbighshire', 'DEN', wales_id],
766
+ ['Dyfed', 'DFD', wales_id],
767
+ #['Flintshire', 'FLN', wales_id],
768
+ #['Glamorgan', 'GLA', wales_id],
769
+ ['Gwent', 'GNT', wales_id],
770
+ ['Gwynedd', 'GWN', wales_id],
771
+ #['Merionethshire', 'MER', wales_id],
772
+ ['Mid Glamorgan', 'MGM', wales_id],
773
+ #['Montgomeryshire', 'MGY', wales_id],
774
+ #['Monmouthshire', 'MON', wales_id],
775
+ #['Pembrokeshire', 'PEM', wales_id],
776
+ ['Powys', 'POW', wales_id],
777
+ #['Radnorshire', 'RAD', wales_id],
778
+ ['South Glamorgan', 'SGM', wales_id],
779
+ ['West Glamorgan', 'WGM', wales_id],
780
+
781
+ # Channel Islands
782
+ # ['Alderney', 'ALD', channel_islands_id],
783
+ # ['Guernsey', 'GSY', channel_islands_id],
784
+ # ['Jersey', 'JSY', channel_islands_id],
785
+ # ['Sark', 'SRK', channel_islands_id],
786
+
787
+ # England
788
+ #['Avon', 'AVN', england_id],
789
+ ['Bedfordshire', 'BDF', england_id],
790
+ ['Buckinghamshire', 'BKM', england_id],
791
+ ['Berkshire', 'BRK', england_id],
792
+ ['Bristol', 'BST', england_id],
793
+ ['Cambridgeshire', 'CAM', england_id],
794
+ ['Cheshire', 'CHS', england_id],
795
+ #['Cleveland', 'CLV', england_id],
796
+ ['Cumbria', 'CMA', england_id],
797
+ ['Cornwall', 'CON', england_id],
798
+ #['Cumberland', 'CUL', england_id],
799
+ ['Derbyshire', 'DBY', england_id],
800
+ ['Devon', 'DEV', england_id],
801
+ ['Dorset', 'DOR', england_id],
802
+ ['Durham', 'DUR', england_id],
803
+ ['East Riding of Yorkshire', 'ERY', england_id],
804
+ ['East Sussex', 'SXE', england_id],
805
+ ['Essex', 'ESS', england_id],
806
+ ['Gloucestershire', 'GLS', england_id],
807
+ ['Greater London', '', england_id],
808
+ ['Greater Manchester', 'GTM', england_id],
809
+ ['Hampshire', 'HAM', england_id],
810
+ ['Herefordshire', 'HEF', england_id],
811
+ ['Hertfordshire', 'HRT', england_id],
812
+ #['Humberside', 'HUM', england_id],
813
+ #['Huntingdonshire', 'HUN', england_id],
814
+ #['Hereford and Worcester', 'HWR', england_id],
815
+ ['Isle of Wight', 'IOW', england_id],
816
+ ['Kent', 'KEN', england_id],
817
+ ['Lancashire', 'LAN', england_id],
818
+ ['Leicestershire', 'LEI', england_id],
819
+ ['Lincolnshire', 'LIN', england_id],
820
+ ['London', '', england_id],
821
+ ['Merseyside', 'MSY', england_id],
822
+ ['Northumberland', 'NBL', england_id],
823
+ ['Norfolk', 'NFK', england_id],
824
+ #['North Riding of Yorkshire', 'NRY', england_id],
825
+ ['Northamptonshire', 'NTH', england_id],
826
+ ['Nottinghamshire', 'NTT', england_id],
827
+ ['North Yorkshire', 'NYK', england_id],
828
+ ['Oxfordshire', 'OXF', england_id],
829
+ ['Rutland', 'RUT', england_id],
830
+ ['Shropshire', 'SAL', england_id],
831
+ ['Suffolk', 'SFK', england_id],
832
+ ['Somerset', 'SOM', england_id],
833
+ ['South Yorkshire', 'SYK', england_id],
834
+ ['Surrey', 'SRY', england_id],
835
+ #['Sussex', 'SSX', england_id],
836
+ ['Staffordshire', 'STS', england_id],
837
+ ['Tyne and Wear', 'TWR', england_id],
838
+ ['Warwickshire', 'WAR', england_id],
839
+ #['Westmorland', 'WES', england_id],
840
+ ['West Sussex', 'SXW', england_id],
841
+ ['West Midlands', 'WMD', england_id],
842
+ #['West Riding of Yorkshire', 'WRY', england_id],
843
+ ['West Yorkshire', 'WYK', england_id],
844
+ ['Worcestershire', 'WOR', england_id],
845
+ ['Wiltshire', 'WIL', england_id],
846
+ #['Yorkshire', 'YKS', england_id],
847
+
848
+ # Northern Ireland - Listed under Ireland
849
+ ['Antrim', 'ANT', ireland_id],
850
+ ['Armagh', 'ARM', ireland_id],
851
+ ['Down', 'DOW', ireland_id],
852
+ ['Fermanagh', 'FER', ireland_id],
853
+ ['Londonderry', 'LDY', ireland_id],
854
+ ['Tyrone', 'TYR', ireland_id],
844
855
 
856
+ # Ireland
857
+ ['Carlow', 'CAR', ireland_id],
858
+ ['Cavan', 'CAV', ireland_id],
859
+ ['Clare', 'CLA', ireland_id],
860
+ ['Cork', 'COR', ireland_id],
861
+ ['Donegal', 'DON', ireland_id],
862
+ ['Dublin', 'DUB', ireland_id],
863
+ ['Galway', 'GAL', ireland_id],
864
+ ['Kerry', 'KER', ireland_id],
865
+ ['Kildare', 'KID', ireland_id],
866
+ ['Kilkenny', 'KIK', ireland_id],
867
+ ['Leitrim', 'LET', ireland_id],
868
+ ['Laois', 'LEX', ireland_id],
869
+ ['Limerick', 'LIM', ireland_id],
870
+ ['Longford', 'LOG', ireland_id],
871
+ ['Louth', 'LOU', ireland_id],
872
+ ['Mayo', 'MAY', ireland_id],
873
+ ['Meath', 'MEA', ireland_id],
874
+ ['Monaghan', 'MOG', ireland_id],
875
+ ['Offaly', 'OFF', ireland_id],
876
+ ['Roscommon', 'ROS', ireland_id],
877
+ ['Sligo', 'SLI', ireland_id],
878
+ ['Tipperary', 'TIP', ireland_id],
879
+ ['Waterford', 'WAT', ireland_id],
880
+ ['Westmeath', 'WEM', ireland_id],
881
+ ['Wexford', 'WEX', ireland_id],
882
+ ['Wicklow', 'WIC', ireland_id]
883
+ ].each {|s| State.create(:name => s[0], :abbreviation => s[1], :country_id => s[2]) unless State.find_by_name(s[0]) }
884
+
885
+ # Canadian Provinces
886
+ ca_id = Country.find_by_abbreviation('CA').id
887
+ [
888
+ ['Alberta', 'AB', ca_id],
889
+ ['British Columbia', 'BC', ca_id],
890
+ ['Manitoba', 'MB', ca_id],
891
+ ['New Brunswick', 'NB', ca_id],
892
+ ['Newfoundland and Labrador', 'NL', ca_id],
893
+ ['Northwest Territories', 'NT', ca_id],
894
+ ['Nova Scotia', 'NS', ca_id],
895
+ ['Nunavut', 'NU', ca_id],
896
+ ['Ontario', 'ON', ca_id],
897
+ ['Prince Edward Island', 'PE', ca_id],
898
+ ['Quebec', 'QC', ca_id],
899
+ ['Saskatchewan', 'SK', ca_id],
900
+ ['Yukon Territory', 'YT', ca_id],
901
+ ].each {|s| State.create(:name => s[0], :abbreviation => s[1], :country_id => s[2]) unless State.find_by_name(s[0]) }
902
+
903
+
904
+ # Languages
845
905
  [
846
906
  ['Afar', 'Afaraf', false, 'aa', false],
847
907
  ['Аҧсуа', 'Abkhazian', false, 'ab', false],
@@ -203,6 +203,6 @@ Factory.define :content_permission do |f|
203
203
  f.user {|a| a.association(:user)}
204
204
  end
205
205
 
206
- Factory.define :invite do |f|
206
+ Factory.define :invitee do |f|
207
207
  f.email { Factory.next(:email) }
208
208
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-engine}
8
- s.version = "0.2.16"
8
+ s.version = "0.2.17"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball", "Joel Duffin"]
12
- s.date = %q{2009-11-17}
12
+ s.date = %q{2009-11-30}
13
13
  s.description = %q{The base engine for the muck system. Contains common tables, custom for, css and javascript.}
14
14
  s.email = %q{justin@tatemae.com}
15
15
  s.extra_rdoc_files = [
@@ -23,6 +23,8 @@ Gem::Specification.new do |s|
23
23
  "VERSION",
24
24
  "app/controllers/admin/muck/base_controller.rb",
25
25
  "app/controllers/admin/muck/base_controller.rb",
26
+ "app/controllers/muck/helper_controller.rb",
27
+ "app/controllers/muck/helper_controller.rb",
26
28
  "app/helpers/muck_custom_form_builder.rb",
27
29
  "app/helpers/muck_custom_form_builder.rb",
28
30
  "app/helpers/muck_engine_helper.rb",
@@ -85,6 +87,8 @@ Gem::Specification.new do |s|
85
87
  "app/views/shared/_growl_box.html.erb",
86
88
  "app/views/shared/_no_result.html.erb",
87
89
  "app/views/shared/_no_result.html.erb",
90
+ "config/muck_engine_routes.rb",
91
+ "config/muck_engine_routes.rb",
88
92
  "db/migrate/20090402234137_create_languages.rb",
89
93
  "db/migrate/20090402234137_create_languages.rb",
90
94
  "db/migrate/20090426041056_create_countries.rb",
@@ -98,6 +102,8 @@ Gem::Specification.new do |s|
98
102
  "lib/active_record/muck_model.rb",
99
103
  "lib/muck_engine.rb",
100
104
  "lib/muck_engine.rb",
105
+ "lib/muck_engine/initialize_routes.rb",
106
+ "lib/muck_engine/initialize_routes.rb",
101
107
  "lib/muck_engine/tasks.rb",
102
108
  "lib/muck_engine/tasks.rb",
103
109
  "lib/muck_test_helper.rb",
@@ -51,6 +51,47 @@ function show_hide_obj (ary_objs_to_show, ary_objs_to_hide)
51
51
  }
52
52
  }
53
53
 
54
+ function setup_country(force_load){
55
+
56
+ var country_id = jQuery("#countries").val();
57
+ var state_id = jQuery("#states").val();
58
+
59
+ if (country_id == undefined){
60
+ return;
61
+ }
62
+
63
+ if (country_id == '-1'){
64
+ jQuery("#states").val('-1');
65
+ jQuery("#counties").val('-1');
66
+ }
67
+
68
+ if (country_id == '-1' || country_id == ''){
69
+ jQuery("#states-container").hide();
70
+ jQuery("#counties-container").hide();
71
+ return;
72
+ }
73
+
74
+ if(force_load || state_id == '' || state_id == null || state_id == -1) {
75
+ jQuery.getJSON("/helper/load_states_for_country/" + country_id + ".js", function(data){
76
+ var options = '';
77
+ jQuery("#counties-container").hide();
78
+ jQuery('#states-container label').html(data.label);
79
+ states = data.states;
80
+ if(states.length > 0){
81
+ for (var i = 0; i < states.length; i++) {
82
+ var state_id = states[i].state.id;
83
+ if(state_id == undefined) { state_id = ''; }
84
+ options += '<option value="' + state_id + '">' + states[i].state.name + '</option>';
85
+ }
86
+ jQuery("#states-container").show();
87
+ jQuery("select#states").html(options);
88
+ } else {
89
+ jQuery("#states-container").hide();
90
+ }
91
+ });
92
+ }
93
+ }
94
+
54
95
  jQuery.jGrowl.defaults.position = 'center';
55
96
 
56
97
  jQuery.jGrowl.info = function(msg){
@@ -69,13 +110,18 @@ jQuery(document).ready(function() {
69
110
  jQuery("#global-login").focus(function() {
70
111
  jQuery("#global-login").val("");
71
112
  });
72
-
73
113
  jQuery("#global-password").focus(function() {
74
114
  jQuery("#global-password").val("");
75
115
  });
76
-
77
116
  jQuery("#quick-login-submit").click(function() {
78
117
  jQuery("#quick-login").submit();
79
118
  });
80
119
 
120
+ jQuery("#countries-container select").change(function() {
121
+ setup_country(true);
122
+ });
123
+ if(jQuery("#states").val() == '' || jQuery("#states").val() == null) {
124
+ jQuery("#states-container").hide();
125
+ }
126
+ setup_country(false);
81
127
  });
@@ -14,4 +14,5 @@ else
14
14
  end
15
15
  end
16
16
 
17
- require 'muck_engine'
17
+ require 'muck_engine'
18
+ require 'muck_engine/initialize_routes'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-17 00:00:00 -07:00
13
+ date: 2009-11-30 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -58,6 +58,7 @@ files:
58
58
  - Rakefile
59
59
  - VERSION
60
60
  - app/controllers/admin/muck/base_controller.rb
61
+ - app/controllers/muck/helper_controller.rb
61
62
  - app/helpers/muck_custom_form_builder.rb
62
63
  - app/helpers/muck_engine_helper.rb
63
64
  - app/models/basic_mailer.rb
@@ -89,6 +90,7 @@ files:
89
90
  - app/views/shared/_growl.html.erb
90
91
  - app/views/shared/_growl_box.html.erb
91
92
  - app/views/shared/_no_result.html.erb
93
+ - config/muck_engine_routes.rb
92
94
  - db/migrate/20090402234137_create_languages.rb
93
95
  - db/migrate/20090426041056_create_countries.rb
94
96
  - db/migrate/20090426041103_create_states.rb
@@ -96,6 +98,7 @@ files:
96
98
  - lib/action_controller/muck_application.rb
97
99
  - lib/active_record/muck_model.rb
98
100
  - lib/muck_engine.rb
101
+ - lib/muck_engine/initialize_routes.rb
99
102
  - lib/muck_engine/tasks.rb
100
103
  - lib/muck_test_helper.rb
101
104
  - lib/test/muck_factories.rb