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.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.rspec +1 -1
- data/.travis.yml +7 -2
- data/CHANGELOG.md +149 -1
- data/LICENSE.txt +2 -2
- data/README.md +83 -1
- data/app/.DS_Store +0 -0
- data/app/assets/javascripts/weeler/init.js.coffee +13 -2
- data/app/assets/javascripts/weeler/lib/notify.js +18 -0
- data/app/assets/javascripts/weeler/lib/sortable.js +9 -0
- data/app/assets/stylesheets/weeler/init.css.erb +2 -1
- data/app/assets/stylesheets/weeler/style.css.scss +22 -0
- data/app/controllers/concerns/weeler/section_seo.rb +16 -0
- data/app/controllers/weeler/administration_controller.rb +11 -0
- data/app/controllers/weeler/application_controller.rb +5 -0
- data/app/controllers/weeler/base_controller.rb +16 -12
- data/app/controllers/weeler/configuration_controller.rb +9 -0
- data/app/controllers/weeler/content_controller.rb +12 -0
- data/app/controllers/weeler/home_controller.rb +5 -2
- data/app/controllers/weeler/seo_items_controller.rb +24 -0
- data/app/controllers/weeler/settings_controller.rb +21 -0
- data/app/controllers/weeler/static_sections_controller.rb +19 -0
- data/app/controllers/weeler/translations_controller.rb +36 -18
- data/app/models/concerns/weeler/seoable.rb +61 -0
- data/app/models/concerns/weeler/sluger.rb +32 -0
- data/app/models/settings.rb +2 -0
- data/app/models/weeler/seo.rb +9 -0
- data/app/views/kaminari/{_first_page.html.erb → weeler/_first_page.html.erb} +1 -1
- data/app/views/kaminari/{_gap.html.erb → weeler/_gap.html.erb} +1 -1
- data/app/views/kaminari/{_last_page.html.erb → weeler/_last_page.html.erb} +1 -1
- data/app/views/kaminari/{_next_page.html.erb → weeler/_next_page.html.erb} +1 -1
- data/app/views/kaminari/{_page.html.erb → weeler/_page.html.erb} +0 -0
- data/app/views/kaminari/{_paginator.html.erb → weeler/_paginator.html.erb} +1 -1
- data/app/views/kaminari/{_prev_page.html.erb → weeler/_prev_page.html.erb} +1 -1
- data/app/views/layouts/weeler/base.html.haml +22 -0
- data/{lib/generators/weeler/templates/views/weeler/example/index.html.erb → app/views/weeler/administration/_filter.html.haml} +0 -0
- data/app/views/weeler/administration/_header_row.html.haml +5 -0
- data/app/views/weeler/administration/_row.html.haml +5 -0
- data/app/views/weeler/administration/_side_navbar.html.haml +8 -0
- data/app/views/weeler/administration/index.html.haml +17 -0
- data/app/views/weeler/administration/welcome.html.haml +5 -0
- data/app/views/weeler/base/_flash.html.haml +3 -0
- data/app/views/weeler/base/_footer.html.haml +2 -0
- data/app/views/weeler/base/_header_navbar.html.haml +19 -0
- data/app/views/weeler/base/_side_navbar.html.haml +2 -0
- data/app/views/weeler/configuration/_side_navbar.html.haml +12 -0
- data/app/views/weeler/configuration/index.html.haml +3 -0
- data/app/views/weeler/content/_error_messages.html.haml +5 -0
- data/app/views/weeler/content/_form.html.haml +6 -0
- data/app/views/weeler/content/_list.html.haml +23 -0
- data/app/views/weeler/content/_object_seo.html.haml +31 -0
- data/app/views/weeler/content/_side_navbar.html.haml +17 -0
- data/app/views/weeler/content/_sortable_list.html.haml +24 -0
- data/app/views/weeler/content/edit.html.haml +2 -0
- data/app/views/weeler/content/index.html.haml +10 -0
- data/app/views/weeler/content/new.html.haml +2 -0
- data/app/views/weeler/content/welcome.html.haml +3 -0
- data/app/views/weeler/home/_side_navbar.html.haml +8 -0
- data/app/views/weeler/home/about.html.haml +15 -0
- data/app/views/weeler/home/index.html.haml +3 -0
- data/app/views/weeler/seo_items/edit.html.haml +28 -0
- data/app/views/weeler/seo_items/index.html.haml +15 -0
- data/app/views/weeler/settings/index.html.haml +19 -0
- data/app/views/weeler/static_sections/show.html.haml +26 -0
- data/app/views/weeler/translations/_form.html.haml +27 -0
- data/app/views/weeler/translations/_translation.html.haml +11 -0
- data/app/views/weeler/translations/edit.html.haml +14 -0
- data/app/views/weeler/translations/index.html.haml +76 -0
- data/app/views/weeler/translations/new.html.haml +13 -0
- data/lib/.DS_Store +0 -0
- data/lib/generators/weeler/.DS_Store +0 -0
- data/lib/generators/weeler/install_generator.rb +30 -26
- data/lib/generators/weeler/templates/assets/javascripts/weeler/app/index.js +2 -0
- data/lib/generators/weeler/templates/assets/stylesheets/weeler/app/index.css +4 -0
- data/lib/generators/weeler/templates/controllers/weeler/application_controller.rb +6 -0
- data/lib/generators/weeler/templates/initializers/weeler.rb +30 -2
- data/lib/generators/weeler/templates/migrations/create_weeler_seos.rb +14 -0
- data/lib/generators/weeler/templates/migrations/create_weeler_settings.rb +17 -0
- data/lib/generators/weeler/templates/migrations/translate_weeler_seos.rb +15 -0
- data/lib/generators/weeler/templates/views/weeler/.keep +0 -0
- data/lib/i18n/backend/weeler.rb +102 -22
- data/lib/i18n/backend/weeler/dedupe.rb +31 -0
- data/lib/i18n/backend/weeler/exporter.rb +67 -5
- data/lib/i18n/backend/weeler/html_checker.rb +41 -0
- data/lib/i18n/backend/weeler/importer.rb +30 -13
- data/lib/i18n/backend/weeler/translation.rb +12 -7
- data/lib/i18n/humanize_missing_translations.rb +1 -0
- data/lib/i18n/weeler.rb +8 -2
- data/lib/tasks/weeler.rake +8 -0
- data/lib/weeler.rb +80 -7
- data/lib/weeler/.DS_Store +0 -0
- data/lib/weeler/action_controller/acts/restful.rb +185 -0
- data/lib/weeler/action_dispatch/routing/mapper.rb +87 -0
- data/lib/weeler/action_view/helpers/form_helper.rb +13 -0
- data/lib/weeler/action_view/helpers/image_form_helper.rb +84 -0
- data/lib/weeler/action_view/helpers/translation_helper.rb +15 -0
- data/lib/weeler/deprecator.rb +9 -0
- data/lib/weeler/engine.rb +18 -4
- data/lib/weeler/version.rb +7 -1
- data/rspec.html +426 -147
- data/spec/.DS_Store +0 -0
- data/spec/controllers/translations_controller_spec.rb +76 -5
- data/spec/dummy/app/controllers/weeler/posts_controller.rb +3 -7
- data/spec/dummy/app/models/post.rb +17 -0
- data/spec/dummy/app/models/translation.rb +2 -0
- data/spec/dummy/config/locales/en.yml +4 -1
- data/spec/dummy/config/routes.rb +3 -3
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20140123083704_create_weeler_seos.rb +14 -0
- data/spec/dummy/db/migrate/20140123083705_create_weeler_settings.rb +17 -0
- data/spec/dummy/db/migrate/{20131015144900_create_weeler_translations.rb → 20140123083706_create_weeler_translations.rb} +0 -0
- data/spec/dummy/db/migrate/20140123083707_translate_weeler_seos.rb +15 -0
- data/spec/dummy/db/migrate/20140718103237_create_posts.rb +12 -0
- data/spec/dummy/db/migrate/20140726151210_create_translations.rb +12 -0
- data/spec/dummy/db/schema.rb +59 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +221 -0
- data/spec/factories/dummy_posts.rb +6 -0
- data/spec/fixtures/.DS_Store +0 -0
- data/spec/routing/routes_spec.rb +4 -4
- data/spec/spec_helper.rb +14 -3
- data/spec/weeler/action_controller/acts/restful_spec.rb +155 -0
- data/spec/weeler/action_view/helpers/form_helper_spec.rb +26 -0
- data/spec/weeler/action_view/helpers/translation_helper_spec.rb +16 -0
- data/spec/weeler/i18n/backend/weeler/dedupe_spec.rb +21 -0
- data/spec/weeler/i18n/backend/weeler/exporter_spec.rb +2 -4
- data/spec/weeler/i18n/backend/weeler/importer_spec.rb +5 -2
- data/spec/weeler/i18n/backend/weeler_spec.rb +121 -23
- data/weeler.gemspec +15 -7
- metadata +207 -85
- data/.DS_Store +0 -0
- data/app/assets/stylesheets/weeler/vendor/bootstrap.css +0 -6086
- data/app/views/layouts/weeler/base.html.erb +0 -40
- data/app/views/weeler/home/about.html.erb +0 -16
- data/app/views/weeler/home/index.html.erb +0 -4
- data/app/views/weeler/shared/_flash.html.erb +0 -17
- data/app/views/weeler/shared/_footer.html.erb +0 -3
- data/app/views/weeler/shared/_header_navbar.html.erb +0 -18
- data/app/views/weeler/shared/_side_navbar.html.erb +0 -14
- data/app/views/weeler/translations/_form.html.erb +0 -43
- data/app/views/weeler/translations/_translation.html.erb +0 -11
- data/app/views/weeler/translations/edit.html.erb +0 -19
- data/app/views/weeler/translations/index.html.erb +0 -103
- data/app/views/weeler/translations/new.html.erb +0 -19
- data/lib/generators/weeler/templates/controllers/weeler/example_controller.rb.example +0 -7
- data/lib/i18n/backend/weeler/exporter/active_record.rb +0 -37
- data/lib/i18n/backend/weeler/exporter/active_record_relation.rb +0 -38
- data/lib/i18n/backend/weeler/store_procs.rb +0 -39
- data/lib/weeler/route_mapper.rb +0 -41
- data/spec/dummy/db/production.sqlite3 +0 -0
- data/spec/dummy/log/test.log +0 -88454
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<title>Weeler</title>
|
|
5
|
-
|
|
6
|
-
<meta charset="utf-8">
|
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
8
|
-
|
|
9
|
-
<%= stylesheet_link_tag "weeler/init", :media => "all" %>
|
|
10
|
-
<%= javascript_include_tag "weeler/init" %>
|
|
11
|
-
|
|
12
|
-
<%= csrf_meta_tags %>
|
|
13
|
-
|
|
14
|
-
<%= render "weeler/shared/flash" %>
|
|
15
|
-
|
|
16
|
-
<%= yield :weeler_header %>
|
|
17
|
-
</head>
|
|
18
|
-
|
|
19
|
-
<body <%= yield :weeler_body_tag %> >
|
|
20
|
-
<%= render "weeler/shared/header_navbar" %>
|
|
21
|
-
|
|
22
|
-
<div class="container">
|
|
23
|
-
<div class="row row-offcanvas row-offcanvas-right">
|
|
24
|
-
|
|
25
|
-
<%= render "weeler/shared/side_navbar" %>
|
|
26
|
-
|
|
27
|
-
<div class="col-xs-12 col-sm-9">
|
|
28
|
-
<%= yield %>
|
|
29
|
-
</div><!--/span-->
|
|
30
|
-
</div><!--/row-->
|
|
31
|
-
|
|
32
|
-
<hr>
|
|
33
|
-
|
|
34
|
-
<%= render "weeler/shared/footer" %>
|
|
35
|
-
|
|
36
|
-
</div><!--/.container-->
|
|
37
|
-
|
|
38
|
-
</body>
|
|
39
|
-
|
|
40
|
-
</html>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<div class="row">
|
|
2
|
-
<div class="col-12-lg">
|
|
3
|
-
<h2>About</h2>
|
|
4
|
-
<h3>History</h3>
|
|
5
|
-
<p>In late 2013 Arturs and Artis decided to make CMS for programmers. Arturs built first prototype on Ruby in few weeks and they implemented Weeler in few projects.</p>
|
|
6
|
-
<h3>Now</h3>
|
|
7
|
-
<p>Weeler is the most popular and the most powerful CMS system today.</p>
|
|
8
|
-
<h3>Technology</h3>
|
|
9
|
-
<ul>
|
|
10
|
-
<li>Ruby</li>
|
|
11
|
-
<li>on Rails - most advanced MVC framework</li>
|
|
12
|
-
<li>RSpec for testing</li>
|
|
13
|
-
<li>Bundler for dependencies</li>
|
|
14
|
-
</ul>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<% flash.each do |name, message| %>
|
|
2
|
-
<script type="text/javascript">
|
|
3
|
-
$(function(){
|
|
4
|
-
$.pnotify({
|
|
5
|
-
type: '<%= name %>', // 'notice', 'info', 'success', 'error'
|
|
6
|
-
title: '<%= name %>',
|
|
7
|
-
text: '<%= message %>',
|
|
8
|
-
styling: 'bootstrap',
|
|
9
|
-
shadow: false,
|
|
10
|
-
animation: 'fade',
|
|
11
|
-
closer: true,
|
|
12
|
-
history: false,
|
|
13
|
-
auto_display: true
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
</script>
|
|
17
|
-
<% end %>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
|
|
2
|
-
<div class="container">
|
|
3
|
-
<div class="navbar-header">
|
|
4
|
-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
|
5
|
-
<span class="icon-bar"></span>
|
|
6
|
-
<span class="icon-bar"></span>
|
|
7
|
-
<span class="icon-bar"></span>
|
|
8
|
-
</button>
|
|
9
|
-
<a class="navbar-brand" href="<%= weeler_root_path %>">Weeler</a>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="collapse navbar-collapse">
|
|
12
|
-
<ul class="nav navbar-nav">
|
|
13
|
-
<li class="<%= 'active' if @current_menu_item == 'home' %>"><a href="<%= weeler_root_path %>">Home</a></li>
|
|
14
|
-
<li class="<%= 'active' if @current_menu_item == 'about' %>"><a href="<%= weeler_home_about_path %>">About</a></li>
|
|
15
|
-
</ul>
|
|
16
|
-
</div><!-- /.nav-collapse -->
|
|
17
|
-
</div><!-- /.container -->
|
|
18
|
-
</div><!-- /.navbar -->
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar" role="navigation">
|
|
2
|
-
<div class="well sidebar-nav">
|
|
3
|
-
<ul class="nav">
|
|
4
|
-
<li>Configuration</li>
|
|
5
|
-
<li class="<%= "active" %> "><a href="<%= weeler_translations_path %>">Translations</a></li>
|
|
6
|
-
<li>Content</li>
|
|
7
|
-
|
|
8
|
-
<% Weeler.menu_items.each do |item| %>
|
|
9
|
-
<li><%= link_to item.to_s.capitalize, "#{weeler_root_url}/#{item}" %></li>
|
|
10
|
-
<% end %>
|
|
11
|
-
|
|
12
|
-
</ul>
|
|
13
|
-
</div><!--/.well -->
|
|
14
|
-
</div><!--/span-->
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<%= form_for translation, {url: weeler_translation_path(translation), html: {class: "form-horizontal", role: "form"}} do |f| %>
|
|
2
|
-
<h4>Basic (required)</h4>
|
|
3
|
-
<div class="form-group">
|
|
4
|
-
<label class="col-lg-2 col-md-2 control-label">Locale</label>
|
|
5
|
-
<div class="col-lg-10 col-md-10">
|
|
6
|
-
<%= f.text_field :locale, {class: "form-control", placeholder: "en"} %>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="form-group">
|
|
10
|
-
<label class="col-lg-2 col-md-2 control-label">Key</label>
|
|
11
|
-
<div class="col-lg-10 col-md-10">
|
|
12
|
-
<%= f.text_field :key, {class: "form-control", placeholder: "footer.middle"} %>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="form-group">
|
|
16
|
-
<label class="col-lg-2 col-md-2 control-label">Value</label>
|
|
17
|
-
<div class="col-lg-10 col-md-10">
|
|
18
|
-
<%= f.text_area :value, {class: "form-control"} %>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
<h4>Ext</h4>
|
|
22
|
-
|
|
23
|
-
<div class="form-group">
|
|
24
|
-
<label class="col-lg-2 col-md-2 control-label">Interpolations</label>
|
|
25
|
-
<div class="col-lg-10 col-md-10">
|
|
26
|
-
<p class="form-control-static">
|
|
27
|
-
<label><%= translation.interpolations.join(", ") %></label>
|
|
28
|
-
</p>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div class="form-group">
|
|
33
|
-
<label class="col-lg-2 col-md-2 control-label">Is procedure?</label>
|
|
34
|
-
<div class="col-lg-4 col-md-4">
|
|
35
|
-
<%= f.select :is_proc, {"No" => false, "Yes" => true}, {}, {class: "form-control"} %>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
<p class="text-center">
|
|
39
|
-
<button type="submit" class="btn btn-primary">Save</button>
|
|
40
|
-
<a class="btn btn-link" href="<%= weeler_translations_path %>">Cancel</a>
|
|
41
|
-
<%= link_to 'Remove', weeler_translation_path(translation), :confirm => "Are you sure you want remove?", :method => :delete, :class => "btn btn-danger" %>
|
|
42
|
-
</p>
|
|
43
|
-
<% end %>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<tr>
|
|
2
|
-
<td>
|
|
3
|
-
<a href="<%= edit_weeler_translation_path(translation.id) %>">
|
|
4
|
-
<%= translation.locale %>
|
|
5
|
-
</a>
|
|
6
|
-
</td>
|
|
7
|
-
<td><%= translation.key %></a></td>
|
|
8
|
-
<td><%= translation.value %></a></td>
|
|
9
|
-
<td><%= translation.interpolations %></a></td>
|
|
10
|
-
<td class="text-center"><%= translation.created_at.strftime("%d/%m/%Y") %></td>
|
|
11
|
-
</tr>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<div class="header container">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<div class="col-lg-12 col-md-12">
|
|
4
|
-
<div class="page-header">
|
|
5
|
-
<h1>Edit translation</h1>
|
|
6
|
-
</div>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<div class="edit_user container">
|
|
12
|
-
<div class="row">
|
|
13
|
-
<div class="col-lg-12 col-md-12">
|
|
14
|
-
|
|
15
|
-
<%= render partial: "form", locals: {translation: @translation} %>
|
|
16
|
-
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<div class="header container">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<div class="col-lg-12">
|
|
4
|
-
<div class="page-header">
|
|
5
|
-
<h1>Translations</h1>
|
|
6
|
-
<p class="lead text-muted">Statis 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.</p>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div class="row">
|
|
14
|
-
<nav class="navbar navbar-default" role="navigation">
|
|
15
|
-
|
|
16
|
-
<!-- Collect the nav links, forms, and other content for toggling -->
|
|
17
|
-
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
|
18
|
-
|
|
19
|
-
<!-- Groups dropdown -->
|
|
20
|
-
<ul class="nav navbar-nav navbar-left">
|
|
21
|
-
<li class="dropdown">
|
|
22
|
-
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= (params[:group].capitalize if params[:group]) || "All groups" %> <b class="caret"></b></a>
|
|
23
|
-
<ul class="dropdown-menu">
|
|
24
|
-
<li><a href="<%= weeler_translations_path(locale: params[:locale]) %>">All</a></li>
|
|
25
|
-
<% @groups.each do |group| %>
|
|
26
|
-
<% if group.present? %>
|
|
27
|
-
<li><a href="<%= weeler_translations_path(locale: params[:locale], group: group) %>"><%= group.capitalize %></a></li>
|
|
28
|
-
<% end %>
|
|
29
|
-
<% end %>
|
|
30
|
-
</ul>
|
|
31
|
-
</li>
|
|
32
|
-
</ul>
|
|
33
|
-
|
|
34
|
-
<!-- Locales dropdown -->
|
|
35
|
-
<ul class="nav navbar-nav">
|
|
36
|
-
<li class="dropdown">
|
|
37
|
-
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= (params[:locale].capitalize if params[:locale]) || "All locales" %> <b class="caret"></b></a>
|
|
38
|
-
<ul class="dropdown-menu">
|
|
39
|
-
<li><a href="<%= weeler_translations_path(group: params[:group]) %>">All</a></li>
|
|
40
|
-
<% I18n::Backend::Weeler::Translation.available_locales.each do |locale| %>
|
|
41
|
-
<% if locale.present? %>
|
|
42
|
-
<li><a href="<%= weeler_translations_path(group: params[:group], locale: locale) %>"><%= locale.capitalize %></a></li>
|
|
43
|
-
<% end %>
|
|
44
|
-
<% end %>
|
|
45
|
-
</ul>
|
|
46
|
-
</li>
|
|
47
|
-
</ul>
|
|
48
|
-
|
|
49
|
-
<!-- Import and export data -->
|
|
50
|
-
<%= form_tag import_weeler_translations_path, {:multipart => true, class: "navbar-form navbar-left"} do %>
|
|
51
|
-
<div class="form-group">
|
|
52
|
-
<input type="file" name="file" class="weeler-file-inputs" /></span>
|
|
53
|
-
</div>
|
|
54
|
-
<div class="btn-group">
|
|
55
|
-
<button type="submit" class="btn btn-default">Import</button>
|
|
56
|
-
<a class="btn btn-default" href="<%= export_weeler_translations_path(locale: params[:locale], group: params[:group], format: :xlsx) %>">Export</a>
|
|
57
|
-
</div>
|
|
58
|
-
<% end %>
|
|
59
|
-
|
|
60
|
-
<!-- Search -->
|
|
61
|
-
<%= form_tag weeler_translations_path, method: 'get', class: "navbar-form navbar-right", role: "search" do %>
|
|
62
|
-
<%= hidden_field_tag :locale, params[:locale] if params[:locale].present? %>
|
|
63
|
-
<%= hidden_field_tag :group, params[:group] if params[:group].present? %>
|
|
64
|
-
<div class="form-group">
|
|
65
|
-
<%= text_field_tag :query, params[:query], class: "form-control", placeholder: "Search" %>
|
|
66
|
-
</div>
|
|
67
|
-
<button type="submit" class="btn btn-default">Submit</button>
|
|
68
|
-
<% end %>
|
|
69
|
-
|
|
70
|
-
</div><!-- /.navbar-collapse -->
|
|
71
|
-
</nav>
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
<div class="container">
|
|
75
|
-
<div class="row">
|
|
76
|
-
<div class="col-lg-12">
|
|
77
|
-
<table class="table table-hover" data-provides="rowlink">
|
|
78
|
-
<thead>
|
|
79
|
-
<tr>
|
|
80
|
-
<th>Locale</th>
|
|
81
|
-
<th>Key</th>
|
|
82
|
-
<th class="text-center">Value</th>
|
|
83
|
-
<th class="text-center">Interpolations</th>
|
|
84
|
-
<th class="text-center">Created</th>
|
|
85
|
-
</tr>
|
|
86
|
-
</thead>
|
|
87
|
-
<tbody id="translations">
|
|
88
|
-
<% @translations.each do |translation| %>
|
|
89
|
-
<%= render :partial => "weeler/translations/translation", locals: {translation: translation} %>
|
|
90
|
-
<% end %>
|
|
91
|
-
</tbody>
|
|
92
|
-
</table>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
|
|
97
|
-
<div class="container">
|
|
98
|
-
<div class="row">
|
|
99
|
-
<div class="col-lg-12">
|
|
100
|
-
<%= paginate @translations, params: {controller: "weeler/translations", action: "index", locale: params[:locale], group: params[:group] }, previous_label: "<<", next_label: ">>" %>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<div class="header container">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<div class="col-lg-12 col-md-12">
|
|
4
|
-
<div class="page-header">
|
|
5
|
-
<h1>New translation</h1>
|
|
6
|
-
</div>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<div class="edit_user container">
|
|
12
|
-
<div class="row">
|
|
13
|
-
<div class="col-lg-12 col-md-12">
|
|
14
|
-
|
|
15
|
-
<%= render partial: "form", locals: {translation: @translation} %>
|
|
16
|
-
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
module I18n
|
|
2
|
-
module Backend
|
|
3
|
-
class Weeler
|
|
4
|
-
module Exporter
|
|
5
|
-
|
|
6
|
-
module ActiveRecord
|
|
7
|
-
extend ActiveSupport::Concern
|
|
8
|
-
|
|
9
|
-
module ClassMethods
|
|
10
|
-
|
|
11
|
-
def title_row locales
|
|
12
|
-
row = [ 'Key' ]
|
|
13
|
-
locales.each do |locale|
|
|
14
|
-
row.push(locale.capitalize)
|
|
15
|
-
end
|
|
16
|
-
row
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def translation_row_by_key_and_locales key, locales
|
|
20
|
-
row = [ key ]
|
|
21
|
-
locales.each do |locale|
|
|
22
|
-
result = Translation.locale(locale).lookup(key).load
|
|
23
|
-
if result.first.present?
|
|
24
|
-
row.push(result.first.value)
|
|
25
|
-
else
|
|
26
|
-
row.push("")
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
row
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
module I18n
|
|
2
|
-
module Backend
|
|
3
|
-
class Weeler
|
|
4
|
-
module Exporter
|
|
5
|
-
|
|
6
|
-
module ActiveRecordRelation
|
|
7
|
-
|
|
8
|
-
def as_xlsx_package
|
|
9
|
-
# construct xlsx file
|
|
10
|
-
p = Axlsx::Package.new
|
|
11
|
-
# Numbers requires this
|
|
12
|
-
p.use_shared_strings = true
|
|
13
|
-
|
|
14
|
-
sheet = p.workbook.add_worksheet(name: "translations")
|
|
15
|
-
|
|
16
|
-
# All used locales and translations by params
|
|
17
|
-
locales = Translation.available_locales
|
|
18
|
-
locales = locales.select{ |l| l.present? }
|
|
19
|
-
|
|
20
|
-
sheet.add_row(Translation.title_row(locales))
|
|
21
|
-
|
|
22
|
-
included_keys = []
|
|
23
|
-
|
|
24
|
-
self.each do |translation|
|
|
25
|
-
unless included_keys.include? translation.key
|
|
26
|
-
sheet.add_row(Translation.translation_row_by_key_and_locales(translation.key, locales))
|
|
27
|
-
included_keys << translation.key
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
return p
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# This module is intended to be mixed into the Weeler backend to allow
|
|
2
|
-
# storing Ruby Procs as translation values in the database.
|
|
3
|
-
#
|
|
4
|
-
# I18n.backend = I18n::Backend::Weeler.new
|
|
5
|
-
# I18n::Backend::Weeler::Translation.send(:include, I18n::Backend::Weeler::StoreProcs)
|
|
6
|
-
#
|
|
7
|
-
# The StoreProcs module requires the ParseTree and ruby2ruby gems and therefor
|
|
8
|
-
# was extracted from the original backend.
|
|
9
|
-
#
|
|
10
|
-
# ParseTree is not compatible with Ruby 1.9.
|
|
11
|
-
|
|
12
|
-
begin
|
|
13
|
-
require 'ruby2ruby'
|
|
14
|
-
require 'parse_tree'
|
|
15
|
-
require 'parse_tree_extensions'
|
|
16
|
-
rescue LoadError => e
|
|
17
|
-
puts "can't use StoreProcs because: #{e.message}"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
module I18n
|
|
21
|
-
module Backend
|
|
22
|
-
class Weeler
|
|
23
|
-
module StoreProcs
|
|
24
|
-
def value=(v)
|
|
25
|
-
case v
|
|
26
|
-
when Proc
|
|
27
|
-
write_attribute(:value, v.to_ruby)
|
|
28
|
-
write_attribute(:is_proc, true)
|
|
29
|
-
else
|
|
30
|
-
write_attribute(:value, v)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
Translation.send(:include, self) if method(:to_s).respond_to?(:to_ruby)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|