new version of custom fields + display error messages for has_one and has_many field types

This commit is contained in:
did 2011-05-20 15:27:07 +02:00
parent 34c5d12ebf
commit e8cdfc4794
5 changed files with 22 additions and 16 deletions

View File

@ -20,8 +20,7 @@ gem 'inherited_resources', '~> 1.1.2'
gem 'rmagick', '2.12.2'
gem 'locomotive_carrierwave', '0.5.0.1.beta3', :require => 'carrierwave'
# gem 'custom_fields', '1.0.0.beta.11'
gem 'custom_fields', :path => '../gems/custom_fields'
gem 'custom_fields', '1.0.0.beta.12'
gem 'fog', '0.3.7'
gem 'mimetype-fu'
gem 'actionmailer-with-request', :require => 'actionmailer_with_request'

View File

@ -1,9 +1,18 @@
GIT
remote: git://github.com/floehopper/mocha.git
revision: f1d182ea33fe08cbc187df90f12013814ae59da8
revision: 7dd9512a874f89b8037d7320fe7988c222f439e1
specs:
mocha (0.9.12.20110213002255)
GIT
remote: git://github.com/locomotivecms/custom_fields.git
revision: 340cb76589e64920a1378a0801cbd28e7029fc2b
specs:
custom_fields (1.0.0.beta.11)
activesupport (>= 3.0.7)
locomotive_carrierwave
mongoid (~> 2.0.1)
GIT
remote: https://github.com/wunderbread/xpath.git
revision: d04da707886287e7dfe82705fda5b3d4f65e94c3
@ -11,14 +20,6 @@ GIT
xpath (0.1.2)
nokogiri (~> 1.4)
PATH
remote: ../gems/custom_fields
specs:
custom_fields (1.0.0.beta.11)
activesupport (>= 3.0.7)
locomotive_carrierwave
mongoid (~> 2.0.1)
GEM
remote: http://rubygems.org/
specs:

View File

@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "nowarning"
s.add_dependency "rails", ">= 3.0.6"
s.add_dependency "rails", ">= 3.0.7"
s.add_dependency "warden"
s.add_dependency "devise", "1.1.3"
s.add_dependency "mongoid", "2.0.1"
@ -37,7 +37,7 @@ Gem::Specification.new do |s|
s.add_dependency "rmagick", "2.12.2"
s.add_dependency "locomotive_carrierwave", "0.5.0.1.beta3"
s.add_dependency "custom_fields", "1.0.0.beta.11"
s.add_dependency "custom_fields", "1.0.0.beta.12"
s.add_dependency "fog", "0.3.7"
s.add_dependency "mimetype-fu"
s.add_dependency "actionmailer-with-request"

View File

@ -80,7 +80,7 @@ $(document).ready(function() {
$('#submenu > ul > li.' + css).addClass('on');
// form
$('.formtastic li input, .formtastic li textarea, .formtastic li code').focus(function() {
$('.formtastic li input, .formtastic li textarea, .formtastic li code, .formtastic li select').focus(function() {
$('.formtastic li.error:not(.code) p.inline-errors').fadeOut(200);
if ($(this).parent().hasClass('error')) {
$(this).nextAll('p.inline-errors').show();

View File

@ -110,6 +110,8 @@ $(document).ready(function() {
registerElementEvents(context, data, domElement);
context.error.hide();
context.list.sortable('refresh');
}
}
@ -119,10 +121,11 @@ $(document).ready(function() {
var context = {
list: wrapper.find('ul'),
empty: wrapper.find('p'),
empty: wrapper.find('p:first'),
template: wrapper.find('script[name=template]').html(),
baseInputName: wrapper.find('script[name=template]').attr('data-base-input-name'),
data: eval(wrapper.find('script[name=data]').html())
data: eval(wrapper.find('script[name=data]').html()),
error: wrapper.parent().find('p.inline-errors')
};
// sortable list
@ -149,6 +152,9 @@ $(document).ready(function() {
addElement(context, data);
}
if (context.error.size() > 0)
context.error.show();
});
};
})(jQuery);