kms 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,21 @@
|
|
1
|
+
<div class="wrapper">
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {class: "form-signin"}) do |f| %>
|
4
|
+
<h2 class="form-signin-heading">KMS</h2>
|
5
|
+
<%= devise_error_messages! %>
|
6
|
+
|
7
|
+
<%= f.email_field :email, autofocus: true, class: 'form-control', placeholder: Kms::User.human_attribute_name(:email), required: '' %>
|
8
|
+
|
9
|
+
<%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: Kms::User.human_attribute_name(:password), required: '' %>
|
10
|
+
<%# if @validatable %>
|
11
|
+
<!--<em>(<%= @minimum_password_length %> characters minimum)</em>-->
|
12
|
+
<%# end %><!--<br />-->
|
13
|
+
|
14
|
+
<%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: Kms::User.human_attribute_name(:password_confirmation), required: '' %>
|
15
|
+
|
16
|
+
<%= f.submit t("sign_up"), class: "btn btn-lg btn-primary btn-block" %>
|
17
|
+
<br>
|
18
|
+
<%= render "devise/shared/links" %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class="wrapper">
|
2
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: {class: "form-signin"}) do |f| %>
|
3
|
+
<h2 class="form-signin-heading">KMS</h2>
|
4
|
+
<%= f.email_field :email, autofocus: true, class: 'form-control', placeholder: Kms::User.human_attribute_name(:email), required: '' %>
|
5
|
+
<%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: Kms::User.human_attribute_name(:password), required: '' %>
|
6
|
+
<% if devise_mapping.rememberable? -%>
|
7
|
+
<div class="checkbox">
|
8
|
+
<label>
|
9
|
+
<%= f.check_box :remember_me %> <%= t("remember_me") %>
|
10
|
+
</label>
|
11
|
+
</div>
|
12
|
+
<% end -%>
|
13
|
+
<%= f.submit t("login"), class: "btn btn-lg btn-primary btn-block" %>
|
14
|
+
<br>
|
15
|
+
<%= render "devise/shared/links" %>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to t("login"), new_session_path(resource_name) %><br />
|
3
|
+
<% end -%>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' && !Kms::User.exists? %>
|
6
|
+
<%= link_to t("sign_up"), new_registration_path(resource_name) %><br />
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
10
|
+
<%= link_to t("forgot_your_password"), new_password_path(resource_name) %><br />
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
19
|
+
<% end -%>
|
20
|
+
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
+
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
24
|
+
<% end -%>
|
25
|
+
<% end -%>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
+
<meta name="description" content="">
|
8
|
+
<meta name="author" content="">
|
9
|
+
<link rel="icon" href="../../favicon.ico">
|
10
|
+
|
11
|
+
<title>KMS</title>
|
12
|
+
|
13
|
+
<%= stylesheet_link_tag 'kms/application', media: 'all', 'data-turbolinks-track' => true %>
|
14
|
+
<%= csrf_meta_tags %>
|
15
|
+
<!-- Bootstrap core CSS -->
|
16
|
+
|
17
|
+
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
|
18
|
+
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
|
19
|
+
|
20
|
+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
21
|
+
<!--[if lt IE 9]>
|
22
|
+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
23
|
+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
24
|
+
<![endif]-->
|
25
|
+
</head>
|
26
|
+
|
27
|
+
<body>
|
28
|
+
|
29
|
+
<div class="container">
|
30
|
+
|
31
|
+
<%= yield %>
|
32
|
+
|
33
|
+
</div> <!-- /container -->
|
34
|
+
|
35
|
+
</body></html>
|
@@ -0,0 +1,139 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en" ng-app="KMS">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
+
|
7
|
+
<title>Kms</title>
|
8
|
+
<%= stylesheet_link_tag 'kms/application', media: 'all', 'data-turbolinks-track' => true %>
|
9
|
+
<script type="text/javascript">
|
10
|
+
var CKEDITOR_BASEPATH = '/assets/ng-ckeditor/libs/ckeditor/';
|
11
|
+
</script>
|
12
|
+
<%= csrf_meta_tags %>
|
13
|
+
|
14
|
+
<!-- build:js js/dashboard.js -->
|
15
|
+
<!-- endbuild -->
|
16
|
+
<!-- SCRIPTS -->
|
17
|
+
<base href="/">
|
18
|
+
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<div id="page-wrapper" ng-controller="SidebarController" ng-class="{'active': toggle}" >
|
22
|
+
|
23
|
+
<!-- Sidebar -->
|
24
|
+
|
25
|
+
<div id="sidebar-wrapper">
|
26
|
+
<ul class="sidebar">
|
27
|
+
<li class="sidebar-main">
|
28
|
+
<a href="#" ng-click="toggleSidebar()">
|
29
|
+
Kms
|
30
|
+
<span class="menu-icon glyphicon glyphicon-transfer"></span>
|
31
|
+
</a>
|
32
|
+
</li>
|
33
|
+
<% Kms::ResourceService.resources.each do |group, resources| %>
|
34
|
+
<% if resources.keys.any? {|r| can?(:index, r)} %>
|
35
|
+
<li class="sidebar-title"><span><%= t(group) %></span></li>
|
36
|
+
<% end %>
|
37
|
+
<% resources.each do |resource_class, tab_icon_class| %>
|
38
|
+
<% if can? :index, resource_class %>
|
39
|
+
<li class="sidebar-list">
|
40
|
+
<a ui-sref="<%= defined?(Kms::Model) && resource_class.is_a?(Kms::Model) ? "models.entries({modelId: #{resource_class.name}})" : resource_class.name.demodulize.tableize %>">
|
41
|
+
<%= resource_class.model_name.human(count: 1.1) %>
|
42
|
+
<span class="menu-icon fa <%= tab_icon_class %>"></span>
|
43
|
+
</a>
|
44
|
+
</li>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
<% end %>
|
48
|
+
</ul>
|
49
|
+
<div class="sidebar-footer">
|
50
|
+
<div class="col-xs-4">
|
51
|
+
<a href="http://webgradus.ru" target="_blank">
|
52
|
+
©Градус
|
53
|
+
</a>
|
54
|
+
</div>
|
55
|
+
<div class="col-xs-4">
|
56
|
+
<a ui-sref="help">
|
57
|
+
<%= t(:help) %>
|
58
|
+
</a>
|
59
|
+
</div>
|
60
|
+
<!--
|
61
|
+
<div class="col-xs-4">
|
62
|
+
<a href="#">
|
63
|
+
Support
|
64
|
+
</a>
|
65
|
+
</div>
|
66
|
+
-->
|
67
|
+
</div>
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<!-- End Sidebar -->
|
71
|
+
|
72
|
+
<div id="content-wrapper">
|
73
|
+
<div class="page-content">
|
74
|
+
|
75
|
+
<!-- Header Bar -->
|
76
|
+
|
77
|
+
<div class="row header">
|
78
|
+
<div class="col-xs-12">
|
79
|
+
<div class="user pull-right">
|
80
|
+
<div class="item dropdown">
|
81
|
+
<a href="#" class="dropdown-toggle">
|
82
|
+
<img src="<%= asset_path "Responsive-Dashboard/src/img/avatar.jpg" %>">
|
83
|
+
</a>
|
84
|
+
<ul class="dropdown-menu dropdown-menu-right">
|
85
|
+
<li class="dropdown-header">
|
86
|
+
<%= current_kms_user.try(:email) %>
|
87
|
+
</li>
|
88
|
+
<li class="divider"></li>
|
89
|
+
<li class="link">
|
90
|
+
<a ui-sref="settings">
|
91
|
+
<%= t(:settings) %>
|
92
|
+
</a>
|
93
|
+
</li>
|
94
|
+
<li class="link">
|
95
|
+
<%= link_to t(:sign_out), destroy_kms_user_session_path, target: "_self" %>
|
96
|
+
</li>
|
97
|
+
</ul>
|
98
|
+
</div>
|
99
|
+
<!--
|
100
|
+
<div class="item dropdown">
|
101
|
+
<a href="#" class="dropdown-toggle">
|
102
|
+
<i class="fa fa-bell-o"></i>
|
103
|
+
</a>
|
104
|
+
<ul class="dropdown-menu dropdown-menu-right">
|
105
|
+
<li class="dropdown-header">
|
106
|
+
Notifications
|
107
|
+
</li>
|
108
|
+
<li class="divider"></li>
|
109
|
+
<li>
|
110
|
+
<a href="#">Server Down!</a>
|
111
|
+
</li>
|
112
|
+
</ul>
|
113
|
+
</div>
|
114
|
+
-->
|
115
|
+
</div>
|
116
|
+
<div class="meta">
|
117
|
+
<div class="page" ui-view="header">
|
118
|
+
Dashboard
|
119
|
+
</div>
|
120
|
+
<!--
|
121
|
+
<div class="breadcrumb-links">
|
122
|
+
Home / Dashboard
|
123
|
+
</div>-->
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
<!-- End Header Bar -->
|
129
|
+
|
130
|
+
<!-- Main Content -->
|
131
|
+
<section ui-view></section>
|
132
|
+
</div><!-- End Page Content -->
|
133
|
+
</div><!-- End Content Wrapper -->
|
134
|
+
</div><!-- End Page Wrapper -->
|
135
|
+
|
136
|
+
<%= javascript_include_tag 'kms/application', 'data-turbolinks-track' => true %>
|
137
|
+
|
138
|
+
</body>
|
139
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
BowerRails.configure do |bower_rails|
|
2
|
+
# Tell bower-rails what path should be considered as root. Defaults to Dir.pwd
|
3
|
+
# bower_rails.root_path = Dir.pwd
|
4
|
+
|
5
|
+
# Invokes rake bower:install before precompilation. Defaults to false
|
6
|
+
# bower_rails.install_before_precompile = true
|
7
|
+
|
8
|
+
# Invokes rake bower:resolve before precompilation. Defaults to false
|
9
|
+
# bower_rails.resolve_before_precompile = true
|
10
|
+
|
11
|
+
# Invokes rake bower:clean before precompilation. Defaults to false
|
12
|
+
# bower_rails.clean_before_precompile = true
|
13
|
+
|
14
|
+
# Invokes rake bower:install:deployment instead rake bower:install. Defaults to false
|
15
|
+
# bower_rails.use_bower_install_deployment = true
|
16
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
include ActionView::Helpers::TextHelper
|
2
|
+
Kms::ExternalsRegistry.register(:request) {|request, controller| Liquor::Rails::Request.new(request, controller) }
|
3
|
+
Kms::ExternalsRegistry.register(:index) {|_,_| Kms::Page.find_by_slug!("index").to_drop }
|
4
|
+
Kms::ExternalsRegistry.register(:page) do |request,_|
|
5
|
+
page = Kms::Page.published.find_by_fullpath(request.params[:path] || Kms::Page::INDEX_FULLPATH)
|
6
|
+
unless page # in case of templatable page
|
7
|
+
page_path = request.params[:path] || ''
|
8
|
+
parent_page_path = File.dirname(page_path)
|
9
|
+
parent_page_path = Kms::Page::INDEX_FULLPATH if parent_page_path == "."
|
10
|
+
parent_page = Kms::Page.published.find_by_fullpath!(parent_page_path)
|
11
|
+
templatable_pages = parent_page.children.where(templatable: true)
|
12
|
+
page = templatable_pages.detect do |templatable_page|
|
13
|
+
templatable_page.fetch_item!(File.basename(page_path))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
page ? page.to_drop : raise(ActiveRecord::RecordNotFound)
|
17
|
+
end
|
18
|
+
Kms::ExternalsRegistry.register(:item) do |request,controller|
|
19
|
+
page = Kms::ExternalsRegistry.externals[:page].call(request, controller)
|
20
|
+
if page && page.source.templatable?
|
21
|
+
page.source.fetch_item!(File.basename(request.params[:path])).try(:to_drop)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
Kms::ExternalsRegistry.register(:search) do |request,controller|
|
25
|
+
results = []
|
26
|
+
if request.params[:query].present?
|
27
|
+
key_words = request.params[:query].split(' ')
|
28
|
+
results_ids = Kms::Page.published.advanced_search(key_words.join('|')).map(&:id)
|
29
|
+
results = Kms::Page.published.where('id IN (?)', results_ids).map {|page| Kms::SearchItem.new(title: highlight(page.title, key_words, highlighter: '<span class="highlight">\1</span>'), link: page.fullpath, content: highlight(page.content, key_words, highlighter: '<span class="highlight">\1</span>'))}
|
30
|
+
|
31
|
+
Kms::SearchService.resources.each do |resource|
|
32
|
+
resource_ids = resource.advanced_search(request.params[:query].split(' ').join('|')).map(&:id)
|
33
|
+
resource_items = resource.where('id IN (?)', resource_ids)
|
34
|
+
parent_page = Kms::Page.published.find_by_templatable_type(resource)
|
35
|
+
resource_items.each do |item|
|
36
|
+
results << Kms::SearchItem.new(title: highlight(item.title, key_words, highlighter: '<span class="highlight">\1</span>'), link: parent_page.parent.fullpath + '/' + item.slug, content: highlight(item.content, key_words, highlighter: '<span class="highlight">\1</span>'))
|
37
|
+
end if parent_page && parent_page.templatable
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
results
|
42
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Kms::HelpService.register_templates Kms::Engine, 'help/filters.html', 'help/variables.html'
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'kms/functions/assets'
|
2
|
+
require 'kms/functions/currency'
|
3
|
+
#Kms.template_manager = Liquor::Manager.new(import: [Liquor::Pagination, Kms::Functions::Assets, Kms::Functions::Currency])
|
4
|
+
|
5
|
+
# if ActiveRecord::Base.connection.tables.include?('kms_templates')
|
6
|
+
# Kms::Template.all.each do |template|
|
7
|
+
# Kms.template_manager.register_layout(template.register_id, template.content || "", Kms::ExternalsRegistry.externals.keys)
|
8
|
+
# end
|
9
|
+
# end
|
10
|
+
# if ActiveRecord::Base.connection.tables.include?('kms_pages')
|
11
|
+
# Kms::Page.all.each do |page|
|
12
|
+
# Kms.template_manager.register_template(page.register_id, page.content || "", Kms::ExternalsRegistry.externals.keys)
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#Rails.configuration.x.template_manager.register_partial("_pagination", <<-eos
|
16
|
+
#{% pagination start: %}
|
17
|
+
#<div class='digg_pagination'>
|
18
|
+
#{% if page.is_current then: %}
|
19
|
+
#<span class="disabled previous_page">← Previous</span>
|
20
|
+
#{% else: %}
|
21
|
+
#<a href="{{ prev_page_path }}" rel="previous" class="previous_page_page">← Previous</a>
|
22
|
+
#{% end if %}
|
23
|
+
#{% page: %}
|
24
|
+
#{% if page.is_current then: %}
|
25
|
+
#<em class="current">{{ page.number }}</em>
|
26
|
+
#{% elsif: page.is_next then: %}
|
27
|
+
#<a href="{{ page.path }}" rel="next">{{ page.number }}</a>
|
28
|
+
#{% elsif: page.is_prev then: %}
|
29
|
+
#<a href="{{ page.path }}" rel="previous">{{ page.number }}</a>
|
30
|
+
#{% else: %}
|
31
|
+
#<a href="{{ page.path }}">3</a>
|
32
|
+
#{% end if %}
|
33
|
+
#{% gap: %}
|
34
|
+
#<span class="gap">…</span>
|
35
|
+
#{% end: %}
|
36
|
+
#{% if page.is_current then: %}
|
37
|
+
#<span class="disabled next_page">Next →</span>
|
38
|
+
#{% else: %}
|
39
|
+
#<a href="{{ next_page_path }}" rel="next" class="next_page">Next →</a></div>
|
40
|
+
#{% end if %}
|
41
|
+
#{% end pagination %}
|
42
|
+
#eos
|
43
|
+
#)
|
44
|
+
|
45
|
+
# unless Kms.template_manager.compile
|
46
|
+
# Kms.template_manager.errors.each do |error|
|
47
|
+
# puts error
|
48
|
+
# end
|
49
|
+
# end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Kms::ResourceService.register(:content_management, Kms::Template, "fa-support")
|
2
|
+
Kms::ResourceService.register(:content_management, Kms::Page, "fa-sitemap")
|
3
|
+
Kms::ResourceService.register(:content_management, Kms::Asset, "fa-image")
|
4
|
+
Kms::ResourceService.register(:content_management, Kms::User, "fa-users")
|
5
|
+
Kms::ResourceService.register(:content_management, Kms::Snippet, "fa-bookmark")
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
devise:
|
5
|
+
confirmations:
|
6
|
+
confirmed: "Your account was successfully confirmed."
|
7
|
+
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
8
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
|
9
|
+
failure:
|
10
|
+
already_authenticated: "You are already signed in."
|
11
|
+
inactive: "Your account is not activated yet."
|
12
|
+
invalid: "Invalid email or password."
|
13
|
+
locked: "Your account is locked."
|
14
|
+
last_attempt: "You have one more attempt before your account will be locked."
|
15
|
+
not_found_in_database: "Invalid email or password."
|
16
|
+
timeout: "Your session expired. Please sign in again to continue."
|
17
|
+
unauthenticated: "You need to sign in or sign up before continuing."
|
18
|
+
unconfirmed: "You have to confirm your account before continuing."
|
19
|
+
mailer:
|
20
|
+
confirmation_instructions:
|
21
|
+
subject: "Confirmation instructions"
|
22
|
+
reset_password_instructions:
|
23
|
+
subject: "Reset password instructions"
|
24
|
+
unlock_instructions:
|
25
|
+
subject: "Unlock Instructions"
|
26
|
+
omniauth_callbacks:
|
27
|
+
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
28
|
+
success: "Successfully authenticated from %{kind} account."
|
29
|
+
passwords:
|
30
|
+
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
31
|
+
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
32
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
33
|
+
updated: "Your password was changed successfully. You are now signed in."
|
34
|
+
updated_not_active: "Your password was changed successfully."
|
35
|
+
registrations:
|
36
|
+
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
|
37
|
+
signed_up: "Welcome! You have signed up successfully."
|
38
|
+
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
39
|
+
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
40
|
+
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
|
41
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
|
42
|
+
updated: "You updated your account successfully."
|
43
|
+
sessions:
|
44
|
+
signed_in: "Signed in successfully."
|
45
|
+
signed_out: "Signed out successfully."
|
46
|
+
unlocks:
|
47
|
+
send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
|
48
|
+
send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
|
49
|
+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
50
|
+
errors:
|
51
|
+
messages:
|
52
|
+
already_confirmed: "was already confirmed, please try signing in"
|
53
|
+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
54
|
+
expired: "has expired, please request a new one"
|
55
|
+
not_found: "not found"
|
56
|
+
not_locked: "was not locked"
|
57
|
+
not_saved:
|
58
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
59
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Русский перевод для https://github.com/plataformatec/devise/blob/6b0d11ed7a457ef1a338718e2e1819aeb25e943d/config/locales/en.yml (3.4.0)
|
2
|
+
# Другие переводы на http://github.com/plataformatec/devise/wiki/I18n
|
3
|
+
|
4
|
+
ru:
|
5
|
+
devise:
|
6
|
+
confirmations:
|
7
|
+
confirmed: "Ваш адрес электронной почты успешно подтвержден."
|
8
|
+
send_instructions: "В течение нескольких минут Вы получите письмо с инструкциями по подтверждению Вашего адреса электронной почты."
|
9
|
+
send_paranoid_instructions: "Если Ваш адрес email есть в нашей базе данных, то в течение нескольких минут Вы получите письмо с инструкциями по подтверждению Вашего адреса электронной почты."
|
10
|
+
failure:
|
11
|
+
already_authenticated: "Вы уже вошли в систему."
|
12
|
+
inactive: "Ваша учётная запись ещё не активирована."
|
13
|
+
invalid: "Неверные %{authentication_keys} или пароль."
|
14
|
+
locked: "Ваша учётная запись заблокирована."
|
15
|
+
last_attempt: "У Вас осталась еще одна попытка ввести пароль до блокировки."
|
16
|
+
not_found_in_database: "Неверный %{authentication_keys} или пароль."
|
17
|
+
timeout: "Ваш сеанс закончился. Пожалуйста, войдите в систему снова."
|
18
|
+
unauthenticated: "Вам необходимо войти в систему или зарегистрироваться."
|
19
|
+
unconfirmed: "Вы должны подтвердить Ваш адрес электронной почты."
|
20
|
+
mailer:
|
21
|
+
confirmation_instructions:
|
22
|
+
subject: "Инструкции по подтверждению учётной записи"
|
23
|
+
reset_password_instructions:
|
24
|
+
subject: "Инструкции по восстановлению пароля"
|
25
|
+
unlock_instructions:
|
26
|
+
subject: "Инструкции по разблокировке учётной записи"
|
27
|
+
omniauth_callbacks:
|
28
|
+
failure: "Вы не можете войти в систему с учётной записью из %{kind}, так как \"%{reason}\"."
|
29
|
+
success: "Вход в систему выполнен с учётной записью из %{kind}."
|
30
|
+
passwords:
|
31
|
+
no_token: "Эта страница доступна только при переходе по ссылке из письма с инструкциями для сброса пароля. Если Вы перешли по ссылке из письма, пожалуйста, убедитесь, что Вы использовали полный URL."
|
32
|
+
send_instructions: "В течение нескольких минут Вы получите письмо с инструкциями по восстановлению Вашего пароля."
|
33
|
+
send_paranoid_instructions: "Если Ваш адрес электронной почты есть в нашей базе данных, то в течение нескольких минут Вы получите письмо с инструкциями по восстановлению Вашего пароля."
|
34
|
+
updated: "Ваш пароль успешно изменён. Теперь Вы вошли в систему."
|
35
|
+
updated_not_active: "Ваш пароль успешно изменён."
|
36
|
+
registrations:
|
37
|
+
destroyed: "До свидания! Ваша учётная запись удалена. Надеемся вскоре снова увидеть Вас."
|
38
|
+
signed_up: "Добро пожаловать! Вы успешно зарегистрировались."
|
39
|
+
signed_up_but_inactive: "Вы успешно зарегистрировались. Тем не менее, Вы не можете войти, потому что Ваша учетная запись еще не активирована."
|
40
|
+
signed_up_but_locked: "Вы успешно зарегистрировались. Тем не менее, Вы не можете войти, потому что Ваша учетная запись заблокирована."
|
41
|
+
signed_up_but_unconfirmed: "На Ваш адрес электронной почты было отправлено сообщение с инструкциями по подтверждению Вашей учётной записи. Пожалуйста, проследуйте по ссылке из этого письма для активации Вашей учетной записи."
|
42
|
+
update_needs_confirmation: "Ваш аккаунт успешно обновлен, но нам необходимо проверить Ваш новый адрес электронной почты. Пожалуйста, проверьте свою электронную почту и проследуйте по ссылке для того чтобы подтвердить ваш адрес электронной почты."
|
43
|
+
updated: "Ваша учётная запись успешно обновлена."
|
44
|
+
sessions:
|
45
|
+
signed_in: "Вход в систему выполнен."
|
46
|
+
signed_out: "Выход из системы выполнен."
|
47
|
+
already_signed_out: "Выход из системы выполнен."
|
48
|
+
unlocks:
|
49
|
+
send_instructions: "В течение нескольких минут Вы получите письмо с инструкциями по разблокировке Вашей учётной записи."
|
50
|
+
send_paranoid_instructions: "Если Ваша учётная запись существует, то в течение нескольких минут Вы получите письмо с инструкциями по её разблокировке."
|
51
|
+
unlocked: "Ваша учётная запись разблокирована. Теперь Вы вошли в систему."
|
52
|
+
errors:
|
53
|
+
messages:
|
54
|
+
already_confirmed: "уже подтверждена. Пожалуйста, попробуйте войти в систему"
|
55
|
+
confirmation_period_expired: "должен быть подтвержден в течении %{period}, пожалуйста, запросите заново"
|
56
|
+
expired: "устарела. Пожалуйста, запросите новую"
|
57
|
+
not_found: "не найдена"
|
58
|
+
not_locked: "не заблокирована"
|
59
|
+
not_saved:
|
60
|
+
one: "%{resource}: сохранение не удалось из-за %{count} ошибки"
|
61
|
+
few: "%{resource}: сохранение не удалось из-за %{count} ошибок"
|
62
|
+
many: "%{resource}: сохранение не удалось из-за %{count} ошибок"
|
63
|
+
other: "%{resource}: сохранение не удалось из-за %{count} ошибки"
|