muck-engine 0.4.14 → 0.4.15
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/muck/helper_controller.rb +2 -2
- data/app/models/country.rb +48 -0
- data/app/models/state.rb +2 -0
- data/app/views/forms/{_base_field.html.erb → _base_field.erb} +0 -0
- data/app/views/forms/{_color_picker_field.html.erb → _color_picker_field.erb} +0 -0
- data/app/views/forms/{_default.html.erb → _default.erb} +0 -0
- data/app/views/forms/{_field.html.erb → _field.erb} +0 -0
- data/app/views/forms/{_field_with_tips.html.erb → _field_with_tips.erb} +0 -0
- data/app/views/forms/{_menu_field.html.erb → _menu_field.erb} +0 -0
- data/app/views/forms/{_tips.html.erb → _tips.erb} +0 -0
- data/app/views/shared/{_delete.html.erb → _delete.erb} +0 -0
- data/app/views/shared/{_error_box.html.erb → _error_box.erb} +0 -0
- data/app/views/shared/{_field_error.html.erb → _field_error.erb} +0 -0
- data/app/views/shared/{_flash_error_box.html.erb → _flash_error_box.erb} +0 -0
- data/app/views/shared/{_flash_messages.html.erb → _flash_messages.erb} +0 -0
- data/app/views/shared/{_growl.html.erb → _growl.erb} +0 -0
- data/app/views/shared/{_growl_box.html.erb → _growl_box.erb} +0 -0
- data/app/views/shared/_message_container.erb +5 -0
- data/app/views/shared/{_no_result.html.erb → _no_result.erb} +0 -0
- data/config/muck_engine_routes.rb +2 -1
- data/lib/muck_engine/flash_errors.rb +6 -0
- data/muck-engine.gemspec +18 -31
- data/public/javascripts/muck-countries.js +1 -1
- metadata +19 -32
- data/app/views/forms/_base_field.iphone.erb +0 -11
- data/app/views/forms/_color_picker_field.iphone.erb +0 -27
- data/app/views/forms/_default.iphone.erb +0 -1
- data/app/views/forms/_field.iphone.erb +0 -3
- data/app/views/forms/_field_with_tips.iphone.erb +0 -4
- data/app/views/forms/_menu_field.iphone.erb +0 -4
- data/app/views/forms/_tips.iphone.erb +0 -7
- data/app/views/shared/_delete.iphone.erb +0 -15
- data/app/views/shared/_error_box.iphone.erb +0 -9
- data/app/views/shared/_field_error.iphone.erb +0 -3
- data/app/views/shared/_flash_error_box.iphone.erb +0 -4
- data/app/views/shared/_flash_messages.iphone.erb +0 -7
- data/app/views/shared/_growl.iphone.erb +0 -16
- data/app/views/shared/_growl_box.iphone.erb +0 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.15
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class HelperController < ApplicationController
|
1
|
+
class Muck::HelperController < ApplicationController
|
2
2
|
|
3
3
|
def load_states_for_country
|
4
4
|
country_id = params[:id]
|
@@ -8,7 +8,7 @@ class HelperController < ApplicationController
|
|
8
8
|
# set cookies so we can remember the last value the user selected
|
9
9
|
cookies[:prefered_country_id] = country_id
|
10
10
|
respond_to do |format|
|
11
|
-
format.
|
11
|
+
format.json { render :json => {:states => @states, :label => label, :prompt => prompt}.as_json }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/app/models/country.rb
CHANGED
@@ -10,4 +10,52 @@
|
|
10
10
|
|
11
11
|
class Country < ActiveRecord::Base
|
12
12
|
|
13
|
+
has_many :states
|
14
|
+
|
15
|
+
named_scope :by_name, :order => "name ASC"
|
16
|
+
|
17
|
+
def self.us
|
18
|
+
self.find_by_abbreviation('US')
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.uk_country?(country_id)
|
22
|
+
unless defined?(@@uk_country_ids)
|
23
|
+
uk_countries = Country.find(:all, :conditions => ["abbreviation in (?)", ['ENG', 'IE', 'WAL', 'SCT']])
|
24
|
+
@@uk_country_ids = uk_countries.map(&:id)
|
25
|
+
end
|
26
|
+
@@uk_country_ids.include?(country_id.to_i)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.canada?(country_id)
|
30
|
+
@@canada_id ||= Country.find_by_abbreviation('CA').id
|
31
|
+
@@canada_id == country_id.to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
# Note that the strings from here are also hard coded into application.js
|
35
|
+
def self.build_state_prompts(country_id, any = false)
|
36
|
+
if uk_country?(country_id)
|
37
|
+
label = 'Choose County'
|
38
|
+
if any
|
39
|
+
prompt = 'Any County (or unknown)'
|
40
|
+
else
|
41
|
+
prompt = 'Please select a county'
|
42
|
+
end
|
43
|
+
elsif canada?(country_id)
|
44
|
+
label = 'Choose Province'
|
45
|
+
if any
|
46
|
+
prompt = 'Any Province (or unknown)'
|
47
|
+
else
|
48
|
+
prompt = 'Please select a Province'
|
49
|
+
end
|
50
|
+
else
|
51
|
+
label = 'Choose State'
|
52
|
+
if any
|
53
|
+
prompt = 'Any State (or unknown)'
|
54
|
+
else
|
55
|
+
prompt = 'Please select a state'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
[label, prompt]
|
59
|
+
end
|
60
|
+
|
13
61
|
end
|
data/app/models/state.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,6 @@
|
|
1
1
|
ActionController::Routing::Routes.draw do |map|
|
2
|
-
|
2
|
+
|
3
|
+
map.connect 'load_states_for_country/:id.:format', :controller => 'muck/helper', :action => 'load_states_for_country'
|
3
4
|
|
4
5
|
# admin
|
5
6
|
map.admin '/admin', :controller => 'admin/muck/default', :action => 'index'
|
@@ -30,6 +30,12 @@ class MuckEngine
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
# Output a message container that is hidden by default. This can be used to create html where an
|
34
|
+
# ajax call can drop messages. Just do something like jQuery('#message_id).html('some message');
|
35
|
+
def output_message_container(message_id = 'message_id', css_class = 'notify-box')
|
36
|
+
render :partial => 'shared/message_container', :locals => { :message_id => message_id, :css_class => css_class }
|
37
|
+
end
|
38
|
+
|
33
39
|
# Output a page update that will display messages in the flash
|
34
40
|
def output_admin_messages(fields = nil, title = '', options = { :class => 'notify-box' }, flash_only = false)
|
35
41
|
@fields = fields
|
data/muck-engine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-engine}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.15"
|
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{2010-03-
|
12
|
+
s.date = %q{2010-03-21}
|
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 = [
|
@@ -33,20 +33,13 @@ Gem::Specification.new do |s|
|
|
33
33
|
"app/models/state.rb",
|
34
34
|
"app/views/admin/default/index.html.erb",
|
35
35
|
"app/views/admin/shared/_output_admin_messages.js.erb",
|
36
|
-
"app/views/forms/_base_field.
|
37
|
-
"app/views/forms/
|
38
|
-
"app/views/forms/
|
39
|
-
"app/views/forms/
|
40
|
-
"app/views/forms/
|
41
|
-
"app/views/forms/
|
42
|
-
"app/views/forms/
|
43
|
-
"app/views/forms/_field.iphone.erb",
|
44
|
-
"app/views/forms/_field_with_tips.html.erb",
|
45
|
-
"app/views/forms/_field_with_tips.iphone.erb",
|
46
|
-
"app/views/forms/_menu_field.html.erb",
|
47
|
-
"app/views/forms/_menu_field.iphone.erb",
|
48
|
-
"app/views/forms/_tips.html.erb",
|
49
|
-
"app/views/forms/_tips.iphone.erb",
|
36
|
+
"app/views/forms/_base_field.erb",
|
37
|
+
"app/views/forms/_color_picker_field.erb",
|
38
|
+
"app/views/forms/_default.erb",
|
39
|
+
"app/views/forms/_field.erb",
|
40
|
+
"app/views/forms/_field_with_tips.erb",
|
41
|
+
"app/views/forms/_menu_field.erb",
|
42
|
+
"app/views/forms/_tips.erb",
|
50
43
|
"app/views/layouts/admin.html.erb",
|
51
44
|
"app/views/layouts/admin/_footer.html.erb",
|
52
45
|
"app/views/layouts/admin/_head.html.erb",
|
@@ -62,21 +55,15 @@ Gem::Specification.new do |s|
|
|
62
55
|
"app/views/scripts/_country_scripts.html.erb",
|
63
56
|
"app/views/scripts/_parse_uri.html.erb",
|
64
57
|
"app/views/scripts/_time_scripts.html.erb",
|
65
|
-
"app/views/shared/_delete.
|
66
|
-
"app/views/shared/
|
67
|
-
"app/views/shared/
|
68
|
-
"app/views/shared/
|
69
|
-
"app/views/shared/
|
70
|
-
"app/views/shared/
|
71
|
-
"app/views/shared/
|
72
|
-
"app/views/shared/
|
73
|
-
"app/views/shared/
|
74
|
-
"app/views/shared/_flash_messages.iphone.erb",
|
75
|
-
"app/views/shared/_growl.html.erb",
|
76
|
-
"app/views/shared/_growl.iphone.erb",
|
77
|
-
"app/views/shared/_growl_box.html.erb",
|
78
|
-
"app/views/shared/_growl_box.iphone.erb",
|
79
|
-
"app/views/shared/_no_result.html.erb",
|
58
|
+
"app/views/shared/_delete.erb",
|
59
|
+
"app/views/shared/_error_box.erb",
|
60
|
+
"app/views/shared/_field_error.erb",
|
61
|
+
"app/views/shared/_flash_error_box.erb",
|
62
|
+
"app/views/shared/_flash_messages.erb",
|
63
|
+
"app/views/shared/_growl.erb",
|
64
|
+
"app/views/shared/_growl_box.erb",
|
65
|
+
"app/views/shared/_message_container.erb",
|
66
|
+
"app/views/shared/_no_result.erb",
|
80
67
|
"app/views/shared/page_alert.js.erb",
|
81
68
|
"config/muck_engine_routes.rb",
|
82
69
|
"db/migrate/20090402234137_create_languages.rb",
|
@@ -19,7 +19,7 @@ function setup_country(force_load){
|
|
19
19
|
}
|
20
20
|
|
21
21
|
if(force_load || state_id == '' || state_id == null || state_id == -1) {
|
22
|
-
jQuery.getJSON("/
|
22
|
+
jQuery.getJSON("/load_states_for_country/" + country_id + ".json", function(data){
|
23
23
|
var options = '';
|
24
24
|
jQuery("#counties-container").hide();
|
25
25
|
jQuery('#states-container label').html(data.label);
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 15
|
9
|
+
version: 0.4.15
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Justin Ball
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-03-
|
18
|
+
date: 2010-03-21 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -92,20 +92,13 @@ files:
|
|
92
92
|
- app/models/state.rb
|
93
93
|
- app/views/admin/default/index.html.erb
|
94
94
|
- app/views/admin/shared/_output_admin_messages.js.erb
|
95
|
-
- app/views/forms/_base_field.
|
96
|
-
- app/views/forms/
|
97
|
-
- app/views/forms/
|
98
|
-
- app/views/forms/
|
99
|
-
- app/views/forms/
|
100
|
-
- app/views/forms/
|
101
|
-
- app/views/forms/
|
102
|
-
- app/views/forms/_field.iphone.erb
|
103
|
-
- app/views/forms/_field_with_tips.html.erb
|
104
|
-
- app/views/forms/_field_with_tips.iphone.erb
|
105
|
-
- app/views/forms/_menu_field.html.erb
|
106
|
-
- app/views/forms/_menu_field.iphone.erb
|
107
|
-
- app/views/forms/_tips.html.erb
|
108
|
-
- app/views/forms/_tips.iphone.erb
|
95
|
+
- app/views/forms/_base_field.erb
|
96
|
+
- app/views/forms/_color_picker_field.erb
|
97
|
+
- app/views/forms/_default.erb
|
98
|
+
- app/views/forms/_field.erb
|
99
|
+
- app/views/forms/_field_with_tips.erb
|
100
|
+
- app/views/forms/_menu_field.erb
|
101
|
+
- app/views/forms/_tips.erb
|
109
102
|
- app/views/layouts/admin.html.erb
|
110
103
|
- app/views/layouts/admin/_footer.html.erb
|
111
104
|
- app/views/layouts/admin/_head.html.erb
|
@@ -121,21 +114,15 @@ files:
|
|
121
114
|
- app/views/scripts/_country_scripts.html.erb
|
122
115
|
- app/views/scripts/_parse_uri.html.erb
|
123
116
|
- app/views/scripts/_time_scripts.html.erb
|
124
|
-
- app/views/shared/_delete.
|
125
|
-
- app/views/shared/
|
126
|
-
- app/views/shared/
|
127
|
-
- app/views/shared/
|
128
|
-
- app/views/shared/
|
129
|
-
- app/views/shared/
|
130
|
-
- app/views/shared/
|
131
|
-
- app/views/shared/
|
132
|
-
- app/views/shared/
|
133
|
-
- app/views/shared/_flash_messages.iphone.erb
|
134
|
-
- app/views/shared/_growl.html.erb
|
135
|
-
- app/views/shared/_growl.iphone.erb
|
136
|
-
- app/views/shared/_growl_box.html.erb
|
137
|
-
- app/views/shared/_growl_box.iphone.erb
|
138
|
-
- app/views/shared/_no_result.html.erb
|
117
|
+
- app/views/shared/_delete.erb
|
118
|
+
- app/views/shared/_error_box.erb
|
119
|
+
- app/views/shared/_field_error.erb
|
120
|
+
- app/views/shared/_flash_error_box.erb
|
121
|
+
- app/views/shared/_flash_messages.erb
|
122
|
+
- app/views/shared/_growl.erb
|
123
|
+
- app/views/shared/_growl_box.erb
|
124
|
+
- app/views/shared/_message_container.erb
|
125
|
+
- app/views/shared/_no_result.erb
|
139
126
|
- app/views/shared/page_alert.js.erb
|
140
127
|
- config/muck_engine_routes.rb
|
141
128
|
- db/migrate/20090402234137_create_languages.rb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<%= pre_html %>
|
2
|
-
<% if is_checkbox -%>
|
3
|
-
<%= field_element %>
|
4
|
-
<%= label_element %>
|
5
|
-
<% else -%>
|
6
|
-
<%= label_element %>
|
7
|
-
<%= field_element %>
|
8
|
-
<% end -%>
|
9
|
-
<% if required -%><div id="<%= field_name %>_required" class="required-tip" style="display:none;"><em><%= I18n.t('muck.forms.please_enter_a_value', :label => label_name) %></em></div><% end -%>
|
10
|
-
<% if !hide_control_error && defined? error -%><div class="form_error_message"><%= error %></div><% end -%>
|
11
|
-
<%= extra_html %>
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<% color = value
|
2
|
-
html_id = '_' + id.to_s + '_' + field_name %>
|
3
|
-
<div <%= wrapper_id.nil? ? '' : "id=\"#{wrapper_id}\"" -%> class="form-row color-selector-container">
|
4
|
-
<%= render :partial => 'forms/base_field', :locals => local_assigns %>
|
5
|
-
<div id="colorSelector<%=html_id%>" class="color-selector">
|
6
|
-
<div id="colorSelectorDisplay<%=html_id%>" style="background-color:#<%=color%>;"></div>
|
7
|
-
</div>
|
8
|
-
<script type="text/javascript" language="JavaScript">
|
9
|
-
jQuery(document).ready(function() {
|
10
|
-
jQuery('#colorSelector<%=html_id%>').ColorPicker({
|
11
|
-
color: '#<%=color%>',
|
12
|
-
onShow: function (colpkr) {
|
13
|
-
jQuery(colpkr).fadeIn(100);
|
14
|
-
return false;
|
15
|
-
},
|
16
|
-
onHide: function (colpkr) {
|
17
|
-
jQuery(colpkr).fadeOut(100);
|
18
|
-
return false;
|
19
|
-
},
|
20
|
-
onChange: function (hsb, hex, rgb) {
|
21
|
-
jQuery('#colorSelectorDisplay<%=html_id%>').css('backgroundColor', '#' + hex);
|
22
|
-
jQuery('#<%=field_name%>').val(hex);
|
23
|
-
}
|
24
|
-
});
|
25
|
-
});
|
26
|
-
</script>
|
27
|
-
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= field_element %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<div class="tip-text" style="display:none;"><%= tip %></div>
|
2
|
-
<div class="tip-title" style="display:none;"><%= tip_title || label_name %></div>
|
3
|
-
<div class="tip-position" style="display:none;"><%= tip_position %></div>
|
4
|
-
<% if tip_key -%>
|
5
|
-
<div class="tip-key" style="display:none;"><%= tip_key %></div>
|
6
|
-
<div class="tip-id" style="display:none;"><%= field_name %></div>
|
7
|
-
<% end -%>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<% if button_type == :text -%>
|
2
|
-
<%= link_to( button_text, :url => delete_path, :method => :delete, :html => { :class => 'muck_ajax_delete_control ajax-delete' }) %>
|
3
|
-
<% else -%>
|
4
|
-
<% form_for(delete_object, :url => delete_path, :html => { :class => "ajax delete-form #{form_class}", :method => :delete } ) do |f| -%>
|
5
|
-
<% if button_type == :image -%>
|
6
|
-
<%= image_submit_tag '/images/icons/delete.png', :title => button_text, :width => '15', :height => '15', :alt => button_text, :class => 'muck_ajax_delete_control' %>
|
7
|
-
<% else -%>
|
8
|
-
<%= submit_tag button_text, :title => button_text, :class => 'muck_ajax_delete_control' %>
|
9
|
-
<% end -%>
|
10
|
-
<% end -%>
|
11
|
-
<% end -%>
|
12
|
-
<% unless defined?(@delete_waiting_text_inserted) -%>
|
13
|
-
<div id="muck_ajax_delete_control_message" style="display:none;"><span class="waiting"><%= t('muck.general.deleting') %></span></div>
|
14
|
-
<% @delete_waiting_text_inserted = true -%>
|
15
|
-
<% end -%>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<% if GlobalConfig.growl_enabled -%>
|
2
|
-
<script type="text/javascript">
|
3
|
-
jQuery(document).ready(function() {
|
4
|
-
jQuery('#errorExplanation').hide();
|
5
|
-
var message = jQuery('#errorExplanation').html();
|
6
|
-
var title = jQuery('#errorExplanation h2').html();
|
7
|
-
if(message) {
|
8
|
-
if (jQuery('#field-errors').length > 0){
|
9
|
-
jQuery.jGrowl.error(message, {header:title});
|
10
|
-
} else {
|
11
|
-
jQuery.jGrowl.info(message, {header:title});
|
12
|
-
}
|
13
|
-
}
|
14
|
-
});
|
15
|
-
</script>
|
16
|
-
<% end -%>
|