rad_kit 0.0.9 → 0.0.10

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.
Files changed (61) hide show
  1. data/Rakefile +3 -2
  2. data/app/controllers/app.rb +5 -0
  3. data/app/controllers/base.rb +47 -0
  4. data/app/controllers/base_app.rb +18 -0
  5. data/app/controllers/comments.rb +49 -0
  6. data/app/controllers/items.rb +208 -0
  7. data/app/helpers/kit/authorization.rb +121 -0
  8. data/app/helpers/kit/captcha.rb +10 -0
  9. data/app/helpers/kit/controller_helper.rb +76 -0
  10. data/app/helpers/kit/item_helper.rb +110 -0
  11. data/app/helpers/kit/navigation_helper.rb +15 -0
  12. data/app/helpers/kit/pagination.rb +62 -0
  13. data/app/models/_item/attachments.rb +15 -0
  14. data/app/models/_item/container.rb +30 -0
  15. data/app/models/_item/slug.rb +28 -0
  16. data/app/models/attachment.rb +9 -0
  17. data/app/models/comment.rb +30 -0
  18. data/app/models/item.rb +136 -0
  19. data/app/models/secure_token.rb +45 -0
  20. data/app/models/tag.rb +71 -0
  21. data/app/static/kit/highlight.css +48 -0
  22. data/app/static/kit.css +3 -0
  23. data/app/static/kit.js +0 -0
  24. data/app/static/themes/default/objects.less +28 -0
  25. data/app/views/controllers/comments/_embedded.html.haml +13 -0
  26. data/app/views/controllers/comments/_form.html.haml +8 -0
  27. data/app/views/controllers/comments/actions.js.haml +22 -0
  28. data/app/views/controllers/comments/show.html.haml +11 -0
  29. data/app/views/controllers/items/_items.html.haml +2 -0
  30. data/app/views/controllers/items/actions.js.haml +23 -0
  31. data/app/views/controllers/items/all.html.haml +4 -0
  32. data/app/views/controllers/items/inherited_action.html.haml +1 -0
  33. data/app/views/kit/_bottom_panel.html.haml +9 -0
  34. data/app/views/kit/_debug.html.haml +13 -0
  35. data/app/views/kit/_messages.html.haml +4 -0
  36. data/app/views/kit/_navigation.html.haml +19 -0
  37. data/app/views/kit/_not_found.html.haml +1 -0
  38. data/app/views/kit/_top_panel.html.haml +19 -0
  39. data/app/views/kit/_web_analytics.html.erb +14 -0
  40. data/app/views/kit/aspects/_comments.html.haml +8 -0
  41. data/app/views/kit/captcha/_action.js.haml +2 -0
  42. data/app/views/kit/captcha/_form.html.haml +10 -0
  43. data/app/views/kit/layout.html.haml +22 -0
  44. data/app/views/kit/layout.js.haml +15 -0
  45. data/app/views/previews/_line.html.haml +8 -0
  46. data/app/views/previews/_thumb.html.haml +5 -0
  47. data/app/views/themes/default/file.html.haml +19 -0
  48. data/app/views/themes/default/folder.html.haml +15 -0
  49. data/app/views/themes/default/layout_definitions/default.yml +27 -0
  50. data/app/views/themes/default/list.html.haml +21 -0
  51. data/app/views/themes/default/list_item.html.haml +14 -0
  52. data/app/views/themes/default/page.html.haml +23 -0
  53. data/app/views/tools/_access.html.haml +12 -0
  54. data/app/views/tools/_buttons.html.haml +11 -0
  55. data/app/views/tools/_context_menu.html.haml +12 -0
  56. data/app/views/tools/_search.html.haml +5 -0
  57. data/app/views/tools/_tags.html.haml +10 -0
  58. data/config/locales/en.yml +136 -0
  59. data/config/locales/ru.yml +142 -0
  60. data/config/routes.rb +44 -0
  61. metadata +82 -23
@@ -0,0 +1,19 @@
1
+ - logo_url, the_title = rad.config.logo_url, rad.config.title
2
+ - b.top_panel do |o|
3
+ - o.logo_image tag(:a, image_tag(logo_url), href: '/') if logo_url
4
+ - o.logo_text tag(:a, the_title, href: '/') if the_title
5
+
6
+ - if breadcrumb?
7
+ - o.left do |a|
8
+ - breadcrumb.each do |o|
9
+ - a.add o
10
+
11
+ - o.right do |a|
12
+ - if Models::User.current.registered?
13
+ - a.add link_to(Models::User.current.name, user_path(Models::User.current))
14
+ - a.add link_to(t(:logout), logout_path)
15
+ - else
16
+ - a.add link_to(t(:anonymous), login_path)
17
+ - a.add link_to(t(:login), login_path)
18
+ - a.add link_to(t(:signup), signup_path)
19
+ - rad.extension(:user_menu, self, a)
@@ -0,0 +1,14 @@
1
+ <% web_analytics_js = rad.config.web_analytics_js %>
2
+ <% if rad.production? and rad.space? and web_analytics_js %>
3
+ <script type="text/javascript">
4
+ var _gaq = _gaq || [];
5
+ _gaq.push(['_setAccount', '<%= js web_analytics_js %>']);
6
+ _gaq.push(['_trackPageview']);
7
+
8
+ (function() {
9
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
10
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
11
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
12
+ })();
13
+ </script>
14
+ <% end %>
@@ -0,0 +1,8 @@
1
+ - if @model and partials.show?(:comments)
2
+ - b.discussion do |o|
3
+ - o.controls do |a|
4
+ - a.add link_to(t(:comment_it), new_comment_path(item_id: @model, format: :js), method: :get) if can? :create_comment
5
+
6
+ - o.content do
7
+ - @model.comments.each do |comment|
8
+ = render '/controllers/comments/embedded', object: comment
@@ -0,0 +1,2 @@
1
+ rad.dialog().show("#{js render('/kit/captcha/form')}");
2
+ Recaptcha.create("#{rad.captcha.public_key}", document.getElementById('dynamic_recaptcha'), {theme: 'clean', lang: '#{I18n.locale}'});
@@ -0,0 +1,10 @@
1
+ = b.title t(:enter_captcha)
2
+ - b.form_tag action: request.path do |f|
3
+ = f.line tag(:div, '', id: :dynamic_recaptcha)
4
+
5
+ - request.raw_params.each do |k, v|
6
+ - next if %w(format recaptcha_challenge_field recaptcha_response_field).include?(k)
7
+ - next unless v.is_a? String
8
+ = hidden_field_tag k, v
9
+
10
+ = f.line ok_button, cancel_button
@@ -0,0 +1,22 @@
1
+ - content_for :nothing do
2
+ - content_for :head do
3
+ = stylesheet_link_tag '/kit.css'
4
+ = yield(:css) || stylesheet_link_tag('/themes/default/style.css')
5
+
6
+ - content_for :bottom do
7
+ = initialize_js_commons
8
+ = javascript_include_tag '/kit.js'
9
+ - if rad.captcha.enabled? and rad.user.anonymous?
10
+ = javascript_include_tag "http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"
11
+ = yield :js
12
+ = render '/kit/messages'
13
+
14
+ - content_for :analytics do
15
+ = render '/kit/web_analytics'
16
+
17
+ - prepend_to :top_aspects, b.message(type: :error, content: h(flash.sticky_error)) if flash.sticky_error?
18
+ - prepend_to :top_aspects, b.message(h(flash.sticky_info)) if flash.sticky_info?
19
+ - prepend_to :content, b.title(h(@title)) if @title
20
+
21
+ - build_layout(@model.try(:layout)) unless @build_layout == false
22
+ = render themed_partial('/application')
@@ -0,0 +1,15 @@
1
+ = "try{"
2
+
3
+ - unless params._target.blank?
4
+ var target = $('#{params._target}');
5
+ - else
6
+ var target = $('body');
7
+
8
+ = yield
9
+
10
+ - if msg = flash.error || flash.sticky_error
11
+ rad.error("#{h(js(msg))}");
12
+ - if msg = flash.info || flash.sticky_info
13
+ rad.info("#{h(js(msg))}");
14
+
15
+ = "}catch(e){console.log(e)};"
@@ -0,0 +1,8 @@
1
+ - b.line id: object._id do |o|
2
+ - o.name h(object.name.blank? ? t(:empty_title) : object.name)
3
+ - unless object.attachments_as_images.empty?
4
+ - o.image object.attachments_as_images.first
5
+ - o.url path(object)
6
+ - o.text object.teaser
7
+ - o.tags render_item_tags(object) + [tag(:div, t(object.class.alias.underscore), class: 'm_item_type')]
8
+ - o.details render_item_details(object)
@@ -0,0 +1,5 @@
1
+ - b.thumb id: object._id do |o|
2
+ - o.name h(object.name)
3
+ - unless object.attachments_as_images.empty?
4
+ - o.image object.attachments_as_images.first
5
+ - o.url path(object)
@@ -0,0 +1,19 @@
1
+ - tag :div, object.merge_html_attributes(class: " the_file m_selectable") do
2
+ - if object.controls?
3
+ .m_hover_controls= object.controls.join(' ')
4
+ - body = capture do
5
+ - if object.name?
6
+ %a{href: object.url, class: 'l_title'}= object.name
7
+ - if object.url? and object.image?
8
+ %table.css_table
9
+ %tbody
10
+ %tr
11
+ %td.css_td1
12
+ .l_image
13
+ %a{href: object.url}
14
+ %img{src: object.image.icon_url}
15
+ %td.css_td2
16
+ = body
17
+ - else
18
+ = body
19
+ = render themed_partial('/shared/details'), object: object
@@ -0,0 +1,15 @@
1
+ - tag :div, object.merge_html_attributes(class: " the_folder m_selectable") do
2
+ - if object.controls?
3
+ .m_hover_controls= object.controls.join(' ')
4
+
5
+ - if object.name?
6
+ %h1.m_title= object.name
7
+ - elsif object.content.blank?
8
+ %h1.m_title= "(#{t(:empty)})"
9
+
10
+ - if object.content?
11
+ .l_content
12
+ = object.content.to_a.join("\n")
13
+ .css_clear
14
+
15
+ = render themed_partial('/shared/details'), object: object
@@ -0,0 +1,27 @@
1
+ layout_template: default
2
+ slots:
3
+ top_panel: "/kit/top_panel"
4
+ navigation: "/kit/navigation"
5
+ bottom_aspects:
6
+ - "/kit/aspects/comments"
7
+ tools:
8
+ - "/tools/buttons"
9
+ - "/tools/search"
10
+ - "/tools/tags"
11
+ - "/tools/access"
12
+ - "/tools/context_menu"
13
+ bottom_panel: "/kit/bottom_panel"
14
+
15
+ # dashboard:
16
+ # navigation:
17
+ # - navigation
18
+ #
19
+ # tools:
20
+ # - buttons
21
+ # - search
22
+ # - tags
23
+ # - access
24
+ # - context_menu
25
+ #
26
+ # bottom_aspects:
27
+ # - comments
@@ -0,0 +1,21 @@
1
+ - tag :div, object.merge_html_attributes(class: " the_list m_selectable") do
2
+ - if object.controls?
3
+ .m_hover_controls= object.controls.join(' ')
4
+
5
+ - if object.name?
6
+ %h1.m_title= object.name
7
+ - elsif object.content.blank?
8
+ %h1.m_title= "(#{t(:empty)})"
9
+
10
+ - if object.content?
11
+ .l_content= object.content.to_a.join("\n")
12
+
13
+ / Show or Hide Finished tasks
14
+ .l_controls
15
+ %a{href: '#', class: 'l_show_more hidden'}= t(:show_more)
16
+ %a{href: '#', class: 'l_show_less hidden'}= t(:show_less)
17
+
18
+ / needed for JavaScript
19
+ .l_hidden_tasks.hidden
20
+
21
+ = render themed_partial('/shared/details'), object: object
@@ -0,0 +1,14 @@
1
+ - classes = " l_item m_selectable "
2
+ - classes << " l_finished" if object.finished
3
+ - tag :div, object.merge_html_attributes(class: classes) do
4
+ - unless object.controls.blank?
5
+ .m_hover_controls= object.controls.join(' ')
6
+
7
+ - unless object.check_box.blank?
8
+ .l_check_box= object.check_box
9
+ .l_content= object.content
10
+
11
+ / .m_tags= object.tags.join(' ') if object.tags?
12
+ - if object.details?
13
+ .m_details= object.details.to_a.join(', ')
14
+ .css_clear
@@ -0,0 +1,23 @@
1
+ - tag :div, object.merge_html_attributes(class: " the_page") do
2
+ - if object.controls?
3
+ .m_hover_controls= object.controls.join(' ')
4
+
5
+ - if object.toolbar?
6
+ %textarea.hidden
7
+ .toolbar
8
+ %br
9
+ .m_hover_controls
10
+ = t(:add_embedded_item) + ':'
11
+ = object.toolbar.join(' ')
12
+
13
+ - if object.name?
14
+ %h1.m_title= object.name
15
+
16
+ - if object.text?
17
+ .l_text.m_markup
18
+ = object.text
19
+ .css_clear
20
+
21
+ .l_content= object.content.to_a.join("\n")
22
+
23
+ = render themed_partial('/shared/details'), object: object
@@ -0,0 +1,12 @@
1
+ - if partials.show?(:context_menu) and @model and can?(:update_access, @model)
2
+ - b.tool name: t(:access), id: 'access_tool' do |o|
3
+ - o.content do
4
+ - b.basic_list do
5
+ / Viewers
6
+ - basic, more = viewers_controls_for(@model)
7
+ - b.basic_list_item do
8
+ = basic + " " + b.more(id: 'viewers_controls', name: t(:show_more), content: more)
9
+
10
+ - basic, more = collaborators_controls_for(@model)
11
+ - b.basic_list_item do
12
+ = basic + " " + b.more(id: 'collaborators_controls', name: t(:show_more), content: more)
@@ -0,0 +1,11 @@
1
+ - if partials.show?(:buttons) and can?(:create)
2
+ - b.tool do
3
+ - buttons_html = rad.kit.items.collect{|name| link_to(t(name), send("new_#{name}_path", format: :js), method: :get)}.join(tag(:span, ', '))
4
+ - if rad.kit.default_item
5
+ - b.more id: 'add_buttons', name: t(:show_more), class: 'm_tiny' do |o|
6
+ - o.core do
7
+ = link_to(t(:add), send("new_#{rad.kit.default_item}_path", format: :js), method: :get) + ",\n"
8
+ - o.more do
9
+ = buttons_html
10
+ - else
11
+ = buttons_html
@@ -0,0 +1,12 @@
1
+ - if @model and partials.show?(:context_menu)
2
+ - model_name = @model.class.alias.underscore
3
+ - b.tool name: t(:parameters), id: '_context_menu' do |o|
4
+ - o.content do
5
+ - b.more id: 'item_context_menu', name: t(:show_more), class: 'm_tiny' do
6
+ - b.basic_list do
7
+ = b.basic_list_item item_layout_selector if can?(:update, @model)
8
+
9
+ - common_controls = []
10
+ - common_controls << link_to(t(:edit), edit_path(@model, format: :js)) if can? :update, @model
11
+ - common_controls << link_to(t(:delete), destroy_path(@model, format: :js), method: :post, confirm: t(:are_you_shure)) if can? :destroy, @model
12
+ = b.basic_list_item common_controls.join(",\n") unless common_controls.empty?
@@ -0,0 +1,5 @@
1
+ / TODO3 search
2
+ - if false && partials.show?(:search)
3
+ - b.tool name: "Search" do
4
+ - form_tag(action: search_path, method: :get) do
5
+ = text_field_tag :q, @query
@@ -0,0 +1,10 @@
1
+ - if partials.show?(:tags)
2
+ - b.tool name: t(:tags) do
3
+ - b.tag_selector do |o|
4
+ - o.selected @selected_tags
5
+ - o.selected_tag_to_link lambda{|tag| link_to tag.name, action_name, {_tags: remove_tag(tag.name)}}
6
+ / TODO2 move this to somewhere else
7
+ - top_tags = Models::Tag.where(context: {_exists: false}).limit(rad.kit.tags_count).sort([:count, -1]).all
8
+ - o.tags top_tags.sort{|a, b| a.name <=> b.name}
9
+ / - o.tag_to_link lambda{|tag| link_to tag.name, {_tags: add_tag(tag.name)}, title: t(:tags_count, count: tag.count)}
10
+ - o.tag_to_link lambda{|tag| tag_link(tag.name, tag.count)}
@@ -0,0 +1,136 @@
1
+ en:
2
+ # General
3
+ access_denied: "Access denied!"
4
+ add: "Add"
5
+ all_items: "All"
6
+ anonymous: "Welcome, Guest"
7
+ are_you_shure: "Are you sure?"
8
+ created_by: "%{owner}"
9
+ common: "Common"
10
+ comments: "Comments"
11
+ email: "eMail"
12
+ empty: "Empty"
13
+ empty_search_query: "Empty query"
14
+ empty_title: "Empty title"
15
+ enabled: "Enabled"
16
+ failed: "Operation failed"
17
+ file: "File"
18
+ files: "Files"
19
+ folder: "Folder"
20
+ folders: "Folders"
21
+ go: "Go to"
22
+ go_next: "Next"
23
+ go_prev: "Prev"
24
+ icon: "Icon"
25
+ item: "Item"
26
+ items: "Items"
27
+ layout: "Layout"
28
+ language: "Language"
29
+ line: "Line"
30
+ list: "List"
31
+ lists: "Lists"
32
+ login: "Login"
33
+ login_not_required: "You are already logged in"
34
+ login_required: "You need to be logged in"
35
+ logout: "Logout"
36
+ member_visibility: "Members"
37
+ miscellaneous: "Miscellaneous"
38
+ name: "Name"
39
+ no_search_result_for: "You searched for %{query}, nothing was found"
40
+ note: "Note"
41
+ notes: "Notes"
42
+ nothing_more: "Nothing more"
43
+ owner_visibility: "Private"
44
+ page: "Page"
45
+ page_not_found: "Page not found"
46
+ pages: "Pages"
47
+ parameters: "Parameters"
48
+ password: "Password"
49
+ search_result_for:
50
+ one: "You searched for %{query}, %{count} page found"
51
+ other: "You searched for %{query}, %{count} pages found"
52
+ security: "Security"
53
+ selector: "Selector"
54
+ selectors: "Selectors"
55
+ signup: "Signup"
56
+ slug: "Link"
57
+ slug_description: "You should manually update current page url after changing the link!"
58
+ show_less: "Hide"
59
+ show_more: "..."
60
+ tag: "Tag"
61
+ tags: "Tags"
62
+ task: "Task"
63
+ teaser: "Teaser"
64
+ thumb: "Thumbnail"
65
+ text: "Text"
66
+ title: "Title"
67
+ type: "Type"
68
+ username: "Username"
69
+ view: "View"
70
+
71
+ # Common actions
72
+ cancel: "Cancel"
73
+ delete: "Delete"
74
+ edit: "Edit"
75
+ move: "Move"
76
+ new: "New"
77
+ ok: "Ok"
78
+
79
+ # Tags
80
+ invalid_tags: "Invalid tags"
81
+ invalid_tag_name: "Invalid tag name"
82
+ tags_count:
83
+ one: "%{count} page"
84
+ other: "%{count} pages"
85
+
86
+ # Comments
87
+ comment_created: "Comment created"
88
+ comment_destroyed: "Comment deleted"
89
+ comment_it: "Leave a comment"
90
+ comment_updated: "Comment updated"
91
+ comments_count:
92
+ one: "%{count} comment"
93
+ other: "%{count} comments"
94
+
95
+ # Authorization
96
+ access: "Access"
97
+ collaborators: "Collaborators"
98
+ collaborators_updated: "Collaborators updated"
99
+ only_owner: "owner only"
100
+ member_role: "member"
101
+ user_role: "all"
102
+ viewers: "Visibility"
103
+ viewers_updated: "Access updated"
104
+
105
+ # Item
106
+ attachments: "Attachments"
107
+ # icon_updated: "Icon updated"
108
+ layout_updated: "Layout updated"
109
+ # set_icon: "Update icon"
110
+
111
+ # Authentication
112
+ access_denied: "Access Denied!"
113
+
114
+ # Other
115
+ powered_by: "Powered by %{company}"
116
+
117
+ # Captcha
118
+ registered_user_or_human_required: "Registered user or human required!"
119
+ enter_captcha: "Please enter symbols displayed on image"
120
+
121
+ # email_registration_title: "%{name}, ваш аккаунт для %{host} создан"
122
+ # email_registration_text: |
123
+ # Ваш аккаунт для %{host} зарегистрирован.
124
+ #
125
+ # Имя пользователя %{name}
126
+ # Пароль %{password}
127
+ #
128
+ # Чтобы активировать его пожалуйста перейдите по ссылке:
129
+ # %{url}
130
+
131
+ #
132
+ # Authorization
133
+ #
134
+ # member_role: "Сообществу"
135
+ # owner_role: "Только мне"
136
+ # user_role: "Всем"
@@ -0,0 +1,142 @@
1
+ ru:
2
+ # General
3
+ access_denied: "Доступ запрещен!"
4
+ add: "Добавить"
5
+ all_items: "Все"
6
+ anonymous: "Добро пожаловать, Гость"
7
+ are_you_shure: "Вы уверены?"
8
+ created_by: "%{owner}"
9
+ comments: "Комментарии"
10
+ common: "Общие"
11
+ email: "Почта"
12
+ empty: "Пусто"
13
+ empty_search_query: "Пустой запрос"
14
+ empty_title: "Нет заголовка"
15
+ enabled: "Активен"
16
+ failed: "Не удалось выполнить операцию"
17
+ file: "Файл"
18
+ files: "Файлы"
19
+ folder: "Папка"
20
+ folders: "Папки"
21
+ go: "Перейти"
22
+ go_next: "Вперед"
23
+ go_prev: "Назад"
24
+ icon: "Иконка"
25
+ item: "Элемент"
26
+ items: "Элементы"
27
+ layout: "Лайаут"
28
+ language: "Язык"
29
+ line: "Линия"
30
+ list: "Список"
31
+ lists: "Списки"
32
+ login: "Войти"
33
+ login_not_required: "Вы уже вошли"
34
+ login_required: "Для получения доступа необходимо войти в систему"
35
+ logout: "Выйти"
36
+ member_visibility: "Участники"
37
+ miscellaneous: "Разное"
38
+ name: "Имя"
39
+ no_search_result_for: "Вы искали %{query}, ничего не найдено"
40
+ note: "Заметка"
41
+ notes: "Заметки"
42
+ nothing_more: "Больше ничего нет"
43
+ owner_visibility: "Личное"
44
+ page: "Страница"
45
+ page_not_found: "Страница не найдена"
46
+ pages: "Страницы"
47
+ parameters: "Параметры"
48
+ password: "Пароль"
49
+ search_result_for:
50
+ one: "Вы искали %{query}, найдена %{count} страница"
51
+ few: "Вы искали %{query}, найдено %{count} страницы"
52
+ many: "Вы искали %{query}, найдено %{count} страниц"
53
+ other: "Вы искали %{query}, найдено %{count} страниц"
54
+ security: "Безопасность"
55
+ selector: "Селектор"
56
+ selectors: "Селекторы"
57
+ signup: "Регистрация"
58
+ slug: "Ссылка"
59
+ slug_description: "После изменения этого поля вы должны вручную обновить соответствующим образом URL страницы"
60
+ show_less: "Скрыть"
61
+ show_more: "..."
62
+ tag: "Тег"
63
+ tags: "Теги"
64
+ task: "Задача"
65
+ teaser: "Тизер"
66
+ thumb: "Картинка"
67
+ text: "Текст"
68
+ title: "Название"
69
+ type: "Тип"
70
+ username: "Логин"
71
+ view: "Вид"
72
+
73
+ # Common actions
74
+ cancel: "Отмена"
75
+ delete: "Удалить"
76
+ edit: "Редактировать"
77
+ move: "Двигать"
78
+ new: "Создать"
79
+ ok: "Ок"
80
+
81
+ # Tags
82
+ invalid_tags: "Неверное значение категории"
83
+ invalid_tag_name: "Неверное имя тега"
84
+ tags_count:
85
+ one: "%{count} страница"
86
+ few: "%{count} страницы"
87
+ many: "%{count} страниц"
88
+ other: "%{count} страниц"
89
+
90
+ # Comments
91
+ comment_created: "Комментарий создан"
92
+ comment_destroyed: "Комментарий удален"
93
+ comment_it: "Оставить комментарий"
94
+ comment_updated: "Комментарий обновлен"
95
+ comments_count:
96
+ one: "%{count} комментарий"
97
+ few: "%{count} комментария"
98
+ many: "%{count} комментариев"
99
+ other: "%{count} комментариев"
100
+
101
+ # Authorization
102
+ access: "Доступ"
103
+ collaborators: "Правят"
104
+ collaborators_updated: "Доступ изменен"
105
+ only_owner: "только владелец"
106
+ member_role: "участники"
107
+ user_role: "все"
108
+ viewers: "Видят"
109
+ viewers_updated: "Доступ изменен"
110
+
111
+ # Item
112
+ attachments: "Файлы"
113
+ # icon_updated: "Иконка изменена"
114
+ layout_updated: "Лайаут изменен"
115
+ # set_icon: "Изменить иконку"
116
+
117
+ # Authentication
118
+ access_denied: "Доступ запрещен!"
119
+
120
+ # Other
121
+ powered_by: "Сайт сделан %{company}"
122
+
123
+ # Captcha
124
+ registered_user_or_human_required: "Требуется зарегистрированный пользователь или человек!"
125
+ enter_captcha: "Пожалуйста введите символы изображенные на картинке"
126
+
127
+ # email_registration_title: "%{name}, ваш аккаунт для %{host} создан"
128
+ # email_registration_text: |
129
+ # Ваш аккаунт для %{host} зарегистрирован.
130
+ #
131
+ # Имя пользователя %{name}
132
+ # Пароль %{password}
133
+ #
134
+ # Чтобы активировать его пожалуйста перейдите по ссылке:
135
+ # %{url}
136
+
137
+ #
138
+ # Authorization
139
+ #
140
+ # member_role: "Сообществу"
141
+ # owner_role: "Только мне"
142
+ # user_role: "Всем"
data/config/routes.rb ADDED
@@ -0,0 +1,44 @@
1
+ # url_root = rad.config.kit.url_root('/kit')
2
+
3
+ persistent_params = rad.extension(:persistent_params){[]}
4
+ options = rad.extension(:routes_options){{}}
5
+
6
+ url_root = rad.http.url_root
7
+ rad.router.configure do |c|
8
+ c.persistent_params persistent_params + [:l, :theme]
9
+
10
+ c.skip(/^#{url_root}\/?(favicon|fs|packaged)/)
11
+ c.skip(/^#{url_root}\/?[^\/]+\/static\//)
12
+
13
+ c.alias url_root, class_name: 'Controllers::Items', method: :redirect
14
+
15
+ options[:url_root] ||= url_root
16
+ c.with_options options do |c|
17
+ # c.resource :comments, class_name: 'Controllers::Comments'
18
+ # c.resource :items, class_name: 'Controllers::Items'
19
+
20
+
21
+ #
22
+ # Special polymorphic routes
23
+ #
24
+ id_to_class = rad.extension :kit_id_to_class do
25
+ cache = {}
26
+ -> id, params {
27
+ model = Models::Item.by_param! id
28
+ rad.workspace.model = model
29
+ unless controller_class = cache[model.class]
30
+ controller_class = "Controllers::#{model.class.alias.pluralize}".constantize
31
+ cache[model.class] = controller_class
32
+ end
33
+ controller_class
34
+ }
35
+ end
36
+
37
+ c.objects(
38
+ default_class_name: 'Controllers::Items',
39
+ class_to_resource: -> klass {klass.alias},
40
+ resource_to_class: -> resource {"Controllers::#{resource}".constantize},
41
+ id_to_class: id_to_class
42
+ )
43
+ end
44
+ end