camaleon_cms 1.0.8 → 1.0.9

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.

Potentially problematic release.


This version of camaleon_cms might be problematic. Click here for more details.

Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -1
  3. data/app/apps/plugins/contact_form/admin_forms_controller.rb +0 -9
  4. data/app/apps/plugins/contact_form/contact_form_helper.rb +94 -3
  5. data/app/apps/plugins/contact_form/front_controller.rb +2 -68
  6. data/app/apps/plugins/front_cache/front_cache_helper.rb +6 -2
  7. data/app/controllers/admin/appearances/widgets/assign_controller.rb +3 -3
  8. data/app/controllers/admin/appearances/widgets/sidebar_controller.rb +5 -5
  9. data/app/controllers/admin/sessions_controller.rb +1 -1
  10. data/app/controllers/api/api_controller.rb +13 -7
  11. data/app/controllers/api/v1/category_controller.rb +9 -1
  12. data/app/controllers/api/v1/contact_form_controller.rb +55 -0
  13. data/app/controllers/camaleon_controller.rb +10 -3
  14. data/app/helpers/session_helper.rb +2 -2
  15. data/app/helpers/theme_helper.rb +12 -0
  16. data/app/serializers/api/base_serializer.rb +9 -0
  17. data/app/serializers/api/v1/category_serializer.rb +8 -0
  18. data/app/views/admin/settings/custom_fields/get_items.html.erb +4 -2
  19. data/app/views/default_theme/layouts/index.html.erb +1 -1
  20. data/config/initializers/swagger.rb +18 -0
  21. data/config/locales/admin/en.yml +12 -2
  22. data/config/locales/languages.yml +14 -0
  23. data/config/locales/ru.yml +207 -0
  24. data/config/routes.rb +5 -0
  25. data/config/routes/admin.rb +2 -0
  26. data/lib/camaleon_cms/engine.rb +5 -0
  27. data/lib/camaleon_cms/version.rb +1 -1
  28. data/lib/generators/camaleon_cms/gem_plugin_generator.rb +23 -23
  29. data/lib/generators/ctheme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +1 -1
  30. data/lib/tasks/precompile_overrides.rake +6 -0
  31. data/public/docs/index.html +70 -0
  32. data/public/docs/swagger-ui/css/highlight.default.css +135 -0
  33. data/public/docs/swagger-ui/css/screen.css +1070 -0
  34. data/public/docs/swagger-ui/images/logo_small.png +0 -0
  35. data/public/docs/swagger-ui/images/throbber.gif +0 -0
  36. data/public/docs/swagger-ui/lib/backbone-min.js +38 -0
  37. data/public/docs/swagger-ui/lib/handlebars-1.0.0.js +2278 -0
  38. data/public/docs/swagger-ui/lib/highlight.7.3.pack.js +1 -0
  39. data/public/docs/swagger-ui/lib/jquery-1.8.0.min.js +2 -0
  40. data/public/docs/swagger-ui/lib/jquery.ba-bbq.min.js +18 -0
  41. data/public/docs/swagger-ui/lib/jquery.slideto.min.js +1 -0
  42. data/public/docs/swagger-ui/lib/jquery.wiggle.min.js +8 -0
  43. data/public/docs/swagger-ui/lib/shred.bundle.js +2765 -0
  44. data/public/docs/swagger-ui/lib/shred/content.js +193 -0
  45. data/public/docs/swagger-ui/lib/swagger.js +1253 -0
  46. data/public/docs/swagger-ui/lib/underscore-min.js +32 -0
  47. data/public/docs/swagger-ui/swagger-ui.js +2039 -0
  48. data/public/docs/swagger-ui/swagger-ui.min.js +1 -0
  49. metadata +56 -11
  50. data/app/views/admin/settings/shortcodes.html.erb +0 -37
  51. data/lib/generators/camaleon_cms/gem_theme_generator.rb +0 -122
  52. data/test/camaleon_cms_test.rb +0 -7
  53. data/test/integration/navigation_test.rb +0 -10
  54. data/test/test_helper.rb +0 -19
@@ -103,7 +103,7 @@ module SessionHelper
103
103
  def authenticate(redirect_uri = nil)
104
104
  params[:return_to] = redirect_uri
105
105
  unless signin?
106
- flash[:error] = "Required Login"
106
+ flash[:error] = t('admin.login.please_login')
107
107
  cookies[:return_to] = params[:return_to].present? ? params[:return_to] : ((request.get? && params[:controller] != "admin/sessions") ? request.original_url : nil)
108
108
  redirect_to admin_login_path
109
109
  end
@@ -120,4 +120,4 @@ module SessionHelper
120
120
  def calc_api_current_user
121
121
  current_site.users_include_admins.find(doorkeeper_token.resource_owner_id).decorate if doorkeeper_token rescue nil
122
122
  end
123
- end
123
+ end
@@ -85,4 +85,16 @@ module ThemeHelper
85
85
  f2.split(k).last.split("/").first
86
86
  end
87
87
  end
88
+
89
+ # returns file system path to theme asset
90
+ # theme_name: theme name, if nil, then will use current theme
91
+ # asset: asset file name, if asset is present return full path to this asset
92
+ # sample: theme_asset_file_path('images/foo.jpg') => return: /home/camaleon/my-site/app/apps/themes/default/assets/images/foo.jpg
93
+ def theme_asset_file_path(asset = nil, theme_name = nil)
94
+ theme_path = current_theme.settings['path']
95
+ if theme_name && theme = Theme.where(name: theme_name).first
96
+ theme_path = theme.settings['path']
97
+ end
98
+ "#{theme_path}/assets/#{asset}"
99
+ end
88
100
  end
@@ -0,0 +1,9 @@
1
+ class Api::BaseSerializer < ActiveModel::Serializer
2
+ def created_at
3
+ object.created_at.in_time_zone.iso8601 if object.created_at
4
+ end
5
+
6
+ def updated_at
7
+ object.updated_at.in_time_zone.iso8601 if object.created_at
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ class Api::V1::CategorySerializer < Api::BaseSerializer
2
+ attributes :id, :name, :slug, :count, :post_type_parent_name
3
+
4
+ def post_type_parent_name
5
+ object.post_type_parent.name
6
+ end
7
+
8
+ end
@@ -191,6 +191,8 @@
191
191
  },500)
192
192
  });
193
193
  }
194
- if(typeof jQuery == 'function') jQuery(function_init<%= @index %>);
195
- else run.push(function_init<%= @index %>);
194
+ jQuery(function(){
195
+ function_init<%= @index %>();
196
+ });
197
+
196
198
  </script>
@@ -8,7 +8,7 @@
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1" />
9
9
  <!-- END META SECTION -->
10
10
 
11
- <%= stylesheet_link_tag theme_asset_path("css/main") %>
11
+ <%= stylesheet_link_tag theme_asset_path("css/main.css") %>
12
12
  <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
13
13
  <%= javascript_include_tag theme_asset_path("js/main.js") %>
14
14
  <%= raw the_head %>
@@ -0,0 +1,18 @@
1
+ Swagger::Docs::Config.register_apis(
2
+ {
3
+ '1.0' => {
4
+ :api_extension_type => :json,
5
+ :api_file_path => "public/",
6
+ :clean_directory => false,
7
+ :attributes => {
8
+ :info => {
9
+ 'title' => 'Camaleon CMS API Docs',
10
+ 'description' => 'This is the api documentation',
11
+ 'contact' => 'owenperedo@gmail.com',
12
+ 'license' => 'AGPLv3',
13
+ 'licenseUrl' => 'http://camaleon.tuzitio.com/license.html/'
14
+ }
15
+ }
16
+ }
17
+ }
18
+ )
@@ -123,6 +123,7 @@ en:
123
123
  subject_email: 'Reset your access'
124
124
  send_mail_succes: 'Send email reset success.'
125
125
  send_mail_error: 'Not found email address.'
126
+ invalid_caption: 'Invalid captcha'
126
127
  personal_info: 'Personal info'
127
128
  please_login: 'Please login'
128
129
  reset_password: 'reset password'
@@ -587,7 +588,16 @@ en:
587
588
  error_created: 'Not Created Widget.'
588
589
  error_updated: 'Not Updated Widget.'
589
590
  not_registered_widgets: 'There are no registered widgets'
590
- intro:
591
+ assign:
592
+ updated: "Widget assign updated"
593
+ error_updated: "Widget assign not updated"
594
+ sidebar:
595
+ created: "Sidebar Create."
596
+ updated: "Sidebar Update."
597
+ error_created: "No created sidebar."
598
+ error_updated: "No Update sidebar."
599
+ error_deleted: "Sidebar deleted."
600
+ intro:
591
601
  profile: "In this place you can see your profile options."
592
602
  content: "This block contains all content groups of your site. Each content can have different structure configured in settings => Content Groups"
593
603
  #dashboard: "In this section you can see "
@@ -605,4 +615,4 @@ en:
605
615
  custom_fields: "This section permit you to extend easily your contents, themes,... by custom fields."
606
616
  post_type: "In this module you can manage your content groups without programing anything."
607
617
  languages: "This module permit you to manage all languages for your site. Also you can configure the language for your admin panel."
608
- shortcodes: "In this section you can see all available shortcodes to use in your contents."
618
+ shortcodes: "In this section you can see all available shortcodes to use in your contents."
@@ -7,6 +7,7 @@ en:
7
7
  de: "Deutsch"
8
8
  pt: "Português"
9
9
  it: "Italian"
10
+ ru: "Russian"
10
11
 
11
12
  es:
12
13
  languages:
@@ -17,6 +18,7 @@ es:
17
18
  de: "Alemán"
18
19
  pt: "Portugues"
19
20
  it: "Italiano"
21
+ ru: "Russian"
20
22
 
21
23
  it:
22
24
  languages:
@@ -27,3 +29,15 @@ it:
27
29
  de: "Tedesco"
28
30
  pt: "Portoghese"
29
31
  it: "Italiano"
32
+ ru: "Russian"
33
+
34
+ ru:
35
+ languages:
36
+ es: "Испанский"
37
+ en: "Английский"
38
+ fr: "Французский"
39
+ zh: "Китайский"
40
+ de: "Немецкий"
41
+ pt: "Португальский"
42
+ it: "Итальянский"
43
+ ru: "Русский"
@@ -0,0 +1,207 @@
1
+ ru:
2
+ date:
3
+ abbr_day_names:
4
+ - Вс
5
+ - Пн
6
+ - Вт
7
+ - Ср
8
+ - Чт
9
+ - Пт
10
+ - Сб
11
+ abbr_month_names:
12
+ -
13
+ - Янв
14
+ - Фев
15
+ - Мар
16
+ - Апр
17
+ - Май
18
+ - Июн
19
+ - Июл
20
+ - Авг
21
+ - Сен
22
+ - Окт
23
+ - Ноя
24
+ - Дек
25
+ day_names:
26
+ - Воскресенье
27
+ - Понедельник
28
+ - Вторник
29
+ - Среда
30
+ - Четверг
31
+ - Пятница
32
+ - Суббота
33
+ formats:
34
+ default: "%Y-%m-%d"
35
+ long: "%B %d, %Y"
36
+ short: "%b %d"
37
+ month_names:
38
+ -
39
+ - Январь
40
+ - Февраль
41
+ - Март
42
+ - Апрель
43
+ - Май
44
+ - Июнь
45
+ - Июль
46
+ - Август
47
+ - Сентябрь
48
+ - Октябрь
49
+ - Ноябрь
50
+ - Декабрь
51
+ order:
52
+ - :day
53
+ - :month
54
+ - :year
55
+ datetime:
56
+ distance_in_words:
57
+ about_x_hours:
58
+ one: около 1 часа
59
+ other: около %{count} часов
60
+ about_x_months:
61
+ one: около 1 месяца
62
+ other: около %{count} месяцев
63
+ about_x_years:
64
+ one: около 1 года
65
+ other: около %{count} лет
66
+ almost_x_years:
67
+ one: почти 1 год
68
+ other: почти %{count} лет
69
+ half_a_minute: полминуты
70
+ less_than_x_minutes:
71
+ one: менее минуты
72
+ other: менее %{count} минут
73
+ less_than_x_seconds:
74
+ one: менее 1 секунды
75
+ other: менее %{count} секунд
76
+ over_x_years:
77
+ one: через год
78
+ other: через %{count} лет
79
+ x_days:
80
+ one: 1 день
81
+ other: "%{count} дней"
82
+ x_minutes:
83
+ one: 1 минута
84
+ other: "%{count} минут"
85
+ x_months:
86
+ one: 1 месяц
87
+ other: "%{count} месяцев"
88
+ x_seconds:
89
+ one: 1 секунда
90
+ other: "%{count} секунд"
91
+ prompts:
92
+ day: День
93
+ hour: Час
94
+ minute: Минута
95
+ month: Месяц
96
+ second: Секунда
97
+ year: Год
98
+ errors:
99
+ format: "%{attribute} %{message}"
100
+ messages:
101
+ accepted: должны быть выбраны
102
+ blank: не может быть пустым
103
+ present: должно быть пустым
104
+ confirmation: не совпадает %{attribute}
105
+ empty: не может быть пустым
106
+ equal_to: должно быть равно %{count}
107
+ even: должно быть ещё
108
+ exclusion: зарезервирован
109
+ greater_than: должно быть больше %{count}
110
+ greater_than_or_equal_to: должно быть больше или равно %{count}
111
+ inclusion: не входит в список
112
+ invalid: недопустим
113
+ less_than: должно быть меньше %{count}
114
+ less_than_or_equal_to: должно быть меньше или равно %{count}
115
+ not_a_number: это не число
116
+ not_an_integer: должно быть числом
117
+ odd: должно быть нечетным
118
+ record_invalid: 'Возникла ошибка: %{errors}'
119
+ restrict_dependent_destroy:
120
+ one: Не могу удалить запись, потому что зависимая %{record} существует
121
+ many: Не могу удалить записи, потому что зависимые %{record} существуют
122
+ taken: уже существует
123
+ too_long:
124
+ one: слишком длинный (максимум 1 символ)
125
+ other: слишком длинный (максимум %{count} символов)
126
+ too_short:
127
+ one: слишком короткий (минимум 1 символ)
128
+ other: слишком короткий (минимум %{count} символов)
129
+ wrong_length:
130
+ one: неверной длины (должен быть 1 символ)
131
+ other: неверной длинны (должно быть %{count} символов)
132
+ other_than: должно отличатся от %{count}
133
+ template:
134
+ body: 'Возникли проблемы со следующими полями:'
135
+ header:
136
+ one: Ошибка, запрещено сохранение %{model}
137
+ other: "%{count} ошибок, невозможно сохранить %{model}"
138
+ helpers:
139
+ select:
140
+ prompt: Пожалуйста, выберите
141
+ submit:
142
+ create: Создать %{model}
143
+ submit: Сохранить %{model}
144
+ update: Обновить %{model}
145
+ number:
146
+ currency:
147
+ format:
148
+ delimiter: ","
149
+ format: "%u%n"
150
+ precision: 2
151
+ separator: "."
152
+ significant: false
153
+ strip_insignificant_zeros: false
154
+ unit: "₽"
155
+ format:
156
+ delimiter: ","
157
+ precision: 3
158
+ separator: "."
159
+ significant: false
160
+ strip_insignificant_zeros: false
161
+ human:
162
+ decimal_units:
163
+ format: "%n %u"
164
+ units:
165
+ billion: Миллиард
166
+ million: Миллион
167
+ quadrillion: Квадриллион
168
+ thousand: Тысяча
169
+ trillion: Триллион
170
+ unit: ''
171
+ format:
172
+ delimiter: ''
173
+ precision: 3
174
+ significant: true
175
+ strip_insignificant_zeros: true
176
+ storage_units:
177
+ format: "%n %u"
178
+ units:
179
+ byte:
180
+ one: Байт
181
+ other: Байт
182
+ gb: ГБ
183
+ kb: КБ
184
+ mb: МБ
185
+ tb: ТБ
186
+ percentage:
187
+ format:
188
+ delimiter: ''
189
+ format: "%n%"
190
+ precision:
191
+ format:
192
+ delimiter: ''
193
+ support:
194
+ array:
195
+ last_word_connector: " и "
196
+ two_words_connector: " и "
197
+ words_connector: ", "
198
+ recaptcha:
199
+ errors:
200
+ incorrect-captcha-sol: 'Ой! Его ошибка с reCAPTCHA!'
201
+ time:
202
+ am: утра
203
+ formats:
204
+ default: "%a, %d %b %Y %H:%M:%S %z"
205
+ long: "%B %d, %Y %H:%M"
206
+ short: "%d %b %H:%M"
207
+ pm: вечера
data/config/routes.rb CHANGED
@@ -8,6 +8,11 @@ Rails.application.routes.draw do
8
8
  get 'categories' => 'category#categories'
9
9
  get 'posts' => 'post#index'
10
10
  get 'pages' => 'page#index'
11
+
12
+ scope :contact_form do
13
+ get 'show/:slug' => 'contact_form#contact_form_by_slug'
14
+ post 'create' => 'contact_form#save_form'
15
+ end
11
16
  end
12
17
  end
13
18
 
@@ -112,6 +112,8 @@ Rails.application.routes.draw do
112
112
  match 'elfinder' => 'media#elfinder', via: :all
113
113
  match 'elfinder/iframe' => 'media#iframe', via: :all
114
114
  match 'crop' => 'media#crop', via: :all
115
+
116
+ get 'doc' => redirect('/docs/index.html?url=/api-docs.json')
115
117
  end
116
118
 
117
119
  eval(PluginRoutes.load("admin"))
@@ -14,6 +14,8 @@ require 'will_paginate'
14
14
  require 'will_paginate-bootstrap'
15
15
  require 'doorkeeper'
16
16
  require 'responders'
17
+ require 'swagger/docs'
18
+ require 'active_model_serializers'
17
19
 
18
20
  $camaleon_engine_dir = File.expand_path("../../../", __FILE__)
19
21
  require File.join($camaleon_engine_dir, "lib", "plugin_routes").to_s
@@ -52,6 +54,9 @@ module CamaleonCms
52
54
  app.config.eager_load_paths += %W(#{app.config.root}/app/apps/**/)
53
55
  PluginRoutes.all_plugins.each{ |plugin| app.config.paths["db/migrate"] << File.join(plugin["path"], "migrate") if Dir.exist?(File.join(plugin["path"], "migrate")) }
54
56
 
57
+ # Static files
58
+ app.middleware.use ::ActionDispatch::Static, "#{root}/public"
59
+
55
60
  # migrations checking
56
61
  unless app.root.to_s.match root.to_s
57
62
  config.paths["db/migrate"].expanded.each do |expanded_path|
@@ -1,3 +1,3 @@
1
1
  module CamaleonCms
2
- VERSION = "1.0.8"
2
+ VERSION = "1.0.9"
3
3
  end
@@ -55,29 +55,29 @@ module CamaleonCms
55
55
  directory(plugin_app, plugin_dir)
56
56
  gsub_file File.join(plugin_dir, "config", "routes.rb"), "end" do
57
57
  "
58
- scope '(:locale)', locale: /\#{PluginRoutes.all_locales}/, :defaults => { } do
59
- # frontend
60
- namespace :plugins do
61
- namespace '#{get_plugin_name}' do
62
- get 'index' => 'front#index'
63
- end
64
- end
65
- end
66
-
67
- #Admin Panel
68
- scope 'admin', as: 'admin' do
69
- namespace 'plugins' do
70
- namespace '#{get_plugin_name}' do
71
- get 'index' => 'admin#index'
72
- end
73
- end
74
- end
75
-
76
- # main routes
77
- #scope '#{get_plugin_name}', module: 'plugins/#{get_plugin_name}/', as: '#{get_plugin_name}' do
78
- # Here my routes for main routes
79
- #end
80
- end"
58
+ scope '(:locale)', locale: /\#{PluginRoutes.all_locales}/, :defaults => { } do
59
+ # frontend
60
+ namespace :plugins do
61
+ namespace '#{get_plugin_name}' do
62
+ get 'index' => 'front#index'
63
+ end
64
+ end
65
+ end
66
+
67
+ #Admin Panel
68
+ scope 'admin', as: 'admin' do
69
+ namespace 'plugins' do
70
+ namespace '#{get_plugin_name}' do
71
+ get 'index' => 'admin#index'
72
+ end
73
+ end
74
+ end
75
+
76
+ # main routes
77
+ #scope '#{get_plugin_name}', module: 'plugins/#{get_plugin_name}/', as: '#{get_plugin_name}' do
78
+ # Here my routes for main routes
79
+ #end
80
+ end"
81
81
  end
82
82
 
83
83
  append_to_file Rails.root.join("Gemfile") do