constructor-cms 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6500e3498ffe43b926ab0eb43bf2d66f9dab464b
4
- data.tar.gz: e3ea540cecc0fe31124b53a1cccd2bdef1af0090
3
+ metadata.gz: fb5e74709b0667680cbe9d64656e64539303042e
4
+ data.tar.gz: 44ecb3bc6d364bc1b8b037f70fb6e2d0a5fc2657
5
5
  SHA512:
6
- metadata.gz: efcb9ee149e95df47d25badfb8f09768d2a4e28e58afd1da1b080f5bd1fa56985721e280575f38253c87d781ee8328396f907da31325ea80241ab3bae7f09068
7
- data.tar.gz: 7a781dd453a6ed3e76f04886f3c320835699f92f05dd2d09ce94a379b6810c5d8a76d00d34f372d94b32ee232af72b4e471b5afa4b8cd7b6cfba6f89e8e864ae
6
+ metadata.gz: 00d9a0051d0a77b25116d96935d6985490d943b6d86b85a388f747e39fc5dc084378916585e7c72cd6273575302aab7e42c592d0cbf85d2230f8b97a3a6e86e3
7
+ data.tar.gz: cc215bfa4c31b01f1d4c3d1afe1c7d99f6c9b5c2ea519b3681287f158eedc0795ee6d22f55534777fa5e92a066eddc26ec94ba2e95c4f2aa69f692c9fb53bfe3
@@ -2,6 +2,7 @@
2
2
 
3
3
  module ConstructorCore
4
4
  class ApplicationController < ::ApplicationController
5
+ layout 'constructor_core/application_core'
5
6
  before_filter :authenticate_user!, :except => [:show]
6
7
 
7
8
  helper_method :current_user
@@ -31,10 +31,11 @@
31
31
  %span.icon-bar
32
32
  .nav-collapse
33
33
  %ul.nav
34
- %li
35
- = link_to '/admin/dashboard' do
36
- %i.icon-dashboard
37
- =t :dashboard
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
- %li
47
- = link_to '/admin/users' do
48
- %i.icon-group
49
- =t :users
50
- %li
51
- = link_to '/admin/settings' do
52
- %i.icon-cogs
53
- =t :settings
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 '/admin/help' do
64
+ = link_to 'http://ivanzotov.github.io/constructor/' do
63
65
  %i.icon-question-sign
64
66
  =t :help
65
67
  %li
@@ -1,3 +1,3 @@
1
1
  module ConstructorCore
2
- VERSION = '0.7.2'
2
+ VERSION = '0.7.3'
3
3
  end
@@ -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
- if params[:all].nil?
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
- @pages = @page.descendants.where(:template_id => template.id)
66
-
67
- params_selection.each_pair do |code_name, value|
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
- instance_variable_set('@'+template.code_name.pluralize, @pages)
44
+ @pages = Page.in(@page).by(_params).search(params[:what_search])
84
45
 
85
- render :template => "templates/#{template.code_name}_search"
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 do |name|
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
 
@@ -0,0 +1,10 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title Dummy
5
+ = stylesheet_link_tag 'application', media: 'all'
6
+ = javascript_include_tag 'application'
7
+ = csrf_meta_tags
8
+
9
+ %body
10
+ = yield
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: constructor-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Zotov
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.2
19
+ version: 0.7.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.7.2
26
+ version: 0.7.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: constructor-pages
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.7.2
33
+ version: 0.7.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.7.2
40
+ version: 0.7.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -156,7 +156,7 @@ files:
156
156
  - core/app/views/constructor_core/devise/unlocks/new.html.haml
157
157
  - core/app/views/constructor_core/sessions/new.html.haml
158
158
  - core/app/views/constructor_core/users/profile.haml
159
- - core/app/views/layouts/constructor_core/application.haml
159
+ - core/app/views/layouts/constructor_core/application_core.haml
160
160
  - core/config/environments/production.rb
161
161
  - core/config/initializers/devise.rb
162
162
  - core/config/locales/devise.en.yml
@@ -418,7 +418,7 @@ files:
418
418
  - spec/dummy/app/mailers/.gitkeep
419
419
  - spec/dummy/app/models/.gitkeep
420
420
  - spec/dummy/app/views/html_templates/page.haml
421
- - spec/dummy/app/views/layouts/application.html.erb
421
+ - spec/dummy/app/views/layouts/application.haml
422
422
  - spec/dummy/bin/bundle
423
423
  - spec/dummy/bin/rails
424
424
  - spec/dummy/bin/rake
@@ -484,7 +484,7 @@ test_files:
484
484
  - spec/dummy/app/mailers/.gitkeep
485
485
  - spec/dummy/app/models/.gitkeep
486
486
  - spec/dummy/app/views/html_templates/page.haml
487
- - spec/dummy/app/views/layouts/application.html.erb
487
+ - spec/dummy/app/views/layouts/application.haml
488
488
  - spec/dummy/bin/bundle
489
489
  - spec/dummy/bin/rails
490
490
  - spec/dummy/bin/rake
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>