constructor-pages 0.3.3 → 0.4.0
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.
- data/app/controllers/constructor_pages/fields_controller.rb +2 -4
- data/app/controllers/constructor_pages/pages_controller.rb +2 -15
- data/app/controllers/constructor_pages/templates_controller.rb +2 -4
- data/app/helpers/constructor_pages/fields_helper.rb +8 -8
- data/app/views/constructor_pages/fields/_form.haml +2 -3
- data/app/views/constructor_pages/fields/edit.haml +1 -1
- data/app/views/constructor_pages/fields/new.haml +1 -1
- data/app/views/constructor_pages/pages/_form.haml +10 -11
- data/app/views/constructor_pages/pages/edit.haml +1 -1
- data/app/views/constructor_pages/pages/error_404.haml +10 -9
- data/app/views/constructor_pages/pages/index.haml +4 -4
- data/app/views/constructor_pages/pages/new.haml +1 -1
- data/app/views/constructor_pages/templates/_form.haml +7 -8
- data/app/views/constructor_pages/templates/edit.haml +1 -1
- data/app/views/constructor_pages/templates/index.haml +4 -4
- data/app/views/constructor_pages/templates/new.haml +1 -1
- data/config/locales/en.yml +34 -0
- data/config/locales/ru.yml +33 -0
- data/constructor-pages.gemspec +0 -3
- data/lib/constructor-pages.rb +0 -2
- data/spec/models/constructor_pages/page_model_spec.rb +8 -0
- metadata +5 -52
@@ -1,11 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module ConstructorPages
|
4
|
-
class FieldsController < ConstructorCore::
|
5
|
-
# TODO
|
6
|
-
include ConstructorCore::DeviseHelper
|
7
|
-
|
4
|
+
class FieldsController < ConstructorCore::ApplicationController
|
8
5
|
before_filter :authenticate_user!
|
6
|
+
|
9
7
|
layout 'constructor_core/application_admin'
|
10
8
|
|
11
9
|
def new
|
@@ -1,22 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module ConstructorPages
|
4
|
-
class PagesController < ConstructorCore::
|
5
|
-
|
6
|
-
include ConstructorCore::DeviseHelper
|
4
|
+
class PagesController < ConstructorCore::ApplicationController
|
5
|
+
before_filter :authenticate_user!, :except => [:show, :search, :sitemap]
|
7
6
|
|
8
7
|
caches_page :show
|
9
8
|
|
10
|
-
before_filter :authenticate_user!, :except => [:show, :search, :sitemap]
|
11
9
|
before_filter {@roots = Page.roots}
|
12
10
|
layout 'constructor_core/application_admin', :except => [:show, :search, :sitemap]
|
13
11
|
before_filter :cache, :only => [:create, :update, :destroy, :move_up, :move_down]
|
14
12
|
|
15
|
-
# TODO
|
16
|
-
def index
|
17
|
-
@user_signed_in = user_signed_in?
|
18
|
-
end
|
19
|
-
|
20
13
|
def new
|
21
14
|
@page = Page.new
|
22
15
|
@template = Template.first.id
|
@@ -53,9 +46,6 @@ module ConstructorPages
|
|
53
46
|
|
54
47
|
instance_variable_set('@'+@page.template.code_name.to_s, @page)
|
55
48
|
|
56
|
-
@children_of_current_root = @page.root.children
|
57
|
-
@children_of_current_page = @page.children
|
58
|
-
|
59
49
|
respond_to do |format|
|
60
50
|
format.html { render :template => "html_templates/#{@page.template.code_name}" }
|
61
51
|
format.json {
|
@@ -107,9 +97,6 @@ module ConstructorPages
|
|
107
97
|
|
108
98
|
instance_variable_set('@'+template.code_name.pluralize, @pages)
|
109
99
|
|
110
|
-
@children_of_current_root = @page.root.children
|
111
|
-
@children_of_current_page = @page.children
|
112
|
-
|
113
100
|
render :template => "templates/#{template.code_name}_search"
|
114
101
|
end
|
115
102
|
|
@@ -1,11 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module ConstructorPages
|
4
|
-
class TemplatesController < ConstructorCore::
|
5
|
-
# TODO
|
6
|
-
include ConstructorCore::DeviseHelper
|
7
|
-
|
4
|
+
class TemplatesController < ConstructorCore::ApplicationController
|
8
5
|
before_filter :authenticate_user!
|
6
|
+
|
9
7
|
before_filter {@roots = Template.roots}
|
10
8
|
layout 'constructor_core/application_admin'
|
11
9
|
|
@@ -4,14 +4,14 @@ module ConstructorPages
|
|
4
4
|
module FieldsHelper
|
5
5
|
def types_value
|
6
6
|
[
|
7
|
-
[
|
8
|
-
[
|
9
|
-
[
|
10
|
-
[
|
11
|
-
[
|
12
|
-
[
|
13
|
-
[
|
14
|
-
[
|
7
|
+
[t(:string), "string"],
|
8
|
+
[t(:integer), "integer"],
|
9
|
+
[t(:float), "float"],
|
10
|
+
[t(:boolean), "boolean"],
|
11
|
+
[t(:date), "date"],
|
12
|
+
[t(:text), "text"],
|
13
|
+
[t(:html), "html"],
|
14
|
+
[t(:image), "image"]
|
15
15
|
]
|
16
16
|
end
|
17
17
|
end
|
@@ -24,6 +24,5 @@
|
|
24
24
|
.row-fluid
|
25
25
|
.span12
|
26
26
|
.form-actions
|
27
|
-
.btn-
|
28
|
-
|
29
|
-
= link_to "Отмена", edit_template_url(@field.template), :class => "btn"
|
27
|
+
= f.submit :class => "btn btn-primary"
|
28
|
+
= link_to t(:cancel), edit_template_url(@field.template), :class => "btn"
|
@@ -39,13 +39,13 @@
|
|
39
39
|
.accordion
|
40
40
|
.accordion-group
|
41
41
|
.accordion-heading.text-center
|
42
|
-
= link_to
|
42
|
+
= link_to t(:settings), '#collapse', :class => 'accordion-toggle', 'data-toggle' => 'collapse'
|
43
43
|
.accordion-body.in.collapse#collapse
|
44
44
|
.accordion-inner
|
45
45
|
.control-group
|
46
46
|
= f.label :parent, :class => 'control-label'
|
47
47
|
.controls
|
48
|
-
= f.select :parent_id, options_for_select(for_select(@roots), :selected => @page.parent_id, :disabled => @page.self_and_descendants.map{|p| p.id}), :include_blank =>
|
48
|
+
= f.select :parent_id, options_for_select(for_select(@roots), :selected => @page.parent_id, :disabled => @page.self_and_descendants.map{|p| p.id}), :include_blank => t(:no)
|
49
49
|
|
50
50
|
.control-group
|
51
51
|
= f.label :template, :class => 'control-label'
|
@@ -56,24 +56,24 @@
|
|
56
56
|
.controls
|
57
57
|
= f.text_field :link, :class => "span9"
|
58
58
|
.control-group
|
59
|
-
%label.control-label
|
59
|
+
%label.control-label=t :display_in
|
60
60
|
.controls
|
61
61
|
%label.checkbox.inline.span2{:for => 'in_menu'}
|
62
62
|
= f.check_box :in_menu
|
63
|
-
|
63
|
+
=t :menu
|
64
64
|
|
65
65
|
%label.checkbox.inline.span2{:for => 'in_map'}
|
66
66
|
= f.check_box :in_map
|
67
|
-
|
67
|
+
=t :sitemap
|
68
68
|
|
69
69
|
%label.checkbox.inline.span2{:for => 'in_nav'}
|
70
70
|
= f.check_box :in_nav
|
71
|
-
|
71
|
+
=t :breadcrumbs
|
72
72
|
|
73
73
|
.accordion
|
74
74
|
.accordion-group
|
75
75
|
.accordion-heading.text-center
|
76
|
-
= link_to
|
76
|
+
= link_to t(:seo), '#collapse-three', :class => 'accordion-toggle', 'data-toggle' => 'collapse'
|
77
77
|
.accordion-body.in.collapse#collapse-three
|
78
78
|
.accordion-inner
|
79
79
|
.control-group
|
@@ -92,7 +92,6 @@
|
|
92
92
|
.row-fluid
|
93
93
|
.span12
|
94
94
|
.form-actions
|
95
|
-
.btn-
|
96
|
-
|
97
|
-
|
98
|
-
= link_to "Удалить страницу", @page, :confirm => 'Вы уверены?', :method => :delete, :class => "btn btn-danger pull-right" unless @page.new_record?
|
95
|
+
= f.submit :class => "btn btn-primary"
|
96
|
+
= link_to t(:cancel), pages_url, :class => "btn"
|
97
|
+
= link_to t(:delete_page), @page, :confirm => t(:are_you_sure?), :method => :delete, :class => "btn btn-danger pull-right" unless @page.new_record?
|
@@ -3,21 +3,22 @@
|
|
3
3
|
%head
|
4
4
|
%meta{'charset' => 'utf-8'}/
|
5
5
|
%meta{'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1'}/
|
6
|
-
%title
|
6
|
+
%title=t :page_not_found
|
7
7
|
|
8
8
|
= stylesheet_link_tag 'styles'
|
9
9
|
= csrf_meta_tag
|
10
10
|
= favicon_link_tag
|
11
11
|
|
12
|
+
%style
|
13
|
+
body { font-family: 'Arial', sans-serif; }
|
14
|
+
|
12
15
|
%body
|
13
16
|
.b-error-404
|
14
|
-
%h1.b-error-404__h1
|
15
|
-
|
16
|
-
|
17
|
-
%br/
|
18
|
-
или такой страницы на сайте больше не существует.
|
17
|
+
%h1.b-error-404__h1
|
18
|
+
=t :error
|
19
|
+
404
|
19
20
|
%p
|
20
|
-
= link_to
|
21
|
-
|
22
|
-
|
21
|
+
= link_to t(:homepage), '/', :class => "b-error-404__link-home"
|
22
|
+
%br/
|
23
|
+
= link_to t(:sitemap), "/sitemap"
|
23
24
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
- content_for :page_title do
|
2
|
-
|
2
|
+
=t :structure
|
3
3
|
|
4
4
|
- content_for :actions do
|
5
5
|
.span4.clearfix.text-right
|
6
|
-
= link_to "<i class='icon-plus icon-white'></i>".html_safe, pages.new_page_path, :class => "btn btn-
|
6
|
+
= link_to "<i class='icon-plus icon-white'></i> #{t :new_page}".html_safe, pages.new_page_path, :class => "btn btn-large btn-link"
|
7
7
|
|
8
|
-
%section.span8
|
9
|
-
%ul
|
8
|
+
%section.b-tree.span8
|
9
|
+
%ul
|
10
10
|
- @roots.each do |root|
|
11
11
|
- level = root.level
|
12
12
|
- last_page = nil
|
@@ -17,17 +17,17 @@
|
|
17
17
|
.control-group
|
18
18
|
= f.label :parent, :class => 'control-label'
|
19
19
|
.controls
|
20
|
-
= f.select :parent_id, options_for_select(for_select(@roots), :selected => @template.parent_id), :include_blank =>
|
20
|
+
= f.select :parent_id, options_for_select(for_select(@roots), :selected => @template.parent_id), :include_blank => t(:no)
|
21
21
|
|
22
22
|
.control-group
|
23
23
|
= f.label :child, :class => 'control-label'
|
24
24
|
.controls
|
25
|
-
= f.select :child_id, options_for_select(for_select(@roots), :selected => @template.child_id), :include_blank =>
|
25
|
+
= f.select :child_id, options_for_select(for_select(@roots), :selected => @template.child_id), :include_blank => t(:no)
|
26
26
|
|
27
27
|
- unless @template.new_record?
|
28
28
|
.control-group
|
29
29
|
.controls
|
30
|
-
= link_to "<i class='icon-plus icon-white'></i>
|
30
|
+
= link_to "<i class='icon-plus icon-white'></i> #{t :new_field}".html_safe, new_field_path(@template.id), :class => "btn btn-mini btn-link"
|
31
31
|
|
32
32
|
- @template.fields.each do |field|
|
33
33
|
.control-group
|
@@ -37,12 +37,11 @@
|
|
37
37
|
= link_to "<i class='icon-arrow-up'></i>".html_safe, field_move_up_path(field), :class => "btn btn-mini #{"disabled" if field.first?}"
|
38
38
|
|
39
39
|
= link_to "<i class='icon-pencil icon-white'></i>".html_safe, edit_field_path(field, field.template), :class => "btn btn-mini btn-primary"
|
40
|
-
= link_to "<i class='icon-remove icon-white'></i>".html_safe, field_path(field), :method => :delete, :confirm =>
|
40
|
+
= link_to "<i class='icon-remove icon-white'></i>".html_safe, field_path(field), :method => :delete, :confirm => t(:are_you_sure?), :class => "btn btn-mini btn-danger"
|
41
41
|
|
42
42
|
.row-fluid
|
43
43
|
.span12
|
44
44
|
.form-actions
|
45
|
-
.btn-
|
46
|
-
|
47
|
-
|
48
|
-
= link_to "Удалить шаблон", @template, :confirm => 'Вы уверены?', :method => :delete, :class => "btn btn-danger pull-right" unless @template.new_record?
|
45
|
+
= f.submit :class => "btn btn-primary"
|
46
|
+
= link_to t(:cancel), templates_url, :class => "btn"
|
47
|
+
= link_to t(:delete_template), @template, :confirm => t(:are_you_sure?), :method => :delete, :class => "btn btn-danger pull-right" unless @template.new_record?
|
@@ -1,12 +1,12 @@
|
|
1
1
|
- content_for :page_title do
|
2
|
-
|
2
|
+
=t :templates
|
3
3
|
|
4
4
|
- content_for :actions do
|
5
5
|
.span4.clearfix.text-right
|
6
|
-
= link_to '
|
6
|
+
= link_to "<i class='icon-plus icon-white'></i> #{t :new_template}".html_safe, new_template_path, :class => "btn btn-link btn-large"
|
7
7
|
|
8
|
-
%section.span8
|
9
|
-
%ul
|
8
|
+
%section.b-tree.span8
|
9
|
+
%ul
|
10
10
|
- @roots.each do |root|
|
11
11
|
- level = root.level
|
12
12
|
- last_template = nil
|
@@ -0,0 +1,34 @@
|
|
1
|
+
en:
|
2
|
+
structure: 'Structure'
|
3
|
+
templates: 'Templates'
|
4
|
+
settings: 'Settings'
|
5
|
+
new_field: 'New field'
|
6
|
+
edit_field: 'Edit field'
|
7
|
+
seo: 'SEO'
|
8
|
+
display_in: 'Display in'
|
9
|
+
|
10
|
+
string: 'String'
|
11
|
+
integer: 'Integer'
|
12
|
+
float: 'Float'
|
13
|
+
boolean: 'Boolean'
|
14
|
+
date: 'Date'
|
15
|
+
text: 'Text'
|
16
|
+
html: 'HTML'
|
17
|
+
image: 'Image'
|
18
|
+
|
19
|
+
menu: 'Menu'
|
20
|
+
breadcrumbs: 'Breadcrumbs'
|
21
|
+
|
22
|
+
are_you_sure?: 'Are you sure?'
|
23
|
+
|
24
|
+
new_page: 'New page'
|
25
|
+
edit_page: 'Edit page'
|
26
|
+
delete_page: 'Delete page'
|
27
|
+
|
28
|
+
new_template: 'New template'
|
29
|
+
edit_template: 'Edit template'
|
30
|
+
delete_template: 'Delete template'
|
31
|
+
|
32
|
+
new_field: 'New field'
|
33
|
+
|
34
|
+
page_not_found: 'Page not found'
|
data/config/locales/ru.yml
CHANGED
@@ -1,4 +1,37 @@
|
|
1
1
|
ru:
|
2
|
+
structure: 'Структура'
|
3
|
+
templates: 'Шаблоны'
|
4
|
+
settings: 'Настройки'
|
5
|
+
new_field: 'Новое поле'
|
6
|
+
edit_field: 'Редактирование поля'
|
7
|
+
seo: 'Поисковая оптимизация'
|
8
|
+
are_you_sure?: 'Вы уверены?'
|
9
|
+
display_in: 'Отображать в'
|
10
|
+
|
11
|
+
menu: 'Меню'
|
12
|
+
breadcrumbs: 'Хлебные крошки'
|
13
|
+
|
14
|
+
new_page: 'Создать страницу'
|
15
|
+
edit_page: 'Редактирование страницы'
|
16
|
+
delete_page: 'Удалить страницу'
|
17
|
+
|
18
|
+
new_template: 'Создать шаблон'
|
19
|
+
edit_template: 'Редактирование шаблона'
|
20
|
+
delete_template: 'Удалить шаблон'
|
21
|
+
|
22
|
+
new_field: 'Добавить поле'
|
23
|
+
|
24
|
+
string: 'Строка'
|
25
|
+
integer: 'Целое число'
|
26
|
+
float: 'Дробное число'
|
27
|
+
boolean: 'Булево'
|
28
|
+
date: 'Дата'
|
29
|
+
text: 'Текст'
|
30
|
+
html: 'HTML'
|
31
|
+
image: 'Изображение'
|
32
|
+
|
33
|
+
page_not_found: 'Страница не найдена'
|
34
|
+
|
2
35
|
activerecord:
|
3
36
|
attributes:
|
4
37
|
constructor_pages/field:
|
data/constructor-pages.gemspec
CHANGED
@@ -23,9 +23,6 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency 'rack-cache'
|
24
24
|
s.add_dependency 'awesome_nested_set', '~> 2.0'
|
25
25
|
s.add_dependency 'haml-rails'
|
26
|
-
s.add_dependency 'aws-s3'
|
27
|
-
s.add_dependency 'russian', '~> 0.6.0'
|
28
|
-
s.add_dependency 'RedCloth'
|
29
26
|
s.add_dependency 'acts_as_list'
|
30
27
|
|
31
28
|
s.add_development_dependency 'rspec-rails'
|
data/lib/constructor-pages.rb
CHANGED
@@ -97,6 +97,14 @@ module ConstructorPages
|
|
97
97
|
page_two.full_url.should == '/hello/world'
|
98
98
|
end
|
99
99
|
|
100
|
+
it 'should be translit utf-8' do
|
101
|
+
page = Page.create name: 'Проверка'
|
102
|
+
page.full_url.should == '/proverka'
|
103
|
+
|
104
|
+
page_two = Page.create name: 'Тест', parent: page
|
105
|
+
page_two.full_url.should == '/proverka/test'
|
106
|
+
end
|
107
|
+
|
100
108
|
context 'if parent or url has been changed' do
|
101
109
|
it 'should update full_url' do
|
102
110
|
page = Page.create name: 'Change url', url: 'change-url', auto_url: false
|
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.
|
4
|
+
version: 0.4.0
|
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-06-
|
12
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: constructor-core
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.4.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.4.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: dragonfly
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,54 +91,6 @@ dependencies:
|
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: aws-s3
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ! '>='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
102
|
-
type: :runtime
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: russian
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.6.0
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 0.6.0
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: RedCloth
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :runtime
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
94
|
- !ruby/object:Gem::Dependency
|
143
95
|
name: acts_as_list
|
144
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,6 +178,7 @@ files:
|
|
226
178
|
- app/views/constructor_pages/templates/index.haml
|
227
179
|
- app/views/constructor_pages/templates/new.haml
|
228
180
|
- config/initializers/dragonfly.rb
|
181
|
+
- config/locales/en.yml
|
229
182
|
- config/locales/ru.yml
|
230
183
|
- config/routes.rb
|
231
184
|
- constructor-pages.gemspec
|