kms 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +30 -0
  4. data/app/assets/fonts/casper-webfont.eot +0 -0
  5. data/app/assets/fonts/casper-webfont.svg +278 -0
  6. data/app/assets/fonts/casper-webfont.ttf +0 -0
  7. data/app/assets/fonts/casper-webfont.woff +0 -0
  8. data/app/assets/fonts/casper-webfont.woff2 +0 -0
  9. data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  10. data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  11. data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  12. data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  13. data/app/assets/javascripts/kms/application.js +49 -0
  14. data/app/assets/javascripts/kms/application/controllers/assets_controller.coffee +70 -0
  15. data/app/assets/javascripts/kms/application/controllers/help_controller.coffee +12 -0
  16. data/app/assets/javascripts/kms/application/controllers/pages_controller.coffee +95 -0
  17. data/app/assets/javascripts/kms/application/controllers/settings_controller.coffee +21 -0
  18. data/app/assets/javascripts/kms/application/controllers/sidebar_controller.coffee +26 -0
  19. data/app/assets/javascripts/kms/application/controllers/snippets_controller.coffee +44 -0
  20. data/app/assets/javascripts/kms/application/controllers/templates_controller.coffee +46 -0
  21. data/app/assets/javascripts/kms/application/controllers/users_controller.coffee +31 -0
  22. data/app/assets/javascripts/kms/application/module.coffee +24 -0
  23. data/app/assets/javascripts/kms/application/routes.coffee.erb +171 -0
  24. data/app/assets/javascripts/kms/application/services/errors_service.coffee +8 -0
  25. data/app/assets/javascripts/templates/assets/edit.html.slim +10 -0
  26. data/app/assets/javascripts/templates/assets/index.html.slim +31 -0
  27. data/app/assets/javascripts/templates/assets/new.html.slim +16 -0
  28. data/app/assets/javascripts/templates/help.html.slim +172 -0
  29. data/app/assets/javascripts/templates/help/filters.html.slim +51 -0
  30. data/app/assets/javascripts/templates/help/variables.html.slim +96 -0
  31. data/app/assets/javascripts/templates/pages/edit.html.slim +7 -0
  32. data/app/assets/javascripts/templates/pages/form.html.slim +32 -0
  33. data/app/assets/javascripts/templates/pages/index.html.slim +33 -0
  34. data/app/assets/javascripts/templates/pages/new.html.slim +5 -0
  35. data/app/assets/javascripts/templates/settings.html.slim +20 -0
  36. data/app/assets/javascripts/templates/snippets/edit.html.slim +5 -0
  37. data/app/assets/javascripts/templates/snippets/form.html.slim +10 -0
  38. data/app/assets/javascripts/templates/snippets/index.html.slim +22 -0
  39. data/app/assets/javascripts/templates/snippets/new.html.slim +5 -0
  40. data/app/assets/javascripts/templates/templates/edit.html.slim +7 -0
  41. data/app/assets/javascripts/templates/templates/form.html.slim +7 -0
  42. data/app/assets/javascripts/templates/templates/index.html.slim +22 -0
  43. data/app/assets/javascripts/templates/templates/new.html.slim +5 -0
  44. data/app/assets/javascripts/templates/users/form.html.slim +14 -0
  45. data/app/assets/javascripts/templates/users/index.html.slim +21 -0
  46. data/app/assets/javascripts/templates/users/new.html.slim +5 -0
  47. data/app/assets/stylesheets/kms/application.css +57 -0
  48. data/app/assets/stylesheets/kms/custom.css.scss +67 -0
  49. data/app/assets/stylesheets/kms/responsive_dashboard.css.less +9 -0
  50. data/app/controllers/kms/application_controller.rb +24 -0
  51. data/app/controllers/kms/assets_controller.rb +58 -0
  52. data/app/controllers/kms/kms_controller.rb +8 -0
  53. data/app/controllers/kms/pages_controller.rb +67 -0
  54. data/app/controllers/kms/public/pages_controller.rb +27 -0
  55. data/app/controllers/kms/public/search_controller.rb +18 -0
  56. data/app/controllers/kms/resources_controller.rb +9 -0
  57. data/app/controllers/kms/settings_controller.rb +24 -0
  58. data/app/controllers/kms/snippets_controller.rb +37 -0
  59. data/app/controllers/kms/templates_controller.rb +43 -0
  60. data/app/controllers/kms/users_controller.rb +36 -0
  61. data/app/controllers/users/confirmations_controller.rb +28 -0
  62. data/app/controllers/users/omniauth_callbacks_controller.rb +28 -0
  63. data/app/controllers/users/passwords_controller.rb +32 -0
  64. data/app/controllers/users/registrations_controller.rb +70 -0
  65. data/app/controllers/users/sessions_controller.rb +25 -0
  66. data/app/controllers/users/unlocks_controller.rb +28 -0
  67. data/app/helpers/kms/application_helper.rb +4 -0
  68. data/app/models/ability.rb +38 -0
  69. data/app/models/concerns/kms/compile_templates.rb +39 -0
  70. data/app/models/concerns/kms/permalinkable.rb +13 -0
  71. data/app/models/concerns/kms/update_stylesheets_text.rb +20 -0
  72. data/app/models/kms/asset.rb +83 -0
  73. data/app/models/kms/page.rb +61 -0
  74. data/app/models/kms/settings.rb +7 -0
  75. data/app/models/kms/snippet.rb +11 -0
  76. data/app/models/kms/template.rb +11 -0
  77. data/app/models/kms/user.rb +18 -0
  78. data/app/serializers/kms/settings_serializer.rb +5 -0
  79. data/app/serializers/kms/snippet_serializer.rb +5 -0
  80. data/app/services/kms/ability_service.rb +11 -0
  81. data/app/services/kms/externals_registry.rb +11 -0
  82. data/app/services/kms/form_customization_service.rb +14 -0
  83. data/app/services/kms/help_service.rb +13 -0
  84. data/app/services/kms/resource_service.rb +22 -0
  85. data/app/services/kms/search_service.rb +11 -0
  86. data/app/services/kms/settings_service.rb +13 -0
  87. data/app/uploaders/kms/asset_uploader.rb +61 -0
  88. data/app/views/devise/registrations/new.html.erb +21 -0
  89. data/app/views/devise/sessions/new.html.erb +17 -0
  90. data/app/views/devise/shared/_links.html.erb +25 -0
  91. data/app/views/layouts/kms/devise.html.erb +35 -0
  92. data/app/views/layouts/kms/kms.html.erb +139 -0
  93. data/config/initializers/bower_rails.rb +16 -0
  94. data/config/initializers/devise.rb +15 -0
  95. data/config/initializers/externals.rb +42 -0
  96. data/config/initializers/help.rb +1 -0
  97. data/config/initializers/liquor.rb +49 -0
  98. data/config/initializers/resources.rb +5 -0
  99. data/config/locales/devise.en.yml +59 -0
  100. data/config/locales/devise.ru.yml +63 -0
  101. data/config/locales/en.yml +172 -0
  102. data/config/locales/ru.yml +172 -0
  103. data/config/routes.rb +31 -0
  104. data/db/migrate/20141027065341_create_pages.rb +12 -0
  105. data/db/migrate/20141027083603_create_templates.rb +10 -0
  106. data/db/migrate/20141027083633_add_template_id_to_pages.rb +6 -0
  107. data/db/migrate/20141029145253_create_assets.rb +10 -0
  108. data/db/migrate/20141031125758_add_ancestry_to_pages.rb +6 -0
  109. data/db/migrate/20141031140308_devise_create_users.rb +42 -0
  110. data/db/migrate/20141119084306_add_fullpath_to_pages.rb +5 -0
  111. data/db/migrate/20141121112652_add_role_to_users.rb +5 -0
  112. data/db/migrate/20141127073902_add_templatable_fields_to_pages.rb +6 -0
  113. data/db/migrate/20141209132901_add_hidden_to_page.rb +5 -0
  114. data/db/migrate/20150209120632_add_position_to_kms_pages.rb +5 -0
  115. data/db/migrate/20160129100437_create_kms_snippets.rb +11 -0
  116. data/db/migrate/20160712094512_create_kms_settings.rb +9 -0
  117. data/lib/generators/kms/install/install_generator.rb +34 -0
  118. data/lib/generators/kms/install/templates/devise.rb +257 -0
  119. data/lib/generators/kms/install/templates/dragonfly.rb +35 -0
  120. data/lib/kms.rb +6 -0
  121. data/lib/kms/dependencies.rb +15 -0
  122. data/lib/kms/drops/page_drop.rb +24 -0
  123. data/lib/kms/drops/search_item_drop.rb +5 -0
  124. data/lib/kms/engine.rb +65 -0
  125. data/lib/kms/externals/bigdecimal.rb +5 -0
  126. data/lib/kms/externals/request.rb +4 -0
  127. data/lib/kms/functions/assets.rb +40 -0
  128. data/lib/kms/functions/currency.rb +21 -0
  129. data/lib/kms/search_item.rb +28 -0
  130. data/lib/kms/version.rb +3 -0
  131. data/lib/tasks/kms_tasks.rake +4 -0
  132. data/lib/tasks/precompile_hook.rake +42 -0
  133. data/spec/controllers/kms/snippets_controller_spec.rb +74 -0
  134. data/spec/factories/kms_settings.rb +6 -0
  135. data/spec/factories/snippets.rb +10 -0
  136. data/spec/factories/users.rb +7 -0
  137. data/spec/internal/Rakefile +2 -0
  138. data/spec/internal/config/database.yml +7 -0
  139. data/spec/internal/config/initializers/devise.rb +257 -0
  140. data/spec/internal/config/routes.rb +7 -0
  141. data/spec/internal/db/schema.rb +69 -0
  142. data/spec/internal/log/test.log +14998 -0
  143. data/spec/internal/public/favicon.ico +0 -0
  144. data/spec/internal/tmp/cache/assets/test/sprockets/v3.0/1XyAFYlYI0pK7WAgjR4PgXV6BgU6huJSviWmHetdCRs.cache +1 -0
  145. data/spec/models/kms/setting_spec.rb +7 -0
  146. data/spec/models/kms/snippet_spec.rb +14 -0
  147. data/spec/services/kms/help_service_spec.rb +8 -0
  148. data/spec/spec_helper.rb +27 -0
  149. data/spec/support/controller_macros.rb +11 -0
  150. data/spec/support/request_helpers.rb +7 -0
  151. metadata +521 -0
@@ -0,0 +1,8 @@
1
+ angular.module('KMS').factory 'ErrorsService', ->
2
+ {
3
+ prepareErrorsString: (errorsData)->
4
+ result = []
5
+ for field, errors of errorsData
6
+ result.push "#{field}: #{errors.join(',')}"
7
+ result.join('\n')
8
+ }
@@ -0,0 +1,10 @@
1
+ .row
2
+ .col-lg-12
3
+ form role="form"
4
+ .form-group
5
+ small = I18n.t(:toggle_fullscreen_mode_instruction)
6
+ textarea#text.form-control ng-if="asset.css" ng-model="asset.text" rows="40" ui-codemirror="cssEditorOptions"
7
+ textarea#text.form-control ng-if="asset.js" ng-model="asset.text" rows="40" ui-codemirror="javascriptEditorOptions"
8
+ .btn-group
9
+ button.btn.btn-default type="submit" data-redirect="true" ng-click="update($event)" = I18n.t(:update_asset)
10
+ button.btn.btn-default type="submit" ng-click="update($event)" = I18n.t(:update_asset_and_continue)
@@ -0,0 +1,31 @@
1
+ .row
2
+ .col-lg-12
3
+ .widget
4
+ .widget-header
5
+ i.fa.fa-image
6
+ = Kms::Asset.model_name.human(count: 1.1)
7
+ /a.pull-right href="#" Manage
8
+ a.btn.btn-sm.btn-primary.pull-right ui-sref="assets.new"
9
+ = I18n.t("add_asset")
10
+ .widget-body.no-padding
11
+ .table-responsive
12
+ table.table ng-repeat="(content_type, typed_assets) in assets"
13
+ thead
14
+ tr
15
+ td.text-center.bg-info colspan="3"
16
+ | {{ content_type }}
17
+ tbody
18
+ tr ng-repeat="asset in typed_assets"
19
+ td style="width: 40%"
20
+ | {{ asset.filename }}
21
+ td style="width: 40%"
22
+ | {{asset.file.url}}
23
+ td
24
+ .btn-group.pull-right
25
+ a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
26
+ i.fa.fa-pencil
27
+ a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
28
+ i.fa.fa-times
29
+ /div ui-tree=""
30
+ /ol ui-tree-nodes="" ng-model="pages" id="tree-root"
31
+ /li ng-repeat="node in pages" ui-tree-node="" ng-include="'nodes_renderer.html'"
@@ -0,0 +1,16 @@
1
+ .row
2
+ .col-lg-12 flow-init="{headers: setHeaders}" flow-files-submitted="$flow.upload()" flow-file-success="$file.msg = $message" flow-complete="$state.go('assets')"
3
+ /! The table listing the files available for upload/download
4
+ .form-group
5
+ button.btn.btn-primary flow-btn="" = I18n.t(:upload_assets)
6
+ table.table.table-striped.files.ng-cloak
7
+ tr ng-repeat="file in $flow.files"
8
+ td
9
+ img flow-img="file" width="50" height="50" ng-show="isImageType(file)"
10
+ td
11
+ | {{ file.name }}
12
+ td
13
+ .progress.progress-striped ng-class="{active: file.isUploading()}"
14
+ .progress-bar role="progressbar" ng-style="{width: (file.progress() * 100) + '%'}"
15
+ td
16
+ | {{ file.msg }}
@@ -0,0 +1,172 @@
1
+ .row
2
+ .col-lg-12
3
+ ul.nav.nav-tabs
4
+ li role="presentation" ng-class="{active: isActiveTab(0)}" ng-click="setActive(0)"
5
+ a href="#liquor" Liquor
6
+ - Kms::HelpService.templates.each_with_index do |(engine_class, _),index|
7
+ li role="presentation" ng-class="{active: isActiveTab(#{index + 1})}" ng-click="setActive(#{index + 1})"
8
+ a href="##{engine_class.engine_name}" = engine_class.engine_name.humanize
9
+ div class="tab-content"
10
+ div role="tabpanel" class="tab-pane" ng-class="{active: isActiveTab(0)}" id="liquor"
11
+ .widget
12
+ .widget-body.no-padding
13
+ .message
14
+ h4 = I18n.t("liquor_help.tags_title")
15
+ p
16
+ ul
17
+ li
18
+ var declare
19
+ p
20
+ span = I18n.t('liquor_help.tags.declare.main_description')
21
+ p
22
+ code
23
+ | {% declare var = expr %}
24
+ p
25
+ span = I18n.t('liquor_help.tags.declare.additional_description')
26
+ li
27
+ var assign
28
+ p
29
+ span = I18n.t('liquor_help.tags.assign.main_description')
30
+ p
31
+ code
32
+ | {% assign var = expr %}
33
+ li
34
+ em if
35
+ p
36
+ span = I18n.t('liquor_help.tags.if.main_description')
37
+ p
38
+ code
39
+ | {% if cond-1 then: %}
40
+ br
41
+ |   code-1
42
+ br
43
+ | [{% elsif: cond-2 then: %}
44
+ br
45
+ |   code-2] ...
46
+ br
47
+ | [{% else: %}
48
+ br
49
+ |   code-else]
50
+ br
51
+ | {% end if %}
52
+ li
53
+ em unless
54
+ p
55
+ span = I18n.t('liquor_help.tags.unless.main_description')
56
+ p
57
+ code
58
+ | {% unless cond-1 then: %}
59
+ br
60
+ |   code-1
61
+ br
62
+ | {% end unless %}
63
+ li
64
+ em for
65
+ p
66
+ span = I18n.t('liquor_help.tags.for.main_description')
67
+ p
68
+ code
69
+ | {% for var in: list do: %}
70
+ br
71
+ |   code
72
+ br
73
+ | {% end for %}
74
+ br
75
+ | {% for var from: lower-limit to: upper-limit do: %}
76
+ br
77
+ |   code
78
+ br
79
+ | {% end for %}
80
+ li
81
+ em capture
82
+ p
83
+ span = I18n.t('liquor_help.tags.capture.main_description')
84
+ p
85
+ code
86
+ | {% capture var = %}
87
+ br
88
+ |   code
89
+ br
90
+ | {% end capture %}
91
+ li
92
+ em content_for
93
+ p
94
+ span = I18n.t('liquor_help.tags.content_for.main_description')
95
+ p
96
+ code
97
+ | {% content_for "handle" capture: %}
98
+ br
99
+ |   code
100
+ br
101
+ | {% end content_for %}
102
+ li
103
+ em yield
104
+ p
105
+ span = I18n.t('liquor_help.tags.yield.main_description')
106
+ p
107
+ code
108
+ | {% yield %}
109
+ br
110
+ |   #{ I18n.t('or') }
111
+ br
112
+ | {% yield "handle" %}
113
+ br
114
+ |   #{ I18n.t('or') }
115
+ br
116
+ | {% yield "handle" if_none: %}
117
+ br
118
+ |   code
119
+ br
120
+ | {% end yield %}
121
+ li
122
+ em include
123
+ p
124
+ span = I18n.t('liquor_help.tags.include.main_description')
125
+ p
126
+ code
127
+ | {% include "partial_name" %}
128
+ .message
129
+ h4 = I18n.t("liquor_help.variables_title")
130
+ p
131
+ ul
132
+ li
133
+ var var_loop
134
+ p
135
+ span = I18n.t('liquor_help.variables.var_loop.main_description')
136
+ p
137
+ code ng-non-bindable=""
138
+ | {% for p in: index.children do: %}
139
+ br
140
+ |   {{ p_loop.index }} # prints number of current iteration
141
+ p
142
+ table.table
143
+ tr
144
+ th #{ I18n.t('liquor_help.properties') } var_loop
145
+ th = I18n.t('liquor_help.description')
146
+ tr
147
+ td length
148
+ td = I18n.t('liquor_help.variables.var_loop.properties.length')
149
+ tr
150
+ td index
151
+ td = I18n.t('liquor_help.variables.var_loop.properties.index')
152
+ tr
153
+ td rindex
154
+ td
155
+ | length - index - 1
156
+ tr
157
+ td is_first
158
+ td
159
+ | index == 0
160
+ tr
161
+ td is_last
162
+ td
163
+ | index == length - 1
164
+ .message
165
+ a href="http://evilmartians.github.io/liquor/language-spec.html" target="_blank" = I18n.t('liquor_help.specification')
166
+ - Kms::HelpService.templates.each_with_index do |(engine_class, templates), index|
167
+ div role="tabpanel" class="tab-pane" ng-class="{active: isActiveTab(#{index + 1})}" id=engine_class.engine_name
168
+ .widget
169
+ .widget-body.no-padding
170
+ - templates.each do |template|
171
+ .message
172
+ ng-include src="'#{template}'"
@@ -0,0 +1,51 @@
1
+ h4 = I18n.t("liquor_help.filters_title")
2
+ p
3
+ ul
4
+ li
5
+ var asset_path
6
+ p
7
+ span = I18n.t('liquor_help.filters.asset_path.main_description')
8
+ p
9
+ code
10
+ | <img src="{{ 'logo.png' | asset_path }}">
11
+ li
12
+ var asset_tag
13
+ p
14
+ span = I18n.t('liquor_help.filters.asset_tag.main_description')
15
+ p
16
+ code
17
+ | {{ 'bootstrap.min.css' | asset_tag }}
18
+ li
19
+ var resize
20
+ p
21
+ span = I18n.t('liquor_help.filters.resize.main_description')
22
+ p
23
+ code
24
+ | {{ 'http://example.com/image.png' | resize format: '100x100' }}
25
+ br
26
+ | {{ (request.base_url + item.image) | resize format: '100x100' }}
27
+ li
28
+ var add_watermark
29
+ p
30
+ span = I18n.t('liquor_help.filters.add_watermark.main_description')
31
+ p
32
+ code
33
+ | {{ 'http://example.com/image.png' | add_watermark image: 'http://example.com/watermark.png' dissolve: '50%' position: 'center' }}
34
+ li
35
+ var ends_with
36
+ p
37
+ span = I18n.t('liquor_help.filters.ends_with.main_description')
38
+ p
39
+ code
40
+ | {% if ends_with(media_item.file pattern: 'mp4') then: %}
41
+ li
42
+ var currency
43
+ p
44
+ span = I18n.t('liquor_help.filters.currency.main_description')
45
+ p
46
+ code
47
+ | # item.price is 100.0
48
+ br
49
+ | {{ item.price | currency precision: 0 }}
50
+ br
51
+ | # result - "100 руб."
@@ -0,0 +1,96 @@
1
+ h4 = I18n.t("liquor_help.variables_title")
2
+ p
3
+ ul
4
+ li
5
+ var page
6
+ p
7
+ span = I18n.t('liquor_help.variables.page.main_description')
8
+ p
9
+ table.table
10
+ tr
11
+ th #{ I18n.t('liquor_help.properties') } Page
12
+ th = I18n.t('liquor_help.description')
13
+ tr
14
+ td slug
15
+ td = I18n.t('liquor_help.variables.page.properties.slug')
16
+ tr
17
+ td fullpath
18
+ td = I18n.t('liquor_help.variables.page.properties.fullpath')
19
+ tr
20
+ td title
21
+ td = I18n.t('liquor_help.variables.page.properties.title')
22
+ tr
23
+ td published
24
+ td = I18n.t('liquor_help.variables.page.properties.published')
25
+ tr
26
+ td hidden
27
+ td = I18n.t('liquor_help.variables.page.properties.hidden')
28
+ tr
29
+ td templatable
30
+ td = I18n.t('liquor_help.variables.page.properties.templatable')
31
+ tr
32
+ td children
33
+ td = I18n.t('liquor_help.variables.page.properties.children')
34
+ tr
35
+ td parent
36
+ td = I18n.t('liquor_help.variables.page.properties.parent')
37
+ li
38
+ var index
39
+ p
40
+ span = I18n.t('liquor_help.variables.index.main_description')
41
+ li
42
+ var request
43
+ p
44
+ span = I18n.t('liquor_help.variables.request.main_description')
45
+ p
46
+ table.table
47
+ tr
48
+ th #{ I18n.t('liquor_help.property') } Request
49
+ th = I18n.t('liquor_help.description')
50
+ tr
51
+ td path
52
+ td = I18n.t('liquor_help.variables.request.properties.path')
53
+ tr
54
+ td url
55
+ td = I18n.t('liquor_help.variables.request.properties.url')
56
+ tr
57
+ td host
58
+ td = I18n.t('liquor_help.variables.request.properties.host')
59
+ tr
60
+ td base_url
61
+ td = I18n.t('liquor_help.variables.request.properties.base_url')
62
+ tr
63
+ td referer
64
+ td = I18n.t('liquor_help.variables.request.properties.referer')
65
+ tr
66
+ td form_authenticity_token
67
+ td = I18n.t('liquor_help.variables.request.properties.form_authenticity_token')
68
+ tr
69
+ td param()
70
+ td = I18n.t('liquor_help.variables.request.properties.param')
71
+ li
72
+ var item
73
+ p
74
+ span = I18n.t('liquor_help.variables.item.main_description')
75
+ li
76
+ var search
77
+ p
78
+ span = I18n.t('liquor_help.variables.search.main_description')
79
+ li
80
+ var search_item
81
+ p
82
+ span = I18n.t('liquor_help.variables.search_item.main_description')
83
+ p
84
+ table.table
85
+ tr
86
+ th #{ I18n.t('liquor_help.property') } search_item
87
+ th = I18n.t('liquor_help.description')
88
+ tr
89
+ td title
90
+ td = I18n.t('liquor_help.variables.search_item.properties.title')
91
+ tr
92
+ td content
93
+ td = I18n.t('liquor_help.variables.search_item.properties.content')
94
+ tr
95
+ td link
96
+ td = I18n.t('liquor_help.variables.search_item.properties.link')
@@ -0,0 +1,7 @@
1
+ .row
2
+ .col-lg-12
3
+ form role="form"
4
+ ng-include src="'pages/form.html'"
5
+ .btn-group
6
+ button.btn.btn-default type="submit" data-redirect="true" ng-click="update($event)" = I18n.t(:update_page)
7
+ button.btn.btn-default type="submit" ng-click="update($event)" = I18n.t(:update_page_and_continue)
@@ -0,0 +1,32 @@
1
+ .form-group
2
+ label for="title" = Kms::Page.human_attribute_name(:title)
3
+ input#title.form-control type="text" ng-model="page.title" required=""
4
+ .form-group ng-hide="page.templatable"
5
+ label for="slug" = Kms::Page.human_attribute_name(:slug)
6
+ input#slug.form-control type="text" ng-model="page.slug" ng-attr-required="{{page.templatable ? undefined : ''}}" ng-disabled="page.slug == 'index'"
7
+ .form-group
8
+ label for="template_id" = Kms::Page.human_attribute_name(:template)
9
+ select#template_id.form-control ng-model="page.template_id" ng-options="template.id as template.name for template in templates" required=""
10
+ .form-group ng-if="page.slug != 'index'"
11
+ label for="parent_id" = Kms::Page.human_attribute_name(:parent)
12
+ select#parent_id.form-control ng-model="page.parent_id" ng-options="page.id as page.title for page in parentPages" required=""
13
+ .form-group
14
+ label for="templatable" style="margin-right:10px;" = Kms::Page.human_attribute_name(:templatable)
15
+ toggle-switch ng-model="page.templatable" on-label=I18n.t(:yes_word) off-label=I18n.t(:no_word)
16
+ .form-group ng-if="page.templatable"
17
+ label for="templatable_type" = Kms::Page.human_attribute_name(:templatable_type)
18
+ select#templatable_type.form-control ng-model="page.templatable_type" ng-options="templatable_type.type as templatable_type.title for templatable_type in templatable_types"
19
+ .form-group
20
+ label for="hidden" style="margin-right:10px;"
21
+ = Kms::Page.human_attribute_name(:hidden)
22
+ toggle-switch ng-model="page.hidden" on-label=I18n.t(:yes_word) off-label=I18n.t(:no_word)
23
+ .form-group
24
+ label for="content" = Kms::Page.human_attribute_name(:content)
25
+ textarea#content.form-control ng-model="page.content" rows="15" ng-if="currentUser.admin" ui-codemirror="codeMirrorOptions"
26
+ small ng-if="currentUser.admin" = I18n.t(:toggle_fullscreen_mode_instruction)
27
+ textarea#content.form-control ng-model="page.content" rows="15" ng-if="!currentUser.admin" ckeditor='editorOptions'
28
+ .form-group
29
+ label for="published" style="margin-right:10px;" = Kms::Page.human_attribute_name(:published)
30
+ toggle-switch ng-model="page.published" on-label=I18n.t(:yes_word) off-label=I18n.t(:no_word)
31
+ - Kms::FormCustomizationService.resources[Kms::Page].each do |template|
32
+ ng-include src="'pages/#{template}.html'"
@@ -0,0 +1,33 @@
1
+ // Nested node template
2
+ script type="text/ng-template" id="nodes_renderer.html"
3
+ div ui-tree-handle=""
4
+ div style="width:50%;float:left;height:30px;line-height:30px;" ng-class="{'not-published': !node.published}"
5
+ a data-nodrag="" ng-click="toggle(node)" ng-if="node.children" style="padding-right:5px;"
6
+ i.fa ng-class="{'fa-plus': collapsed, 'fa-minus': !collapsed}"
7
+ | {{node.title}} 
8
+ i.fa.fa-cogs style="font-size:18px !important" ng-if="node.templatable"
9
+ div style="width:30%;float:left;height:30px;line-height:30px;"
10
+ | {{ node.fullpath }}
11
+ .btn-group.pull-right
12
+ a.btn.btn-sm.btn-info data-nodrag="" ui-sref="pages.edit({id: node.id})"
13
+ i.fa.fa-pencil
14
+ a.btn.btn-sm.btn-danger data-nodrag="" ng-click="destroy(node)" style="margin-right: 8px;"
15
+ i.fa.fa-times
16
+ ol ui-tree-nodes="pages" ng-model="node.children" ng-class="{hidden: collapsed}"
17
+ li ng-repeat="node in node.children" ui-tree-node="" ng-include="'nodes_renderer.html'" data-id="{{node.id}}"
18
+
19
+
20
+
21
+ .row
22
+ .col-lg-12
23
+ .widget
24
+ .widget-header
25
+ i.fa.fa-sitemap
26
+ = Kms::Page.model_name.human(count: 1.1)
27
+ /a.pull-right href="#" Manage
28
+ a.btn.btn-sm.btn-primary.pull-right ui-sref="pages.new"
29
+ = I18n.t("add_page")
30
+ .widget-body.no-padding
31
+ div ui-tree="pages" callbacks="treeOptions"
32
+ ol ui-tree-nodes="" ng-model="pages" id="tree-root"
33
+ li ng-repeat="node in pages" ui-tree-node="" ng-include="'nodes_renderer.html'" data-id="{{node.id}}"