constructor-pages 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,6 +52,10 @@ function update_page(href) {
52
52
 
53
53
  update_pages();
54
54
 
55
+ if (typeof Retina != 'undefined') {
56
+ Retina.update();
57
+ }
58
+
55
59
  eval(page.js);
56
60
  });
57
61
  }
@@ -9,8 +9,8 @@ module ConstructorPages
9
9
 
10
10
  validates_uniqueness_of :code_name, :scope => :template_id
11
11
 
12
- after_create :create_page_field
13
- after_destroy :destroy_page_field
12
+ after_create :create_page_fields
13
+ after_destroy :destroy_page_fields
14
14
 
15
15
  belongs_to :template
16
16
 
@@ -29,17 +29,18 @@ module ConstructorPages
29
29
  private
30
30
 
31
31
  def method_uniqueness
32
- if Page.first.respond_to?(code_name.pluralize) \
32
+ if Page.first.respond_to?(code_name) \
33
+ or Page.first.respond_to?(code_name.pluralize) \
33
34
  or Page.first.respond_to?(code_name.singularize) \
34
- or template.self_and_ancestors.map{|t| t.code_name}.include?(code_name.pluralize) \
35
- or template.self_and_ancestors.map{|t| t.code_name}.include?(code_name.singularize) \
36
- or template.descendants.map{|t| t.code_name}.include?(code_name.pluralize) \
37
- or template.descendants.map{|t| t.code_name}.include?(code_name.singularize)
35
+ or template.self_and_ancestors.map{|t| t.code_name unless t.code_name == code_name}.include?(code_name.pluralize) \
36
+ or template.self_and_ancestors.map{|t| t.code_name t.code_name == code_name}.include?(code_name.singularize) \
37
+ or template.descendants.map{|t| t.code_name t.code_name == code_name}.include?(code_name.pluralize) \
38
+ or template.descendants.map{|t| t.code_name t.code_name == code_name}.include?(code_name.singularize)
38
39
  errors.add(:base, "Такой метод уже используется")
39
40
  end
40
41
  end
41
42
 
42
- def create_page_field
43
+ def create_page_fields
43
44
  self.template.pages.each do |page|
44
45
  "constructor_pages/types/#{type_value}_type".classify.constantize.create(
45
46
  :page_id => page.id,
@@ -48,7 +49,7 @@ module ConstructorPages
48
49
  end
49
50
  end
50
51
 
51
- def destroy_page_field
52
+ def destroy_page_fields
52
53
  self.template.pages.each do |page|
53
54
  "constructor_pages/types/#{type_value}_type".classify.constantize.destroy_all(
54
55
  :page_id => page.id,
@@ -18,10 +18,11 @@ module ConstructorPages
18
18
  private
19
19
 
20
20
  def method_uniqueness
21
- if Page.first.respond_to?(code_name.pluralize) \
21
+ if Page.first.respond_to?(code_name) \
22
+ or Page.first.respond_to?(code_name.pluralize) \
22
23
  or Page.first.respond_to?(code_name.singularize) \
23
- or root.descendants.map{|t| t.code_name}.include?(code_name.pluralize) \
24
- or root.descendants.map{|t| t.code_name}.include?(code_name.singularize) \
24
+ or root.descendants.map{|t| t.code_name unless t.code_name == code_name}.include?(code_name.pluralize) \
25
+ or root.descendants.map{|t| t.code_name unless t.code_name == code_name}.include?(code_name.singularize) \
25
26
 
26
27
  errors.add(:base, "Такой метод уже используется")
27
28
  end
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = %q{constructor-pages}
6
- s.version = '0.3.0'
6
+ s.version = '0.3.1'
7
7
  s.summary = %q{Pages for ConstructorCms}
8
8
  s.authors = ['Ivan Zotov']
9
9
  s.require_paths = %w(lib)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: constructor-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-29 00:00:00.000000000 Z
12
+ date: 2013-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dragonfly