aerogel-pages 1.4.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +14 -0
  6. data/Rakefile +1 -0
  7. data/aerogel-pages.gemspec +26 -0
  8. data/app/helpers/README.md +7 -0
  9. data/app/helpers/decorators.rb +74 -0
  10. data/app/helpers/pages.rb +32 -0
  11. data/app/routes/admin-pages.rb +150 -0
  12. data/app/routes/pages.rb +16 -0
  13. data/assets/javascripts/admin-pages/pages-widget.js.coffee +83 -0
  14. data/assets/javascripts/admin-pages/pane-preview.js.coffee +37 -0
  15. data/assets/javascripts/admin-pages/pane-tree.js.coffee +105 -0
  16. data/assets/javascripts/admin-pages-edit/admin-modal-select.js.coffee +63 -0
  17. data/assets/javascripts/admin-pages-edit/datetime-picker-field.js.coffee +36 -0
  18. data/assets/javascripts/admin-pages-edit/page-blocks.js.coffee +71 -0
  19. data/assets/javascripts/admin-pages-edit/page-content-tabs.js.coffee +40 -0
  20. data/assets/javascripts/admin-pages-utils/attached-footer.js.coffee +62 -0
  21. data/assets/javascripts/admin-pages-utils/autofixed-height.js.coffee +15 -0
  22. data/assets/javascripts/admin-pages-utils/two-pane-widget.js.coffee +78 -0
  23. data/assets/javascripts/aerogel-pages.js.coffee +3 -0
  24. data/assets/javascripts/controllers/admin-pages-edit.js.coffee +33 -0
  25. data/assets/javascripts/controllers/admin-pages.js.coffee +17 -0
  26. data/assets/stylesheets/admin-pages/_admin-pages-alert.css.scss +14 -0
  27. data/assets/stylesheets/admin-pages/_pages-widget.css.scss +113 -0
  28. data/assets/stylesheets/admin-pages/_pane-tree.css.scss +15 -0
  29. data/assets/stylesheets/admin-pages/_preview.css.scss +35 -0
  30. data/assets/stylesheets/admin-pages/_two-pane-widget.css.scss +103 -0
  31. data/assets/stylesheets/admin-pages-common/_admin-modals-select.css.scss +34 -0
  32. data/assets/stylesheets/admin-pages-common/_form-details.css.scss +11 -0
  33. data/assets/stylesheets/admin-pages-common/_nav-tabs.css.scss +6 -0
  34. data/assets/stylesheets/admin-pages-common/_page-blocks.css.scss +18 -0
  35. data/assets/stylesheets/admin-pages-common/_panels.css.scss +11 -0
  36. data/assets/stylesheets/admin-pages-common/_publication-states.css.scss +11 -0
  37. data/assets/stylesheets/admin-pages-common/_smart-links.css.scss +9 -0
  38. data/assets/stylesheets/admin-pages-common/_smart-tree-table-icons.css.scss +42 -0
  39. data/assets/stylesheets/admin-pages-edit/breadcrumbs.css.scss +11 -0
  40. data/assets/stylesheets/admin-pages-edit/form.css.scss +23 -0
  41. data/assets/stylesheets/admin-pages-edit/page-blocks.css.scss +88 -0
  42. data/assets/stylesheets/admin-pages-edit/page-footer.css.scss +21 -0
  43. data/assets/stylesheets/admin-pages-edit/page-header.css.scss +15 -0
  44. data/assets/stylesheets/admin-pages-edit/page.css.scss +30 -0
  45. data/assets/stylesheets/admin-pages-edit/tabs.css.scss +20 -0
  46. data/assets/stylesheets/aerogel-pages.css.scss +20 -0
  47. data/assets/stylesheets/controllers/admin-pages-edit.css.scss +7 -0
  48. data/assets/stylesheets/controllers/admin-pages.css.scss +5 -0
  49. data/assets/stylesheets/pages/_body.css.scss +3 -0
  50. data/assets/stylesheets/pages/_footer.css.scss +13 -0
  51. data/assets/stylesheets/pages/_header.css.scss +5 -0
  52. data/assets/stylesheets/pages/_image.css.scss +18 -0
  53. data/assets/stylesheets/pages/_layout-sticky-footer.css.scss +27 -0
  54. data/assets/stylesheets/pages/_menu.css.scss +45 -0
  55. data/assets/stylesheets/pages/_page-content.css.scss +3 -0
  56. data/assets/vendor/jquery.history.js +1 -0
  57. data/assets/vendor/smart-links.js.coffee +42 -0
  58. data/config/README.md +3 -0
  59. data/config/development/.keep +0 -0
  60. data/config/production/.keep +0 -0
  61. data/db/model/page.rb +137 -0
  62. data/db/model/page_node.rb +43 -0
  63. data/db/model/page_type.rb +15 -0
  64. data/db/model/pages/block.rb +38 -0
  65. data/db/model/pages/blocks/hr.rb +9 -0
  66. data/db/model/pages/blocks/image.rb +16 -0
  67. data/db/model/pages/blocks/pages_list.rb +41 -0
  68. data/db/model/pages/blocks/text.rb +9 -0
  69. data/db/seed/development/.keep +0 -0
  70. data/db/seed/development/01_page_types.seed +8 -0
  71. data/db/seed/development/02_root_page_node.seed +8 -0
  72. data/db/seed/development/03_root_pages.seed +10 -0
  73. data/db/seed/development/04_news_page_node.seed +15 -0
  74. data/db/seed/development/05_news_pages.seed +10 -0
  75. data/db/seed/production/.keep +0 -0
  76. data/db/seed/production/01_page_types.seed +8 -0
  77. data/db/seed/production/02_root_page_node.seed +8 -0
  78. data/db/seed/production/03_root_pages.seed +10 -0
  79. data/db/seed/seed.template +42 -0
  80. data/lib/aerogel/pages/core.rb +37 -0
  81. data/lib/aerogel/pages/traversal.rb +30 -0
  82. data/lib/aerogel/pages/version.rb +5 -0
  83. data/lib/aerogel/pages.rb +19 -0
  84. data/locales/actions.en.yml +11 -0
  85. data/locales/actions.ru.yml +11 -0
  86. data/locales/admin.en.yml +11 -0
  87. data/locales/admin.ru.yml +11 -0
  88. data/locales/models.en.yml +18 -0
  89. data/locales/models.ru.yml +19 -0
  90. data/locales/views.en.yml +38 -0
  91. data/locales/views.ru.yml +39 -0
  92. data/public/README.md +1 -0
  93. data/rake/README.md +3 -0
  94. data/views/admin/pages/_edit_form.html.erb +23 -0
  95. data/views/admin/pages/_page-DISABLED.html.erb +5 -0
  96. data/views/admin/pages/append.html.erb +4 -0
  97. data/views/admin/pages/delete.html.erb +28 -0
  98. data/views/admin/pages/edit/_block.html.erb +16 -0
  99. data/views/admin/pages/edit/_block_header.html.erb +66 -0
  100. data/views/admin/pages/edit/_breadcrumbs.html.erb +13 -0
  101. data/views/admin/pages/edit/_page.html.erb +63 -0
  102. data/views/admin/pages/edit/_page_footer.html.erb +55 -0
  103. data/views/admin/pages/edit/_page_header.html.erb +65 -0
  104. data/views/admin/pages/edit/_page_node.html.erb +79 -0
  105. data/views/admin/pages/edit/block/_default.html.erb +3 -0
  106. data/views/admin/pages/edit/block/_hr.html.erb +5 -0
  107. data/views/admin/pages/edit/block/_image.html.erb +20 -0
  108. data/views/admin/pages/edit/block/_pages_list.html.erb +53 -0
  109. data/views/admin/pages/edit/block/_text.html.erb +3 -0
  110. data/views/admin/pages/edit/select_page.html.erb +59 -0
  111. data/views/admin/pages/edit/select_template.html.erb +50 -0
  112. data/views/admin/pages/edit.html.erb +4 -0
  113. data/views/admin/pages/index/_pane_preview.html.erb +23 -0
  114. data/views/admin/pages/index/_pane_tree.html.erb +50 -0
  115. data/views/admin/pages/index/_pane_tree_tabs.html.erb +26 -0
  116. data/views/admin/pages/index.html.erb +26 -0
  117. data/views/admin/pages/insert.html.erb +4 -0
  118. data/views/admin/pages/preview/_block.html.erb +7 -0
  119. data/views/admin/pages/preview/_breadcrumbs.html.erb +11 -0
  120. data/views/admin/pages/preview/block/_default.html.erb +5 -0
  121. data/views/admin/pages/preview/block/_hr.html.erb +1 -0
  122. data/views/admin/pages/preview/block/_image.html.erb +8 -0
  123. data/views/admin/pages/preview/block/_pages_list.html.erb +14 -0
  124. data/views/admin/pages/preview/block/_text.html.erb +1 -0
  125. data/views/admin/pages/preview.html.erb +30 -0
  126. data/views/admin/table_builder/smart-list-table/_table_column.html.erb +3 -0
  127. data/views/admin/table_builder/smart-list-table/_table_row.html.erb +9 -0
  128. data/views/admin/table_builder/smart-list-table/table.html.erb +10 -0
  129. data/views/admin/table_builder/smart-tree-table/_table_column.html.erb +3 -0
  130. data/views/admin/table_builder/smart-tree-table/_table_row.html.erb +14 -0
  131. data/views/admin/table_builder/smart-tree-table/table.html.erb +10 -0
  132. data/views/admin/tabs_builder/pages-tree-tabs/_tab.html.erb +5 -0
  133. data/views/admin/tabs_builder/pages-tree-tabs/tabs.html.erb +3 -0
  134. data/views/form_builder/admin-pages-edit/field.erb +31 -0
  135. data/views/form_builder/admin-pages-edit/field_datetime.erb +19 -0
  136. data/views/form_builder/admin-pages-edit/field_default.erb +5 -0
  137. data/views/form_builder/admin-pages-edit/field_radio_buttons.erb +22 -0
  138. data/views/form_builder/admin-pages-edit/field_text_addon.erb +17 -0
  139. data/views/form_builder/admin-pages-edit/field_textarea.erb +28 -0
  140. data/views/form_builder/admin-pages-edit/field_title.erb +5 -0
  141. data/views/form_builder/admin-pages-edit/fieldset.erb +4 -0
  142. data/views/form_builder/admin-pages-edit-block/field.erb +31 -0
  143. data/views/form_builder/admin-pages-edit-block/field_default.erb +5 -0
  144. data/views/form_builder/admin-pages-edit-block/field_media-file.erb +60 -0
  145. data/views/form_builder/admin-pages-edit-block/field_media-image.erb +67 -0
  146. data/views/form_builder/admin-pages-edit-block/field_radio_buttons.erb +22 -0
  147. data/views/form_builder/admin-pages-edit-block/field_select_page.erb +34 -0
  148. data/views/form_builder/admin-pages-edit-block/field_select_template.erb +32 -0
  149. data/views/form_builder/admin-pages-edit-block/field_text_inline.erb +5 -0
  150. data/views/form_builder/admin-pages-edit-block/field_textarea.erb +2 -0
  151. data/views/form_builder/admin-pages-edit-block/fieldset.erb +4 -0
  152. data/views/layouts/admin/pages/preview.html.erb +9 -0
  153. data/views/layouts/application.html.erb +62 -0
  154. data/views/layouts/pages/_breadcrumbs.html.erb +20 -0
  155. data/views/layouts/pages/_flashes.html.erb +9 -0
  156. data/views/layouts/pages/_menu.html.erb +37 -0
  157. data/views/layouts/pages/_menu_item.html.erb +15 -0
  158. data/views/layouts/pages/_menu_user.html.erb +8 -0
  159. data/views/pages/_block.html.erb +7 -0
  160. data/views/pages/block/_default.html.erb +5 -0
  161. data/views/pages/block/_hr.html.erb +1 -0
  162. data/views/pages/block/_image.html.erb +8 -0
  163. data/views/pages/block/_pages_list.html.erb +13 -0
  164. data/views/pages/block/_text.html.erb +1 -0
  165. data/views/pages/list/_default.html.erb +7 -0
  166. data/views/pages/list/_table.html.erb +12 -0
  167. data/views/pages/list/_ul.html.erb +7 -0
  168. data/views/pages/view.html.erb +4 -0
  169. metadata +267 -0
@@ -0,0 +1,39 @@
1
+ ru:
2
+ aerogel:
3
+ admin:
4
+ pages:
5
+ views:
6
+ index:
7
+ no_page_selected: Страница не выбрана
8
+
9
+ delete:
10
+ title: Удалить страницу?
11
+ text_no_subpages: |
12
+ <p>
13
+ Вы действительно хотите удалить страницу <b>%{title}</b>?
14
+ </p>
15
+
16
+ text_with_subpages: |
17
+ <p>
18
+ Вы действительно хотите удалить страницу <b>%{title}</b> и <b>%{count}</b>
19
+ её вложенных страниц?
20
+ </p>
21
+
22
+ preview:
23
+ no_content_in_this_language: Страница не имеет содержания на этом языке
24
+
25
+
26
+ edit:
27
+ clear_page_content: Удалить содержимое страницы
28
+ no_content: Нет содержания
29
+ add_content: Добавить содержание
30
+ page_details: Параметры страницы
31
+ no_publication_date: Нет даты публикации
32
+ add_block: Добавить блок
33
+ block:
34
+ details: Параметры
35
+ text: Текст
36
+ image: Картинка
37
+ hr: HR
38
+ pages_list: "Страницы: Список"
39
+
data/public/README.md ADDED
@@ -0,0 +1 @@
1
+ A place for static files.
data/rake/README.md ADDED
@@ -0,0 +1,3 @@
1
+ A place for module rake tasks.
2
+
3
+ *.rake files found in this folder are included into an end application's Rakefile
@@ -0,0 +1,23 @@
1
+ <% assets 'controllers/admin-pages-edit' %>
2
+ <div class="page-edit-form">
3
+
4
+ <%= partial "admin/pages/edit/breadcrumbs" %>
5
+
6
+ <% form @page_node,
7
+ cancel_url: "/admin/pages/#{@lang}-#{@selected_page_node.id}",
8
+ current_lang: @lang,
9
+ multipart: true,
10
+ html_params: { novalidate: true } do
11
+ %>
12
+
13
+ <%= partial "admin/pages/edit/page_node", scope: self, locals: { form_builder: self, object: object } %>
14
+
15
+ <div class="form-buttons">
16
+ <div class="container">
17
+ <%= button :cancel, url: options[:cancel_url] %>
18
+ <%= button :save %>
19
+ </div>
20
+ </div>
21
+ <% end %>
22
+
23
+ </div>
@@ -0,0 +1,5 @@
1
+ <tr data-id="<%= page.id %>" data-parent-id="<%= page.parent_id %>">
2
+ <td><div class="drag-handle"><%= icon 'fa-arrows-v' %></div></td>
3
+ <td></td>
4
+ <td><%= page.name %></td>
5
+ </tr>
@@ -0,0 +1,4 @@
1
+
2
+ <% page_title t.aerogel.admin.pages.append %>
3
+
4
+ <%= partial 'admin/pages/edit_form' %>
@@ -0,0 +1,28 @@
1
+ <% page_title t.aerogel.admin.pages.views.delete.title %>
2
+
3
+ <% form @page_node,
4
+ action: "/admin/pages/#{@lang}-#{@page_node.id}/delete",
5
+ cancel_url: "/admin/pages/#{@lang}-#{@page_node.id}",
6
+ lang: @lang do
7
+ %>
8
+
9
+ <% subpages_count = object.descendants.count %>
10
+ <% if subpages_count == 0 %>
11
+ <%= t.aerogel.admin.pages.views.delete.text_no_subpages(
12
+ title: admin_pages_title_as_text( object, options[:lang] )
13
+ )
14
+ %>
15
+ <% else %>
16
+ <%= t.aerogel.admin.pages.views.delete.text_with_subpages(
17
+ title: admin_pages_title_as_text( object, options[:lang] ),
18
+ count: subpages_count
19
+ )
20
+ %>
21
+ <% end %>
22
+
23
+ <p class="alert alert-warning">
24
+ <%= icon_warning %> <%= t.aerogel.admin.warning_permanent_action %>
25
+ </p>
26
+ <%= button :cancel, url: options[:cancel_url] %>
27
+ <%= button :danger_submit, label: t.aerogel.admin.pages.delete %>
28
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <div class="page-block id-<%= self.object.id %>">
2
+ <%= field :_destroy, as: :hidden, class: 'marked-for-removal' %>
3
+ <%= field :_type, as: :hidden %>
4
+ <%= field :position, as: :hidden, class: 'page-block-position' %>
5
+
6
+ <%= partial "admin/pages/edit/block_header", scope: self, locals: { type: type } %>
7
+
8
+ <%=
9
+ begin
10
+ partial "admin/pages/edit/block/#{type}", scope: self
11
+ rescue Errno::ENOENT
12
+ partial "admin/pages/edit/block/default", scope: self
13
+ end
14
+ %>
15
+
16
+ </div>
@@ -0,0 +1,66 @@
1
+ <!-- .header -->
2
+ <div class="header closed" style="display:none">
3
+ <span class="header-label">
4
+ <a href="#" class="smart-link"
5
+ data-show-id=".page-block.id-<%= self.object.id %> .header.open, .page-block.id-<%= self.object.id %> .content"
6
+ data-hide-id=".page-block.id-<%= self.object.id %> .header.closed"
7
+ data-effect="slide"
8
+ >
9
+ <%= icon 'fa-chevron-right' %><span class="type"><%=
10
+ t type, scope: 'aerogel.admin.pages.views.edit.block'
11
+ %></span>
12
+ <span class="preview">...</span>
13
+ </a>
14
+ </span>
15
+ </div>
16
+
17
+ <div class="header open">
18
+ <span class="header-label">
19
+ <a href="#" class="smart-link"
20
+ data-hide-id=".page-block.id-<%= self.object.id %> .header.open, .page-block.id-<%= self.object.id %> .content"
21
+ data-show-id=".page-block.id-<%= self.object.id %> .header.closed"
22
+ data-effect="slide"
23
+ >
24
+ <%= icon 'fa-chevron-down' %><span class="type"><%=
25
+ t type, scope: 'aerogel.admin.pages.views.edit.block'
26
+ %></span>
27
+ </a>
28
+ </span>
29
+
30
+ <% if self.object.has_details? %>
31
+ <% details_expanded = !self.valid? %>
32
+ <span class="header-label delimiter">
33
+ &nbsp;
34
+ </span>
35
+ <span class="header-label header-details closed" <%= details_expanded ? 'style="display:none"' : '' %> >
36
+ <a href="#" class="smart-link"
37
+ data-show-id=".page-block.id-<%= self.object.id %> .header-details.open, .page-block.id-<%= self.object.id %> .details"
38
+ data-hide-id=".page-block.id-<%= self.object.id %> .header-details.closed"
39
+ data-effect="slide"
40
+ >
41
+ <%= icon 'fa-chevron-right' %><span class="type"><%=
42
+ t.aerogel.admin.pages.views.edit.block.details
43
+ %></span>
44
+ </a>
45
+ </span>
46
+ <span class="header-label header-details open" <%= details_expanded ? '' : 'style="display:none"' %> >
47
+ <a href="#" class="smart-link"
48
+ data-hide-id=".page-block.id-<%= self.object.id %> .header-details.open, .page-block.id-<%= self.object.id %> .details"
49
+ data-show-id=".page-block.id-<%= self.object.id %> .header-details.closed"
50
+ data-effect="slide"
51
+ >
52
+ <%= icon 'fa-chevron-down' %><span class="type"><%=
53
+ t.aerogel.admin.pages.views.edit.block.details
54
+ %></span>
55
+ </a>
56
+ </span>
57
+ <% end %>
58
+
59
+ <button type="button" class="btn-block-delete smart-link" title="Delete block"
60
+ data-hide-id=".page_block.id-<%= self.object.id %>"
61
+ data-effect="slide"
62
+ >
63
+ <%= icon 'fa-times' %>
64
+ </button>
65
+ </div>
66
+ <!-- /.header -->
@@ -0,0 +1,13 @@
1
+ <ol class="breadcrumb">
2
+ <% @page_node.parent.ancestors_and_self.sort_by(&:depth).each do |p| %>
3
+
4
+ <li>
5
+ <%= render_once :home, icon('fa-home') %>
6
+ <%= admin_pages_title_as_icon_and_text p, @lang %>
7
+ </li>
8
+ <% end if @page_node.parent.present? %>
9
+ <li>
10
+ <%= icon 'fa-file-text-o' %>
11
+ <%= @page_node.page_type.try(:name) %>
12
+ </li>
13
+ </ol>
@@ -0,0 +1,63 @@
1
+ <div class="page-empty page-empty-<%= page.lang %>" style="display:none" >
2
+ <div class="message">
3
+ <%= t.aerogel.admin.pages.views.edit.no_content %>
4
+ </div>
5
+ <div class="button">
6
+ <a href="#" class="btn btn-default add-page-content-link" data-lang="<%= page.lang %>">
7
+ <%= icon 'fa-plus' %> <%= t.aerogel.admin.pages.views.edit.add_content %>
8
+ </a>
9
+ </div>
10
+ </div>
11
+
12
+ <div class="page page-<%= page.lang %>" data-lang="<%= page.lang %>">
13
+
14
+ <% fieldset page,
15
+ parent: form_builder,
16
+ name: :pages,
17
+ object_index: page.lang do
18
+ %>
19
+
20
+ <%= field :_destroy, as: :hidden, class: 'marked-for-removal' %>
21
+ <%= field :lang, as: :hidden %>
22
+
23
+ <div class="title">
24
+ <%= field :title, as: :title, style: 'admin-pages-edit', required: false %>
25
+ </div>
26
+
27
+
28
+
29
+ <div class="page-header">
30
+ <%= partial "admin/pages/edit/page_header",
31
+ scope: self,
32
+ locals: {
33
+ page_node: page_node,
34
+ page: page,
35
+ object: object,
36
+ form_builder: self
37
+ }
38
+ %>
39
+ </div>
40
+
41
+ <div class="page-blocks">
42
+ <% fieldset :page_blocks, style: 'admin-pages-edit-block' do %>
43
+ <%= partial "admin/pages/edit/block",
44
+ scope: self,
45
+ locals: { type: self.object.type }
46
+ %>
47
+ <!-- %= field :content, as: :textarea % -->
48
+ <% end %>
49
+ </div>
50
+
51
+ <div class="page-footer">
52
+ <%= partial "admin/pages/edit/page_footer",
53
+ scope: self,
54
+ locals: {
55
+ page_node: page_node,
56
+ page: self.object
57
+ }
58
+ %>
59
+ </div>
60
+
61
+ <% end %>
62
+
63
+ </div>
@@ -0,0 +1,55 @@
1
+ <% collapsed = true %>
2
+
3
+ <!-- .header.closed -->
4
+ <div class="header closed" <%= collapsed ? "" : "style='display:none'" %> >
5
+ <a href="#" class="smart-link"
6
+ data-show-id=".page-<%= page.lang %> .page-footer .header.open, .page-<%= page.lang %> .page-footer .content"
7
+ data-hide-id=".page-<%= page.lang %> .page-footer .header.closed"
8
+ data-effect="slide"
9
+ >
10
+ <%= icon 'fa-plus' -%><span class="header-label"><%=
11
+ t.aerogel.admin.pages.views.edit.add_block
12
+ %></span>
13
+ </a>
14
+ </div>
15
+ <!-- /.header.closed -->
16
+
17
+
18
+ <div class="content" <%= collapsed ? "style='display:none'" : "" %> >
19
+ <ul class="block-creators">
20
+ <% page.available_block_types.each do |block_type| %>
21
+ <li>
22
+ <a href="#" class="btn-block-create smart-link"
23
+ data-lang="<%= page.lang %>"
24
+ data-type="<%= block_type %>"
25
+ data-page-node-id="<%= page_node.id %>"
26
+ data-page-id="<%= page.id %>"
27
+ data-show-id=".page-<%= page.lang %> .page-footer .header.closed"
28
+ data-hide-id=".page-<%= page.lang %> .page-footer .header.open, .page-<%= page.lang %> .page-footer .content"
29
+ data-effect="slide"
30
+
31
+ >
32
+ <%= icon 'fa-plus' %>
33
+ <span class="block-creator-label"><%=
34
+ t block_type, scope: 'aerogel.admin.pages.views.edit.block'
35
+ %></span>
36
+ </a>
37
+ </li>
38
+ <% end %>
39
+ </ul>
40
+ </div>
41
+ <!-- /.content -->
42
+
43
+ <!-- .header.open -->
44
+ <div class="header open" <%= collapsed ? "style='display:none'" : "" %> >
45
+ <a href="#" class="smart-link"
46
+ data-show-id=".page-<%= page.lang %> .page-footer .header.closed"
47
+ data-hide-id=".page-<%= page.lang %> .page-footer .header.open, .page-<%= page.lang %> .page-footer .content"
48
+ data-effect="slide"
49
+ >
50
+ <%= icon 'fa-chevron-up' -%><span class="header-label"><%=
51
+ t.aerogel.admin.pages.views.edit.add_block
52
+ %></span>
53
+ </a>
54
+ </div>
55
+ <!-- /.header -->
@@ -0,0 +1,65 @@
1
+ <% collapsed = page.errors.blank? && page.persisted? %>
2
+
3
+ <!-- .header -->
4
+ <div class="header closed" <%= collapsed ? "" : "style='display:none'" %> >
5
+ <a href="#" class="smart-link"
6
+ data-show-id=".page-<%= page.lang %> .page-header .header.open, .page-<%= page.lang %> .page-header .content"
7
+ data-hide-id=".page-<%= page.lang %> .page-header .header.closed"
8
+ data-effect="slide"
9
+ >
10
+ <%= icon 'fa-chevron-right' -%><span class="header-label"><%=
11
+ txt = admin_pages_publication_state_as_icon( page_node, page.lang )
12
+ txt.present? ? txt+" " : ''
13
+ -%><%=
14
+ l page.published_at.try(:to_date),
15
+ format: :long,
16
+ default: t.aerogel.admin.pages.views.edit.no_publication_date
17
+ -%>
18
+ </span>
19
+ </a>
20
+ </div>
21
+
22
+ <div class="header open" <%= collapsed ? "style='display:none'" : "" %> >
23
+ <a href="#" class="smart-link"
24
+ data-show-id=".page-<%= page.lang %> .page-header .header.closed"
25
+ data-hide-id=".page-<%= page.lang %> .page-header .header.open, .page-<%= page.lang %> .page-header .content"
26
+ data-effect="slide"
27
+ >
28
+ <%= icon 'fa-chevron-down' -%><span class="header-label"><%=
29
+ t.aerogel.admin.pages.views.edit.page_details %>
30
+ </span>
31
+ </a>
32
+ </div>
33
+ <!-- /.header -->
34
+
35
+ <div class="content" <%= collapsed ? "style='display:none'" : "" %> >
36
+ <div class="row">
37
+ <div class="col-sm-5">
38
+ <%= field :published_at, as: :datetime, style: 'admin-pages-edit' %>
39
+ </div>
40
+ <div class="col-sm-7">
41
+ <%= field :publication_state, as: :radio_buttons, style: 'admin-pages-edit',
42
+ values:%w(published hidden not_published),
43
+ labels:[
44
+ icon('fa-check')+' published',
45
+ icon('fa-eye')+' hidden',
46
+ icon('fa-times')+' not published'
47
+ ],
48
+ required: true
49
+
50
+ %>
51
+ </div>
52
+ </div>
53
+
54
+ <%= field :link, as: :text_addon, style: 'admin-pages-edit', required: false,
55
+ prefix: (
56
+ admin_pages_url_as_text( page_node.parent, page.lang )+" /"
57
+ )
58
+ %>
59
+
60
+ <%= field :html_description, as: :textarea, style: 'admin-pages-edit', collapsible: true %>
61
+ <%= field :html_keywords, as: :textarea, style: 'admin-pages-edit', collapsible: true %>
62
+
63
+ </div>
64
+ <!-- /.content -->
65
+
@@ -0,0 +1,79 @@
1
+ <%= field :parent_id, as: :hidden %>
2
+ <%= field :page_type_id, as: :hidden %>
3
+
4
+ <div class="page-toolbar">
5
+
6
+ <ul class="nav nav-tabs">
7
+ <% Page.available_langs.each do |lang| %>
8
+ <li <%= options[:current_lang].to_s == lang.to_s ? 'class="active"' : '' %>>
9
+ <a href="#<%= lang %>" data-toggle="tab">
10
+ <% if object.page( lang ).present? %>
11
+ <% if object.page( lang ).errors.present? %>
12
+ <span class="present has-error">
13
+ <%= icon 'fa-warning' %> <%= lang %>
14
+ </span>
15
+ <% else %>
16
+ <span class="present">
17
+ <%= lang %>
18
+ </span>
19
+ <% end %>
20
+ <% else %>
21
+ <span class="empty">
22
+ <%= lang %>
23
+ </span>
24
+ <% end %>
25
+ </a>
26
+ </li>
27
+ <% end %>
28
+
29
+ <li class="dropdown pull-right">
30
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
31
+ <%= icon 'fa-cog' %> <span class="caret"></span>
32
+ </a>
33
+ <ul class="dropdown-menu">
34
+ <li>
35
+ <a href="#" class="clear-page-content-link">
36
+ <%= t.aerogel.admin.pages.views.edit.clear_page_content %>
37
+ </a>
38
+ </li>
39
+ </ul>
40
+ </li>
41
+
42
+ </ul>
43
+
44
+ </div>
45
+
46
+
47
+ <!-- Tab panes -->
48
+ <div class="tab-content page-tabs">
49
+ <% Page.available_langs.each do |lang| %>
50
+ <%
51
+ page = object.page(lang)
52
+ unless page.present?
53
+ page = object.pages.new( lang: lang )
54
+ unless options[:current_lang].to_s == lang.to_s
55
+ %>
56
+ <script type="text/javascript">
57
+ $(function(){
58
+ // сlear empty page content panes
59
+ page_clear('<%= lang %>');
60
+ });
61
+ </script>
62
+ <% end
63
+ end
64
+ %>
65
+ <div class="tab-pane <%= options[:current_lang].to_s == lang.to_s ? 'active' : '' %>"
66
+ id="<%= lang %>"
67
+ >
68
+ <%= partial "admin/pages/edit/page",
69
+ scope: self,
70
+ locals: {
71
+ page_node: object,
72
+ page: page,
73
+ object: object,
74
+ form_builder: self
75
+ }
76
+ %>
77
+ </div>
78
+ <% end %>
79
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="content">
2
+ UNKNOWN BLOCK TYPE: '<%= self.object.type %>'
3
+ </div>
@@ -0,0 +1,5 @@
1
+ <div class="content">
2
+ <div style="border-top: 1px solid black">
3
+ &nbsp;
4
+ </div>
5
+ </div>
@@ -0,0 +1,20 @@
1
+ <div class="content">
2
+ <div class="row">
3
+ <div class="col-sm-6">
4
+ <%= field :image %>
5
+ <%= field :name, as: :text_inline %>
6
+ </div>
7
+ <div class="col-sm-6">
8
+ <%=
9
+ field :alignment, as: :radio_buttons, required: true,
10
+ values: [:left, :middle, :right],
11
+ labels: [
12
+ icon('glyphicon-picture')+' '+icon('fa-align-justify'),
13
+ icon('glyphicon-picture'),
14
+ icon('fa-align-justify')+' '+icon('glyphicon-picture')
15
+ ]
16
+ %>
17
+ <%= field :thumb, as: :text_inline %>
18
+ </div>
19
+ </div>
20
+ </div>
@@ -0,0 +1,53 @@
1
+ <%
2
+ details_expanded = !self.valid?
3
+ current_lang = self.object.lang
4
+ %>
5
+ <div class="details form-inline" <%= details_expanded ? '' : 'style="display:none"' %> >
6
+ <div class="row">
7
+ <div class="col-sm-6">
8
+ <label>
9
+ Show pages from
10
+ </label>
11
+ <%= field :target_page_node_id, as: :select_page, lang: current_lang, placeholder: "This page" %>
12
+ </div>
13
+ <div class="col-sm-6">
14
+ <%= field :show_hidden, as: :radio_buttons,
15
+ values: [true, false],
16
+ labels: ['published & hidden', 'only published'],
17
+ required: true
18
+ %>
19
+ <%= field :limit, as: :text_inline, width: '30px' %>
20
+ </div>
21
+ </div>
22
+ <div class="form-row">
23
+ <label>
24
+ Order by
25
+ </label>
26
+ <%= field :ordered_by, as: :radio_buttons,
27
+ values:[:position, :published_at, :updated_at],
28
+ labels:['position', 'published at', 'updated at'],
29
+ required: true
30
+ %>
31
+ <%= field :ordered_asc, as: :radio_buttons,
32
+ values:[:asc, :desc],
33
+ labels:[ icon('fa-chevron-up'), icon('fa-chevron-down') ],
34
+ required: true
35
+ %>
36
+ </div>
37
+
38
+ <div class="form-row">
39
+ <%= field :template, as: :select_template, prefix: "pages/list", placeholder: "Use default template" %>
40
+ </div>
41
+
42
+ </div> <!-- /.details -->
43
+
44
+ <div class="content">
45
+ <table class="table table-condensed">
46
+ <% self.object.listed_pages.to_a.each do |p| %>
47
+ <tr>
48
+ <td><%= admin_pages_title_as_text p.page_node, current_lang %></td>
49
+ </tr>
50
+ <% end %>
51
+ </table>
52
+ </div> <!-- /.content -->
53
+
@@ -0,0 +1,3 @@
1
+ <div class="content">
2
+ <%= field :content, as: :textarea %>
3
+ </div>
@@ -0,0 +1,59 @@
1
+ <% page_title "Выбрать страницу" %>
2
+
3
+ <div class="tree-select-page-widget">
4
+ <%
5
+ table @page_nodes, style: 'smart-tree-table', lang: @select_lang, html_params: { id: 'treeSelectPage' } do
6
+ column :publication_state, label: '' do |p|
7
+ admin_pages_publication_state_as_icon( p, options[:lang] )
8
+ end
9
+ column :name, label: 'Name' do |p|
10
+ admin_pages_title_as_text( p, options[:lang] )
11
+ end
12
+ end
13
+ %>
14
+ </div>
15
+
16
+ <% form nil, html_params: { class: 'select-page-form' } do %>
17
+ <%= button :cancel %>
18
+ <%= button :select, onclick: "on_click_select();", id: "btn-select-page", disabled: true %>
19
+ <% end %>
20
+
21
+ <script type="text/javascript">
22
+ var tree = null;
23
+
24
+ $(function(){
25
+ tree = new SmartTreeTable( $("#treeSelectPage").first(), {
26
+ column: 2,
27
+ on_select: on_page_select,
28
+ prefix: {
29
+ branch: {
30
+ expanded: '<i class="prefix-expanded fa fa-caret-down"></i>',
31
+ collapsed: '<i class="prefix-collapsed fa fa-caret-right"></i>'
32
+ }
33
+ }
34
+
35
+ });
36
+ var selected_page_node_id = '<%= @select_page_node_id %>';
37
+ if ( selected_page_node_id ) {
38
+ tree.select( selected_page_node_id );
39
+ tree.expand( selected_page_node_id );
40
+ } else {
41
+ // expand root
42
+ tree.expand( '<%= PageNode.root.id %>' );
43
+ }
44
+ });
45
+
46
+ var page_id = null;
47
+ var page_label = null;
48
+
49
+ function on_page_select( id, object, el ) {
50
+ $("#btn-select-page").removeAttr('disabled');
51
+ page_node_id = id;
52
+ page_label = object.contents;
53
+ }
54
+ function on_click_select() {
55
+ console.log("clicked Select: id:"+page_node_id+" label: '"+page_label+"'" );
56
+ admin_modal_select_and_close( { page_node_id: page_node_id, page_label: page_label } );
57
+ return false;
58
+ }
59
+ </script>