constructor-pages 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,14 +17,12 @@ function update_pages(){
17
17
  update_page(window.location.href.toString().split(window.location.host)[1]);
18
18
  };
19
19
 
20
- update_page(_href);
20
+ update_page(_href, el);
21
21
  });
22
22
  });
23
23
  }
24
24
 
25
- function update_page(href) {
26
- var _b_page_json = $('.b-page-json');
27
-
25
+ function update_page(href, el) {
28
26
  close_blocks();
29
27
 
30
28
  $.get(href+'.json', function(page){
@@ -41,19 +39,14 @@ function update_page(href) {
41
39
  $('.b-page-part__'+name).html(partials[name]);
42
40
  }
43
41
 
44
- _b_page_json.parent().removeClass('active');
42
+ $("[class*='b-page-json__id-']").removeClass('active');
45
43
 
46
- for (var i in $page.ancestors) {
47
- var ancestor = $page.ancestors[i];
48
- $('.b-page-json__id-'+ancestor).addClass('active');
44
+ for (var i in $page.self_and_ancestors) {
45
+ $('.b-page-json__id-'+$page.self_and_ancestors[i]).addClass('active');
49
46
  }
50
47
 
51
- el.parent().addClass('active');
52
-
53
48
  update_pages();
54
49
 
55
50
  eval(page.js);
56
51
  });
57
-
58
- var el = $('a[href="'+ href +'"]');
59
52
  }
@@ -67,7 +67,7 @@ module ConstructorPages
67
67
  _template = render_to_string :partial => "json_templates/#{@page.template.code_name}.json.erb", :layout => false, :locals => {@page.template.code_name.to_sym => @page, :page => @page}
68
68
  _js = render_to_string :partial => "js_partials/#{@page.template.code_name}.js"
69
69
 
70
- render :json => @page, :ancestors => @page.ancestors.map{|a| a.id}, :template => _template.gsub(/\n/, '\\\\n'), :js => _js
70
+ render :json => @page, :self_and_ancestors => @page.self_and_ancestors.map{|a| a.id}, :template => _template.gsub(/\n/, '\\\\n'), :js => _js
71
71
  }
72
72
  end
73
73
  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.2.4'
6
+ s.version = '0.2.5'
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.2.4
4
+ version: 0.2.5
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-22 00:00:00.000000000 Z
12
+ date: 2013-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dragonfly