fix js bugs
This commit is contained in:
parent
630577658d
commit
1e5624ce06
3
Gemfile
3
Gemfile
@ -20,7 +20,8 @@ gem 'inherited_resources', '~> 1.1.2'
|
|||||||
gem 'rmagick', '2.12.2'
|
gem 'rmagick', '2.12.2'
|
||||||
gem 'locomotive_carrierwave', '0.5.0.1.beta3', :require => 'carrierwave'
|
gem 'locomotive_carrierwave', '0.5.0.1.beta3', :require => 'carrierwave'
|
||||||
|
|
||||||
gem 'custom_fields', '1.0.0.beta.6'
|
# gem 'custom_fields', '1.0.0.beta.7'
|
||||||
|
gem 'custom_fields', '1.0.0.beta.7', :path => '../gems/custom_fields'
|
||||||
gem 'fog', '0.3.7'
|
gem 'fog', '0.3.7'
|
||||||
gem 'mimetype-fu'
|
gem 'mimetype-fu'
|
||||||
gem 'actionmailer-with-request'
|
gem 'actionmailer-with-request'
|
||||||
|
14
Gemfile.lock
14
Gemfile.lock
@ -11,6 +11,14 @@ GIT
|
|||||||
xpath (0.1.2)
|
xpath (0.1.2)
|
||||||
nokogiri (~> 1.4)
|
nokogiri (~> 1.4)
|
||||||
|
|
||||||
|
PATH
|
||||||
|
remote: ../gems/custom_fields
|
||||||
|
specs:
|
||||||
|
custom_fields (1.0.0.beta.7)
|
||||||
|
activesupport (>= 3.0.4)
|
||||||
|
locomotive_carrierwave
|
||||||
|
mongoid (~> 2.0.0.rc.7)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@ -77,10 +85,6 @@ GEM
|
|||||||
cucumber-rails (0.3.2)
|
cucumber-rails (0.3.2)
|
||||||
cucumber (>= 0.8.0)
|
cucumber (>= 0.8.0)
|
||||||
culerity (0.2.15)
|
culerity (0.2.15)
|
||||||
custom_fields (1.0.0.beta.6)
|
|
||||||
activesupport (>= 3.0.4)
|
|
||||||
locomotive_carrierwave
|
|
||||||
mongoid (~> 2.0.0.rc.7)
|
|
||||||
daemons (1.1.0)
|
daemons (1.1.0)
|
||||||
database_cleaner (0.6.6)
|
database_cleaner (0.6.6)
|
||||||
delayed_job (2.1.4)
|
delayed_job (2.1.4)
|
||||||
@ -261,7 +265,7 @@ DEPENDENCIES
|
|||||||
capybara
|
capybara
|
||||||
cucumber (= 0.8.5)
|
cucumber (= 0.8.5)
|
||||||
cucumber-rails
|
cucumber-rails
|
||||||
custom_fields (= 1.0.0.beta.6)
|
custom_fields (= 1.0.0.beta.7)!
|
||||||
database_cleaner
|
database_cleaner
|
||||||
delayed_job (= 2.1.4)
|
delayed_job (= 2.1.4)
|
||||||
delayed_job_mongoid (= 1.0.2)
|
delayed_job_mongoid (= 1.0.2)
|
||||||
|
@ -8,12 +8,23 @@ module Admin::ContentTypesHelper
|
|||||||
@content_types = current_site.content_types.ordered.
|
@content_types = current_site.content_types.ordered.
|
||||||
limit(:contents => Locomotive.config.lastest_items_nb).
|
limit(:contents => Locomotive.config.lastest_items_nb).
|
||||||
only(:name, :slug, :highlighted_field_name, :updated_at).to_a
|
only(:name, :slug, :highlighted_field_name, :updated_at).to_a
|
||||||
|
# only(:name, :slug, :highlighted_field_name, :content_custom_fields_updated_at).to_a
|
||||||
|
|
||||||
if @content_type && @content_type.persisted? && @content_types.index(@content_type) >= MAX_DISPLAYED_CONTENTS
|
if @content_type && @content_type.persisted? && @content_types.index(@content_type) >= MAX_DISPLAYED_CONTENTS
|
||||||
@content_types.delete(@content_type)
|
@content_types.delete(@content_type)
|
||||||
@content_types.insert(0, @content_type)
|
@content_types.insert(0, @content_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# # be sure, we've got the custom klass up-to-date, otherwise it will fail miserably
|
||||||
|
# @content_types.each do |content_type|
|
||||||
|
# # puts "content_type custom_fields !!! ? #{content_type.name} / #{content_type.content_klass.try(:built_at).inspect} / #{content_type.content_custom_fields_updated_at.try(:utc)}"
|
||||||
|
# if content_type.content_klass_out_of_date?
|
||||||
|
# puts "RELOADED #{content_type.name}"
|
||||||
|
# content_type.reload
|
||||||
|
# content_type.invalidate_content_klass
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
@content_types
|
@content_types
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ class ContentType
|
|||||||
## named scopes ##
|
## named scopes ##
|
||||||
scope :ordered, :order_by => :updated_at.desc
|
scope :ordered, :order_by => :updated_at.desc
|
||||||
|
|
||||||
|
|
||||||
## indexes ##
|
## indexes ##
|
||||||
index [[:site_id, Mongo::ASCENDING], [:slug, Mongo::ASCENDING]]
|
index [[:site_id, Mongo::ASCENDING], [:slug, Mongo::ASCENDING]]
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ $(document).ready(function() {
|
|||||||
content: $(link.attr('href')).parent().html(),
|
content: $(link.attr('href')).parent().html(),
|
||||||
padding: 0,
|
padding: 0,
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
$('#fancybox-wrap .actions button[type=submit]').click(function(e) {
|
$('#fancybox-wrap .popup-actions button[type=submit]').click(function(e) {
|
||||||
$.each(attributes, function(index, name) {
|
$.each(attributes, function(index, name) {
|
||||||
var val = domBoxAttrVal(name).trim();
|
var val = domBoxAttrVal(name).trim();
|
||||||
if (val != '') domFieldVal(domField, name, val);
|
if (val != '') domFieldVal(domField, name, val);
|
||||||
@ -148,7 +148,7 @@ $(document).ready(function() {
|
|||||||
field = $.extend({
|
field = $.extend({
|
||||||
behaviour_flag: function() { return options.is_template ? 'template' : 'added' },
|
behaviour_flag: function() { return options.is_template ? 'template' : 'added' },
|
||||||
new_record_flag: function() { return this.new_record == true && options.is_template == false ? 'new' : '' },
|
new_record_flag: function() { return this.new_record == true && options.is_template == false ? 'new' : '' },
|
||||||
errors_flag: function() { return this.errors.length > 0 ? 'error' : '' },
|
errors_flag: function() { return Object.size(this.errors) > 0 ? 'error' : '' },
|
||||||
required_flag: function() { return this.required ? 'required' : ''; },
|
required_flag: function() { return this.required ? 'required' : ''; },
|
||||||
base_name: function() { return options.is_template ? '' : baseInputName + "[" + index + "]"; },
|
base_name: function() { return options.is_template ? '' : baseInputName + "[" + index + "]"; },
|
||||||
base_dom_id: function() { return options.is_template ? 'custom_field_template' : 'custom_field_' + index; },
|
base_dom_id: function() { return options.is_template ? 'custom_field_template' : 'custom_field_' + index; },
|
||||||
|
@ -108,7 +108,7 @@ var SetupCustomFieldCategoryEditor = function(target) {
|
|||||||
category = $.extend({
|
category = $.extend({
|
||||||
behaviour_flag: function() { return options.is_template ? 'template' : 'added' },
|
behaviour_flag: function() { return options.is_template ? 'template' : 'added' },
|
||||||
new_record_flag: function() { return this.new_record == true && options.is_template == false ? 'new' : '' },
|
new_record_flag: function() { return this.new_record == true && options.is_template == false ? 'new' : '' },
|
||||||
errors_flag: function() { return this.errors && this.errors.length > 0 ? 'error' : '' },
|
errors_flag: function() { return this.errors && Object.size(this.errors) > 0 ? 'error' : '' },
|
||||||
base_name: function() { return options.is_template ? '' : baseInputName + "[" + index + "]"; },
|
base_name: function() { return options.is_template ? '' : baseInputName + "[" + index + "]"; },
|
||||||
base_dom_id: function() { return options.is_template ? 'category_template' : 'category_' + index; },
|
base_dom_id: function() { return options.is_template ? 'category_template' : 'category_' + index; },
|
||||||
if_existing_record: function() { return this.new_record == false }
|
if_existing_record: function() { return this.new_record == false }
|
||||||
|
@ -14,3 +14,11 @@ function makeSlug(val, sep) { // code largely inspired by http://www.thewebsitet
|
|||||||
return this.replace(/^\s+/g, '').replace(/\s+$/g, '');
|
return this.replace(/^\s+/g, '').replace(/\s+$/g, '');
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
Object.size = function(obj) {
|
||||||
|
var size = 0, key;
|
||||||
|
for (key in obj) {
|
||||||
|
if (obj.hasOwnProperty(key)) size++;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user