weeler 1.5.2 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -0
- data/.travis.yml +3 -14
- data/CHANGELOG.md +43 -0
- data/Gemfile +3 -0
- data/README.md +30 -37
- data/Rakefile +4 -4
- data/app/assets/javascripts/weeler/init.js +32 -0
- data/app/assets/stylesheets/weeler/style.css.scss +7 -1
- data/app/controllers/concerns/weeler/section_seo.rb +1 -1
- data/app/controllers/weeler/base_controller.rb +2 -2
- data/app/controllers/weeler/seo_items_controller.rb +3 -2
- data/app/controllers/weeler/settings_controller.rb +27 -9
- data/app/controllers/weeler/static_sections_controller.rb +2 -2
- data/app/controllers/weeler/translations_controller.rb +5 -19
- data/app/models/setting.rb +7 -0
- data/app/views/kaminari/weeler/_first_page.html.haml +3 -0
- data/app/views/kaminari/weeler/_gap.html.haml +2 -0
- data/app/views/kaminari/weeler/_last_page.html.haml +3 -0
- data/app/views/kaminari/weeler/_next_page.html.haml +3 -0
- data/app/views/kaminari/weeler/_page.html.haml +2 -0
- data/app/views/kaminari/weeler/_paginator.html.haml +11 -0
- data/app/views/kaminari/weeler/_prev_page.html.haml +3 -0
- data/app/views/weeler/base/_footer.html.haml +1 -1
- data/app/views/weeler/settings/_form.html.haml +16 -0
- data/app/views/weeler/settings/index.html.haml +5 -8
- data/app/views/weeler/static_sections/show.html.haml +5 -1
- data/app/views/weeler/translations/_form.html.haml +5 -2
- data/app/views/weeler/translations/index.html.haml +0 -10
- data/lib/generators/weeler/templates/assets/javascripts/weeler/app/index.js +3 -1
- data/lib/generators/weeler/templates/assets/stylesheets/weeler/app/index.css +1 -1
- data/lib/generators/weeler/templates/controllers/weeler/application_controller.rb +1 -1
- data/lib/i18n/backend/weeler/exporter.rb +32 -14
- data/lib/i18n/backend/weeler/importer.rb +57 -54
- data/lib/i18n/backend/weeler.rb +15 -26
- data/lib/weeler/action_controller/acts/restful.rb +4 -4
- data/lib/weeler/action_dispatch/routing/mapper.rb +1 -2
- data/lib/weeler/action_view/helpers/translation_helper.rb +2 -2
- data/lib/weeler/engine.rb +0 -3
- data/lib/weeler/version.rb +3 -3
- data/lib/weeler.rb +8 -3
- data/spec/.DS_Store +0 -0
- data/spec/controllers/translations_controller_spec.rb +16 -16
- data/spec/dummy/.ruby-version +1 -0
- data/spec/dummy/Rakefile +2 -2
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/app/assets/stylesheets/application.css +6 -4
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/{assets/javascripts → javascript/packs}/application.js +5 -3
- data/spec/dummy/app/jobs/application_job.rb +7 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/post.rb +1 -1
- data/spec/dummy/app/views/layouts/application.html.erb +9 -9
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/bin/setup +33 -0
- data/spec/dummy/config/application.rb +19 -13
- data/spec/dummy/config/boot.rb +3 -3
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +1 -0
- data/spec/dummy/config/environment.rb +2 -2
- data/spec/dummy/config/environments/development.rb +38 -5
- data/spec/dummy/config/environments/production.rb +64 -32
- data/spec/dummy/config/environments/test.rb +21 -9
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +12 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/mime_types.rb +0 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +2 -2
- data/spec/dummy/config/puma.rb +38 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +2 -1
- data/spec/dummy/db/migrate/20140123083704_create_weeler_seos.rb +1 -1
- data/spec/dummy/db/migrate/20140123083705_create_weeler_settings.rb +1 -1
- data/spec/dummy/db/migrate/20140123083706_create_weeler_translations.rb +1 -1
- data/spec/dummy/db/migrate/20140123083707_translate_weeler_seos.rb +1 -1
- data/spec/dummy/db/migrate/20140718103237_create_posts.rb +1 -1
- data/spec/dummy/db/migrate/20140726151210_create_translations.rb +1 -1
- data/spec/dummy/db/migrate/20160330161101_create_weeler_locks.rb +1 -1
- data/spec/dummy/db/migrate/20160330192005_create_weeler_translation_stats.rb +1 -1
- data/spec/dummy/db/schema.rb +56 -64
- data/spec/dummy/{app/mailers/.keep → db/test.sqlite3} +0 -0
- data/spec/dummy/log/development.log +0 -1020
- data/spec/dummy/public/404.html +24 -15
- data/spec/dummy/public/422.html +24 -15
- data/spec/dummy/public/500.html +23 -14
- data/spec/dummy/{app/models/.keep → public/apple-touch-icon-precomposed.png} +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/storage/.keep +0 -0
- data/spec/factories/dummy_posts.rb +3 -3
- data/spec/factories/translations.rb +4 -4
- data/spec/fixtures/test_2020_format.xlsx +0 -0
- data/spec/spec_helper.rb +7 -5
- data/spec/weeler/action_controller/acts/restful_spec.rb +15 -16
- data/spec/weeler/i18n/backend/weeler/exporter_spec.rb +6 -0
- data/spec/weeler/i18n/backend/weeler/importer_spec.rb +17 -6
- data/spec/weeler/i18n/backend/weeler_spec.rb +55 -70
- data/spec/weeler/i18n/humanize_missing_translations_spec.rb +14 -11
- data/weeler.gemspec +18 -13
- metadata +103 -65
- data/app/assets/javascripts/weeler/init.js.coffee +0 -26
- data/app/models/settings.rb +0 -2
- data/app/views/kaminari/weeler/_first_page.html.erb +0 -13
- data/app/views/kaminari/weeler/_gap.html.erb +0 -8
- data/app/views/kaminari/weeler/_last_page.html.erb +0 -13
- data/app/views/kaminari/weeler/_next_page.html.erb +0 -14
- data/app/views/kaminari/weeler/_page.html.erb +0 -12
- data/app/views/kaminari/weeler/_paginator.html.erb +0 -23
- data/app/views/kaminari/weeler/_prev_page.html.erb +0 -13
- data/app/views/weeler/translations/usage_stats.html.haml +0 -34
- data/lib/generators/weeler/templates/migrations/create_weeler_translation_stats.rb +0 -11
- data/lib/i18n/backend/weeler/usage_logger.rb +0 -35
- data/lib/weeler/action_view/helpers/form_helper.rb +0 -13
- data/lib/weeler/action_view/helpers/image_form_helper.rb +0 -83
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/log/production.log +0 -4
- data/spec/weeler/action_view/helpers/form_helper_spec.rb +0 -35
- data/spec/weeler/i18n/backend/weeler/usage_logger_spec.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9a5843d8169cc1f00da76876d33c136077878f6f02b516207402652068bfb54b
|
4
|
+
data.tar.gz: 2b1d3e9aa399794f81e91b096b76147cd7529bae9966e1798668551321890c2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a8056a9690d1dfab75ea1e570e1b332e0c22b245c48908ad46f4994e9dd8c3ae1557b7d089555143d6824a0a0af2756817bf623a62a23a50d1922f3ba56cd5
|
7
|
+
data.tar.gz: 02dc435b1cd9f7f358b2a36b2a2507389071ca0e0a65a8d43136dd442c0b748664d77d2d99f4f5d1473effff97cb0e335c8441993d960071b5ff01822bfd66ab
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.0
|
data/.travis.yml
CHANGED
@@ -7,20 +7,9 @@ sudo: false
|
|
7
7
|
before_script:
|
8
8
|
- psql -c 'create database travis_ci_test;' -U postgres
|
9
9
|
rvm:
|
10
|
-
- "2.
|
11
|
-
- "2.
|
12
|
-
- "
|
13
|
-
- "2.1.2"
|
14
|
-
- "2.1.3"
|
15
|
-
- "2.1.4"
|
16
|
-
- "2.1.5"
|
17
|
-
- "2.1.6"
|
18
|
-
- "2.2.0"
|
19
|
-
- "2.2.1"
|
20
|
-
- "2.2.2"
|
21
|
-
- "2.2.3"
|
22
|
-
- "2.2.4"
|
23
|
-
- "2.3.0"
|
10
|
+
- "2.6.0"
|
11
|
+
- "2.7.2"
|
12
|
+
- "3.0.0"
|
24
13
|
# uncomment this line if your project needs to run something other than `rake`:
|
25
14
|
script:
|
26
15
|
- RAILS_ENV=test bundle exec rake db:migrate --trace
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,46 @@
|
|
1
|
+
## 2.0.1
|
2
|
+
|
3
|
+
### Features & Enhancements
|
4
|
+
|
5
|
+
* Optimized translation import and export (avoiding n+1 queries)
|
6
|
+
|
7
|
+
## 2.0.0
|
8
|
+
|
9
|
+
### Features & Enhancements
|
10
|
+
|
11
|
+
* Add Rails 6.0 support
|
12
|
+
* Add Ruby 2.6 - 2.7 support (drop other rubys)
|
13
|
+
* Removed 'image_upload_field' helper
|
14
|
+
|
15
|
+
### Contributors
|
16
|
+
|
17
|
+
* Arturs Braucs
|
18
|
+
|
19
|
+
## 1.6.0
|
20
|
+
|
21
|
+
### Features & Enhancements
|
22
|
+
|
23
|
+
* Add Rails 5.0 support
|
24
|
+
* Add Ruby 2.4.0 support
|
25
|
+
* Drop ruby's < 2.2.2 support
|
26
|
+
|
27
|
+
### Bug Fixes
|
28
|
+
|
29
|
+
* Fixed RailsSettings::CachedSettings deprication warning
|
30
|
+
|
31
|
+
### Contributors
|
32
|
+
|
33
|
+
* Arturs Braucs
|
34
|
+
|
35
|
+
## 1.5.4
|
36
|
+
|
37
|
+
* Using RailsSettings::CachedSettings instead of RailsSettings::Base
|
38
|
+
|
39
|
+
## 1.5.3
|
40
|
+
|
41
|
+
* Rails depricated table exists, using data source exists instead
|
42
|
+
* Using RailsSettings::Base instead of RailsSettings::CachedSettings
|
43
|
+
|
1
44
|
## 1.5.2
|
2
45
|
|
3
46
|
* Added translation filter by created at
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,26 +1,39 @@
|
|
1
1
|
# Weeler
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/weeler.
|
4
|
-
[![Build Status](https://travis-ci.org/weby-lv/weeler.
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/weby-lv/weeler/badge.
|
6
|
-
[![Code Climate](https://codeclimate.com/github/weby-lv/weeler.
|
7
|
-
|
8
|
-
CMS for weby.lv projects.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/weeler.svg)](https://badge.fury.io/rb/weeler)
|
4
|
+
[![Build Status](https://travis-ci.org/weby-lv/weeler.svg?branch=master)](https://travis-ci.org/weby-lv/weeler)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/weby-lv/weeler/badge.svg)](https://coveralls.io/r/weby-lv/weeler)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/weby-lv/weeler/badges/gpa.svg)](https://codeclimate.com/github/weby-lv/weeler)
|
9
7
|
|
10
8
|
## Installation
|
11
9
|
|
12
|
-
|
10
|
+
### Rails 6.0
|
11
|
+
|
12
|
+
2.0.0 version only supports Rails 6.0 and ruby 2.5 or higher version. In Gemfile include:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'weeler', '~> 2.0'
|
16
|
+
```
|
17
|
+
|
18
|
+
### Rails 5.0
|
13
19
|
|
14
|
-
|
20
|
+
1.6.0 version only supports Rails 5.0 and ruby 2.2.2 and higher version. In Gemfile include:
|
15
21
|
|
16
|
-
|
22
|
+
```ruby
|
23
|
+
gem 'weeler', '~> 1.6'
|
24
|
+
```
|
17
25
|
|
18
|
-
|
26
|
+
### Rails 4.2
|
19
27
|
|
20
|
-
|
28
|
+
```ruby
|
29
|
+
gem 'weeler', '~> 1.5'
|
30
|
+
```
|
21
31
|
|
22
|
-
|
32
|
+
After specifying necessary gems in Gemfile run
|
23
33
|
|
34
|
+
```bash
|
35
|
+
bundle install
|
36
|
+
```
|
24
37
|
|
25
38
|
## Setup
|
26
39
|
|
@@ -41,9 +54,9 @@ This will generate follwing files:
|
|
41
54
|
|
42
55
|
Following will be appended to your route file:
|
43
56
|
|
44
|
-
mount_weeler_at "weeler" do
|
45
|
-
# weeler_resources :example, include_in_weeler_menu: true
|
46
|
-
# Also you orderable and imageable concerns
|
57
|
+
mount_weeler_at "weeler" do
|
58
|
+
# weeler_resources :example, include_in_weeler_menu: true
|
59
|
+
# Also you orderable and imageable concerns
|
47
60
|
end
|
48
61
|
|
49
62
|
And then migrate database:
|
@@ -111,7 +124,7 @@ you must add block <tt>permit_params: -> (params) { params.require(:post).permit
|
|
111
124
|
|
112
125
|
You can override redirect path after <tt>:create</tt>, <tt>:update</tt>, <tt>:destroy</tt> actions.
|
113
126
|
You can do this by overriding private methods in your controller.
|
114
|
-
|
127
|
+
|
115
128
|
def after_create_path
|
116
129
|
{ action: :edit, id: @item.id }
|
117
130
|
end
|
@@ -126,7 +139,7 @@ You can do this by overriding private methods in your controller.
|
|
126
139
|
|
127
140
|
Or you can override what happens after successful <tt>:create</tt>, <tt>:update</tt>, <tt>:destroy</tt> actions.
|
128
141
|
You can do this by overriding private methods in your controller.
|
129
|
-
|
142
|
+
|
130
143
|
def after_create_action
|
131
144
|
redirect_to( after_create_path, {:notice => "Successfully created item"} )
|
132
145
|
end
|
@@ -150,26 +163,6 @@ Also you can override all standart restful action view and implement, if you nee
|
|
150
163
|
|
151
164
|
Weeler have default views for index, new, edit actions. You should override <tt>_form.html.haml</tt> partial.
|
152
165
|
|
153
|
-
### View helper image_upload_field :
|
154
|
-
|
155
|
-
Weeler action view helper method.
|
156
|
-
It creates file upload field with info and preview for image.
|
157
|
-
|
158
|
-
e.g.
|
159
|
-
|
160
|
-
<%= f.image_upload_field :image, size_info: "270x294" %>
|
161
|
-
|
162
|
-
It creates:
|
163
|
-
|
164
|
-
<div class="col-lg-10 col-md-10">
|
165
|
-
<label class="col-lg-2 col-md-2 control-label" for="object_image">Image</label><div class="col-lg-5 col-md-5"><div class="row"><div class="col-lg-12 col-md-12"><input class="form-control" id="object_image" name="object[image]" type="file"></div></div><div class="row"><div class="col-lg-12 col-md-12">Size should be 270x294</div></div></div><div class="col-lg-5 col-md-5"><div class="row"><div class="col-lg-12 col-md-12"><img alt="Name" src="/images/name.jpg" style="height: 80px;"></div></div></div>
|
166
|
-
</div>
|
167
|
-
|
168
|
-
If you use another image handler than Paperclip, you can also pass <tt>image_url_method</tt> for image preview.
|
169
|
-
|
170
|
-
Also with remove_image action in controller and route for that,
|
171
|
-
it removes only image from object.
|
172
|
-
|
173
166
|
## Contributing
|
174
167
|
|
175
168
|
1. Fork it
|
data/Rakefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
load 'rails/tasks/engine.rake'
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
# require 'spec/dummy/tasks'
|
4
3
|
|
5
|
-
|
4
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
5
|
+
load 'rails/tasks/engine.rake'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery-ui
|
3
|
+
//= require jquery_ujs
|
4
|
+
//= require ./vendor/moment
|
5
|
+
//= require_tree ./vendor
|
6
|
+
//= require_tree ./lib
|
7
|
+
//= require weeler/app
|
8
|
+
//= require_self
|
9
|
+
|
10
|
+
(function() {
|
11
|
+
var app;
|
12
|
+
|
13
|
+
app = {
|
14
|
+
boot: function() {
|
15
|
+
$('.weeler-file-inputs').bootstrapFileInput();
|
16
|
+
sortable.init();
|
17
|
+
flash.init();
|
18
|
+
$('[data-provide="rowlink"],[data-provides="rowlink"]').each(function() {
|
19
|
+
return $(this).rowlink($(this).data());
|
20
|
+
});
|
21
|
+
$('.datepicker').datetimepicker({
|
22
|
+
format: 'DD/MM/YYYY'
|
23
|
+
});
|
24
|
+
return $('.datetimepicker').datetimepicker();
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
$(document).ready(function() {
|
29
|
+
return app.boot();
|
30
|
+
});
|
31
|
+
|
32
|
+
}).call(this);
|
@@ -17,8 +17,9 @@ module Weeler
|
|
17
17
|
translation.value = value
|
18
18
|
translation.save
|
19
19
|
end
|
20
|
-
|
20
|
+
Setting.i18n_updated_at = Time.now
|
21
|
+
|
21
22
|
redirect_to({action: :edit, id: params[:id]}, {flash: {success: "Section updated."}})
|
22
23
|
end
|
23
24
|
end
|
24
|
-
end
|
25
|
+
end
|
@@ -1,21 +1,39 @@
|
|
1
1
|
class Weeler::SettingsController < Weeler::ConfigurationController
|
2
|
+
HIDDEN_SETTINGS_KEYS = %w[i18n_updated_at].freeze
|
3
|
+
|
2
4
|
def index
|
3
|
-
|
4
|
-
|
5
|
+
@settings = Setting.all.order(:id).where.not(var: HIDDEN_SETTINGS_KEYS)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create
|
9
|
+
@setting = Setting.new(create_setting_params)
|
10
|
+
|
11
|
+
if @setting.save
|
12
|
+
redirect_to weeler_settings_path, flash: { success: 'Setting created.' }
|
13
|
+
else
|
14
|
+
flash.now[:error] = 'Errors on creating.'
|
15
|
+
render :index
|
16
|
+
end
|
5
17
|
end
|
6
18
|
|
7
19
|
def update
|
8
|
-
@setting =
|
9
|
-
|
10
|
-
|
20
|
+
@setting = Setting.find(params[:id])
|
21
|
+
|
22
|
+
if @setting.update(update_setting_params)
|
23
|
+
redirect_to weeler_settings_path, flash: { success: 'Setting updated.' }
|
11
24
|
else
|
12
|
-
flash.now[:error] =
|
25
|
+
flash.now[:error] = 'Errors on updating.'
|
13
26
|
render :index
|
14
27
|
end
|
15
28
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def create_setting_params
|
33
|
+
params.require(:setting).permit(:var, :value)
|
19
34
|
end
|
20
35
|
|
36
|
+
def update_setting_params
|
37
|
+
params.require(:setting).permit(:value)
|
38
|
+
end
|
21
39
|
end
|
@@ -12,8 +12,8 @@ module Weeler
|
|
12
12
|
translation.value = value
|
13
13
|
translation.save
|
14
14
|
end
|
15
|
-
|
16
|
-
redirect_to({action: :show, id: params[:id]}, {flash: {success: "Section updated."}})
|
15
|
+
Setting.i18n_updated_at = Time.current
|
16
|
+
redirect_to({ action: :show, id: params[:id] }, { flash: { success: "Section updated." } })
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -19,7 +19,7 @@ module Weeler
|
|
19
19
|
@translation = I18n::Backend::Weeler::Translation.new(translation_params)
|
20
20
|
|
21
21
|
if @translation.save
|
22
|
-
|
22
|
+
Setting.i18n_updated_at = Time.now
|
23
23
|
redirect_to ({ action: :edit, id: @translation }), flash: { success: "Translation saved." }
|
24
24
|
else
|
25
25
|
flash.now[:error] = "Errors in saving."
|
@@ -30,8 +30,8 @@ module Weeler
|
|
30
30
|
def update
|
31
31
|
@translation = I18n::Backend::Weeler::Translation.find(params[:id])
|
32
32
|
|
33
|
-
if @translation.
|
34
|
-
|
33
|
+
if @translation.update(translation_params)
|
34
|
+
Setting.i18n_updated_at = Time.now
|
35
35
|
|
36
36
|
redirect_to ({ action: :edit, id: @translation }), flash: { success: "Translation updated." }
|
37
37
|
else
|
@@ -44,24 +44,11 @@ module Weeler
|
|
44
44
|
@translation = I18n::Backend::Weeler::Translation.find(params[:id])
|
45
45
|
@translation.destroy
|
46
46
|
|
47
|
-
|
47
|
+
Setting.i18n_updated_at = Time.now
|
48
48
|
|
49
49
|
redirect_to ({ action: :index }), flash: {success: "Translation succesfully removed."}
|
50
50
|
end
|
51
51
|
|
52
|
-
def usage_stats
|
53
|
-
@used_keys = []
|
54
|
-
if Settings.log_key_usage == 'dump'
|
55
|
-
I18n::Backend::Weeler::TranslationStat.all.each do |translation_stat|
|
56
|
-
@used_keys << [translation_stat.key, translation_stat.usage_count]
|
57
|
-
end
|
58
|
-
else
|
59
|
-
Weeler.i18n_cache.instance_variable_get(:@data).keys.each do |key|
|
60
|
-
@used_keys << [key, Weeler.i18n_cache.read(key)] if key.start_with?('usage_stats')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
52
|
def export
|
66
53
|
respond_to do |format|
|
67
54
|
format.xlsx do
|
@@ -76,7 +63,7 @@ module Weeler
|
|
76
63
|
if params[:file].present?
|
77
64
|
I18n::Backend::Weeler::Translation.import params[:file]
|
78
65
|
|
79
|
-
|
66
|
+
Setting.i18n_updated_at = Time.now
|
80
67
|
|
81
68
|
redirect_to ({ action: :index }), flash: {success: "Translations succesfully imported."}
|
82
69
|
else
|
@@ -108,6 +95,5 @@ module Weeler
|
|
108
95
|
translations = translations.lookup(params[:group]) if params[:group].present?
|
109
96
|
translations
|
110
97
|
end
|
111
|
-
|
112
98
|
end
|
113
99
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
= paginator.render do
|
2
|
+
%ul.pagination.pagination-lg.col-lg-12.col-md-12
|
3
|
+
= first_page_tag unless current_page.first?
|
4
|
+
= prev_page_tag unless current_page.first?
|
5
|
+
- each_page do |page|
|
6
|
+
- if page.left_outer? || page.right_outer? || page.inside_window?
|
7
|
+
= page_tag page
|
8
|
+
- elsif !page.was_truncated?
|
9
|
+
= gap_tag
|
10
|
+
= next_page_tag unless current_page.last?
|
11
|
+
= last_page_tag unless current_page.last?
|
@@ -1,2 +1,2 @@
|
|
1
1
|
%footer
|
2
|
-
%p © Weby
|
2
|
+
%p © Weby 2021
|
@@ -0,0 +1,16 @@
|
|
1
|
+
= form_for [:weeler, item], html: {class: "form-vertical", role: "form"} do |f|
|
2
|
+
- if item.new_record?
|
3
|
+
= f.hidden_field :var
|
4
|
+
|
5
|
+
.form-group
|
6
|
+
%label.col-lg-4.col-md-4.control-label
|
7
|
+
= "#{item.var.humanize.capitalize}:"
|
8
|
+
.col-lg-6.col-md-6
|
9
|
+
- type = item.class.get_field(item.var)[:type]
|
10
|
+
- if type == :boolean
|
11
|
+
= f.check_box :value, class: "form-check-input"
|
12
|
+
- else
|
13
|
+
= f.text_field :value, class: "form-control"
|
14
|
+
|
15
|
+
.col-lg-2.col-md-2
|
16
|
+
= f.submit "Save", class: "btn btn-primary"
|
@@ -9,11 +9,8 @@
|
|
9
9
|
%div{class: "col-lg-8 col-md-8"}
|
10
10
|
- @settings.each do |item|
|
11
11
|
%div{style: "min-height: 50px;"}
|
12
|
-
=
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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"
|
12
|
+
= render 'form', item: item
|
13
|
+
- Setting.keys.each do |key|
|
14
|
+
- if !Setting.all.map(&:var).include?(key)
|
15
|
+
%div{style: "min-height: 50px;"}
|
16
|
+
= render 'form', item: Setting.new(var: key)
|
@@ -17,8 +17,12 @@
|
|
17
17
|
.form-group
|
18
18
|
= label_tag key, key.to_s.split('.').last.humanize, class: "col-lg-2 col-md-2 control-label"
|
19
19
|
%div{class: "col-lg-10 col-md-10"}
|
20
|
+
|
20
21
|
- if translation.html?
|
21
|
-
|
22
|
+
- if ::Weeler.use_rails_rich_text_editor
|
23
|
+
= rich_text_area_tag "translations[#{translation.id}]", translation.value
|
24
|
+
- else
|
25
|
+
= text_area_tag "translations[#{translation.id}]", translation.value, class: 'form-control html'
|
22
26
|
- else
|
23
27
|
= text_area_tag "translations[#{translation.id}]", translation.value, class: 'form-control'
|
24
28
|
|
@@ -10,8 +10,11 @@
|
|
10
10
|
.form-group
|
11
11
|
%label.col-lg-2.col-md-2.control-label Value
|
12
12
|
.col-lg-10.col-md-10
|
13
|
-
|
14
|
-
= translation.value
|
13
|
+
- if ::Weeler.use_rails_rich_text_editor && translation.html?
|
14
|
+
= rich_text_area_tag 'i18n_backend_weeler_translation[value]', translation.value
|
15
|
+
- else
|
16
|
+
%textarea.form-control{class: "#{'html' if translation.html?}", name: 'i18n_backend_weeler_translation[value]', id: 'i18n_backend_weeler_translation_value'}
|
17
|
+
= translation.value
|
15
18
|
%h4 Info
|
16
19
|
.form-group
|
17
20
|
%label.col-lg-2.col-md-2.control-label Variables
|
@@ -10,15 +10,6 @@
|
|
10
10
|
= link_to 'Show translations', weeler_translations_path(show_translation_keys: false)
|
11
11
|
- else
|
12
12
|
= link_to 'Show translation keys', weeler_translations_path(show_translation_keys: true)
|
13
|
-
%h1 Stats
|
14
|
-
%p.lead.text-muted
|
15
|
-
- if Settings.log_key_usage == 'true'
|
16
|
-
= 'Translation usage stat gathering is ON'
|
17
|
-
- else
|
18
|
-
= 'Translation usage stat gathering is OFF'
|
19
|
-
%p.lead.text-muted
|
20
|
-
= link_to 'Go to Stats', {action: :usage_stats}
|
21
|
-
|
22
13
|
.row
|
23
14
|
.col-xs-12
|
24
15
|
%nav.navbar.navbar-default{ role: "navigation" }
|
@@ -39,7 +30,6 @@
|
|
39
30
|
%li
|
40
31
|
%a{href: weeler_translations_path(group: params[:group], filtered_locale: locale)}= locale.capitalize
|
41
32
|
|
42
|
-
|
43
33
|
/ key group lookup
|
44
34
|
%ul.nav.navbar-nav.navbar-left
|
45
35
|
%li.dropdown
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Weeler
|
2
2
|
class ApplicationController < ::ApplicationController
|
3
3
|
# Here you can define controller methods for using in weeler.
|
4
|
-
# Also you can set
|
4
|
+
# Also you can set before_action 's and define those methods.
|
5
5
|
end
|
6
6
|
end
|