weeler 0.0.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.rspec +1 -1
  4. data/.travis.yml +7 -2
  5. data/CHANGELOG.md +149 -1
  6. data/LICENSE.txt +2 -2
  7. data/README.md +83 -1
  8. data/app/.DS_Store +0 -0
  9. data/app/assets/javascripts/weeler/init.js.coffee +13 -2
  10. data/app/assets/javascripts/weeler/lib/notify.js +18 -0
  11. data/app/assets/javascripts/weeler/lib/sortable.js +9 -0
  12. data/app/assets/stylesheets/weeler/init.css.erb +2 -1
  13. data/app/assets/stylesheets/weeler/style.css.scss +22 -0
  14. data/app/controllers/concerns/weeler/section_seo.rb +16 -0
  15. data/app/controllers/weeler/administration_controller.rb +11 -0
  16. data/app/controllers/weeler/application_controller.rb +5 -0
  17. data/app/controllers/weeler/base_controller.rb +16 -12
  18. data/app/controllers/weeler/configuration_controller.rb +9 -0
  19. data/app/controllers/weeler/content_controller.rb +12 -0
  20. data/app/controllers/weeler/home_controller.rb +5 -2
  21. data/app/controllers/weeler/seo_items_controller.rb +24 -0
  22. data/app/controllers/weeler/settings_controller.rb +21 -0
  23. data/app/controllers/weeler/static_sections_controller.rb +19 -0
  24. data/app/controllers/weeler/translations_controller.rb +36 -18
  25. data/app/models/concerns/weeler/seoable.rb +61 -0
  26. data/app/models/concerns/weeler/sluger.rb +32 -0
  27. data/app/models/settings.rb +2 -0
  28. data/app/models/weeler/seo.rb +9 -0
  29. data/app/views/kaminari/{_first_page.html.erb → weeler/_first_page.html.erb} +1 -1
  30. data/app/views/kaminari/{_gap.html.erb → weeler/_gap.html.erb} +1 -1
  31. data/app/views/kaminari/{_last_page.html.erb → weeler/_last_page.html.erb} +1 -1
  32. data/app/views/kaminari/{_next_page.html.erb → weeler/_next_page.html.erb} +1 -1
  33. data/app/views/kaminari/{_page.html.erb → weeler/_page.html.erb} +0 -0
  34. data/app/views/kaminari/{_paginator.html.erb → weeler/_paginator.html.erb} +1 -1
  35. data/app/views/kaminari/{_prev_page.html.erb → weeler/_prev_page.html.erb} +1 -1
  36. data/app/views/layouts/weeler/base.html.haml +22 -0
  37. data/{lib/generators/weeler/templates/views/weeler/example/index.html.erb → app/views/weeler/administration/_filter.html.haml} +0 -0
  38. data/app/views/weeler/administration/_header_row.html.haml +5 -0
  39. data/app/views/weeler/administration/_row.html.haml +5 -0
  40. data/app/views/weeler/administration/_side_navbar.html.haml +8 -0
  41. data/app/views/weeler/administration/index.html.haml +17 -0
  42. data/app/views/weeler/administration/welcome.html.haml +5 -0
  43. data/app/views/weeler/base/_flash.html.haml +3 -0
  44. data/app/views/weeler/base/_footer.html.haml +2 -0
  45. data/app/views/weeler/base/_header_navbar.html.haml +19 -0
  46. data/app/views/weeler/base/_side_navbar.html.haml +2 -0
  47. data/app/views/weeler/configuration/_side_navbar.html.haml +12 -0
  48. data/app/views/weeler/configuration/index.html.haml +3 -0
  49. data/app/views/weeler/content/_error_messages.html.haml +5 -0
  50. data/app/views/weeler/content/_form.html.haml +6 -0
  51. data/app/views/weeler/content/_list.html.haml +23 -0
  52. data/app/views/weeler/content/_object_seo.html.haml +31 -0
  53. data/app/views/weeler/content/_side_navbar.html.haml +17 -0
  54. data/app/views/weeler/content/_sortable_list.html.haml +24 -0
  55. data/app/views/weeler/content/edit.html.haml +2 -0
  56. data/app/views/weeler/content/index.html.haml +10 -0
  57. data/app/views/weeler/content/new.html.haml +2 -0
  58. data/app/views/weeler/content/welcome.html.haml +3 -0
  59. data/app/views/weeler/home/_side_navbar.html.haml +8 -0
  60. data/app/views/weeler/home/about.html.haml +15 -0
  61. data/app/views/weeler/home/index.html.haml +3 -0
  62. data/app/views/weeler/seo_items/edit.html.haml +28 -0
  63. data/app/views/weeler/seo_items/index.html.haml +15 -0
  64. data/app/views/weeler/settings/index.html.haml +19 -0
  65. data/app/views/weeler/static_sections/show.html.haml +26 -0
  66. data/app/views/weeler/translations/_form.html.haml +27 -0
  67. data/app/views/weeler/translations/_translation.html.haml +11 -0
  68. data/app/views/weeler/translations/edit.html.haml +14 -0
  69. data/app/views/weeler/translations/index.html.haml +76 -0
  70. data/app/views/weeler/translations/new.html.haml +13 -0
  71. data/lib/.DS_Store +0 -0
  72. data/lib/generators/weeler/.DS_Store +0 -0
  73. data/lib/generators/weeler/install_generator.rb +30 -26
  74. data/lib/generators/weeler/templates/assets/javascripts/weeler/app/index.js +2 -0
  75. data/lib/generators/weeler/templates/assets/stylesheets/weeler/app/index.css +4 -0
  76. data/lib/generators/weeler/templates/controllers/weeler/application_controller.rb +6 -0
  77. data/lib/generators/weeler/templates/initializers/weeler.rb +30 -2
  78. data/lib/generators/weeler/templates/migrations/create_weeler_seos.rb +14 -0
  79. data/lib/generators/weeler/templates/migrations/create_weeler_settings.rb +17 -0
  80. data/lib/generators/weeler/templates/migrations/translate_weeler_seos.rb +15 -0
  81. data/lib/generators/weeler/templates/views/weeler/.keep +0 -0
  82. data/lib/i18n/backend/weeler.rb +102 -22
  83. data/lib/i18n/backend/weeler/dedupe.rb +31 -0
  84. data/lib/i18n/backend/weeler/exporter.rb +67 -5
  85. data/lib/i18n/backend/weeler/html_checker.rb +41 -0
  86. data/lib/i18n/backend/weeler/importer.rb +30 -13
  87. data/lib/i18n/backend/weeler/translation.rb +12 -7
  88. data/lib/i18n/humanize_missing_translations.rb +1 -0
  89. data/lib/i18n/weeler.rb +8 -2
  90. data/lib/tasks/weeler.rake +8 -0
  91. data/lib/weeler.rb +80 -7
  92. data/lib/weeler/.DS_Store +0 -0
  93. data/lib/weeler/action_controller/acts/restful.rb +185 -0
  94. data/lib/weeler/action_dispatch/routing/mapper.rb +87 -0
  95. data/lib/weeler/action_view/helpers/form_helper.rb +13 -0
  96. data/lib/weeler/action_view/helpers/image_form_helper.rb +84 -0
  97. data/lib/weeler/action_view/helpers/translation_helper.rb +15 -0
  98. data/lib/weeler/deprecator.rb +9 -0
  99. data/lib/weeler/engine.rb +18 -4
  100. data/lib/weeler/version.rb +7 -1
  101. data/rspec.html +426 -147
  102. data/spec/.DS_Store +0 -0
  103. data/spec/controllers/translations_controller_spec.rb +76 -5
  104. data/spec/dummy/app/controllers/weeler/posts_controller.rb +3 -7
  105. data/spec/dummy/app/models/post.rb +17 -0
  106. data/spec/dummy/app/models/translation.rb +2 -0
  107. data/spec/dummy/config/locales/en.yml +4 -1
  108. data/spec/dummy/config/routes.rb +3 -3
  109. data/spec/dummy/db/development.sqlite3 +0 -0
  110. data/spec/dummy/db/migrate/20140123083704_create_weeler_seos.rb +14 -0
  111. data/spec/dummy/db/migrate/20140123083705_create_weeler_settings.rb +17 -0
  112. data/spec/dummy/db/migrate/{20131015144900_create_weeler_translations.rb → 20140123083706_create_weeler_translations.rb} +0 -0
  113. data/spec/dummy/db/migrate/20140123083707_translate_weeler_seos.rb +15 -0
  114. data/spec/dummy/db/migrate/20140718103237_create_posts.rb +12 -0
  115. data/spec/dummy/db/migrate/20140726151210_create_translations.rb +12 -0
  116. data/spec/dummy/db/schema.rb +59 -1
  117. data/spec/dummy/db/test.sqlite3 +0 -0
  118. data/spec/dummy/log/development.log +221 -0
  119. data/spec/factories/dummy_posts.rb +6 -0
  120. data/spec/fixtures/.DS_Store +0 -0
  121. data/spec/routing/routes_spec.rb +4 -4
  122. data/spec/spec_helper.rb +14 -3
  123. data/spec/weeler/action_controller/acts/restful_spec.rb +155 -0
  124. data/spec/weeler/action_view/helpers/form_helper_spec.rb +26 -0
  125. data/spec/weeler/action_view/helpers/translation_helper_spec.rb +16 -0
  126. data/spec/weeler/i18n/backend/weeler/dedupe_spec.rb +21 -0
  127. data/spec/weeler/i18n/backend/weeler/exporter_spec.rb +2 -4
  128. data/spec/weeler/i18n/backend/weeler/importer_spec.rb +5 -2
  129. data/spec/weeler/i18n/backend/weeler_spec.rb +121 -23
  130. data/weeler.gemspec +15 -7
  131. metadata +207 -85
  132. data/.DS_Store +0 -0
  133. data/app/assets/stylesheets/weeler/vendor/bootstrap.css +0 -6086
  134. data/app/views/layouts/weeler/base.html.erb +0 -40
  135. data/app/views/weeler/home/about.html.erb +0 -16
  136. data/app/views/weeler/home/index.html.erb +0 -4
  137. data/app/views/weeler/shared/_flash.html.erb +0 -17
  138. data/app/views/weeler/shared/_footer.html.erb +0 -3
  139. data/app/views/weeler/shared/_header_navbar.html.erb +0 -18
  140. data/app/views/weeler/shared/_side_navbar.html.erb +0 -14
  141. data/app/views/weeler/translations/_form.html.erb +0 -43
  142. data/app/views/weeler/translations/_translation.html.erb +0 -11
  143. data/app/views/weeler/translations/edit.html.erb +0 -19
  144. data/app/views/weeler/translations/index.html.erb +0 -103
  145. data/app/views/weeler/translations/new.html.erb +0 -19
  146. data/lib/generators/weeler/templates/controllers/weeler/example_controller.rb.example +0 -7
  147. data/lib/i18n/backend/weeler/exporter/active_record.rb +0 -37
  148. data/lib/i18n/backend/weeler/exporter/active_record_relation.rb +0 -38
  149. data/lib/i18n/backend/weeler/store_procs.rb +0 -39
  150. data/lib/weeler/route_mapper.rb +0 -41
  151. data/spec/dummy/db/production.sqlite3 +0 -0
  152. data/spec/dummy/log/test.log +0 -88454
@@ -0,0 +1,5 @@
1
+ .jumbotron
2
+ %h1
3
+ Administration
4
+ %p
5
+ Choose what you want to manage!
@@ -0,0 +1,3 @@
1
+ - flash.each do |name, message|
2
+ :javascript
3
+ notify.show("#{name}", "#{message}");
@@ -0,0 +1,2 @@
1
+ %footer
2
+ %p © Weby 2014
@@ -0,0 +1,19 @@
1
+ .navbar.navbar-fixed-top.navbar-inverse{role: "navigation"}
2
+ .container
3
+ .navbar-header
4
+ %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"}
5
+ %span.icon-bar
6
+ %span.icon-bar
7
+ %span.icon-bar
8
+ %a.navbar-brand.weeler{href: weeler_root_path}
9
+ = Weeler
10
+ %span.weeler_version= Gem.loaded_specs["weeler"].version
11
+ .collapse.navbar-collapse
12
+ %ul.nav.navbar-nav
13
+ - Weeler.main_menu_items.each do |item|
14
+ %li{class: "#{'active' if @current_menu_item.downcase == item[:name].downcase}"}
15
+ = link_to item[:name].humanize, "/#{Weeler.mount_location_namespace}/#{item[:weeler_path]}"
16
+ - if Weeler.logout_path
17
+ %ul.nav.navbar-nav.navbar-right
18
+ %li
19
+ %a{href: Weeler.logout_path} Logout
@@ -0,0 +1,2 @@
1
+ #sidebar.col-xs-6.col-sm-3.sidebar-offcanvas{role: "navigation"}
2
+ .well.sidebar-nav
@@ -0,0 +1,12 @@
1
+ #sidebar.col-xs-6.col-sm-3.sidebar-offcanvas{role: "navigation"}
2
+ .well.sidebar-nav
3
+ %ul.nav
4
+ %li Configurations
5
+ - if Weeler.use_weeler_i18n
6
+ %li
7
+ %a{href: weeler_translations_path} Translations
8
+ - if I18n::Backend::Weeler::Translation.select("key").where("key LIKE ?", "seo.%").order("key").size > 0
9
+ %li
10
+ %a{href: weeler_seo_items_path} SEO
11
+ %li
12
+ %a{href: weeler_settings_path} Settings
@@ -0,0 +1,3 @@
1
+ .jumbotron
2
+ %h1 Configurations
3
+ %p Choose what you want to manage!
@@ -0,0 +1,5 @@
1
+ - if object.errors.any?
2
+ %div{class: "alert alert-danger"}
3
+ - object.errors.full_messages.each do |message|
4
+ %li
5
+ = message
@@ -0,0 +1,6 @@
1
+ = form_for [:weeler, @item], html: {class: "form-horizontal", role: "form"} do |f|
2
+
3
+ = render 'error_messages', :object => @item
4
+
5
+ %p{class: "pull-right"}
6
+ = f.submit "Save", class: "btn btn-primary"
@@ -0,0 +1,23 @@
1
+ #content
2
+ %h2 All #{item_humanized_name} items
3
+ %h6
4
+ - path_options = {} if path_options.nil?
5
+
6
+ = link_to "click here to add a new #{item_humanized_name} item", {action: :new}.merge(path_options)
7
+
8
+ - if collection.count < 1
9
+ .no_news
10
+ = "Sorry, It seams there are no #{collection.klass.to_s.underscore.humanize.downcase} items at this moment.. "
11
+ = link_to "press here to add a new #{collection.klass.to_s.underscore.humanize.downcase} item", {action: :new}.merge(path_options)
12
+
13
+ - else
14
+ - collection.each do |item|
15
+ .list-group-item{:id => "order_#{item.id}"}
16
+ %span
17
+ - if defined? item.weeler_image_path
18
+ = image_tag(item.weeler_image_path, style: "max-width: 75px")
19
+ %b
20
+ = truncate(item.to_s, length: 40)
21
+ %span{class: "pull-right"}
22
+ = link_to "Edit", action: :edit, id: item.id
23
+ = link_to "Delete", [:weeler, item], data: {confirm: 'Are you sure?'}, :method => :delete
@@ -0,0 +1,31 @@
1
+ = form.fields_for :seo do |seo_fields|
2
+ %h2
3
+ = "SEO options"
4
+ %p
5
+ = "Here you can adjust (override) Title and meta tags for current page"
6
+ %br
7
+
8
+ - I18n.available_locales.each do |lang|
9
+ - if I18n.available_locales.size > 1
10
+ %h3
11
+ = lang.capitalize
12
+
13
+ = seo_fields.hidden_field :id, :value => seo_fields.object.id if seo_fields.object.present?
14
+ = seo_fields.hidden_field :section, :value => controller_name
15
+
16
+ - seo_fields.globalize_fields_for lang do |g|
17
+
18
+ .form-group
19
+ .input-group
20
+ = g.label :title, class: "input-group-addon"
21
+ = g.text_field :title, :class => 'form-control'
22
+
23
+ .form-group
24
+ .input-group
25
+ = g.label :description, class: "input-group-addon"
26
+ = g.text_field :description, :class => 'form-control'
27
+
28
+ .form-group
29
+ .input-group
30
+ = g.label :keywords, class: "input-group-addon"
31
+ = g.text_field :keywords, :class => 'form-control'
@@ -0,0 +1,17 @@
1
+ #sidebar.col-xs-6.col-sm-3.sidebar-offcanvas{role: "navigation"}
2
+ .well.sidebar-nav
3
+ %ul.nav
4
+ %li Content
5
+ - Weeler.content_menu_items.each do |item|
6
+ %li
7
+ - if item[:seen].present? && item[:seen] == true
8
+ = link_to "/#{Weeler.mount_location_namespace}/#{item[:weeler_path]}/" do
9
+ %span.badge.pull-right= item[:class].where(seen: false).size
10
+ = item[:name].humanize
11
+ - else
12
+ = link_to item[:name].humanize, "/#{Weeler.mount_location_namespace}/#{item[:weeler_path]}/"
13
+ - if Weeler.static_menu_items.size > 0
14
+ %li Static content
15
+ - Weeler.static_menu_items.each do |item|
16
+ %li
17
+ = link_to item[:name].humanize, "/#{Weeler.mount_location_namespace}/#{item[:weeler_path]}/"
@@ -0,0 +1,24 @@
1
+ #content
2
+ %h2 All #{item_humanized_name} items
3
+ %h6
4
+ - path_options = {} if path_options.nil?
5
+
6
+ = link_to "click here to add a new #{item_humanized_name} item", {action: :new}.merge(path_options)
7
+
8
+ - if collection.count < 1
9
+ .no_news
10
+ = "Sorry, It seams there are no #{item_humanized_name} items at this moment.. "
11
+ = link_to "press here to add a new #{item_humanized_name} item", {action: :new}.merge(path_options)
12
+
13
+ - else
14
+ .sortable.list-group{data: {url: "#{url_for({action: :order}.merge(path_options)) }"} }
15
+ - collection.each do |item|
16
+ .list-group-item{:id => "order_#{item.id}"}
17
+ %span
18
+ - if defined? item.weeler_image_path
19
+ = image_tag(item.weeler_image_path, style: "max-width: 75px")
20
+ %b
21
+ = raw item.to_s
22
+ %span{class: "pull-right"}
23
+ = link_to "Edit", edit_polymorphic_path([:weeler, item])
24
+ = link_to "Delete", [:weeler, item], data: {confirm: 'Are you sure?'}, :method => :delete
@@ -0,0 +1,2 @@
1
+ %h2 Edit #{item_humanized_name}
2
+ = render :partial => 'form'
@@ -0,0 +1,10 @@
1
+ .row
2
+ %div{class: "col-lg-12 col-md-12"}
3
+ - if @items.klass.new.has_attribute?(:sequence)
4
+ = render "sortable_list", { collection: @items }
5
+ - else
6
+ = render "list", { collection: @items }
7
+
8
+ - if @paginate.present? && @paginate > 0
9
+ .row
10
+ = paginate @items, params: { action: "index" }, theme: "weeler"
@@ -0,0 +1,2 @@
1
+ %h2 New #{item_humanized_name}
2
+ = render :partial => 'form'
@@ -0,0 +1,3 @@
1
+ .jumbotron
2
+ %h1 Content
3
+ %p Choose what you want to manage!
@@ -0,0 +1,8 @@
1
+ #sidebar.col-xs-6.col-sm-3.sidebar-offcanvas{role: "navigation"}
2
+ .well.sidebar-nav
3
+ %ul.nav
4
+ %li Home
5
+ %li
6
+ %a{href: weeler_root_path} Index
7
+ %li
8
+ %a{href: weeler_home_about_path} About
@@ -0,0 +1,15 @@
1
+ .row
2
+ .col-12-lg
3
+ %h2 About
4
+ %p Simple open source CMS system. Most used in Weby LTC systems.
5
+ %h3 Features
6
+ %ul
7
+ %li Dynamic static texts
8
+ %li Localization
9
+ %li Light design
10
+ %h3 Technology (used in implementation)
11
+ %ul
12
+ %li Ruby - cool programming language
13
+ %li Rails - most advanced WEB MVC framework
14
+ %li RSpec - automatic tests/unit tests
15
+ %li Bundler - uses only fresh and tested libs
@@ -0,0 +1,3 @@
1
+ .jumbotron
2
+ %h1 Weeler!
3
+ %p Welcome to Weeler CMS. Made by Weby Ltd.
@@ -0,0 +1,28 @@
1
+ .header.container
2
+ .row
3
+ .col-lg-12.col-md-12
4
+ .page-header
5
+ %h3
6
+ = "\"#{@section.humanize}\""
7
+ SEO data
8
+ .row
9
+ %div{class: "col-lg-12 col-md-12"}
10
+ = form_tag weeler_seo_item_path(id: @section.gsub('.', '_')), {method: "put", class: "form-horizontal", role: "form"} do
11
+ - I18n.available_locales.each do |lang|
12
+ - if I18n.available_locales.size > 1
13
+ %h3
14
+ = lang.capitalize
15
+ - ["title", "description", "keywords"].each do |subsection|
16
+ - translation = I18n::Backend::Weeler::Translation.locale(lang).lookup("seo.#{@section}.#{subsection}").first
17
+ - translation = I18n::Backend::Weeler::Translation.create(key: "seo.#{@section}.#{subsection}", locale: locale) if translation.nil?
18
+ .form-group
19
+ = label_tag subsection, subsection.humanize, class: "col-lg-2 col-md-2 control-label"
20
+ %div{class: "col-lg-10 col-md-10"}
21
+ = text_area_tag "translations[#{translation.id}]", translation.value, class: 'form-control'
22
+ - if translation.interpolations.size > 0
23
+ %b Variables
24
+ = translation.interpolations.map{ |t| "%{#{t}}" }.join(", ")
25
+
26
+ .form-group
27
+ = submit_tag "Save", class: "btn btn-primary"
28
+ = link_to 'Back', {action: :index}, class: "btn btn-default"
@@ -0,0 +1,15 @@
1
+ .row
2
+ %div{class: "col-lg-12 col-md-12"}
3
+ #content
4
+ %h2 All seo items
5
+ - if @groups.count < 1
6
+ .no_news
7
+ = "Sorry, It seams there are no seo items at this moment."
8
+ - else
9
+ - @groups.each do |item|
10
+ .list-group-item
11
+ %span
12
+ %b
13
+ = item.humanize
14
+ %span{class: "pull-right"}
15
+ = link_to "Open", action: :edit, id: item
@@ -0,0 +1,19 @@
1
+ .row
2
+ .header.container
3
+ .row
4
+ .col-lg-12
5
+ .page-header
6
+ %h1
7
+ Settings
8
+ .row
9
+ %div{class: "col-lg-8 col-md-8"}
10
+ - @settings.each do |item|
11
+ %div{style: "min-height: 50px;"}
12
+ = form_for [:weeler, item], html: {class: "form-vertical", role: "form"} do |f|
13
+ .form-group
14
+ %label.col-lg-4.col-md-4.control-label
15
+ = "#{item.var.humanize.capitalize}:"
16
+ .col-lg-6.col-md-6
17
+ = f.text_field :value, value: item.value, class: "form-control"
18
+ .col-lg-2.col-md-2
19
+ = f.submit "Save", class: "btn btn-primary"
@@ -0,0 +1,26 @@
1
+ .header.container
2
+ .row
3
+ .col-lg-12.col-md-12
4
+ .page-header
5
+ %h3
6
+ = @section.humanize
7
+ section
8
+ .row
9
+ %div{class: "col-lg-12 col-md-12"}
10
+ = form_tag weeler_static_section_path(id: @section), {method: "put", class: "form-horizontal", role: "form"} do
11
+ - @items.each do |key|
12
+ - I18n.available_locales.each do |lang|
13
+ - if I18n.available_locales.size > 1
14
+ %h3
15
+ = lang.capitalize
16
+ - translation = I18n::Backend::Weeler::Translation.locale(lang).lookup(key).first
17
+ .form-group
18
+ = label_tag key, key.to_s.split('.').last.humanize, class: "col-lg-2 col-md-2 control-label"
19
+ %div{class: "col-lg-10 col-md-10"}
20
+ - if translation.html?
21
+ = text_area_tag "translations[#{translation.id}]", translation.value, class: 'form-control redactor'
22
+ - else
23
+ = text_area_tag "translations[#{translation.id}]", translation.value, class: 'form-control'
24
+
25
+ .form-group
26
+ = submit_tag "Save", class: "btn btn-primary"
@@ -0,0 +1,27 @@
1
+ %h4 Basic (required)
2
+ .form-group
3
+ %label.col-lg-2.col-md-2.control-label Locale
4
+ .col-lg-10.col-md-10
5
+ = f.select :locale, I18n.available_locales, {}, {class: "form-control", placeholder: "en"}
6
+ .form-group
7
+ %label.col-lg-2.col-md-2.control-label Key
8
+ .col-lg-10.col-md-10
9
+ = f.text_field :key, {class: "form-control", placeholder: "footer.middle"}
10
+ .form-group
11
+ %label.col-lg-2.col-md-2.control-label Value
12
+ .col-lg-10.col-md-10
13
+ - if translation.html?
14
+ = f.text_area :value, {class: "form-control redactor"}
15
+ - else
16
+ = f.text_area :value, {class: "form-control" }
17
+ %h4 Info
18
+ .form-group
19
+ %label.col-lg-2.col-md-2.control-label Variables
20
+ .col-lg-10.col-md-10
21
+ %p.form-control-static
22
+ %label= translation.interpolations.join(", ")
23
+ .form-group{style: "display: none;"}
24
+ %label.col-lg-2.col-md-2.control-label Is a ruby procedure?
25
+ .col-lg-10.col-md-10
26
+ %p.form-control-static
27
+ %label= translation.is_proc
@@ -0,0 +1,11 @@
1
+ %tr
2
+ %td
3
+ %a{href: edit_weeler_translation_path(translation.id)}
4
+ \   #{translation.locale}
5
+ %td= translation.key
6
+ - if translation.value.present? && translation.value.is_a?(String)
7
+ %td= strip_tags(truncate(translation.value, lenght: 50))
8
+ - else
9
+ %td= translation.value
10
+ %td= translation.interpolations
11
+ %td.text-center= translation.created_at.strftime("%d/%m/%Y")
@@ -0,0 +1,14 @@
1
+ .header.container
2
+ .row
3
+ .col-lg-12.col-md-12
4
+ .page-header
5
+ %h1 Edit translation
6
+ .edit_user.container
7
+ .row
8
+ .col-lg-12.col-md-12
9
+ = form_for @translation, {url: weeler_translation_path(@translation), html: {class: "form-horizontal", role: "form"}} do |f|
10
+ = render partial: "form", locals: {translation: @translation, f: f}
11
+ %p.text-center
12
+ %button.btn.btn-primary{type: "submit"} Save
13
+ %a.btn.btn-link{href: weeler_translations_path} Cancel
14
+ = link_to 'Remove', weeler_translation_path(@translation), :confirm => "Are you sure you want remove?", :method => :delete, :class => "btn btn-danger"
@@ -0,0 +1,76 @@
1
+ .header.container
2
+ .row
3
+ .col-lg-12
4
+ .page-header
5
+ %h1 Translations
6
+ %p.lead.text-muted Static translation data over all your app. You can safely edit translation values. Also you can export excel document, translate in all locales you need and import it back.
7
+ %p.lead.text-muted
8
+ = "You can switch between showing keys and translations:"
9
+ %br/
10
+ - if params[:show_translation_keys] == 'true'
11
+ = link_to 'Show translations', weeler_translations_path(show_translation_keys: false)
12
+ - else
13
+ = link_to 'Show translation keys', weeler_translations_path(show_translation_keys: true)
14
+
15
+ .row
16
+ %nav.navbar.navbar-default{role: "navigation"}
17
+ / Collect the nav links, forms, and other content for toggling
18
+ .collapse.navbar-collapse.navbar-ex1-collapse
19
+ / Groups dropdown
20
+ %ul.nav.navbar-nav.navbar-left
21
+ %li.dropdown
22
+ %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
23
+ = (params[:group].capitalize if params[:group]) || "All groups"
24
+ %b.caret
25
+ %ul.dropdown-menu
26
+ %li
27
+ %a{href: weeler_translations_path(filtered_locale: params[:filtered_locale])} All
28
+ - @groups.each do |group|
29
+ - if group.present?
30
+ %li
31
+ %a{href: weeler_translations_path(filtered_locale: params[:filtered_locale], group: group)}= group.capitalize
32
+ / Locales dropdown
33
+ %ul.nav.navbar-nav
34
+ %li.dropdown
35
+ %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
36
+ = (params[:filtered_locale].capitalize if params[:filtered_locale]) || "All locales"
37
+ %b.caret
38
+ %ul.dropdown-menu
39
+ %li
40
+ %a{href: weeler_translations_path(group: params[:group])} All
41
+ - I18n.available_locales.each do |locale|
42
+ - if locale.present?
43
+ %li
44
+ %a{href: weeler_translations_path(group: params[:group], filtered_locale: locale)}= locale.capitalize
45
+ / Import and export data
46
+ = form_tag import_weeler_translations_path, {:multipart => true, class: "navbar-form navbar-left"} do
47
+ .form-group
48
+ %input.weeler-file-inputs{name: "file", type: "file"}/
49
+ .btn-group
50
+ %button.btn.btn-default{type: "submit"} Import
51
+ %a.btn.btn-default{href: export_weeler_translations_path(filtered_locale: params[:filtered_locale], group: params[:group], query: params[:query], format: :xlsx)} Export
52
+ / Search
53
+ = form_tag weeler_translations_path, method: 'get', class: "navbar-form navbar-right", role: "search" do
54
+ = hidden_field_tag :filtered_locale, params[:filtered_locale] if params[:filtered_locale].present?
55
+ = hidden_field_tag :group, params[:group] if params[:group].present?
56
+ .form-group
57
+ = text_field_tag :query, params[:query], class: "form-control", placeholder: "Search"
58
+ %button.btn.btn-default{type: "submit"} Submit
59
+ / /.navbar-collapse
60
+ .container
61
+ .row
62
+ .col-lg-12
63
+ %table.table.table-hover{"data-provides" => "rowlink"}
64
+ %thead
65
+ %tr
66
+ %th Locale
67
+ %th Key
68
+ %th.text-center Value
69
+ %th.text-center Interpolations
70
+ %th.text-center Created
71
+ %tbody#translations
72
+ - @translations.each do |translation|
73
+ = render :partial => "weeler/translations/translation", locals: {translation: translation}
74
+ .container
75
+ .row
76
+ = paginate @translations, params: {controller: "weeler/translations", action: "index", filtered_locale: params[:filtered_locale], group: params[:group], query: params[:query] }, previous_label: "<<", next_label: ">>", theme: "weeler"