constructor-pages 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: 63ef39f68dac8f72fa5e9d9b4d3b72f7e36f31b3
4
- data.tar.gz: 9336100ad846bcea8c4b95488309f004c1ffd42a
3
+ metadata.gz: a1daae4a216a015ea8fe8addbeef7b38571d5224
4
+ data.tar.gz: 84be5d3d1f1cb825db4d728c1a01e38ef694ffa8
5
5
  SHA512:
6
- metadata.gz: b35eaa007793be95dce5f71cbed6377a126df7d2a89b0121a18d7e59e2aa2d4e59ff9c3328dda439731c3957a499430caf6fc48e82a846a5eb8566460192750a
7
- data.tar.gz: 4be0984e5c783571f4f8fa82d17d14fecb2aeb341da30056ed2a787dba298ae164b6f22ee8a7fb444c3eee4a3786c0f45ff867ad9ba237ca4a9e8550d39baaa1
6
+ metadata.gz: 8b4144c5bba120623c79e18ecbab1fefdd4e212f91b7fffad18d808cdd4faa46a797beecc15f407a6d97a7547ff21058eb8a636a58427688688b0e863f864b47
7
+ data.tar.gz: 6374fc871b07f8e2b0ff637312b8ebd4d50ad1c9b3c35bad2813d7dfee26a90a46cbb62eed03a806f5e5559cc2bfb18370d2addfc4964d5a1078f0663f9679e9
@@ -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-pages
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,14 +16,14 @@ 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: dragonfly
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -199,7 +199,7 @@ files:
199
199
  - core/app/views/constructor_core/devise/unlocks/new.html.haml
200
200
  - core/app/views/constructor_core/sessions/new.html.haml
201
201
  - core/app/views/constructor_core/users/profile.haml
202
- - core/app/views/layouts/constructor_core/application.haml
202
+ - core/app/views/layouts/constructor_core/application_core.haml
203
203
  - core/config/environments/production.rb
204
204
  - core/config/initializers/devise.rb
205
205
  - core/config/locales/devise.en.yml
@@ -461,7 +461,7 @@ files:
461
461
  - spec/dummy/app/mailers/.gitkeep
462
462
  - spec/dummy/app/models/.gitkeep
463
463
  - spec/dummy/app/views/html_templates/page.haml
464
- - spec/dummy/app/views/layouts/application.html.erb
464
+ - spec/dummy/app/views/layouts/application.haml
465
465
  - spec/dummy/bin/bundle
466
466
  - spec/dummy/bin/rails
467
467
  - spec/dummy/bin/rake
@@ -527,7 +527,7 @@ test_files:
527
527
  - spec/dummy/app/mailers/.gitkeep
528
528
  - spec/dummy/app/models/.gitkeep
529
529
  - spec/dummy/app/views/html_templates/page.haml
530
- - spec/dummy/app/views/layouts/application.html.erb
530
+ - spec/dummy/app/views/layouts/application.haml
531
531
  - spec/dummy/bin/bundle
532
532
  - spec/dummy/bin/rails
533
533
  - 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>