constructor-core 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/core/app/controllers/constructor_core/application_controller.rb +1 -0
- data/core/app/views/layouts/constructor_core/{application.haml → application_core.haml} +15 -13
- data/core/lib/constructor_core/version.rb +1 -1
- data/pages/app/controllers/constructor_pages/pages_controller.rb +11 -50
- data/pages/app/models/constructor_pages/page.rb +2 -4
- data/spec/dummy/app/views/layouts/application.haml +10 -0
- metadata +4 -4
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9102123bee93e7f71e4d809e57c3bf93feeff872
|
4
|
+
data.tar.gz: 123265b3943235c4082e1faa1d1c5dd3b4b1fbb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b332b5052cc57374fc63452d3ea10c671fa8323ba4d922f5e43e78c243ee05d66badc47c8001a9b41cf4eaf25061e342d093cc0ccd6bafd8cacf3f369fed776
|
7
|
+
data.tar.gz: 6c1330cfcd55d39811a86646046ed879b6cfaab4508c2c0cd4e20303a5e8382700dfbf10a7864f192ffe5156368e0dc9405a94b00fd80146a1566076bde89c7a
|
@@ -31,10 +31,11 @@
|
|
31
31
|
%span.icon-bar
|
32
32
|
.nav-collapse
|
33
33
|
%ul.nav
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
/
|
35
|
+
%li
|
36
|
+
= link_to '/admin/dashboard' do
|
37
|
+
%i.icon-dashboard
|
38
|
+
=t :dashboard
|
38
39
|
%li
|
39
40
|
= link_to '/admin/pages' do
|
40
41
|
%i.icon-sitemap
|
@@ -43,14 +44,15 @@
|
|
43
44
|
= link_to '/admin/templates' do
|
44
45
|
%i.icon-film
|
45
46
|
=t :templates
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
/
|
48
|
+
%li
|
49
|
+
= link_to '/admin/users' do
|
50
|
+
%i.icon-group
|
51
|
+
=t :users
|
52
|
+
%li
|
53
|
+
= link_to '/admin/settings' do
|
54
|
+
%i.icon-cogs
|
55
|
+
=t :settings
|
54
56
|
|
55
57
|
- if current_user
|
56
58
|
%ul.nav.pull-right
|
@@ -59,7 +61,7 @@
|
|
59
61
|
= image_tag gravatar_icon(current_user.email, 48), width: 24, height: 24, class: 'avatar'
|
60
62
|
%span= current_user.email
|
61
63
|
%li
|
62
|
-
= link_to '/
|
64
|
+
= link_to 'http://ivanzotov.github.io/constructor/' do
|
63
65
|
%i.icon-question-sign
|
64
66
|
=t :help
|
65
67
|
%li
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module ConstructorPages
|
4
4
|
class PagesController < ApplicationController
|
5
|
+
layout 'constructor_core/application_core', except: [:show, :search]
|
6
|
+
|
5
7
|
movable :page
|
6
8
|
|
7
9
|
before_filter {@roots, @template_exists = Page.roots, Template.count > 0}
|
@@ -13,84 +15,43 @@ module ConstructorPages
|
|
13
15
|
def new
|
14
16
|
redirect_to pages_path and return unless @template_exists
|
15
17
|
@page, @template_id, @multipart = Page.new, Template.first.id, false
|
16
|
-
|
17
|
-
if params[:page] and (@page.parent = Page.find(params[:page]))
|
18
|
-
@template_id = @page.parent.template.child.id
|
19
|
-
end
|
18
|
+
@template_id = @page.parent.template.child.id if params[:page] and (@page.parent = Page.find(params[:page]))
|
20
19
|
end
|
21
20
|
|
22
21
|
def show
|
23
22
|
@page = Page.find_by_request_or_first("/#{params[:all]}")
|
24
|
-
|
25
23
|
error_404 and return if @page.nil? or !@page.active?
|
26
|
-
|
27
24
|
redirect_to @page.link if @page.redirect?
|
28
|
-
|
29
25
|
_code_name = @page.template.code_name.to_s
|
30
|
-
|
31
26
|
instance_variable_set('@'+_code_name, @page)
|
32
|
-
|
33
27
|
respond_to do |format|
|
34
28
|
format.html { render template: "html_templates/#{_code_name}" }
|
35
29
|
format.json {
|
36
30
|
_template = render_to_string partial: "json_templates/#{_code_name}.json.erb", layout: false, locals: {_code_name.to_sym => @page, page: @page}
|
37
31
|
_js = render_to_string partial: "js_partials/#{_code_name}.js"
|
38
|
-
|
39
32
|
render json: @page, self_and_ancestors: @page.self_and_ancestors.map(&:id), template: _template.gsub(/\n/, '\\\\n'), js: _js
|
40
33
|
}
|
41
34
|
end
|
42
35
|
end
|
43
36
|
|
44
|
-
=begin
|
45
37
|
def search
|
46
|
-
|
47
|
-
@page = Page.first
|
48
|
-
else
|
49
|
-
@request = '/' + params[:all]
|
50
|
-
@page = Page.where(:full_url => @request).first
|
51
|
-
end
|
52
|
-
|
53
|
-
instance_variable_set('@'+@page.template.code_name.to_s, @page)
|
54
|
-
|
55
|
-
what_search = params[:what_search]
|
56
|
-
params_selection = request.query_parameters
|
57
|
-
|
58
|
-
template = Template.find_by_code_name(what_search.singularize)
|
59
|
-
|
60
|
-
if template.nil?
|
61
|
-
render :action => "error_404", :layout => false
|
62
|
-
return
|
63
|
-
end
|
38
|
+
@page = Page.find_by_request_or_first("/#{params[:all]}")
|
64
39
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
if value.numeric?
|
69
|
-
value = value.to_f
|
70
|
-
elsif value.boolean?
|
71
|
-
value = value.to_bool
|
72
|
-
end
|
73
|
-
|
74
|
-
@pages = @pages.select do |page|
|
75
|
-
if code_name == 'name'
|
76
|
-
page.name == value
|
77
|
-
else
|
78
|
-
page.field(code_name) == value
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
40
|
+
_params = request.query_parameters
|
41
|
+
_params.each_pair {|k,v| v || (_params.delete(k); next)
|
42
|
+
_params[k] = v.numeric? ? v.to_f : (v.to_bool if v.boolean?)}
|
82
43
|
|
83
|
-
|
44
|
+
@pages = Page.in(@page).by(_params).search(params[:what_search])
|
84
45
|
|
85
|
-
|
46
|
+
instance_variable_set('@'+@page.template.code_name.pluralize, @pages)
|
47
|
+
instance_variable_set('@'+@page.template.code_name.singularize, @page)
|
48
|
+
render :template => "html_templates/#{@page.template.code_name}_search"
|
86
49
|
end
|
87
|
-
=end
|
88
50
|
|
89
51
|
def edit
|
90
52
|
@page = Page.find(params[:id])
|
91
53
|
@page.template ||= Template.first
|
92
54
|
@template_id = @page.template.id
|
93
|
-
|
94
55
|
@multipart = @page.fields.map{|f| f.type_value == 'image'}.include?(true) ? true : false
|
95
56
|
end
|
96
57
|
|
@@ -39,10 +39,8 @@ module ConstructorPages
|
|
39
39
|
# When missing method Page find field or page in branch with plural and singular code_name so
|
40
40
|
# field and template code_name should be uniqueness for page methods
|
41
41
|
def check_code_name(code_name)
|
42
|
-
[code_name, code_name.pluralize, code_name.singularize].each
|
43
|
-
return false if Page.instance_methods.include?(name.to_sym)
|
44
|
-
end
|
45
|
-
|
42
|
+
[code_name, code_name.pluralize, code_name.singularize].each {|name|
|
43
|
+
return false if Page.instance_methods.include?(name.to_sym)}
|
46
44
|
true
|
47
45
|
end
|
48
46
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constructor-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Zotov
|
@@ -129,7 +129,7 @@ files:
|
|
129
129
|
- core/app/views/constructor_core/devise/unlocks/new.html.haml
|
130
130
|
- core/app/views/constructor_core/sessions/new.html.haml
|
131
131
|
- core/app/views/constructor_core/users/profile.haml
|
132
|
-
- core/app/views/layouts/constructor_core/
|
132
|
+
- core/app/views/layouts/constructor_core/application_core.haml
|
133
133
|
- core/config/environments/production.rb
|
134
134
|
- core/config/initializers/devise.rb
|
135
135
|
- core/config/locales/devise.en.yml
|
@@ -391,7 +391,7 @@ files:
|
|
391
391
|
- spec/dummy/app/mailers/.gitkeep
|
392
392
|
- spec/dummy/app/models/.gitkeep
|
393
393
|
- spec/dummy/app/views/html_templates/page.haml
|
394
|
-
- spec/dummy/app/views/layouts/application.
|
394
|
+
- spec/dummy/app/views/layouts/application.haml
|
395
395
|
- spec/dummy/bin/bundle
|
396
396
|
- spec/dummy/bin/rails
|
397
397
|
- spec/dummy/bin/rake
|
@@ -457,7 +457,7 @@ test_files:
|
|
457
457
|
- spec/dummy/app/mailers/.gitkeep
|
458
458
|
- spec/dummy/app/models/.gitkeep
|
459
459
|
- spec/dummy/app/views/html_templates/page.haml
|
460
|
-
- spec/dummy/app/views/layouts/application.
|
460
|
+
- spec/dummy/app/views/layouts/application.haml
|
461
461
|
- spec/dummy/bin/bundle
|
462
462
|
- spec/dummy/bin/rails
|
463
463
|
- spec/dummy/bin/rake
|