kms 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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +30 -0
- data/app/assets/fonts/casper-webfont.eot +0 -0
- data/app/assets/fonts/casper-webfont.svg +278 -0
- data/app/assets/fonts/casper-webfont.ttf +0 -0
- data/app/assets/fonts/casper-webfont.woff +0 -0
- data/app/assets/fonts/casper-webfont.woff2 +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/javascripts/kms/application.js +49 -0
- data/app/assets/javascripts/kms/application/controllers/assets_controller.coffee +70 -0
- data/app/assets/javascripts/kms/application/controllers/help_controller.coffee +12 -0
- data/app/assets/javascripts/kms/application/controllers/pages_controller.coffee +95 -0
- data/app/assets/javascripts/kms/application/controllers/settings_controller.coffee +21 -0
- data/app/assets/javascripts/kms/application/controllers/sidebar_controller.coffee +26 -0
- data/app/assets/javascripts/kms/application/controllers/snippets_controller.coffee +44 -0
- data/app/assets/javascripts/kms/application/controllers/templates_controller.coffee +46 -0
- data/app/assets/javascripts/kms/application/controllers/users_controller.coffee +31 -0
- data/app/assets/javascripts/kms/application/module.coffee +24 -0
- data/app/assets/javascripts/kms/application/routes.coffee.erb +171 -0
- data/app/assets/javascripts/kms/application/services/errors_service.coffee +8 -0
- data/app/assets/javascripts/templates/assets/edit.html.slim +10 -0
- data/app/assets/javascripts/templates/assets/index.html.slim +31 -0
- data/app/assets/javascripts/templates/assets/new.html.slim +16 -0
- data/app/assets/javascripts/templates/help.html.slim +172 -0
- data/app/assets/javascripts/templates/help/filters.html.slim +51 -0
- data/app/assets/javascripts/templates/help/variables.html.slim +96 -0
- data/app/assets/javascripts/templates/pages/edit.html.slim +7 -0
- data/app/assets/javascripts/templates/pages/form.html.slim +32 -0
- data/app/assets/javascripts/templates/pages/index.html.slim +33 -0
- data/app/assets/javascripts/templates/pages/new.html.slim +5 -0
- data/app/assets/javascripts/templates/settings.html.slim +20 -0
- data/app/assets/javascripts/templates/snippets/edit.html.slim +5 -0
- data/app/assets/javascripts/templates/snippets/form.html.slim +10 -0
- data/app/assets/javascripts/templates/snippets/index.html.slim +22 -0
- data/app/assets/javascripts/templates/snippets/new.html.slim +5 -0
- data/app/assets/javascripts/templates/templates/edit.html.slim +7 -0
- data/app/assets/javascripts/templates/templates/form.html.slim +7 -0
- data/app/assets/javascripts/templates/templates/index.html.slim +22 -0
- data/app/assets/javascripts/templates/templates/new.html.slim +5 -0
- data/app/assets/javascripts/templates/users/form.html.slim +14 -0
- data/app/assets/javascripts/templates/users/index.html.slim +21 -0
- data/app/assets/javascripts/templates/users/new.html.slim +5 -0
- data/app/assets/stylesheets/kms/application.css +57 -0
- data/app/assets/stylesheets/kms/custom.css.scss +67 -0
- data/app/assets/stylesheets/kms/responsive_dashboard.css.less +9 -0
- data/app/controllers/kms/application_controller.rb +24 -0
- data/app/controllers/kms/assets_controller.rb +58 -0
- data/app/controllers/kms/kms_controller.rb +8 -0
- data/app/controllers/kms/pages_controller.rb +67 -0
- data/app/controllers/kms/public/pages_controller.rb +27 -0
- data/app/controllers/kms/public/search_controller.rb +18 -0
- data/app/controllers/kms/resources_controller.rb +9 -0
- data/app/controllers/kms/settings_controller.rb +24 -0
- data/app/controllers/kms/snippets_controller.rb +37 -0
- data/app/controllers/kms/templates_controller.rb +43 -0
- data/app/controllers/kms/users_controller.rb +36 -0
- data/app/controllers/users/confirmations_controller.rb +28 -0
- data/app/controllers/users/omniauth_callbacks_controller.rb +28 -0
- data/app/controllers/users/passwords_controller.rb +32 -0
- data/app/controllers/users/registrations_controller.rb +70 -0
- data/app/controllers/users/sessions_controller.rb +25 -0
- data/app/controllers/users/unlocks_controller.rb +28 -0
- data/app/helpers/kms/application_helper.rb +4 -0
- data/app/models/ability.rb +38 -0
- data/app/models/concerns/kms/compile_templates.rb +39 -0
- data/app/models/concerns/kms/permalinkable.rb +13 -0
- data/app/models/concerns/kms/update_stylesheets_text.rb +20 -0
- data/app/models/kms/asset.rb +83 -0
- data/app/models/kms/page.rb +61 -0
- data/app/models/kms/settings.rb +7 -0
- data/app/models/kms/snippet.rb +11 -0
- data/app/models/kms/template.rb +11 -0
- data/app/models/kms/user.rb +18 -0
- data/app/serializers/kms/settings_serializer.rb +5 -0
- data/app/serializers/kms/snippet_serializer.rb +5 -0
- data/app/services/kms/ability_service.rb +11 -0
- data/app/services/kms/externals_registry.rb +11 -0
- data/app/services/kms/form_customization_service.rb +14 -0
- data/app/services/kms/help_service.rb +13 -0
- data/app/services/kms/resource_service.rb +22 -0
- data/app/services/kms/search_service.rb +11 -0
- data/app/services/kms/settings_service.rb +13 -0
- data/app/uploaders/kms/asset_uploader.rb +61 -0
- data/app/views/devise/registrations/new.html.erb +21 -0
- data/app/views/devise/sessions/new.html.erb +17 -0
- data/app/views/devise/shared/_links.html.erb +25 -0
- data/app/views/layouts/kms/devise.html.erb +35 -0
- data/app/views/layouts/kms/kms.html.erb +139 -0
- data/config/initializers/bower_rails.rb +16 -0
- data/config/initializers/devise.rb +15 -0
- data/config/initializers/externals.rb +42 -0
- data/config/initializers/help.rb +1 -0
- data/config/initializers/liquor.rb +49 -0
- data/config/initializers/resources.rb +5 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/locales/devise.ru.yml +63 -0
- data/config/locales/en.yml +172 -0
- data/config/locales/ru.yml +172 -0
- data/config/routes.rb +31 -0
- data/db/migrate/20141027065341_create_pages.rb +12 -0
- data/db/migrate/20141027083603_create_templates.rb +10 -0
- data/db/migrate/20141027083633_add_template_id_to_pages.rb +6 -0
- data/db/migrate/20141029145253_create_assets.rb +10 -0
- data/db/migrate/20141031125758_add_ancestry_to_pages.rb +6 -0
- data/db/migrate/20141031140308_devise_create_users.rb +42 -0
- data/db/migrate/20141119084306_add_fullpath_to_pages.rb +5 -0
- data/db/migrate/20141121112652_add_role_to_users.rb +5 -0
- data/db/migrate/20141127073902_add_templatable_fields_to_pages.rb +6 -0
- data/db/migrate/20141209132901_add_hidden_to_page.rb +5 -0
- data/db/migrate/20150209120632_add_position_to_kms_pages.rb +5 -0
- data/db/migrate/20160129100437_create_kms_snippets.rb +11 -0
- data/db/migrate/20160712094512_create_kms_settings.rb +9 -0
- data/lib/generators/kms/install/install_generator.rb +34 -0
- data/lib/generators/kms/install/templates/devise.rb +257 -0
- data/lib/generators/kms/install/templates/dragonfly.rb +35 -0
- data/lib/kms.rb +6 -0
- data/lib/kms/dependencies.rb +15 -0
- data/lib/kms/drops/page_drop.rb +24 -0
- data/lib/kms/drops/search_item_drop.rb +5 -0
- data/lib/kms/engine.rb +65 -0
- data/lib/kms/externals/bigdecimal.rb +5 -0
- data/lib/kms/externals/request.rb +4 -0
- data/lib/kms/functions/assets.rb +40 -0
- data/lib/kms/functions/currency.rb +21 -0
- data/lib/kms/search_item.rb +28 -0
- data/lib/kms/version.rb +3 -0
- data/lib/tasks/kms_tasks.rake +4 -0
- data/lib/tasks/precompile_hook.rake +42 -0
- data/spec/controllers/kms/snippets_controller_spec.rb +74 -0
- data/spec/factories/kms_settings.rb +6 -0
- data/spec/factories/snippets.rb +10 -0
- data/spec/factories/users.rb +7 -0
- data/spec/internal/Rakefile +2 -0
- data/spec/internal/config/database.yml +7 -0
- data/spec/internal/config/initializers/devise.rb +257 -0
- data/spec/internal/config/routes.rb +7 -0
- data/spec/internal/db/schema.rb +69 -0
- data/spec/internal/log/test.log +14998 -0
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/v3.0/1XyAFYlYI0pK7WAgjR4PgXV6BgU6huJSviWmHetdCRs.cache +1 -0
- data/spec/models/kms/setting_spec.rb +7 -0
- data/spec/models/kms/snippet_spec.rb +14 -0
- data/spec/services/kms/help_service_spec.rb +8 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/controller_macros.rb +11 -0
- data/spec/support/request_helpers.rb +7 -0
- metadata +521 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
en:
|
|
2
|
+
login: "Sign in"
|
|
3
|
+
sign_up: "Sign up"
|
|
4
|
+
sign_out: "Sign out"
|
|
5
|
+
forgot_your_password: "Forgot your password?"
|
|
6
|
+
remember_me: "Remember me"
|
|
7
|
+
content_management: "Content management"
|
|
8
|
+
add_template: "Add template"
|
|
9
|
+
new_template: "New Template"
|
|
10
|
+
edit_template: "Edit Template"
|
|
11
|
+
update_template: "Update template"
|
|
12
|
+
add_page: "Add page"
|
|
13
|
+
new_page: "New Page"
|
|
14
|
+
edit_page: "Edit Page"
|
|
15
|
+
update_page: "Update page"
|
|
16
|
+
update_page_and_continue: "Update page and continue"
|
|
17
|
+
update_template_and_continue: "Update template and continue"
|
|
18
|
+
update_asset_and_continue: "Update asset and continue"
|
|
19
|
+
add_asset: "Add asset"
|
|
20
|
+
new_asset: "New Asset"
|
|
21
|
+
edit_asset: "Edit Asset"
|
|
22
|
+
update_asset: "Update asset"
|
|
23
|
+
upload_assets: "Upload assets"
|
|
24
|
+
add_user: "Add user"
|
|
25
|
+
new_user: "New User"
|
|
26
|
+
toggle_fullscreen_mode_instruction: "Press F11 when cursor is in the editor to toggle full screen editing. ESC can also be used to exit full screen editing."
|
|
27
|
+
add_snippet: "Add snippet"
|
|
28
|
+
new_snippet: "New Snippet"
|
|
29
|
+
edit_snippet: "Edit Snippet"
|
|
30
|
+
update_snippet: "Update snippet"
|
|
31
|
+
help: "Help"
|
|
32
|
+
settings: "Settings"
|
|
33
|
+
update_settings: "Update settings"
|
|
34
|
+
no_settings: "No settings specified"
|
|
35
|
+
yes_word: "Yes"
|
|
36
|
+
no_word: "No"
|
|
37
|
+
or: "Или"
|
|
38
|
+
roles:
|
|
39
|
+
admin: "Admin"
|
|
40
|
+
content_manager: "Content manager"
|
|
41
|
+
liquor_help:
|
|
42
|
+
header: "Liquor help"
|
|
43
|
+
tags_title: "Tags"
|
|
44
|
+
filters_title: "Filters"
|
|
45
|
+
variables_title: "Variables"
|
|
46
|
+
property: "Property of"
|
|
47
|
+
description: "Description"
|
|
48
|
+
specification: "Detailed Liquor specification"
|
|
49
|
+
tags:
|
|
50
|
+
declare:
|
|
51
|
+
main_description: "Tag declare could be used for variables declaration and initial value setup in this form: "
|
|
52
|
+
additional_description: "Difference between declare and assign tag - with declare you can create variables with the same names but in different scopes."
|
|
53
|
+
assign:
|
|
54
|
+
main_description: "Tag assign could be used for variables declaration and its initial value setup in this form: "
|
|
55
|
+
if:
|
|
56
|
+
main_description: "Tag if is a standard conditional statement and has this form: "
|
|
57
|
+
unless:
|
|
58
|
+
main_description: 'Tag unless executes its "body" if conditional expression results in false or null: '
|
|
59
|
+
for:
|
|
60
|
+
main_description: "Tag for is a standard cycle statement and has this form: "
|
|
61
|
+
capture:
|
|
62
|
+
main_description: "Tag capture runs code and saves result in var. If var already contained value, capture changes it: "
|
|
63
|
+
content_for:
|
|
64
|
+
main_description: "Tag content_for runs code and saves result in some handle: "
|
|
65
|
+
yield:
|
|
66
|
+
main_description: "Tag yield has 3 forms. In the simples case (without arguments) it inserts content of internal template (Page content in terms of this CMS). If string with handle was setup with {% content_for %}, then yield returns this string. If no string with handle, yield returns result of if_none block execution, if such block was specified, or just empty string: "
|
|
67
|
+
include:
|
|
68
|
+
main_description: 'Tag include includes content of Snippet into template. The only argument of include - Snippet ID (field "Slug/ID" that you need to setup on Snippet creation in "Snippets"): '
|
|
69
|
+
variables:
|
|
70
|
+
var_loop:
|
|
71
|
+
main_description: 'Variable giving access to current state of cycle/iteration. Can be used only in "for" cycle. var_loop - common name, for accessing actual cycle variable you need to concatenate cycle variable name and "_loop". Example:'
|
|
72
|
+
properties:
|
|
73
|
+
length: "Iterations count (collection size)"
|
|
74
|
+
index: "Current iteration index - index of element"
|
|
75
|
+
page:
|
|
76
|
+
main_description: 'Variable "page" can be accessed in any template and references to current page: '
|
|
77
|
+
properties:
|
|
78
|
+
slug: 'Value of "Slug" field'
|
|
79
|
+
fullpath: 'Page fullpath'
|
|
80
|
+
title: 'Value of "Title" field'
|
|
81
|
+
published: 'Value of "Published" field'
|
|
82
|
+
hidden: 'Value of "Hidden (from navigation)" field'
|
|
83
|
+
templatable: 'Value of "Use as object template" field'
|
|
84
|
+
children: 'Returns "children" collection - pages having this page as parent in "Parent page" field'
|
|
85
|
+
parent: 'Parent page reference'
|
|
86
|
+
index:
|
|
87
|
+
main_description: 'Variable "index" accessible in templates and references to root page (with "index" slug). Object properties are the same as for "page" variable.'
|
|
88
|
+
request:
|
|
89
|
+
main_description: 'Variable "request" gives an access to some properties of current request: '
|
|
90
|
+
properties:
|
|
91
|
+
path: 'Returns request relative path'
|
|
92
|
+
url: 'Returns request URL'
|
|
93
|
+
host: 'Returns host - domain name or IP address'
|
|
94
|
+
base_url: 'Returns request root URL - protocol + domain name or IP, ex., "http://example.com"'
|
|
95
|
+
referer: 'Returns URL of page that initiated current request'
|
|
96
|
+
form_authenticity_token: 'Returns authenticity token for current request - for form protection from CSRF attack'
|
|
97
|
+
param: "Returns URL param. Example: request.param('page')"
|
|
98
|
+
item:
|
|
99
|
+
main_description: 'Variable "item" gives access to current object of "templatable" page. "Templatable" - page with enabled "Use as object template" field and chosen object in "Object" field. Properties of "item" depend on concrete object.'
|
|
100
|
+
search:
|
|
101
|
+
main_description: "Variable 'search' gives access to search results. Need to use on search results page. Searching possible, if request contains 'query' param, i.e. URL like /some_path?query=text. Object 'search' - array of search results (SearchItem objects). Properties of SearchItem could be found below."
|
|
102
|
+
search_item:
|
|
103
|
+
main_description: 'search_item is a search results element (element of "search" collection).'
|
|
104
|
+
properties:
|
|
105
|
+
title: 'Page title'
|
|
106
|
+
content: 'Content with search query'
|
|
107
|
+
link: 'Link to page, containing query'
|
|
108
|
+
filters:
|
|
109
|
+
asset_path:
|
|
110
|
+
main_description: 'Filter "asset_path" allows to get a relative path to any file from "Assets" section by filename: '
|
|
111
|
+
asset_tag:
|
|
112
|
+
main_description: 'Filter "asset_tag" allows to include javascript and css files, uploaded to "Assets" section: '
|
|
113
|
+
resize:
|
|
114
|
+
main_description: 'This function/filter helps to change image size on-the-fly. For this filter you need to use absolute URL of image and "format" argument. Returns also URL. To get absolute URL (having only relative - any asset from "Assets") you should use "request.base_url": '
|
|
115
|
+
add_watermark:
|
|
116
|
+
main_description: 'It allows to add watermark to image. You need image URL and 3 arguments: "image" - watermark image (watermark), "dissolve" - transparency and "position" - position. Returns also URL: '
|
|
117
|
+
ends_with:
|
|
118
|
+
main_description: 'Allows to check if string ends with some pattern: '
|
|
119
|
+
currency:
|
|
120
|
+
main_description: 'Formats currency values. Possible options: precision, delimiter, separator, format, unit: '
|
|
121
|
+
activerecord:
|
|
122
|
+
models:
|
|
123
|
+
kms/template:
|
|
124
|
+
one: "Template"
|
|
125
|
+
few: "Templates"
|
|
126
|
+
many: "Templates"
|
|
127
|
+
other: "Templates"
|
|
128
|
+
kms/page:
|
|
129
|
+
one: "Page"
|
|
130
|
+
few: "Pages"
|
|
131
|
+
many: "Pages"
|
|
132
|
+
other: "Pages"
|
|
133
|
+
kms/asset:
|
|
134
|
+
one: "Asset"
|
|
135
|
+
few: "Assets"
|
|
136
|
+
many: "Assets"
|
|
137
|
+
other: "Assets"
|
|
138
|
+
kms/user:
|
|
139
|
+
one: "User"
|
|
140
|
+
few: "Users"
|
|
141
|
+
many: "Users"
|
|
142
|
+
other: "Users"
|
|
143
|
+
kms/snippet:
|
|
144
|
+
one: "Snippet"
|
|
145
|
+
few: "Snippets"
|
|
146
|
+
many: "Snippets"
|
|
147
|
+
other: "Snippets"
|
|
148
|
+
attributes:
|
|
149
|
+
kms/template:
|
|
150
|
+
name: "Name"
|
|
151
|
+
content: "Content"
|
|
152
|
+
kms/page:
|
|
153
|
+
title: "Title"
|
|
154
|
+
content: "Content"
|
|
155
|
+
slug: "Slug"
|
|
156
|
+
published: "Published"
|
|
157
|
+
template: "Template"
|
|
158
|
+
parent: "Parent page"
|
|
159
|
+
templatable: "Use as object template"
|
|
160
|
+
templatable_type: "Object"
|
|
161
|
+
hidden: 'Hidden (from navigation)'
|
|
162
|
+
kms/asset:
|
|
163
|
+
file: "File"
|
|
164
|
+
kms/user:
|
|
165
|
+
email: "Email"
|
|
166
|
+
password: "Password"
|
|
167
|
+
password_confirmation: "Password Confirmation"
|
|
168
|
+
role: "Role"
|
|
169
|
+
kms/snippet:
|
|
170
|
+
name: "Name"
|
|
171
|
+
slug: "Slug/ID"
|
|
172
|
+
content: "Content"
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
ru:
|
|
2
|
+
login: "Войти"
|
|
3
|
+
sign_up: "Зарегистрироваться"
|
|
4
|
+
sign_out: "Выйти"
|
|
5
|
+
forgot_your_password: "Забыли пароль?"
|
|
6
|
+
remember_me: "Запомнить меня"
|
|
7
|
+
content_management: "Управление контентом"
|
|
8
|
+
add_template: "Добавить шаблон"
|
|
9
|
+
new_template: "Новый Шаблон"
|
|
10
|
+
edit_template: "Редактирование Шаблона"
|
|
11
|
+
update_template: "Обновить шаблон"
|
|
12
|
+
add_page: "Добавить страницу"
|
|
13
|
+
new_page: "Новая Страница"
|
|
14
|
+
edit_page: "Редактирование Страницы"
|
|
15
|
+
update_page: "Обновить страницу"
|
|
16
|
+
update_page_and_continue: "Обновить страницу и продолжить"
|
|
17
|
+
update_template_and_continue: "Обновить шаблон и продолжить"
|
|
18
|
+
update_asset_and_continue: "Обновить файл и продолжить"
|
|
19
|
+
add_asset: "Добавить файл"
|
|
20
|
+
new_asset: "Новый Файл"
|
|
21
|
+
edit_asset: "Редактирование Файла"
|
|
22
|
+
update_asset: "Обновить файл"
|
|
23
|
+
upload_assets: "Загрузить файлы"
|
|
24
|
+
add_user: "Добавить пользователя"
|
|
25
|
+
new_user: "Новый Пользователь"
|
|
26
|
+
toggle_fullscreen_mode_instruction: "Используйте F11 для включения/выключения полноэкранного редактирования, когда курсор находится внутри поля. Также можно использовать ESC для выхода из этого режима."
|
|
27
|
+
add_snippet: "Добавить сниппет"
|
|
28
|
+
new_snippet: "Новый Сниппет"
|
|
29
|
+
edit_snippet: "Редактирование Сниппета"
|
|
30
|
+
update_snippet: "Обновить сниппет"
|
|
31
|
+
help: "Справка"
|
|
32
|
+
settings: "Настройки"
|
|
33
|
+
update_settings: "Обновить настройки"
|
|
34
|
+
no_settings: "Нет настроек для отображения"
|
|
35
|
+
yes_word: "Да"
|
|
36
|
+
no_word: "Нет"
|
|
37
|
+
or: "Или"
|
|
38
|
+
roles:
|
|
39
|
+
admin: "Администратор"
|
|
40
|
+
content_manager: "Контент-менеджер"
|
|
41
|
+
liquor_help:
|
|
42
|
+
header: "Справка по Liquor"
|
|
43
|
+
tags_title: "Тэги"
|
|
44
|
+
filters_title: "Фильтры"
|
|
45
|
+
variables_title: "Переменные"
|
|
46
|
+
property: "Свойство"
|
|
47
|
+
description: "Описание"
|
|
48
|
+
specification: "Подробная спецификация Liquor"
|
|
49
|
+
tags:
|
|
50
|
+
declare:
|
|
51
|
+
main_description: "Тэг declare может быть использован для объявления и задания значений переменным в следующей форме: "
|
|
52
|
+
additional_description: "Отличие от assign в том, что с declare можно создавать переменные с одинаковыми именами, но в разных областях видимости."
|
|
53
|
+
assign:
|
|
54
|
+
main_description: "Тэг assign может быть использован для объявления и задания значений переменным в следующей форме: "
|
|
55
|
+
if:
|
|
56
|
+
main_description: "Тэг if является стандартным условным оператором и имеет следующую форму: "
|
|
57
|
+
unless:
|
|
58
|
+
main_description: 'Тэг unless выполняет "тело" условия, если результат выражения - false или null: '
|
|
59
|
+
for:
|
|
60
|
+
main_description: "Тэг for является стандартным циклическим оператором и имеет следующую форму: "
|
|
61
|
+
capture:
|
|
62
|
+
main_description: "Тэг capture выполняет code и сохраняет результат в var. Если var уже имела значение, capture изменяет его: "
|
|
63
|
+
content_for:
|
|
64
|
+
main_description: "Тэг content_for выполняет code и сохраняет результат в handle: "
|
|
65
|
+
yield:
|
|
66
|
+
main_description: "Тэг yield имеет 3 формы написания. В самом простом случае (без аргументов) тэг вставляет содержимое внутреннего шаблона (в данной CMS это страница). Если строка с handle была задана с помощью {% content_for %}, тогда yield возвращает эту строку. Если не было задано строки с этим handle, yield либо возвращает результат выполнения блока if_none, если он задан, или пустую строку: "
|
|
67
|
+
include:
|
|
68
|
+
main_description: 'Тэг include включает в шаблон содержимое Сниппета. Единственный аргумент include - это идентификатор Сниппета (поле "Идентификатор", указанное при создании сниппета в разделе "Сниппеты"): '
|
|
69
|
+
variables:
|
|
70
|
+
var_loop:
|
|
71
|
+
main_description: 'Переменная, предоставляющая доступ к текущему состоянию цикла. Может быть использована только внутри цикла for. var_loop - обобщённое имя, для получения настоящего имени переменной нужно сконкатенировать название переменной цикла и "_loop". Например:'
|
|
72
|
+
properties:
|
|
73
|
+
length: "Количество итераций (размер коллекции)"
|
|
74
|
+
index: "Номер текущей итерации - индекс элемента"
|
|
75
|
+
page:
|
|
76
|
+
main_description: 'Переменная page доступна в шаблонах и является ссылкой на текущую отображаемую страницу: '
|
|
77
|
+
properties:
|
|
78
|
+
slug: 'Значение поля "Ссылка" страницы'
|
|
79
|
+
fullpath: 'Полный путь страницы'
|
|
80
|
+
title: 'Значение поля "Название" страницы'
|
|
81
|
+
published: 'Значение поля "Опубликована" страницы'
|
|
82
|
+
hidden: 'Значение поля "Скрывать из общего списка" страницы (не отображать в меню)'
|
|
83
|
+
templatable: 'Значение поля "Использовать как шаблон" страницы'
|
|
84
|
+
children: 'Возвращает "дочерние" страницы - страницы, для которых данная страница проставлена в поле "Родительская страница"'
|
|
85
|
+
parent: 'Родительская страница'
|
|
86
|
+
index:
|
|
87
|
+
main_description: 'Переменная index доступна в шаблонах и является ссылкой на корневую страницу сайта (со ссылкой index). Свойства объекта такие же, как у переменной page.'
|
|
88
|
+
request:
|
|
89
|
+
main_description: 'Переменная request предоставляет доступ к некоторым параметрам текущего запроса: '
|
|
90
|
+
properties:
|
|
91
|
+
path: 'Возвращает относительный путь запроса'
|
|
92
|
+
url: 'Возвращает URL запроса'
|
|
93
|
+
host: 'Возвращает host запроса - доменное имя или IP адрес'
|
|
94
|
+
base_url: 'Возвращает корневой URL запроса - протокол + доменное имя или IP адрес, напр., "http://example.com"'
|
|
95
|
+
referer: 'Возвращает URL страницы, с которой произошёл текущий запрос'
|
|
96
|
+
form_authenticity_token: 'Возвращает authenticity token для текущего запроса - необходимо для защиты от CSRF при отправке форм'
|
|
97
|
+
param: "Возвращает значение параметра URL. Пример: request.param('page')"
|
|
98
|
+
item:
|
|
99
|
+
main_description: 'Переменная item предоставляет доступ к текущему объекту "шаблонной" страницы. Под "шаблонной" подразумевается страница с включенным переключателем "Использовать как шаблон" и выбранным объектом в поле "Объект". Свойства item зависят от выбранного объекта.'
|
|
100
|
+
search:
|
|
101
|
+
main_description: "Переменная search предоставляет доступ к результатам поиска. Используется на странице результатов поиска. Поиск возможен, если запрос содержит параметр 'query', т.е. URL вида /some_path?query=text. Сам объект search - это массив результатов поиска (объектов SearchItem). Свойства SearchItem см. ниже."
|
|
102
|
+
search_item:
|
|
103
|
+
main_description: 'search_item это элемент результатов поиска.'
|
|
104
|
+
properties:
|
|
105
|
+
title: 'Заголовок страницы'
|
|
106
|
+
content: 'Контент, содержащий искомый запрос'
|
|
107
|
+
link: 'Ссылка на страницу, содержащую искомый запрос'
|
|
108
|
+
filters:
|
|
109
|
+
asset_path:
|
|
110
|
+
main_description: 'Фильтр asset_path позволяет получить путь к файлу из раздела "Файлы" по имени файла: '
|
|
111
|
+
asset_tag:
|
|
112
|
+
main_description: 'Фильтр asset_tag позволяет подключать javascript и css файлы, загруженные в раздел "Файлы": '
|
|
113
|
+
resize:
|
|
114
|
+
main_description: 'Функция выполняет изменение размеров изображения. Для функции необходим абсолютный URL изображения и аргумент "format", на выходе также URL. Для получения абсолютного URL следует использовать request.base_url: '
|
|
115
|
+
add_watermark:
|
|
116
|
+
main_description: 'Функция выполняет добавление watermark к изображению. Для функции необходим URL изображения и 3 аргумента "image" - изображение для наложения (watermark), "dissolve" - прозрачность и "position" - позиция, на выходе также URL: '
|
|
117
|
+
ends_with:
|
|
118
|
+
main_description: 'Позволяет проверить, оканчивается строка определённым паттерном или нет: '
|
|
119
|
+
currency:
|
|
120
|
+
main_description: 'Форматирование полей, хранящих денежные значения. Возможные опции - precision, delimiter, separator, format, unit: '
|
|
121
|
+
activerecord:
|
|
122
|
+
models:
|
|
123
|
+
kms/template:
|
|
124
|
+
one: "Шаблон"
|
|
125
|
+
few: "Шаблона"
|
|
126
|
+
many: "Шаблонов"
|
|
127
|
+
other: "Шаблоны"
|
|
128
|
+
kms/page:
|
|
129
|
+
one: "Страница"
|
|
130
|
+
few: "Страницы"
|
|
131
|
+
many: "Страниц"
|
|
132
|
+
other: "Страницы"
|
|
133
|
+
kms/asset:
|
|
134
|
+
one: "Файл"
|
|
135
|
+
few: "Файла"
|
|
136
|
+
many: "Файлов"
|
|
137
|
+
other: "Файлы"
|
|
138
|
+
kms/user:
|
|
139
|
+
one: "Пользователь"
|
|
140
|
+
few: "Пользователя"
|
|
141
|
+
many: "Пользователей"
|
|
142
|
+
other: "Пользователи"
|
|
143
|
+
kms/snippet:
|
|
144
|
+
one: "Сниппет"
|
|
145
|
+
few: "Сниппета"
|
|
146
|
+
many: "Сниппетов"
|
|
147
|
+
other: "Сниппеты"
|
|
148
|
+
attributes:
|
|
149
|
+
kms/template:
|
|
150
|
+
name: "Название"
|
|
151
|
+
content: "Содержимое"
|
|
152
|
+
kms/page:
|
|
153
|
+
title: "Название"
|
|
154
|
+
content: "Содержимое"
|
|
155
|
+
slug: "Ссылка"
|
|
156
|
+
published: "Опубликована"
|
|
157
|
+
template: "Шаблон"
|
|
158
|
+
parent: "Родительская страница"
|
|
159
|
+
templatable: "Использовать как шаблон"
|
|
160
|
+
templatable_type: "Объект"
|
|
161
|
+
hidden: 'Скрывать из общего списка'
|
|
162
|
+
kms/asset:
|
|
163
|
+
file: "Файл"
|
|
164
|
+
kms/user:
|
|
165
|
+
email: "Email"
|
|
166
|
+
password: "Пароль"
|
|
167
|
+
password_confirmation: "Подтверждение пароля"
|
|
168
|
+
role: "Роль"
|
|
169
|
+
kms/snippet:
|
|
170
|
+
name: "Название"
|
|
171
|
+
slug: "Идентификатор"
|
|
172
|
+
content: "Содержимое"
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Kms::Engine.routes.draw do
|
|
2
|
+
devise_for :kms_users,
|
|
3
|
+
class_name: "Kms::User",
|
|
4
|
+
failure_app: 'Kms::Devise::FailureApp',
|
|
5
|
+
module: :devise,
|
|
6
|
+
controllers: { registrations: "users/registrations" }
|
|
7
|
+
constraints(format: "json") do
|
|
8
|
+
resources :templates, format: true
|
|
9
|
+
resources :snippets, except: [:new, :edit], format: true
|
|
10
|
+
resources :pages, format: true do
|
|
11
|
+
collection do
|
|
12
|
+
post 'sorting'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
resources :assets, format: true, as: :kms_assets
|
|
16
|
+
resources :users, only: [:index, :destroy], format: true
|
|
17
|
+
resources :resources, only: :index, format: true
|
|
18
|
+
resource :settings, only: [:show, :update], format: true
|
|
19
|
+
get '/users/kms_user' => "users#kms_user", format: true
|
|
20
|
+
post "/users/from_kms" => "users#create", format: true
|
|
21
|
+
end
|
|
22
|
+
post "/assets/ckeditor" => "assets#ckeditor"
|
|
23
|
+
constraints(format: "html") do
|
|
24
|
+
get "/(*path)" => "kms#index"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
Rails.application.routes.draw do
|
|
29
|
+
root 'kms/public/pages#show'
|
|
30
|
+
get "*path" => "kms/public/pages#show"
|
|
31
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
class DeviseCreateUsers < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table(:kms_users) do |t|
|
|
4
|
+
## Database authenticatable
|
|
5
|
+
t.string :email, null: false, default: ""
|
|
6
|
+
t.string :encrypted_password, null: false, default: ""
|
|
7
|
+
|
|
8
|
+
## Recoverable
|
|
9
|
+
t.string :reset_password_token
|
|
10
|
+
t.datetime :reset_password_sent_at
|
|
11
|
+
|
|
12
|
+
## Rememberable
|
|
13
|
+
t.datetime :remember_created_at
|
|
14
|
+
|
|
15
|
+
## Trackable
|
|
16
|
+
#t.integer :sign_in_count, default: 0, null: false
|
|
17
|
+
#t.datetime :current_sign_in_at
|
|
18
|
+
#t.datetime :last_sign_in_at
|
|
19
|
+
#t.string :current_sign_in_ip
|
|
20
|
+
#t.string :last_sign_in_ip
|
|
21
|
+
|
|
22
|
+
## Confirmable
|
|
23
|
+
# t.string :confirmation_token
|
|
24
|
+
# t.datetime :confirmed_at
|
|
25
|
+
# t.datetime :confirmation_sent_at
|
|
26
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
|
27
|
+
|
|
28
|
+
## Lockable
|
|
29
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
|
30
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
|
31
|
+
# t.datetime :locked_at
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
t.timestamps
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
add_index :kms_users, :email, unique: true
|
|
38
|
+
add_index :kms_users, :reset_password_token, unique: true
|
|
39
|
+
# add_index :users, :confirmation_token, unique: true
|
|
40
|
+
# add_index :users, :unlock_token, unique: true
|
|
41
|
+
end
|
|
42
|
+
end
|